{"version":3,"file":"vendor-Mhg0I1DC.js","sources":["../../node_modules/react/cjs/react.production.min.js","../../node_modules/react/index.js","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/react-dom/client.js","../../node_modules/@rive-app/canvas/rive.js","../../node_modules/@rive-app/react-canvas/dist/index.js","../../node_modules/@remix-run/router/dist/router.js","../../node_modules/react-router/dist/index.js","../../node_modules/react-router-dom/dist/index.js","../../node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs","../../node_modules/framer-motion/dist/es/context/MotionContext/index.mjs","../../node_modules/framer-motion/dist/es/context/PresenceContext.mjs","../../node_modules/framer-motion/dist/es/utils/is-browser.mjs","../../node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs","../../node_modules/framer-motion/dist/es/context/LazyContext.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs","../../node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.mjs","../../node_modules/framer-motion/dist/es/utils/is-ref-object.mjs","../../node_modules/framer-motion/dist/es/render/utils/is-variant-label.mjs","../../node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs","../../node_modules/framer-motion/dist/es/render/utils/variant-props.mjs","../../node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.mjs","../../node_modules/framer-motion/dist/es/context/MotionContext/create.mjs","../../node_modules/framer-motion/dist/es/motion/features/definitions.mjs","../../node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs","../../node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs","../../node_modules/framer-motion/dist/es/motion/utils/symbol.mjs","../../node_modules/framer-motion/dist/es/motion/index.mjs","../../node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs","../../node_modules/framer-motion/dist/es/motion/features/load-features.mjs","../../node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs","../../node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs","../../node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs","../../node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs","../../node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs","../../node_modules/framer-motion/dist/es/render/html/utils/transform.mjs","../../node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs","../../node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs","../../node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs","../../node_modules/framer-motion/dist/es/utils/clamp.mjs","../../node_modules/framer-motion/dist/es/value/types/numbers/index.mjs","../../node_modules/framer-motion/dist/es/value/types/utils.mjs","../../node_modules/framer-motion/dist/es/value/types/numbers/units.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs","../../node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs","../../node_modules/framer-motion/dist/es/render/html/use-props.mjs","../../node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs","../../node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/path.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs","../../node_modules/framer-motion/dist/es/render/svg/use-props.mjs","../../node_modules/framer-motion/dist/es/render/dom/use-render.mjs","../../node_modules/framer-motion/dist/es/render/html/utils/render.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/render.mjs","../../node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs","../../node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs","../../node_modules/framer-motion/dist/es/render/utils/resolve-variants.mjs","../../node_modules/framer-motion/dist/es/utils/use-constant.mjs","../../node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs","../../node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs","../../node_modules/framer-motion/dist/es/utils/resolve-value.mjs","../../node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs","../../node_modules/framer-motion/dist/es/utils/noop.mjs","../../node_modules/framer-motion/dist/es/frameloop/render-step.mjs","../../node_modules/framer-motion/dist/es/frameloop/batcher.mjs","../../node_modules/framer-motion/dist/es/frameloop/frame.mjs","../../node_modules/framer-motion/dist/es/render/svg/config-motion.mjs","../../node_modules/framer-motion/dist/es/render/html/config-motion.mjs","../../node_modules/framer-motion/dist/es/events/add-dom-event.mjs","../../node_modules/framer-motion/dist/es/events/utils/is-primary-pointer.mjs","../../node_modules/framer-motion/dist/es/events/event-info.mjs","../../node_modules/framer-motion/dist/es/events/add-pointer-event.mjs","../../node_modules/framer-motion/dist/es/utils/pipe.mjs","../../node_modules/framer-motion/dist/es/gestures/drag/utils/lock.mjs","../../node_modules/framer-motion/dist/es/motion/features/Feature.mjs","../../node_modules/framer-motion/dist/es/gestures/hover.mjs","../../node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs","../../node_modules/framer-motion/dist/es/gestures/press.mjs","../../node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs","../../node_modules/framer-motion/dist/es/motion/features/viewport/index.mjs","../../node_modules/framer-motion/dist/es/motion/features/gestures.mjs","../../node_modules/framer-motion/dist/es/gestures/focus.mjs","../../node_modules/framer-motion/dist/es/utils/shallow-compare.mjs","../../node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs","../../node_modules/framer-motion/dist/es/utils/errors.mjs","../../node_modules/framer-motion/dist/es/utils/time-conversion.mjs","../../node_modules/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs","../../node_modules/framer-motion/dist/es/animation/animators/waapi/easing.mjs","../../node_modules/framer-motion/dist/es/easing/cubic-bezier.mjs","../../node_modules/framer-motion/dist/es/easing/ease.mjs","../../node_modules/framer-motion/dist/es/easing/modifiers/mirror.mjs","../../node_modules/framer-motion/dist/es/easing/modifiers/reverse.mjs","../../node_modules/framer-motion/dist/es/easing/circ.mjs","../../node_modules/framer-motion/dist/es/easing/back.mjs","../../node_modules/framer-motion/dist/es/easing/utils/map.mjs","../../node_modules/framer-motion/dist/es/easing/anticipate.mjs","../../node_modules/framer-motion/dist/es/value/types/color/utils.mjs","../../node_modules/framer-motion/dist/es/value/types/color/rgba.mjs","../../node_modules/framer-motion/dist/es/value/types/color/hex.mjs","../../node_modules/framer-motion/dist/es/value/types/color/hsla.mjs","../../node_modules/framer-motion/dist/es/value/types/color/index.mjs","../../node_modules/framer-motion/dist/es/utils/mix.mjs","../../node_modules/framer-motion/dist/es/utils/hsla-to-rgba.mjs","../../node_modules/framer-motion/dist/es/utils/mix-color.mjs","../../node_modules/framer-motion/dist/es/value/types/complex/index.mjs","../../node_modules/framer-motion/dist/es/utils/mix-complex.mjs","../../node_modules/framer-motion/dist/es/utils/progress.mjs","../../node_modules/framer-motion/dist/es/utils/interpolate.mjs","../../node_modules/framer-motion/dist/es/animation/generators/keyframes.mjs","../../node_modules/framer-motion/dist/es/easing/utils/is-easing-array.mjs","../../node_modules/framer-motion/dist/es/utils/offsets/time.mjs","../../node_modules/framer-motion/dist/es/utils/offsets/default.mjs","../../node_modules/framer-motion/dist/es/utils/offsets/fill.mjs","../../node_modules/framer-motion/dist/es/utils/velocity-per-second.mjs","../../node_modules/framer-motion/dist/es/animation/generators/utils/velocity.mjs","../../node_modules/framer-motion/dist/es/animation/generators/spring/find.mjs","../../node_modules/framer-motion/dist/es/animation/generators/spring/index.mjs","../../node_modules/framer-motion/dist/es/animation/generators/inertia.mjs","../../node_modules/framer-motion/dist/es/animation/animators/js/driver-frameloop.mjs","../../node_modules/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs","../../node_modules/framer-motion/dist/es/animation/animators/js/index.mjs","../../node_modules/framer-motion/dist/es/animation/animators/waapi/create-accelerated-animation.mjs","../../node_modules/framer-motion/dist/es/utils/memo.mjs","../../node_modules/framer-motion/dist/es/animation/utils/default-transitions.mjs","../../node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs","../../node_modules/framer-motion/dist/es/value/types/complex/filter.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/defaults.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs","../../node_modules/framer-motion/dist/es/utils/is-zero-value-string.mjs","../../node_modules/framer-motion/dist/es/animation/utils/is-none.mjs","../../node_modules/framer-motion/dist/es/animation/utils/transitions.mjs","../../node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs","../../node_modules/framer-motion/dist/es/animation/interfaces/motion-value.mjs","../../node_modules/framer-motion/dist/es/animation/utils/keyframes.mjs","../../node_modules/framer-motion/dist/es/animation/animators/instant.mjs","../../node_modules/framer-motion/dist/es/animation/animators/waapi/index.mjs","../../node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs","../../node_modules/framer-motion/dist/es/value/use-will-change/is.mjs","../../node_modules/framer-motion/dist/es/utils/is-numerical-string.mjs","../../node_modules/framer-motion/dist/es/utils/array.mjs","../../node_modules/framer-motion/dist/es/utils/subscription-manager.mjs","../../node_modules/framer-motion/dist/es/value/index.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/test.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.mjs","../../node_modules/framer-motion/dist/es/render/dom/value-types/find.mjs","../../node_modules/framer-motion/dist/es/render/utils/setters.mjs","../../node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs","../../node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs","../../node_modules/framer-motion/dist/es/render/utils/animation-state.mjs","../../node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs","../../node_modules/framer-motion/dist/es/motion/features/animations.mjs","../../node_modules/framer-motion/dist/es/motion/features/animation/index.mjs","../../node_modules/framer-motion/dist/es/animation/interfaces/visual-element.mjs","../../node_modules/framer-motion/dist/es/utils/distance.mjs","../../node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs","../../node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs","../../node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/conversion.mjs","../../node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs","../../node_modules/framer-motion/dist/es/projection/utils/measure.mjs","../../node_modules/framer-motion/dist/es/utils/get-context-window.mjs","../../node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/models.mjs","../../node_modules/framer-motion/dist/es/gestures/pan/index.mjs","../../node_modules/framer-motion/dist/es/projection/node/state.mjs","../../node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs","../../node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs","../../node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs","../../node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs","../../node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/copy.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs","../../node_modules/framer-motion/dist/es/projection/geometry/utils.mjs","../../node_modules/framer-motion/dist/es/projection/shared/stack.mjs","../../node_modules/framer-motion/dist/es/projection/styles/transform.mjs","../../node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs","../../node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs","../../node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs","../../node_modules/framer-motion/dist/es/debug/record.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs","../../node_modules/framer-motion/dist/es/utils/delay.mjs","../../node_modules/framer-motion/dist/es/animation/interfaces/single-value.mjs","../../node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs","../../node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs","../../node_modules/framer-motion/dist/es/motion/features/drag.mjs","../../node_modules/framer-motion/dist/es/gestures/drag/index.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.mjs","../../node_modules/framer-motion/dist/es/utils/reduced-motion/state.mjs","../../node_modules/framer-motion/dist/es/render/store.mjs","../../node_modules/framer-motion/dist/es/render/VisualElement.mjs","../../node_modules/framer-motion/dist/es/utils/reduced-motion/index.mjs","../../node_modules/framer-motion/dist/es/render/utils/motion-values.mjs","../../node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.mjs","../../node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.mjs","../../node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.mjs","../../node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs","../../node_modules/framer-motion/dist/es/render/dom/motion.mjs","../../node_modules/framer-motion/dist/es/motion/features/layout.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/create-config.mjs","../../node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs","../../node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../node_modules/framer-motion/dist/es/utils/use-force-update.mjs","../../node_modules/framer-motion/dist/es/utils/use-unmount-effect.mjs","../../node_modules/framer-motion/dist/es/render/dom/viewport/index.mjs","../../node_modules/framer-motion/dist/es/utils/use-in-view.mjs","../../node_modules/framer-motion/dist/es/render/dom/utils/resolve-element.mjs","../../node_modules/react-icons/lib/esm/iconContext.js","../../node_modules/react-icons/lib/esm/iconBase.js","../../node_modules/react-icons/fa6/index.esm.js","../../node_modules/react-icons/bs/index.esm.js","../../node_modules/prop-types/factoryWithThrowingShims.js","../../node_modules/prop-types/index.js","../../node_modules/prop-types/lib/ReactPropTypesSecret.js","../../node_modules/react-icons/md/index.esm.js","../../node_modules/react-icons/fa/index.esm.js","../../node_modules/react-icons/go/index.esm.js","../../node_modules/react-icons/hi2/index.esm.js","../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../node_modules/react-select/dist/useStateManager-7e1e8489.esm.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js","../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js","../../node_modules/stylis/src/Enum.js","../../node_modules/stylis/src/Utility.js","../../node_modules/stylis/src/Tokenizer.js","../../node_modules/stylis/src/Parser.js","../../node_modules/stylis/src/Serializer.js","../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../node_modules/stylis/src/Middleware.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../node_modules/@emotion/serialize/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js","../../node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js","../../node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js","../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../../node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js","../../node_modules/react-select/dist/index-a301f526.esm.js","../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../../node_modules/memoize-one/dist/memoize-one.esm.js","../../node_modules/react-select/dist/Select-49a62830.esm.js","../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../node_modules/@babel/runtime/helpers/esm/createSuper.js","../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../node_modules/react-select/dist/react-select.esm.js","../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js","../../node_modules/use-sync-external-store/with-selector.js","../../node_modules/react-redux/dist/react-redux.mjs","../../node_modules/redux/dist/redux.mjs","../../node_modules/immer/dist/immer.mjs","../../node_modules/reselect/dist/reselect.mjs","../../node_modules/redux-thunk/dist/redux-thunk.mjs","../../node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs","../../node_modules/axios/lib/helpers/bind.js","../../node_modules/axios/lib/utils.js","../../node_modules/axios/lib/core/AxiosError.js","../../node_modules/axios/lib/helpers/toFormData.js","../../node_modules/axios/lib/helpers/AxiosURLSearchParams.js","../../node_modules/axios/lib/helpers/buildURL.js","../../node_modules/axios/lib/core/InterceptorManager.js","../../node_modules/axios/lib/defaults/transitional.js","../../node_modules/axios/lib/platform/browser/index.js","../../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js","../../node_modules/axios/lib/platform/browser/classes/FormData.js","../../node_modules/axios/lib/platform/browser/classes/Blob.js","../../node_modules/axios/lib/platform/common/utils.js","../../node_modules/axios/lib/platform/index.js","../../node_modules/axios/lib/helpers/formDataToJSON.js","../../node_modules/axios/lib/defaults/index.js","../../node_modules/axios/lib/helpers/toURLEncodedForm.js","../../node_modules/axios/lib/helpers/parseHeaders.js","../../node_modules/axios/lib/core/AxiosHeaders.js","../../node_modules/axios/lib/core/transformData.js","../../node_modules/axios/lib/cancel/isCancel.js","../../node_modules/axios/lib/cancel/CanceledError.js","../../node_modules/axios/lib/helpers/cookies.js","../../node_modules/axios/lib/core/buildFullPath.js","../../node_modules/axios/lib/helpers/isAbsoluteURL.js","../../node_modules/axios/lib/helpers/combineURLs.js","../../node_modules/axios/lib/helpers/isURLSameOrigin.js","../../node_modules/axios/lib/adapters/xhr.js","../../node_modules/axios/lib/helpers/speedometer.js","../../node_modules/axios/lib/adapters/adapters.js","../../node_modules/axios/lib/helpers/null.js","../../node_modules/axios/lib/core/settle.js","../../node_modules/axios/lib/helpers/parseProtocol.js","../../node_modules/axios/lib/core/dispatchRequest.js","../../node_modules/axios/lib/core/mergeConfig.js","../../node_modules/axios/lib/env/data.js","../../node_modules/axios/lib/helpers/validator.js","../../node_modules/axios/lib/core/Axios.js","../../node_modules/axios/lib/cancel/CancelToken.js","../../node_modules/axios/lib/helpers/HttpStatusCode.js","../../node_modules/axios/lib/axios.js","../../node_modules/axios/lib/helpers/spread.js","../../node_modules/axios/lib/helpers/isAxiosError.js","../../node_modules/react-indiana-drag-scroll/dist/index.es.js","../../node_modules/react-fast-marquee/dist/index.js","../../node_modules/react-icons/fi/index.esm.js","../../node_modules/react-icons/ci/index.esm.js","../../node_modules/react-icons/ai/index.esm.js","../../node_modules/react-select/dist/useCreatable-d97ef2c9.esm.js","../../node_modules/react-select/creatable/dist/react-select-creatable.esm.js","../../node_modules/@emailjs/browser/es/store/store.js","../../node_modules/@emailjs/browser/es/utils/validateParams.js","../../node_modules/@emailjs/browser/es/models/EmailJSResponseStatus.js","../../node_modules/@emailjs/browser/es/api/sendPost.js","../../node_modules/@emailjs/browser/es/index.js","../../node_modules/@emailjs/browser/es/methods/init/init.js","../../node_modules/@emailjs/browser/es/methods/send/send.js","../../node_modules/@emailjs/browser/es/methods/sendForm/sendForm.js","../../node_modules/jquery/dist/jquery.js","../../node_modules/react-easy-swipe/lib/index.js","../../node_modules/react-easy-swipe/lib/react-swipe.js","../../node_modules/classnames/index.js","../../node_modules/react-responsive-carousel/lib/js/cssClasses.js","../../node_modules/react-responsive-carousel/lib/js/dimensions.js","../../node_modules/react-responsive-carousel/lib/js/CSSTranslate.js","../../node_modules/react-responsive-carousel/lib/js/shims/window.js","../../node_modules/react-responsive-carousel/lib/js/components/Thumbs.js","../../node_modules/react-responsive-carousel/lib/js/shims/document.js","../../node_modules/react-responsive-carousel/lib/js/components/Carousel/utils.js","../../node_modules/react-responsive-carousel/lib/js/components/Carousel/animations.js","../../node_modules/react-responsive-carousel/lib/js/components/Carousel/index.js","../../node_modules/react-icons/lu/index.esm.js","../../node_modules/react-icons/io5/index.esm.js","../../node_modules/react-icons/io/index.esm.js","../../node_modules/react-icons/tfi/index.esm.js","../../node_modules/react-responsive-carousel/lib/js/index.js"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&uh(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=sh(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Ah(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=yh(f.type,f.key,f.props,null,a.mode,h),h.ref=sh(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=zh(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);th(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=xh(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(a){if(a===Dh)throw Error(p(174));return a}function Ih(a,b){G(Gh,b);G(Fh,a);G(Eh,Dh);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:lb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=lb(b,a)}E(Eh);G(Eh,b)}function Jh(){E(Eh);E(Fh);E(Gh)}\nfunction Kh(a){Hh(Gh.current);var b=Hh(Eh.current);var c=lb(b,a.type);b!==c&&(G(Fh,a),G(Eh,c))}function Lh(a){Fh.current===a&&(E(Eh),E(Fh))}var M=Uf(0);\nfunction Mh(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Nh=[];\nfunction Oh(){for(var a=0;ac?c:4;a(!0);var d=Qh.transition;Qh.transition={};try{a(!1),b()}finally{C=c,Qh.transition=d}}function Fi(){return di().memoizedState}\nfunction Gi(a,b,c){var d=lh(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,c);else if(c=Yg(a,b,c,d),null!==c){var e=L();mh(c,a,d,e);Ji(c,b,d)}}\nfunction ri(a,b,c){var d=lh(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,Xg(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=Yg(a,b,e,d);null!==c&&(e=L(),mh(c,a,d,e),Ji(c,b,d))}}\nfunction Hi(a){var b=a.alternate;return a===N||null!==b&&b===N}function Ii(a,b){Th=Sh=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Ji(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar ai={readContext:Vg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useInsertionEffect:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useDeferredValue:Q,useTransition:Q,useMutableSource:Q,useSyncExternalStore:Q,useId:Q,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(a,b){ci().memoizedState=[a,void 0===b?null:b];return a},useContext:Vg,useEffect:vi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ti(4194308,\n4,yi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ti(4194308,4,a,b)},useInsertionEffect:function(a,b){return ti(4,2,a,b)},useMemo:function(a,b){var c=ci();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=ci();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=Gi.bind(null,N,a);return[d.memoizedState,a]},useRef:function(a){var b=\nci();a={current:a};return b.memoizedState=a},useState:qi,useDebugValue:Ai,useDeferredValue:function(a){return ci().memoizedState=a},useTransition:function(){var a=qi(!1),b=a[0];a=Ei.bind(null,a[1]);ci().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=N,e=ci();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===R)throw Error(p(349));0!==(Rh&30)||ni(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;vi(ki.bind(null,d,\nf,a),[a]);d.flags|=2048;li(9,mi.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=ci(),b=R.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Uh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;Aj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eHj&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304)}else{if(!d)if(a=Mh(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Ej(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Hj&&1073741824!==c&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=M.current,G(M,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Ij(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(gj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Jj(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return Jh(),E(Wf),E(H),Oh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Lh(b),null;case 13:E(M);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(M),null;case 4:return Jh(),null;case 10:return Rg(b.type._context),null;case 22:case 23:return Ij(),\nnull;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Mj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Nj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Oj=!1;\nfunction Pj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Lg(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Oj;Oj=!1;return n}\nfunction Qj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Nj(b,c,f)}e=e.next}while(e!==d)}}function Rj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Sj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Tj(a){var b=a.alternate;null!==b&&(a.alternate=null,Tj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Uj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Vj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Uj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}\nfunction Xj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Xj(a,b,c),a=a.sibling;null!==a;)Xj(a,b,c),a=a.sibling}var X=null,Yj=!1;function Zj(a,b,c){for(c=c.child;null!==c;)ak(a,b,c),c=c.sibling}\nfunction ak(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Mj(c,b);case 6:var d=X,e=Yj;X=null;Zj(a,b,c);X=d;Yj=e;null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Yj;X=c.stateNode.containerInfo;Yj=!0;\nZj(a,b,c);X=d;Yj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Nj(c,b,g):0!==(f&4)&&Nj(c,b,g));e=e.next}while(e!==d)}Zj(a,b,c);break;case 1:if(!U&&(Mj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Zj(a,b,c);break;case 21:Zj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Zj(a,b,c),U=d):Zj(a,b,c);break;default:Zj(a,b,c)}}function bk(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Lj);b.forEach(function(b){var d=ck.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction dk(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*mk(d/1960))-d;if(10a?16:a;if(null===xk)var d=!1;else{a=xk;xk=null;yk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-gk?Lk(a,0):sk|=c);Ek(a,b)}function Zk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=L();a=Zg(a,b);null!==a&&(Ac(a,b,c),Ek(a,c))}function vj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Zk(a,c)}\nfunction ck(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Zk(a,c)}var Wk;\nWk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)Ug=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return Ug=!1,zj(a,b,c);Ug=0!==(a.flags&131072)?!0:!1}else Ug=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;jj(a,b);a=b.pendingProps;var e=Yf(b,H.current);Tg(b,c);e=Xh(null,b,d,a,e,c);var f=bi();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,ah(b),e.updater=nh,b.stateNode=e,e._reactInternals=b,rh(b,d,a,c),b=kj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Yi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{jj(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=$k(d);a=Lg(d,a);switch(e){case 0:b=dj(null,b,d,a,c);break a;case 1:b=ij(null,b,d,a,c);break a;case 11:b=Zi(null,b,d,a,c);break a;case 14:b=aj(null,b,d,Lg(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),dj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),ij(a,b,d,e,c);case 3:a:{lj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;bh(a,b);gh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ki(Error(p(423)),b);b=mj(a,b,d,c,e);break a}else if(d!==e){e=Ki(Error(p(424)),b);b=mj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Ch(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=$i(a,b,c);break a}Yi(a,b,d,c)}b=b.child}return b;case 5:return Kh(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\nhj(a,b),Yi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return pj(a,b,c);case 4:return Ih(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Bh(b,null,d,c):Yi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),Zi(a,b,d,e,c);case 7:return Yi(a,b,b.pendingProps,c),b.child;case 8:return Yi(a,b,b.pendingProps.children,c),b.child;case 12:return Yi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Mg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=$i(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=ch(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);Sg(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);Sg(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Yi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,Tg(b,c),e=Vg(e),d=d(e),b.flags|=1,Yi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Lg(d,b.pendingProps),e=Lg(d.type,e),aj(a,b,d,e,c);case 15:return cj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),jj(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,Tg(b,c),ph(b,d,e),rh(b,d,e,c),kj(null,b,d,!0,a,c);case 19:return yj(a,b,c);case 22:return ej(a,b,c)}throw Error(p(156,b.tag));};function Gk(a,b){return ac(a,b)}\nfunction al(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new al(a,b,c,d)}function bj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction $k(a){if(\"function\"===typeof a)return bj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction wh(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction yh(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)bj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Ah(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return qj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Ah(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function qj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function xh(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction zh(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction bl(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function cl(a,b,c,d,e,f,g,h,k){a=new bl(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};ah(f);return a}function dl(a,b,c){var d=3 {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ([\n/* 0 */,\n/* 1 */\n/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n\nvar Rive = (() => {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n \n return (\nfunction(moduleArg = {}) {\n\nvar m = moduleArg, aa, ea;\nm.ready = new Promise((a, b) => {\n aa = a;\n ea = b;\n});\nfunction fa() {\n function a(g) {\n const n = d;\n c = b = 0;\n d = new Map();\n n.forEach(p => {\n try {\n p(g);\n } catch (l) {\n console.error(l);\n }\n });\n this.ob();\n e && e.Tb();\n }\n let b = 0, c = 0, d = new Map(), e = null, f = null;\n this.requestAnimationFrame = function(g) {\n b || (b = requestAnimationFrame(a.bind(this)));\n const n = ++c;\n d.set(n, g);\n return n;\n };\n this.cancelAnimationFrame = function(g) {\n d.delete(g);\n b && 0 == d.size && (cancelAnimationFrame(b), b = 0);\n };\n this.Rb = function(g) {\n f && (document.body.remove(f), f = null);\n g || (f = document.createElement(\"div\"), f.style.backgroundColor = \"black\", f.style.position = \"fixed\", f.style.right = 0, f.style.top = 0, f.style.color = \"white\", f.style.padding = \"4px\", f.innerHTML = \"RIVE FPS\", g = function(n) {\n f.innerHTML = \"RIVE FPS \" + n.toFixed(1);\n }, document.body.appendChild(f));\n e = new function() {\n let n = 0, p = 0;\n this.Tb = function() {\n var l = performance.now();\n p ? (++n, l -= p, 1000 < l && (g(1000 * n / l), n = p = 0)) : (p = l, n = 0);\n };\n }();\n };\n this.Ob = function() {\n f && (document.body.remove(f), f = null);\n e = null;\n };\n this.ob = function() {\n };\n}\nfunction ha(a) {\n console.assert(!0);\n const b = new Map();\n let c = -Infinity;\n this.push = function(d) {\n d = d + ((1 << a) - 1) >> a;\n b.has(d) && clearTimeout(b.get(d));\n b.set(d, setTimeout(function() {\n b.delete(d);\n 0 == b.length ? c = -Infinity : d == c && (c = Math.max(...b.keys()), console.assert(c < d));\n }, 1000));\n c = Math.max(d, c);\n return c << a;\n };\n}\nconst ia = m.onRuntimeInitialized;\nm.onRuntimeInitialized = function() {\n ia && ia();\n let a = m.decodeAudio;\n m.decodeAudio = function(e, f) {\n e = a(e);\n f(e);\n };\n let b = m.decodeFont;\n m.decodeFont = function(e, f) {\n e = b(e);\n f(e);\n };\n const c = m.FileAssetLoader;\n m.ptrToAsset = e => {\n let f = m.ptrToFileAsset(e);\n return f.isImage ? m.ptrToImageAsset(e) : f.isFont ? m.ptrToFontAsset(e) : f.isAudio ? m.ptrToAudioAsset(e) : f;\n };\n m.CustomFileAssetLoader = c.extend(\"CustomFileAssetLoader\", {__construct:function({loadContents:e}) {\n this.__parent.__construct.call(this);\n this.Gb = e;\n }, loadContents:function(e, f) {\n e = m.ptrToAsset(e);\n return this.Gb(e, f);\n },});\n m.CDNFileAssetLoader = c.extend(\"CDNFileAssetLoader\", {__construct:function() {\n this.__parent.__construct.call(this);\n }, loadContents:function(e) {\n let f = m.ptrToAsset(e);\n e = f.cdnUuid;\n if (\"\" === e) {\n return !1;\n }\n (function(g, n) {\n var p = new XMLHttpRequest();\n p.responseType = \"arraybuffer\";\n p.onreadystatechange = function() {\n 4 == p.readyState && 200 == p.status && n(p);\n };\n p.open(\"GET\", g, !0);\n p.send(null);\n })(f.cdnBaseUrl + \"/\" + e, g => {\n f.decode(new Uint8Array(g.response));\n });\n return !0;\n },});\n m.FallbackFileAssetLoader = c.extend(\"FallbackFileAssetLoader\", {__construct:function() {\n this.__parent.__construct.call(this);\n this.kb = [];\n }, addLoader:function(e) {\n this.kb.push(e);\n }, loadContents:function(e, f) {\n for (let g of this.kb) {\n if (g.loadContents(e, f)) {\n return !0;\n }\n }\n return !1;\n },});\n let d = m.computeAlignment;\n m.computeAlignment = function(e, f, g, n, p = 1.0) {\n return d.call(this, e, f, g, n, p);\n };\n};\nconst ja = \"createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText\".split(\" \"), ka = new function() {\n function a() {\n if (!b) {\n var k = document.createElement(\"canvas\"), t = {alpha:1, depth:0, stencil:0, antialias:0, premultipliedAlpha:1, preserveDrawingBuffer:0, powerPreference:\"high-performance\", failIfMajorPerformanceCaveat:0, enableExtensionsByDefault:1, explicitSwapControl:1, renderViaOffscreenBackBuffer:1,};\n let r;\n if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {\n if (r = k.getContext(\"webgl\", t), c = 1, !r) {\n return console.log(\"No WebGL support. Image mesh will not be drawn.\"), !1;\n }\n } else {\n if (r = k.getContext(\"webgl2\", t)) {\n c = 2;\n } else {\n if (r = k.getContext(\"webgl\", t)) {\n c = 1;\n } else {\n return console.log(\"No WebGL support. Image mesh will not be drawn.\"), !1;\n }\n }\n }\n r = new Proxy(r, {get(D, w) {\n if (D.isContextLost()) {\n if (p || (console.error(\"Cannot render the mesh because the GL Context was lost. Tried to invoke \", w), p = !0), \"function\" === typeof D[w]) {\n return function() {\n };\n }\n } else {\n return \"function\" === typeof D[w] ? function(...M) {\n return D[w].apply(D, M);\n } : D[w];\n }\n }, set(D, w, M) {\n if (D.isContextLost()) {\n p || (console.error(\"Cannot render the mesh because the GL Context was lost. Tried to set property \" + w), p = !0);\n } else {\n return D[w] = M, !0;\n }\n },});\n d = Math.min(r.getParameter(r.MAX_RENDERBUFFER_SIZE), r.getParameter(r.MAX_TEXTURE_SIZE));\n function B(D, w, M) {\n w = r.createShader(w);\n r.shaderSource(w, M);\n r.compileShader(w);\n M = r.getShaderInfoLog(w);\n if (0 < (M || \"\").length) {\n throw M;\n }\n r.attachShader(D, w);\n }\n k = r.createProgram();\n B(k, r.VERTEX_SHADER, \"attribute vec2 vertex;\\n attribute vec2 uv;\\n uniform vec4 mat;\\n uniform vec2 translate;\\n varying vec2 st;\\n void main() {\\n st = uv;\\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\\n }\");\n B(k, r.FRAGMENT_SHADER, \"precision highp float;\\n uniform sampler2D image;\\n varying vec2 st;\\n void main() {\\n gl_FragColor = texture2D(image, st);\\n }\");\n r.bindAttribLocation(k, 0, \"vertex\");\n r.bindAttribLocation(k, 1, \"uv\");\n r.linkProgram(k);\n t = r.getProgramInfoLog(k);\n if (0 < (t || \"\").trim().length) {\n throw t;\n }\n e = r.getUniformLocation(k, \"mat\");\n f = r.getUniformLocation(k, \"translate\");\n r.useProgram(k);\n r.bindBuffer(r.ARRAY_BUFFER, r.createBuffer());\n r.enableVertexAttribArray(0);\n r.enableVertexAttribArray(1);\n r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, r.createBuffer());\n r.uniform1i(r.getUniformLocation(k, \"image\"), 0);\n r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);\n b = r;\n }\n return !0;\n }\n let b = null, c = 0, d = 0, e = null, f = null, g = 0, n = 0, p = !1;\n a();\n this.hc = function() {\n a();\n return d;\n };\n this.Mb = function(k) {\n b.deleteTexture && b.deleteTexture(k);\n };\n this.Lb = function(k) {\n if (!a()) {\n return null;\n }\n const t = b.createTexture();\n if (!t) {\n return null;\n }\n b.bindTexture(b.TEXTURE_2D, t);\n b.texImage2D(b.TEXTURE_2D, 0, b.RGBA, b.RGBA, b.UNSIGNED_BYTE, k);\n b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE);\n b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE);\n b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.LINEAR);\n 2 == c ? (b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR_MIPMAP_LINEAR), b.generateMipmap(b.TEXTURE_2D)) : b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR);\n return t;\n };\n const l = new ha(8), u = new ha(8), v = new ha(10), x = new ha(10);\n this.Qb = function(k, t, r, B, D) {\n if (a()) {\n var w = l.push(k), M = u.push(t);\n if (b.canvas) {\n if (b.canvas.width != w || b.canvas.height != M) {\n b.canvas.width = w, b.canvas.height = M;\n }\n b.viewport(0, M - t, k, t);\n b.disable(b.SCISSOR_TEST);\n b.clearColor(0, 0, 0, 0);\n b.clear(b.COLOR_BUFFER_BIT);\n b.enable(b.SCISSOR_TEST);\n r.sort((H, ba) => ba.wb - H.wb);\n w = v.push(B);\n g != w && (b.bufferData(b.ARRAY_BUFFER, 8 * w, b.DYNAMIC_DRAW), g = w);\n w = 0;\n for (var T of r) {\n b.bufferSubData(b.ARRAY_BUFFER, w, T.Ta), w += 4 * T.Ta.length;\n }\n console.assert(w == 4 * B);\n for (var ca of r) {\n b.bufferSubData(b.ARRAY_BUFFER, w, ca.Db), w += 4 * ca.Db.length;\n }\n console.assert(w == 8 * B);\n w = x.push(D);\n n != w && (b.bufferData(b.ELEMENT_ARRAY_BUFFER, 2 * w, b.DYNAMIC_DRAW), n = w);\n T = 0;\n for (var ra of r) {\n b.bufferSubData(b.ELEMENT_ARRAY_BUFFER, T, ra.indices), T += 2 * ra.indices.length;\n }\n console.assert(T == 2 * D);\n ra = 0;\n ca = !0;\n w = T = 0;\n for (const H of r) {\n H.image.Ka != ra && (b.bindTexture(b.TEXTURE_2D, H.image.Ja || null), ra = H.image.Ka);\n H.mc ? (b.scissor(H.Ya, M - H.Za - H.jb, H.Ac, H.jb), ca = !0) : ca && (b.scissor(0, M - t, k, t), ca = !1);\n r = 2 / k;\n const ba = -2 / t;\n b.uniform4f(e, H.ha[0] * r * H.Ba, H.ha[1] * ba * H.Ca, H.ha[2] * r * H.Ba, H.ha[3] * ba * H.Ca);\n b.uniform2f(f, H.ha[4] * r * H.Ba + r * (H.Ya - H.ic * H.Ba) - 1, H.ha[5] * ba * H.Ca + ba * (H.Za - H.jc * H.Ca) + 1);\n b.vertexAttribPointer(0, 2, b.FLOAT, !1, 0, w);\n b.vertexAttribPointer(1, 2, b.FLOAT, !1, 0, w + 4 * B);\n b.drawElements(b.TRIANGLES, H.indices.length, b.UNSIGNED_SHORT, T);\n w += 4 * H.Ta.length;\n T += 2 * H.indices.length;\n }\n console.assert(w == 4 * B);\n console.assert(T == 2 * D);\n }\n }\n };\n this.canvas = function() {\n return a() && b.canvas;\n };\n}(), la = m.onRuntimeInitialized;\nm.onRuntimeInitialized = function() {\n function a(q) {\n switch(q) {\n case l.srcOver:\n return \"source-over\";\n case l.screen:\n return \"screen\";\n case l.overlay:\n return \"overlay\";\n case l.darken:\n return \"darken\";\n case l.lighten:\n return \"lighten\";\n case l.colorDodge:\n return \"color-dodge\";\n case l.colorBurn:\n return \"color-burn\";\n case l.hardLight:\n return \"hard-light\";\n case l.softLight:\n return \"soft-light\";\n case l.difference:\n return \"difference\";\n case l.exclusion:\n return \"exclusion\";\n case l.multiply:\n return \"multiply\";\n case l.hue:\n return \"hue\";\n case l.saturation:\n return \"saturation\";\n case l.color:\n return \"color\";\n case l.luminosity:\n return \"luminosity\";\n }\n }\n function b(q) {\n return \"rgba(\" + ((16711680 & q) >>> 16) + \",\" + ((65280 & q) >>> 8) + \",\" + ((255 & q) >>> 0) + \",\" + ((4278190080 & q) >>> 24) / 255 + \")\";\n }\n function c() {\n 0 < M.length && (ka.Qb(w.drawWidth(), w.drawHeight(), M, T, ca), M = [], ca = T = 0, w.reset(512, 512));\n for (const q of D) {\n for (const y of q.H) {\n y();\n }\n q.H = [];\n }\n D.clear();\n }\n la && la();\n var d = m.RenderPaintStyle;\n const e = m.RenderPath, f = m.RenderPaint, g = m.Renderer, n = m.StrokeCap, p = m.StrokeJoin, l = m.BlendMode, u = d.fill, v = d.stroke, x = m.FillRule.evenOdd;\n let k = 1;\n var t = m.RenderImage.extend(\"CanvasRenderImage\", {__construct:function({la:q, xa:y} = {}) {\n this.__parent.__construct.call(this);\n this.Ka = k;\n k = k + 1 & 2147483647 || 1;\n this.la = q;\n this.xa = y;\n }, __destruct:function() {\n this.Ja && (ka.Mb(this.Ja), URL.revokeObjectURL(this.Wa));\n this.__parent.__destruct.call(this);\n }, decode:function(q) {\n var y = this;\n y.xa && y.xa(y);\n var F = new Image();\n y.Wa = URL.createObjectURL(new Blob([q], {type:\"image/png\",}));\n F.onload = function() {\n y.Fb = F;\n y.Ja = ka.Lb(F);\n y.size(F.width, F.height);\n y.la && y.la(y);\n };\n F.src = y.Wa;\n },}), r = e.extend(\"CanvasRenderPath\", {__construct:function() {\n this.__parent.__construct.call(this);\n this.T = new Path2D();\n }, rewind:function() {\n this.T = new Path2D();\n }, addPath:function(q, y, F, G, A, I, J) {\n var K = this.T, X = K.addPath;\n q = q.T;\n const Q = new DOMMatrix();\n Q.a = y;\n Q.b = F;\n Q.c = G;\n Q.d = A;\n Q.e = I;\n Q.f = J;\n X.call(K, q, Q);\n }, fillRule:function(q) {\n this.Va = q;\n }, moveTo:function(q, y) {\n this.T.moveTo(q, y);\n }, lineTo:function(q, y) {\n this.T.lineTo(q, y);\n }, cubicTo:function(q, y, F, G, A, I) {\n this.T.bezierCurveTo(q, y, F, G, A, I);\n }, close:function() {\n this.T.closePath();\n },}), B = f.extend(\"CanvasRenderPaint\", {color:function(q) {\n this.Xa = b(q);\n }, thickness:function(q) {\n this.Ib = q;\n }, join:function(q) {\n switch(q) {\n case p.miter:\n this.Ia = \"miter\";\n break;\n case p.round:\n this.Ia = \"round\";\n break;\n case p.bevel:\n this.Ia = \"bevel\";\n }\n }, cap:function(q) {\n switch(q) {\n case n.butt:\n this.Ha = \"butt\";\n break;\n case n.round:\n this.Ha = \"round\";\n break;\n case n.square:\n this.Ha = \"square\";\n }\n }, style:function(q) {\n this.Hb = q;\n }, blendMode:function(q) {\n this.Eb = a(q);\n }, clearGradient:function() {\n this.ja = null;\n }, linearGradient:function(q, y, F, G) {\n this.ja = {yb:q, zb:y, bb:F, cb:G, Ra:[],};\n }, radialGradient:function(q, y, F, G) {\n this.ja = {yb:q, zb:y, bb:F, cb:G, Ra:[], ec:!0,};\n }, addStop:function(q, y) {\n this.ja.Ra.push({color:q, stop:y,});\n }, completeGradient:function() {\n }, draw:function(q, y, F) {\n let G = this.Hb;\n var A = this.Xa, I = this.ja;\n q.globalCompositeOperation = this.Eb;\n if (null != I) {\n A = I.yb;\n var J = I.zb;\n const X = I.bb;\n var K = I.cb;\n const Q = I.Ra;\n I.ec ? (I = X - A, K -= J, A = q.createRadialGradient(A, J, 0, A, J, Math.sqrt(I * I + K * K))) : A = q.createLinearGradient(A, J, X, K);\n for (let da = 0, R = Q.length; da < R; da++) {\n J = Q[da], A.addColorStop(J.stop, b(J.color));\n }\n this.Xa = A;\n this.ja = null;\n }\n switch(G) {\n case v:\n q.strokeStyle = A;\n q.lineWidth = this.Ib;\n q.lineCap = this.Ha;\n q.lineJoin = this.Ia;\n q.stroke(y);\n break;\n case u:\n q.fillStyle = A, q.fill(y, F);\n }\n },});\n const D = new Set();\n let w = null, M = [], T = 0, ca = 0;\n var ra = m.CanvasRenderer = g.extend(\"Renderer\", {__construct:function(q) {\n this.__parent.__construct.call(this);\n this.S = [1, 0, 0, 1, 0, 0];\n this.C = q.getContext(\"2d\");\n this.Ua = q;\n this.H = [];\n }, save:function() {\n this.S.push(...this.S.slice(this.S.length - 6));\n this.H.push(this.C.save.bind(this.C));\n }, restore:function() {\n const q = this.S.length - 6;\n if (6 > q) {\n throw \"restore() called without matching save().\";\n }\n this.S.splice(q);\n this.H.push(this.C.restore.bind(this.C));\n }, transform:function(q, y, F, G, A, I) {\n const J = this.S, K = J.length - 6;\n J.splice(K, 6, J[K] * q + J[K + 2] * y, J[K + 1] * q + J[K + 3] * y, J[K] * F + J[K + 2] * G, J[K + 1] * F + J[K + 3] * G, J[K] * A + J[K + 2] * I + J[K + 4], J[K + 1] * A + J[K + 3] * I + J[K + 5]);\n this.H.push(this.C.transform.bind(this.C, q, y, F, G, A, I));\n }, rotate:function(q) {\n const y = Math.sin(q);\n q = Math.cos(q);\n this.transform(q, y, -y, q, 0, 0);\n }, _drawPath:function(q, y) {\n this.H.push(y.draw.bind(y, this.C, q.T, q.Va === x ? \"evenodd\" : \"nonzero\"));\n }, _drawRiveImage:function(q, y, F) {\n var G = q.Fb;\n if (G) {\n var A = this.C, I = a(y);\n this.H.push(function() {\n A.globalCompositeOperation = I;\n A.globalAlpha = F;\n A.drawImage(G, 0, 0);\n A.globalAlpha = 1;\n });\n }\n }, _getMatrix:function(q) {\n const y = this.S, F = y.length - 6;\n for (let G = 0; 6 > G; ++G) {\n q[G] = y[F + G];\n }\n }, _drawImageMesh:function(q, y, F, G, A, I, J, K, X, Q) {\n var da = this.C.canvas.width, R = this.C.canvas.height;\n const Yb = X - J, Zb = Q - K;\n J = Math.max(J, 0);\n K = Math.max(K, 0);\n X = Math.min(X, da);\n Q = Math.min(Q, R);\n const Ga = X - J, Ha = Q - K;\n console.assert(Ga <= Math.min(Yb, da));\n console.assert(Ha <= Math.min(Zb, R));\n if (!(0 >= Ga || 0 >= Ha)) {\n X = Ga < Yb || Ha < Zb;\n da = Q = 1;\n var sa = Math.ceil(Ga * Q), ta = Math.ceil(Ha * da);\n R = ka.hc();\n sa > R && (Q *= R / sa, sa = R);\n ta > R && (da *= R / ta, ta = R);\n w || (w = new m.DynamicRectanizer(R), w.reset(512, 512));\n R = w.addRect(sa, ta);\n 0 > R && (c(), D.add(this), R = w.addRect(sa, ta), console.assert(0 <= R));\n var $b = R & 65535, ac = R >> 16;\n M.push({ha:this.S.slice(this.S.length - 6), image:q, Ya:$b, Za:ac, ic:J, jc:K, Ac:sa, jb:ta, Ba:Q, Ca:da, Ta:new Float32Array(G), Db:new Float32Array(A), indices:new Uint16Array(I), mc:X, wb:q.Ka << 1 | (X ? 1 : 0),});\n T += G.length;\n ca += I.length;\n var za = this.C, qd = a(y);\n this.H.push(function() {\n za.save();\n za.resetTransform();\n za.globalCompositeOperation = qd;\n za.globalAlpha = F;\n const bc = ka.canvas();\n bc && za.drawImage(bc, $b, ac, sa, ta, J, K, Ga, Ha);\n za.restore();\n });\n }\n }, _clipPath:function(q) {\n this.H.push(this.C.clip.bind(this.C, q.T, q.Va === x ? \"evenodd\" : \"nonzero\"));\n }, clear:function() {\n D.add(this);\n this.H.push(this.C.clearRect.bind(this.C, 0, 0, this.Ua.width, this.Ua.height));\n }, flush:function() {\n }, translate:function(q, y) {\n this.transform(1, 0, 0, 1, q, y);\n },});\n m.makeRenderer = function(q) {\n const y = new ra(q), F = y.C;\n return new Proxy(y, {get(G, A) {\n if (\"function\" === typeof G[A]) {\n return function(...I) {\n return G[A].apply(G, I);\n };\n }\n if (\"function\" === typeof F[A]) {\n if (-1 < ja.indexOf(A)) {\n throw Error(\"RiveException: Method call to '\" + A + \"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.\");\n }\n return function(...I) {\n y.H.push(F[A].bind(F, ...I));\n };\n }\n return G[A];\n }, set(G, A, I) {\n if (A in F) {\n return y.H.push(() => {\n F[A] = I;\n }), !0;\n }\n },});\n };\n m.decodeImage = function(q, y) {\n (new t({la:y})).decode(q);\n };\n m.renderFactory = {makeRenderPaint:function() {\n return new B();\n }, makeRenderPath:function() {\n return new r();\n }, makeRenderImage:function() {\n let q = ba;\n return new t({xa:() => {\n q.total++;\n }, la:() => {\n q.loaded++;\n if (q.loaded === q.total) {\n const y = q.ready;\n y && (y(), q.ready = null);\n }\n },});\n },};\n let H = m.load, ba = null;\n m.load = function(q, y, F = !0) {\n const G = new m.FallbackFileAssetLoader();\n void 0 !== y && G.addLoader(y);\n F && (y = new m.CDNFileAssetLoader(), G.addLoader(y));\n return new Promise(function(A) {\n let I = null;\n ba = {total:0, loaded:0, ready:function() {\n A(I);\n },};\n I = H(q, G);\n 0 == ba.total && A(I);\n });\n };\n let rd = m.RendererWrapper.prototype.align;\n m.RendererWrapper.prototype.align = function(q, y, F, G, A = 1.0) {\n rd.call(this, q, y, F, G, A);\n };\n d = new fa();\n m.requestAnimationFrame = d.requestAnimationFrame.bind(d);\n m.cancelAnimationFrame = d.cancelAnimationFrame.bind(d);\n m.enableFPSCounter = d.Rb.bind(d);\n m.disableFPSCounter = d.Ob;\n d.ob = c;\n m.resolveAnimationFrame = c;\n m.cleanup = function() {\n w && w.delete();\n };\n};\nvar ma = Object.assign({}, m), na = \"./this.program\", oa = \"object\" == typeof window, pa = \"function\" == typeof importScripts, qa = \"\", ua, va;\nif (oa || pa) {\n pa ? qa = self.location.href : \"undefined\" != typeof document && document.currentScript && (qa = document.currentScript.src), _scriptDir && (qa = _scriptDir), 0 !== qa.indexOf(\"blob:\") ? qa = qa.substr(0, qa.replace(/[?#].*/, \"\").lastIndexOf(\"/\") + 1) : qa = \"\", pa && (va = a => {\n var b = new XMLHttpRequest();\n b.open(\"GET\", a, !1);\n b.responseType = \"arraybuffer\";\n b.send(null);\n return new Uint8Array(b.response);\n }), ua = (a, b, c) => {\n var d = new XMLHttpRequest();\n d.open(\"GET\", a, !0);\n d.responseType = \"arraybuffer\";\n d.onload = () => {\n 200 == d.status || 0 == d.status && d.response ? b(d.response) : c();\n };\n d.onerror = c;\n d.send(null);\n };\n}\nvar wa = m.print || console.log.bind(console), xa = m.printErr || console.error.bind(console);\nObject.assign(m, ma);\nma = null;\nm.thisProgram && (na = m.thisProgram);\nvar ya;\nm.wasmBinary && (ya = m.wasmBinary);\nvar noExitRuntime = m.noExitRuntime || !0;\n\"object\" != typeof WebAssembly && Aa(\"no native wasm support detected\");\nvar Ba, z, Ca = !1, C, E, Da, Ea, L, N, Fa, Ia;\nfunction Ja() {\n var a = Ba.buffer;\n m.HEAP8 = C = new Int8Array(a);\n m.HEAP16 = Da = new Int16Array(a);\n m.HEAP32 = L = new Int32Array(a);\n m.HEAPU8 = E = new Uint8Array(a);\n m.HEAPU16 = Ea = new Uint16Array(a);\n m.HEAPU32 = N = new Uint32Array(a);\n m.HEAPF32 = Fa = new Float32Array(a);\n m.HEAPF64 = Ia = new Float64Array(a);\n}\nvar Ka, La = [], Ma = [], Na = [];\nfunction Oa() {\n var a = m.preRun.shift();\n La.unshift(a);\n}\nvar Pa = 0, Qa = null, Ra = null;\nfunction Aa(a) {\n if (m.onAbort) {\n m.onAbort(a);\n }\n a = \"Aborted(\" + a + \")\";\n xa(a);\n Ca = !0;\n a = new WebAssembly.RuntimeError(a + \". Build with -sASSERTIONS for more info.\");\n ea(a);\n throw a;\n}\nfunction Sa(a) {\n return a.startsWith(\"data:application/octet-stream;base64,\");\n}\nvar Ta;\nTa = \"canvas_advanced.wasm\";\nif (!Sa(Ta)) {\n var Ua = Ta;\n Ta = m.locateFile ? m.locateFile(Ua, qa) : qa + Ua;\n}\nfunction Va(a) {\n if (a == Ta && ya) {\n return new Uint8Array(ya);\n }\n if (va) {\n return va(a);\n }\n throw \"both async and sync fetching of the wasm failed\";\n}\nfunction Wa(a) {\n if (!ya && (oa || pa)) {\n if (\"function\" == typeof fetch && !a.startsWith(\"file://\")) {\n return fetch(a, {credentials:\"same-origin\"}).then(b => {\n if (!b.ok) {\n throw \"failed to load wasm binary file at '\" + a + \"'\";\n }\n return b.arrayBuffer();\n }).catch(() => Va(a));\n }\n if (ua) {\n return new Promise((b, c) => {\n ua(a, d => b(new Uint8Array(d)), c);\n });\n }\n }\n return Promise.resolve().then(() => Va(a));\n}\nfunction Xa(a, b, c) {\n return Wa(a).then(d => WebAssembly.instantiate(d, b)).then(d => d).then(c, d => {\n xa(\"failed to asynchronously prepare wasm: \" + d);\n Aa(d);\n });\n}\nfunction Ya(a, b) {\n var c = Ta;\n return ya || \"function\" != typeof WebAssembly.instantiateStreaming || Sa(c) || c.startsWith(\"file://\") || \"function\" != typeof fetch ? Xa(c, a, b) : fetch(c, {credentials:\"same-origin\"}).then(d => WebAssembly.instantiateStreaming(d, a).then(b, function(e) {\n xa(\"wasm streaming compile failed: \" + e);\n xa(\"falling back to ArrayBuffer instantiation\");\n return Xa(c, a, b);\n }));\n}\nvar Za, $a, db = {448252:(a, b, c, d, e) => {\n if (\"undefined\" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {\n return 0;\n }\n if (\"undefined\" === typeof window.h) {\n window.h = {Aa:0};\n window.h.I = {};\n window.h.I.ya = a;\n window.h.I.capture = b;\n window.h.I.La = c;\n window.h.ga = {};\n window.h.ga.stopped = d;\n window.h.ga.xb = e;\n let f = window.h;\n f.D = [];\n f.yc = function(g) {\n for (var n = 0; n < f.D.length; ++n) {\n if (null == f.D[n]) {\n return f.D[n] = g, n;\n }\n }\n f.D.push(g);\n return f.D.length - 1;\n };\n f.Cb = function(g) {\n for (f.D[g] = null; 0 < f.D.length;) {\n if (null == f.D[f.D.length - 1]) {\n f.D.pop();\n } else {\n break;\n }\n }\n };\n f.Sc = function(g) {\n for (var n = 0; n < f.D.length; ++n) {\n if (f.D[n] == g) {\n return f.Cb(n);\n }\n }\n };\n f.ra = function(g) {\n return f.D[g];\n };\n f.Bb = [\"touchend\", \"click\"];\n f.unlock = function() {\n for (var g = 0; g < f.D.length; ++g) {\n var n = f.D[g];\n null != n && null != n.J && n.state === f.ga.xb && n.J.resume().then(() => {\n ab(n.pb);\n }, p => {\n console.error(\"Failed to resume audiocontext\", p);\n });\n }\n f.Bb.map(function(p) {\n document.removeEventListener(p, f.unlock, !0);\n });\n };\n f.Bb.map(function(g) {\n document.addEventListener(g, f.unlock, !0);\n });\n }\n window.h.Aa += 1;\n return 1;\n}, 450430:() => {\n \"undefined\" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);\n}, 450594:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 450698:() => {\n try {\n var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;\n a.close();\n return b;\n } catch (c) {\n return 0;\n }\n}, 450869:(a, b, c, d, e, f) => {\n if (\"undefined\" === typeof window.h) {\n return -1;\n }\n var g = {}, n = {};\n a == window.h.I.ya && 0 != c && (n.sampleRate = c);\n g.J = new (window.AudioContext || window.webkitAudioContext)(n);\n g.J.suspend();\n g.state = window.h.ga.stopped;\n c = 0;\n a != window.h.I.ya && (c = b);\n g.Z = g.J.createScriptProcessor(d, c, b);\n g.Z.onaudioprocess = function(p) {\n if (null == g.sa || 0 == g.sa.length) {\n g.sa = new Float32Array(Fa.buffer, e, d * b);\n }\n if (a == window.h.I.capture || a == window.h.I.La) {\n for (var l = 0; l < b; l += 1) {\n for (var u = p.inputBuffer.getChannelData(l), v = g.sa, x = 0; x < d; x += 1) {\n v[x * b + l] = u[x];\n }\n }\n bb(f, d, e);\n }\n if (a == window.h.I.ya || a == window.h.I.La) {\n for (cb(f, d, e), l = 0; l < p.outputBuffer.numberOfChannels; ++l) {\n for (u = p.outputBuffer.getChannelData(l), v = g.sa, x = 0; x < d; x += 1) {\n u[x] = v[x * b + l];\n }\n }\n } else {\n for (l = 0; l < p.outputBuffer.numberOfChannels; ++l) {\n p.outputBuffer.getChannelData(l).fill(0.0);\n }\n }\n };\n a != window.h.I.capture && a != window.h.I.La || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(p) {\n g.Da = g.J.createMediaStreamSource(p);\n g.Da.connect(g.Z);\n g.Z.connect(g.J.destination);\n }).catch(function(p) {\n console.log(\"Failed to get user media: \" + p);\n });\n a == window.h.I.ya && g.Z.connect(g.J.destination);\n g.pb = f;\n return window.h.yc(g);\n}, 453746:a => window.h.ra(a).J.sampleRate, 453819:a => {\n a = window.h.ra(a);\n void 0 !== a.Z && (a.Z.onaudioprocess = function() {\n }, a.Z.disconnect(), a.Z = void 0);\n void 0 !== a.Da && (a.Da.disconnect(), a.Da = void 0);\n a.J.close();\n a.J = void 0;\n a.pb = void 0;\n}, 454219:a => {\n window.h.Cb(a);\n}, 454269:a => {\n a = window.h.ra(a);\n a.J.resume();\n a.state = window.h.ga.xb;\n}, 454408:a => {\n a = window.h.ra(a);\n a.J.suspend();\n a.state = window.h.ga.stopped;\n}}, eb = a => {\n for (; 0 < a.length;) {\n a.shift()(m);\n }\n}, fb = (a, b) => {\n for (var c = 0, d = a.length - 1; 0 <= d; d--) {\n var e = a[d];\n \".\" === e ? a.splice(d, 1) : \"..\" === e ? (a.splice(d, 1), c++) : c && (a.splice(d, 1), c--);\n }\n if (b) {\n for (; c; c--) {\n a.unshift(\"..\");\n }\n }\n return a;\n}, gb = a => {\n var b = \"/\" === a.charAt(0), c = \"/\" === a.substr(-1);\n (a = fb(a.split(\"/\").filter(d => !!d), !b).join(\"/\")) || b || (a = \".\");\n a && c && (a += \"/\");\n return (b ? \"/\" : \"\") + a;\n}, hb = a => {\n var b = /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(a).slice(1);\n a = b[0];\n b = b[1];\n if (!a && !b) {\n return \".\";\n }\n b && (b = b.substr(0, b.length - 1));\n return a + b;\n}, ib = a => {\n if (\"/\" === a) {\n return \"/\";\n }\n a = gb(a);\n a = a.replace(/\\/$/, \"\");\n var b = a.lastIndexOf(\"/\");\n return -1 === b ? a : a.substr(b + 1);\n}, jb = () => {\n if (\"object\" == typeof crypto && \"function\" == typeof crypto.getRandomValues) {\n return a => crypto.getRandomValues(a);\n }\n Aa(\"initRandomDevice\");\n}, kb = a => (kb = jb())(a);\nfunction lb() {\n for (var a = \"\", b = !1, c = arguments.length - 1; -1 <= c && !b; c--) {\n b = 0 <= c ? arguments[c] : \"/\";\n if (\"string\" != typeof b) {\n throw new TypeError(\"Arguments to path.resolve must be strings\");\n }\n if (!b) {\n return \"\";\n }\n a = b + \"/\" + a;\n b = \"/\" === b.charAt(0);\n }\n a = fb(a.split(\"/\").filter(d => !!d), !b).join(\"/\");\n return (b ? \"/\" : \"\") + a || \".\";\n}\nvar mb = \"undefined\" != typeof TextDecoder ? new TextDecoder(\"utf8\") : void 0, nb = (a, b, c) => {\n var d = b + c;\n for (c = b; a[c] && !(c >= d);) {\n ++c;\n }\n if (16 < c - b && a.buffer && mb) {\n return mb.decode(a.subarray(b, c));\n }\n for (d = \"\"; b < c;) {\n var e = a[b++];\n if (e & 128) {\n var f = a[b++] & 63;\n if (192 == (e & 224)) {\n d += String.fromCharCode((e & 31) << 6 | f);\n } else {\n var g = a[b++] & 63;\n e = 224 == (e & 240) ? (e & 15) << 12 | f << 6 | g : (e & 7) << 18 | f << 12 | g << 6 | a[b++] & 63;\n 65536 > e ? d += String.fromCharCode(e) : (e -= 65536, d += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023));\n }\n } else {\n d += String.fromCharCode(e);\n }\n }\n return d;\n}, ob = [], pb = a => {\n for (var b = 0, c = 0; c < a.length; ++c) {\n var d = a.charCodeAt(c);\n 127 >= d ? b++ : 2047 >= d ? b += 2 : 55296 <= d && 57343 >= d ? (b += 4, ++c) : b += 3;\n }\n return b;\n}, qb = (a, b, c, d) => {\n if (!(0 < d)) {\n return 0;\n }\n var e = c;\n d = c + d - 1;\n for (var f = 0; f < a.length; ++f) {\n var g = a.charCodeAt(f);\n if (55296 <= g && 57343 >= g) {\n var n = a.charCodeAt(++f);\n g = 65536 + ((g & 1023) << 10) | n & 1023;\n }\n if (127 >= g) {\n if (c >= d) {\n break;\n }\n b[c++] = g;\n } else {\n if (2047 >= g) {\n if (c + 1 >= d) {\n break;\n }\n b[c++] = 192 | g >> 6;\n } else {\n if (65535 >= g) {\n if (c + 2 >= d) {\n break;\n }\n b[c++] = 224 | g >> 12;\n } else {\n if (c + 3 >= d) {\n break;\n }\n b[c++] = 240 | g >> 18;\n b[c++] = 128 | g >> 12 & 63;\n }\n b[c++] = 128 | g >> 6 & 63;\n }\n b[c++] = 128 | g & 63;\n }\n }\n b[c] = 0;\n return c - e;\n};\nfunction rb(a, b) {\n var c = Array(pb(a) + 1);\n a = qb(a, c, 0, c.length);\n b && (c.length = a);\n return c;\n}\nvar sb = [];\nfunction tb(a, b) {\n sb[a] = {input:[], F:[], V:b};\n ub(a, vb);\n}\nvar vb = {open:function(a) {\n var b = sb[a.node.za];\n if (!b) {\n throw new O(43);\n }\n a.s = b;\n a.seekable = !1;\n}, close:function(a) {\n a.s.V.qa(a.s);\n}, qa:function(a) {\n a.s.V.qa(a.s);\n}, read:function(a, b, c, d) {\n if (!a.s || !a.s.V.ib) {\n throw new O(60);\n }\n for (var e = 0, f = 0; f < d; f++) {\n try {\n var g = a.s.V.ib(a.s);\n } catch (n) {\n throw new O(29);\n }\n if (void 0 === g && 0 === e) {\n throw new O(6);\n }\n if (null === g || void 0 === g) {\n break;\n }\n e++;\n b[c + f] = g;\n }\n e && (a.node.timestamp = Date.now());\n return e;\n}, write:function(a, b, c, d) {\n if (!a.s || !a.s.V.Oa) {\n throw new O(60);\n }\n try {\n for (var e = 0; e < d; e++) {\n a.s.V.Oa(a.s, b[c + e]);\n }\n } catch (f) {\n throw new O(29);\n }\n d && (a.node.timestamp = Date.now());\n return e;\n},}, wb = {ib:function() {\n a: {\n if (!ob.length) {\n var a = null;\n \"undefined\" != typeof window && \"function\" == typeof window.prompt ? (a = window.prompt(\"Input: \"), null !== a && (a += \"\\n\")) : \"function\" == typeof readline && (a = readline(), null !== a && (a += \"\\n\"));\n if (!a) {\n a = null;\n break a;\n }\n ob = rb(a, !0);\n }\n a = ob.shift();\n }\n return a;\n}, Oa:function(a, b) {\n null === b || 10 === b ? (wa(nb(a.F, 0)), a.F = []) : 0 != b && a.F.push(b);\n}, qa:function(a) {\n a.F && 0 < a.F.length && (wa(nb(a.F, 0)), a.F = []);\n}, bc:function() {\n return {Fc:25856, Hc:5, Ec:191, Gc:35387, Dc:[3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]};\n}, cc:function() {\n return 0;\n}, dc:function() {\n return [24, 80];\n},}, xb = {Oa:function(a, b) {\n null === b || 10 === b ? (xa(nb(a.F, 0)), a.F = []) : 0 != b && a.F.push(b);\n}, qa:function(a) {\n a.F && 0 < a.F.length && (xa(nb(a.F, 0)), a.F = []);\n},};\nfunction yb(a, b) {\n var c = a.j ? a.j.length : 0;\n c >= b || (b = Math.max(b, c * (1048576 > c ? 2.0 : 1.125) >>> 0), 0 != c && (b = Math.max(b, 256)), c = a.j, a.j = new Uint8Array(b), 0 < a.v && a.j.set(c.subarray(0, a.v), 0));\n}\nvar P = {O:null, U() {\n return P.createNode(null, \"/\", 16895, 0);\n}, createNode(a, b, c, d) {\n if (24576 === (c & 61440) || 4096 === (c & 61440)) {\n throw new O(63);\n }\n P.O || (P.O = {dir:{node:{Y:P.l.Y, P:P.l.P, ka:P.l.ka, va:P.l.va, ub:P.l.ub, Ab:P.l.Ab, vb:P.l.vb, sb:P.l.sb, Ea:P.l.Ea}, stream:{ba:P.m.ba}}, file:{node:{Y:P.l.Y, P:P.l.P}, stream:{ba:P.m.ba, read:P.m.read, write:P.m.write, pa:P.m.pa, lb:P.m.lb, nb:P.m.nb}}, link:{node:{Y:P.l.Y, P:P.l.P, ma:P.l.ma}, stream:{}}, $a:{node:{Y:P.l.Y, P:P.l.P}, stream:zb}});\n c = Ab(a, b, c, d);\n 16384 === (c.mode & 61440) ? (c.l = P.O.dir.node, c.m = P.O.dir.stream, c.j = {}) : 32768 === (c.mode & 61440) ? (c.l = P.O.file.node, c.m = P.O.file.stream, c.v = 0, c.j = null) : 40960 === (c.mode & 61440) ? (c.l = P.O.link.node, c.m = P.O.link.stream) : 8192 === (c.mode & 61440) && (c.l = P.O.$a.node, c.m = P.O.$a.stream);\n c.timestamp = Date.now();\n a && (a.j[b] = c, a.timestamp = c.timestamp);\n return c;\n}, Kc(a) {\n return a.j ? a.j.subarray ? a.j.subarray(0, a.v) : new Uint8Array(a.j) : new Uint8Array(0);\n}, l:{Y(a) {\n var b = {};\n b.Jc = 8192 === (a.mode & 61440) ? a.id : 1;\n b.Mc = a.id;\n b.mode = a.mode;\n b.Oc = 1;\n b.uid = 0;\n b.Lc = 0;\n b.za = a.za;\n 16384 === (a.mode & 61440) ? b.size = 4096 : 32768 === (a.mode & 61440) ? b.size = a.v : 40960 === (a.mode & 61440) ? b.size = a.link.length : b.size = 0;\n b.Bc = new Date(a.timestamp);\n b.Nc = new Date(a.timestamp);\n b.Ic = new Date(a.timestamp);\n b.Jb = 4096;\n b.Cc = Math.ceil(b.size / b.Jb);\n return b;\n}, P(a, b) {\n void 0 !== b.mode && (a.mode = b.mode);\n void 0 !== b.timestamp && (a.timestamp = b.timestamp);\n if (void 0 !== b.size && (b = b.size, a.v != b)) {\n if (0 == b) {\n a.j = null, a.v = 0;\n } else {\n var c = a.j;\n a.j = new Uint8Array(b);\n c && a.j.set(c.subarray(0, Math.min(b, a.v)));\n a.v = b;\n }\n }\n}, ka() {\n throw Bb[44];\n}, va(a, b, c, d) {\n return P.createNode(a, b, c, d);\n}, ub(a, b, c) {\n if (16384 === (a.mode & 61440)) {\n try {\n var d = Cb(b, c);\n } catch (f) {\n }\n if (d) {\n for (var e in d.j) {\n throw new O(55);\n }\n }\n }\n delete a.parent.j[a.name];\n a.parent.timestamp = Date.now();\n a.name = c;\n b.j[c] = a;\n b.timestamp = a.parent.timestamp;\n a.parent = b;\n}, Ab(a, b) {\n delete a.j[b];\n a.timestamp = Date.now();\n}, vb(a, b) {\n var c = Cb(a, b), d;\n for (d in c.j) {\n throw new O(55);\n }\n delete a.j[b];\n a.timestamp = Date.now();\n}, sb(a) {\n var b = [\".\", \"..\"], c;\n for (c in a.j) {\n a.j.hasOwnProperty(c) && b.push(c);\n }\n return b;\n}, Ea(a, b, c) {\n a = P.createNode(a, b, 41471, 0);\n a.link = c;\n return a;\n}, ma(a) {\n if (40960 !== (a.mode & 61440)) {\n throw new O(28);\n }\n return a.link;\n},}, m:{read(a, b, c, d, e) {\n var f = a.node.j;\n if (e >= a.node.v) {\n return 0;\n }\n a = Math.min(a.node.v - e, d);\n if (8 < a && f.subarray) {\n b.set(f.subarray(e, e + a), c);\n } else {\n for (d = 0; d < a; d++) {\n b[c + d] = f[e + d];\n }\n }\n return a;\n}, write(a, b, c, d, e, f) {\n b.buffer === C.buffer && (f = !1);\n if (!d) {\n return 0;\n }\n a = a.node;\n a.timestamp = Date.now();\n if (b.subarray && (!a.j || a.j.subarray)) {\n if (f) {\n return a.j = b.subarray(c, c + d), a.v = d;\n }\n if (0 === a.v && 0 === e) {\n return a.j = b.slice(c, c + d), a.v = d;\n }\n if (e + d <= a.v) {\n return a.j.set(b.subarray(c, c + d), e), d;\n }\n }\n yb(a, e + d);\n if (a.j.subarray && b.subarray) {\n a.j.set(b.subarray(c, c + d), e);\n } else {\n for (f = 0; f < d; f++) {\n a.j[e + f] = b[c + f];\n }\n }\n a.v = Math.max(a.v, e + d);\n return d;\n}, ba(a, b, c) {\n 1 === c ? b += a.position : 2 === c && 32768 === (a.node.mode & 61440) && (b += a.node.v);\n if (0 > b) {\n throw new O(28);\n }\n return b;\n}, pa(a, b, c) {\n yb(a.node, b + c);\n a.node.v = Math.max(a.node.v, b + c);\n}, lb(a, b, c, d, e) {\n if (32768 !== (a.node.mode & 61440)) {\n throw new O(43);\n }\n a = a.node.j;\n if (e & 2 || a.buffer !== C.buffer) {\n if (0 < c || c + b < a.length) {\n a.subarray ? a = a.subarray(c, c + b) : a = Array.prototype.slice.call(a, c, c + b);\n }\n c = !0;\n Aa();\n b = void 0;\n if (!b) {\n throw new O(48);\n }\n C.set(a, b);\n } else {\n c = !1, b = a.byteOffset;\n }\n return {o:b, M:c};\n}, nb(a, b, c, d) {\n P.m.write(a, b, 0, d, c, !1);\n return 0;\n},},};\nfunction Db(a, b) {\n var c = 0;\n a && (c |= 365);\n b && (c |= 146);\n return c;\n}\nvar Eb = null, Fb = {}, Gb = [], Hb = 1, Ib = null, Jb = !0, O = null, Bb = {}, Lb = (a, b = {}) => {\n a = lb(a);\n if (!a) {\n return {path:\"\", node:null};\n }\n b = Object.assign({gb:!0, Qa:0}, b);\n if (8 < b.Qa) {\n throw new O(32);\n }\n a = a.split(\"/\").filter(g => !!g);\n for (var c = Eb, d = \"/\", e = 0; e < a.length; e++) {\n var f = e === a.length - 1;\n if (f && b.parent) {\n break;\n }\n c = Cb(c, a[e]);\n d = gb(d + \"/\" + a[e]);\n c.wa && (!f || f && b.gb) && (c = c.wa.root);\n if (!f || b.fb) {\n for (f = 0; 40960 === (c.mode & 61440);) {\n if (c = Kb(d), d = lb(hb(d), c), c = Lb(d, {Qa:b.Qa + 1}).node, 40 < f++) {\n throw new O(32);\n }\n }\n }\n }\n return {path:d, node:c};\n}, Mb = a => {\n for (var b;;) {\n if (a === a.parent) {\n return a = a.U.mb, b ? \"/\" !== a[a.length - 1] ? `${a}/${b}` : a + b : a;\n }\n b = b ? `${a.name}/${b}` : a.name;\n a = a.parent;\n }\n}, Nb = (a, b) => {\n for (var c = 0, d = 0; d < b.length; d++) {\n c = (c << 5) - c + b.charCodeAt(d) | 0;\n }\n return (a + c >>> 0) % Ib.length;\n}, Cb = (a, b) => {\n var c;\n if (c = (c = Ob(a, \"x\")) ? c : a.l.ka ? 0 : 2) {\n throw new O(c, a);\n }\n for (c = Ib[Nb(a.id, b)]; c; c = c.lc) {\n var d = c.name;\n if (c.parent.id === a.id && d === b) {\n return c;\n }\n }\n return a.l.ka(a, b);\n}, Ab = (a, b, c, d) => {\n a = new Pb(a, b, c, d);\n b = Nb(a.parent.id, a.name);\n a.lc = Ib[b];\n return Ib[b] = a;\n}, Qb = a => {\n var b = [\"r\", \"w\", \"rw\"][a & 3];\n a & 512 && (b += \"w\");\n return b;\n}, Ob = (a, b) => {\n if (Jb) {\n return 0;\n }\n if (!b.includes(\"r\") || a.mode & 292) {\n if (b.includes(\"w\") && !(a.mode & 146) || b.includes(\"x\") && !(a.mode & 73)) {\n return 2;\n }\n } else {\n return 2;\n }\n return 0;\n}, Rb = (a, b) => {\n try {\n return Cb(a, b), 20;\n } catch (c) {\n }\n return Ob(a, \"wx\");\n}, Sb = () => {\n for (var a = 0; 4096 >= a; a++) {\n if (!Gb[a]) {\n return a;\n }\n }\n throw new O(33);\n}, Tb = a => {\n a = Gb[a];\n if (!a) {\n throw new O(8);\n }\n return a;\n}, Vb = (a, b = -1) => {\n Ub || (Ub = function() {\n this.h = {};\n }, Ub.prototype = {}, Object.defineProperties(Ub.prototype, {object:{get() {\n return this.node;\n }, set(c) {\n this.node = c;\n }}, flags:{get() {\n return this.h.flags;\n }, set(c) {\n this.h.flags = c;\n },}, position:{get() {\n return this.h.position;\n }, set(c) {\n this.h.position = c;\n },},}));\n a = Object.assign(new Ub(), a);\n -1 == b && (b = Sb());\n a.X = b;\n return Gb[b] = a;\n}, zb = {open:a => {\n a.m = Fb[a.node.za].m;\n a.m.open && a.m.open(a);\n}, ba:() => {\n throw new O(70);\n},}, ub = (a, b) => {\n Fb[a] = {m:b};\n}, Wb = (a, b) => {\n var c = \"/\" === b, d = !b;\n if (c && Eb) {\n throw new O(10);\n }\n if (!c && !d) {\n var e = Lb(b, {gb:!1});\n b = e.path;\n e = e.node;\n if (e.wa) {\n throw new O(10);\n }\n if (16384 !== (e.mode & 61440)) {\n throw new O(54);\n }\n }\n b = {type:a, Qc:{}, mb:b, kc:[]};\n a = a.U(b);\n a.U = b;\n b.root = a;\n c ? Eb = a : e && (e.wa = b, e.U && e.U.kc.push(b));\n}, S = (a, b, c) => {\n var d = Lb(a, {parent:!0}).node;\n a = ib(a);\n if (!a || \".\" === a || \"..\" === a) {\n throw new O(28);\n }\n var e = Rb(d, a);\n if (e) {\n throw new O(e);\n }\n if (!d.l.va) {\n throw new O(63);\n }\n return d.l.va(d, a, b, c);\n}, Xb = (a, b, c) => {\n \"undefined\" == typeof c && (c = b, b = 438);\n S(a, b | 8192, c);\n}, cc = (a, b) => {\n if (!lb(a)) {\n throw new O(44);\n }\n var c = Lb(b, {parent:!0}).node;\n if (!c) {\n throw new O(44);\n }\n b = ib(b);\n var d = Rb(c, b);\n if (d) {\n throw new O(d);\n }\n if (!c.l.Ea) {\n throw new O(63);\n }\n c.l.Ea(c, b, a);\n}, Kb = a => {\n a = Lb(a).node;\n if (!a) {\n throw new O(44);\n }\n if (!a.l.ma) {\n throw new O(28);\n }\n return lb(Mb(a.parent), a.l.ma(a));\n}, ec = (a, b, c) => {\n if (\"\" === a) {\n throw new O(44);\n }\n if (\"string\" == typeof b) {\n var d = {r:0, \"r+\":2, w:577, \"w+\":578, a:1089, \"a+\":1090,}[b];\n if (\"undefined\" == typeof d) {\n throw Error(`Unknown file open mode: ${b}`);\n }\n b = d;\n }\n c = b & 64 ? (\"undefined\" == typeof c ? 438 : c) & 4095 | 32768 : 0;\n if (\"object\" == typeof a) {\n var e = a;\n } else {\n a = gb(a);\n try {\n e = Lb(a, {fb:!(b & 131072)}).node;\n } catch (f) {\n }\n }\n d = !1;\n if (b & 64) {\n if (e) {\n if (b & 128) {\n throw new O(20);\n }\n } else {\n e = S(a, c, 0), d = !0;\n }\n }\n if (!e) {\n throw new O(44);\n }\n 8192 === (e.mode & 61440) && (b &= -513);\n if (b & 65536 && 16384 !== (e.mode & 61440)) {\n throw new O(54);\n }\n if (!d && (c = e ? 40960 === (e.mode & 61440) ? 32 : 16384 === (e.mode & 61440) && (\"r\" !== Qb(b) || b & 512) ? 31 : Ob(e, Qb(b)) : 44)) {\n throw new O(c);\n }\n if (b & 512 && !d) {\n c = e;\n c = \"string\" == typeof c ? Lb(c, {fb:!0}).node : c;\n if (!c.l.P) {\n throw new O(63);\n }\n if (16384 === (c.mode & 61440)) {\n throw new O(31);\n }\n if (32768 !== (c.mode & 61440)) {\n throw new O(28);\n }\n if (d = Ob(c, \"w\")) {\n throw new O(d);\n }\n c.l.P(c, {size:0, timestamp:Date.now()});\n }\n b &= -131713;\n e = Vb({node:e, path:Mb(e), flags:b, seekable:!0, position:0, m:e.m, zc:[], error:!1});\n e.m.open && e.m.open(e);\n !m.logReadFiles || b & 1 || (dc || (dc = {}), a in dc || (dc[a] = 1));\n return e;\n}, fc = (a, b, c) => {\n if (null === a.X) {\n throw new O(8);\n }\n if (!a.seekable || !a.m.ba) {\n throw new O(70);\n }\n if (0 != c && 1 != c && 2 != c) {\n throw new O(28);\n }\n a.position = a.m.ba(a, b, c);\n a.zc = [];\n}, gc = () => {\n O || (O = function(a, b) {\n this.name = \"ErrnoError\";\n this.node = b;\n this.pc = function(c) {\n this.aa = c;\n };\n this.pc(a);\n this.message = \"FS error\";\n }, O.prototype = Error(), O.prototype.constructor = O, [44].forEach(a => {\n Bb[a] = new O(a);\n Bb[a].stack = \"\";\n }));\n}, hc, jc = (a, b, c) => {\n a = gb(\"/dev/\" + a);\n var d = Db(!!b, !!c);\n ic || (ic = 64);\n var e = ic++ << 8 | 0;\n ub(e, {open:f => {\n f.seekable = !1;\n }, close:() => {\n c && c.buffer && c.buffer.length && c(10);\n }, read:(f, g, n, p) => {\n for (var l = 0, u = 0; u < p; u++) {\n try {\n var v = b();\n } catch (x) {\n throw new O(29);\n }\n if (void 0 === v && 0 === l) {\n throw new O(6);\n }\n if (null === v || void 0 === v) {\n break;\n }\n l++;\n g[n + u] = v;\n }\n l && (f.node.timestamp = Date.now());\n return l;\n }, write:(f, g, n, p) => {\n for (var l = 0; l < p; l++) {\n try {\n c(g[n + l]);\n } catch (u) {\n throw new O(29);\n }\n }\n p && (f.node.timestamp = Date.now());\n return l;\n }});\n Xb(a, d, e);\n}, ic, kc = {}, Ub, dc, lc = void 0;\nfunction mc() {\n lc += 4;\n return L[lc - 4 >> 2];\n}\nfunction nc(a) {\n if (void 0 === a) {\n return \"_unknown\";\n }\n a = a.replace(/[^a-zA-Z0-9_]/g, \"$\");\n var b = a.charCodeAt(0);\n return 48 <= b && 57 >= b ? `_${a}` : a;\n}\nfunction oc(a, b) {\n a = nc(a);\n return {[a]:function() {\n return b.apply(this, arguments);\n }}[a];\n}\nfunction pc() {\n this.M = [void 0];\n this.hb = [];\n}\nvar U = new pc(), qc = void 0;\nfunction V(a) {\n throw new qc(a);\n}\nvar rc = a => {\n a || V(\"Cannot use deleted val. handle = \" + a);\n return U.get(a).value;\n}, sc = a => {\n switch(a) {\n case void 0:\n return 1;\n case null:\n return 2;\n case !0:\n return 3;\n case !1:\n return 4;\n default:\n return U.pa({tb:1, value:a});\n }\n};\nfunction tc(a) {\n var b = Error, c = oc(a, function(d) {\n this.name = a;\n this.message = d;\n d = Error(d).stack;\n void 0 !== d && (this.stack = this.toString() + \"\\n\" + d.replace(/^Error(:[^\\n]*)?\\n/, \"\"));\n });\n c.prototype = Object.create(b.prototype);\n c.prototype.constructor = c;\n c.prototype.toString = function() {\n return void 0 === this.message ? this.name : `${this.name}: ${this.message}`;\n };\n return c;\n}\nvar uc = void 0, vc = void 0;\nfunction W(a) {\n for (var b = \"\"; E[a];) {\n b += vc[E[a++]];\n }\n return b;\n}\nvar wc = [];\nfunction xc() {\n for (; wc.length;) {\n var a = wc.pop();\n a.g.fa = !1;\n a[\"delete\"]();\n }\n}\nvar yc = void 0, zc = {};\nfunction Ac(a, b) {\n for (void 0 === b && V(\"ptr should not be undefined\"); a.A;) {\n b = a.na(b), a = a.A;\n }\n return b;\n}\nvar Bc = {};\nfunction Cc(a) {\n a = Dc(a);\n var b = W(a);\n Ec(a);\n return b;\n}\nfunction Fc(a, b) {\n var c = Bc[a];\n void 0 === c && V(b + \" has unknown type \" + Cc(a));\n return c;\n}\nfunction Gc() {\n}\nvar Hc = !1;\nfunction Ic(a) {\n --a.count.value;\n 0 === a.count.value && (a.G ? a.L.W(a.G) : a.u.i.W(a.o));\n}\nfunction Jc(a, b, c) {\n if (b === c) {\n return a;\n }\n if (void 0 === c.A) {\n return null;\n }\n a = Jc(a, b, c.A);\n return null === a ? null : c.Pb(a);\n}\nvar Kc = {};\nfunction Lc(a, b) {\n b = Ac(a, b);\n return zc[b];\n}\nvar Mc = void 0;\nfunction Nc(a) {\n throw new Mc(a);\n}\nfunction Oc(a, b) {\n b.u && b.o || Nc(\"makeClassHandle requires ptr and ptrType\");\n !!b.L !== !!b.G && Nc(\"Both smartPtrType and smartPtr must be specified\");\n b.count = {value:1};\n return Pc(Object.create(a, {g:{value:b,},}));\n}\nfunction Pc(a) {\n if (\"undefined\" === typeof FinalizationRegistry) {\n return Pc = b => b, a;\n }\n Hc = new FinalizationRegistry(b => {\n Ic(b.g);\n });\n Pc = b => {\n var c = b.g;\n c.G && Hc.register(b, {g:c}, b);\n return b;\n };\n Gc = b => {\n Hc.unregister(b);\n };\n return Pc(a);\n}\nvar Qc = {};\nfunction Rc(a) {\n for (; a.length;) {\n var b = a.pop();\n a.pop()(b);\n }\n}\nfunction Sc(a) {\n return this.fromWireType(L[a >> 2]);\n}\nvar Tc = {}, Uc = {};\nfunction Y(a, b, c) {\n function d(n) {\n n = c(n);\n n.length !== a.length && Nc(\"Mismatched type converter count\");\n for (var p = 0; p < a.length; ++p) {\n Vc(a[p], n[p]);\n }\n }\n a.forEach(function(n) {\n Uc[n] = b;\n });\n var e = Array(b.length), f = [], g = 0;\n b.forEach((n, p) => {\n Bc.hasOwnProperty(n) ? e[p] = Bc[n] : (f.push(n), Tc.hasOwnProperty(n) || (Tc[n] = []), Tc[n].push(() => {\n e[p] = Bc[n];\n ++g;\n g === f.length && d(e);\n }));\n });\n 0 === f.length && d(e);\n}\nfunction Wc(a) {\n switch(a) {\n case 1:\n return 0;\n case 2:\n return 1;\n case 4:\n return 2;\n case 8:\n return 3;\n default:\n throw new TypeError(`Unknown type size: ${a}`);\n }\n}\nfunction Xc(a, b, c = {}) {\n var d = b.name;\n a || V(`type \"${d}\" must have a positive integer typeid pointer`);\n if (Bc.hasOwnProperty(a)) {\n if (c.$b) {\n return;\n }\n V(`Cannot register type '${d}' twice`);\n }\n Bc[a] = b;\n delete Uc[a];\n Tc.hasOwnProperty(a) && (b = Tc[a], delete Tc[a], b.forEach(e => e()));\n}\nfunction Vc(a, b, c = {}) {\n if (!(\"argPackAdvance\" in b)) {\n throw new TypeError(\"registerType registeredInstance requires argPackAdvance\");\n }\n Xc(a, b, c);\n}\nfunction Yc(a) {\n V(a.g.u.i.name + \" instance already deleted\");\n}\nfunction Zc() {\n}\nfunction $c(a, b, c) {\n if (void 0 === a[b].B) {\n var d = a[b];\n a[b] = function() {\n a[b].B.hasOwnProperty(arguments.length) || V(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${a[b].B})!`);\n return a[b].B[arguments.length].apply(this, arguments);\n };\n a[b].B = [];\n a[b].B[d.ea] = d;\n }\n}\nfunction ad(a, b, c) {\n m.hasOwnProperty(a) ? ((void 0 === c || void 0 !== m[a].B && void 0 !== m[a].B[c]) && V(`Cannot register public name '${a}' twice`), $c(m, a, a), m.hasOwnProperty(c) && V(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`), m[a].B[c] = b) : (m[a] = b, void 0 !== c && (m[a].Pc = c));\n}\nfunction bd(a, b, c, d, e, f, g, n) {\n this.name = a;\n this.constructor = b;\n this.N = c;\n this.W = d;\n this.A = e;\n this.Ub = f;\n this.na = g;\n this.Pb = n;\n this.qb = [];\n}\nfunction cd(a, b, c) {\n for (; b !== c;) {\n b.na || V(`Expected null or instance of ${c.name}, got an instance of ${b.name}`), a = b.na(a), b = b.A;\n }\n return a;\n}\nfunction dd(a, b) {\n if (null === b) {\n return this.Na && V(`null is not a valid ${this.name}`), 0;\n }\n b.g || V(`Cannot pass \"${ed(b)}\" as a ${this.name}`);\n b.g.o || V(`Cannot pass deleted object as a pointer of type ${this.name}`);\n return cd(b.g.o, b.g.u.i, this.i);\n}\nfunction fd(a, b) {\n if (null === b) {\n this.Na && V(`null is not a valid ${this.name}`);\n if (this.ua) {\n var c = this.Pa();\n null !== a && a.push(this.W, c);\n return c;\n }\n return 0;\n }\n b.g || V(`Cannot pass \"${ed(b)}\" as a ${this.name}`);\n b.g.o || V(`Cannot pass deleted object as a pointer of type ${this.name}`);\n !this.ta && b.g.u.ta && V(`Cannot convert argument of type ${b.g.L ? b.g.L.name : b.g.u.name} to parameter type ${this.name}`);\n c = cd(b.g.o, b.g.u.i, this.i);\n if (this.ua) {\n switch(void 0 === b.g.G && V(\"Passing raw pointer to smart pointer is illegal\"), this.tc) {\n case 0:\n b.g.L === this ? c = b.g.G : V(`Cannot convert argument of type ${b.g.L ? b.g.L.name : b.g.u.name} to parameter type ${this.name}`);\n break;\n case 1:\n c = b.g.G;\n break;\n case 2:\n if (b.g.L === this) {\n c = b.g.G;\n } else {\n var d = b.clone();\n c = this.oc(c, sc(function() {\n d[\"delete\"]();\n }));\n null !== a && a.push(this.W, c);\n }\n break;\n default:\n V(\"Unsupporting sharing policy\");\n }\n }\n return c;\n}\nfunction gd(a, b) {\n if (null === b) {\n return this.Na && V(`null is not a valid ${this.name}`), 0;\n }\n b.g || V(`Cannot pass \"${ed(b)}\" as a ${this.name}`);\n b.g.o || V(`Cannot pass deleted object as a pointer of type ${this.name}`);\n b.g.u.ta && V(`Cannot convert argument of type ${b.g.u.name} to parameter type ${this.name}`);\n return cd(b.g.o, b.g.u.i, this.i);\n}\nfunction hd(a, b, c, d) {\n this.name = a;\n this.i = b;\n this.Na = c;\n this.ta = d;\n this.ua = !1;\n this.W = this.oc = this.Pa = this.rb = this.tc = this.nc = void 0;\n void 0 !== b.A ? this.toWireType = fd : (this.toWireType = d ? dd : gd, this.K = null);\n}\nfunction jd(a, b, c) {\n m.hasOwnProperty(a) || Nc(\"Replacing nonexistant public symbol\");\n void 0 !== m[a].B && void 0 !== c ? m[a].B[c] = b : (m[a] = b, m[a].ea = c);\n}\nvar kd = [], ld = a => {\n var b = kd[a];\n b || (a >= kd.length && (kd.length = a + 1), kd[a] = b = Ka.get(a));\n return b;\n}, md = (a, b) => {\n var c = [];\n return function() {\n c.length = 0;\n Object.assign(c, arguments);\n if (a.includes(\"j\")) {\n var d = m[\"dynCall_\" + a];\n d = c && c.length ? d.apply(null, [b].concat(c)) : d.call(null, b);\n } else {\n d = ld(b).apply(null, c);\n }\n return d;\n };\n};\nfunction Z(a, b) {\n a = W(a);\n var c = a.includes(\"j\") ? md(a, b) : ld(b);\n \"function\" != typeof c && V(`unknown function pointer with signature ${a}: ${b}`);\n return c;\n}\nvar nd = void 0;\nfunction od(a, b) {\n function c(f) {\n e[f] || Bc[f] || (Uc[f] ? Uc[f].forEach(c) : (d.push(f), e[f] = !0));\n }\n var d = [], e = {};\n b.forEach(c);\n throw new nd(`${a}: ` + d.map(Cc).join([\", \"]));\n}\nfunction pd(a, b, c, d, e) {\n var f = b.length;\n 2 > f && V(\"argTypes array size mismatch! Must at least get return value and 'this' types!\");\n var g = null !== b[1] && null !== c, n = !1;\n for (c = 1; c < b.length; ++c) {\n if (null !== b[c] && void 0 === b[c].K) {\n n = !0;\n break;\n }\n }\n var p = \"void\" !== b[0].name, l = f - 2, u = Array(l), v = [], x = [];\n return function() {\n arguments.length !== l && V(`function ${a} called with ${arguments.length} arguments, expected ${l} args!`);\n x.length = 0;\n v.length = g ? 2 : 1;\n v[0] = e;\n if (g) {\n var k = b[1].toWireType(x, this);\n v[1] = k;\n }\n for (var t = 0; t < l; ++t) {\n u[t] = b[t + 2].toWireType(x, arguments[t]), v.push(u[t]);\n }\n t = d.apply(null, v);\n if (n) {\n Rc(x);\n } else {\n for (var r = g ? 1 : 2; r < b.length; r++) {\n var B = 1 === r ? k : u[r - 2];\n null !== b[r].K && b[r].K(B);\n }\n }\n k = p ? b[0].fromWireType(t) : void 0;\n return k;\n };\n}\nfunction sd(a, b) {\n for (var c = [], d = 0; d < a; d++) {\n c.push(N[b + 4 * d >> 2]);\n }\n return c;\n}\nfunction td(a, b, c) {\n a instanceof Object || V(`${c} with invalid \"this\": ${a}`);\n a instanceof b.i.constructor || V(`${c} incompatible with \"this\" of type ${a.constructor.name}`);\n a.g.o || V(`cannot call emscripten binding method ${c} on deleted object`);\n return cd(a.g.o, a.g.u.i, b.i);\n}\nfunction ud(a) {\n a >= U.h && 0 === --U.get(a).tb && U.Zb(a);\n}\nfunction vd(a, b, c) {\n switch(b) {\n case 0:\n return function(d) {\n return this.fromWireType((c ? C : E)[d]);\n };\n case 1:\n return function(d) {\n return this.fromWireType((c ? Da : Ea)[d >> 1]);\n };\n case 2:\n return function(d) {\n return this.fromWireType((c ? L : N)[d >> 2]);\n };\n default:\n throw new TypeError(\"Unknown integer type: \" + a);\n }\n}\nfunction ed(a) {\n if (null === a) {\n return \"null\";\n }\n var b = typeof a;\n return \"object\" === b || \"array\" === b || \"function\" === b ? a.toString() : \"\" + a;\n}\nfunction wd(a, b) {\n switch(b) {\n case 2:\n return function(c) {\n return this.fromWireType(Fa[c >> 2]);\n };\n case 3:\n return function(c) {\n return this.fromWireType(Ia[c >> 3]);\n };\n default:\n throw new TypeError(\"Unknown float type: \" + a);\n }\n}\nfunction xd(a, b, c) {\n switch(b) {\n case 0:\n return c ? function(d) {\n return C[d];\n } : function(d) {\n return E[d];\n };\n case 1:\n return c ? function(d) {\n return Da[d >> 1];\n } : function(d) {\n return Ea[d >> 1];\n };\n case 2:\n return c ? function(d) {\n return L[d >> 2];\n } : function(d) {\n return N[d >> 2];\n };\n default:\n throw new TypeError(\"Unknown integer type: \" + a);\n }\n}\nvar yd = \"undefined\" != typeof TextDecoder ? new TextDecoder(\"utf-16le\") : void 0, zd = (a, b) => {\n var c = a >> 1;\n for (var d = c + b / 2; !(c >= d) && Ea[c];) {\n ++c;\n }\n c <<= 1;\n if (32 < c - a && yd) {\n return yd.decode(E.subarray(a, c));\n }\n c = \"\";\n for (d = 0; !(d >= b / 2); ++d) {\n var e = Da[a + 2 * d >> 1];\n if (0 == e) {\n break;\n }\n c += String.fromCharCode(e);\n }\n return c;\n}, Ad = (a, b, c) => {\n void 0 === c && (c = 2147483647);\n if (2 > c) {\n return 0;\n }\n c -= 2;\n var d = b;\n c = c < 2 * a.length ? c / 2 : a.length;\n for (var e = 0; e < c; ++e) {\n Da[b >> 1] = a.charCodeAt(e), b += 2;\n }\n Da[b >> 1] = 0;\n return b - d;\n}, Bd = a => 2 * a.length, Cd = (a, b) => {\n for (var c = 0, d = \"\"; !(c >= b / 4);) {\n var e = L[a + 4 * c >> 2];\n if (0 == e) {\n break;\n }\n ++c;\n 65536 <= e ? (e -= 65536, d += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023)) : d += String.fromCharCode(e);\n }\n return d;\n}, Dd = (a, b, c) => {\n void 0 === c && (c = 2147483647);\n if (4 > c) {\n return 0;\n }\n var d = b;\n c = d + c - 4;\n for (var e = 0; e < a.length; ++e) {\n var f = a.charCodeAt(e);\n if (55296 <= f && 57343 >= f) {\n var g = a.charCodeAt(++e);\n f = 65536 + ((f & 1023) << 10) | g & 1023;\n }\n L[b >> 2] = f;\n b += 4;\n if (b + 4 > c) {\n break;\n }\n }\n L[b >> 2] = 0;\n return b - d;\n}, Ed = a => {\n for (var b = 0, c = 0; c < a.length; ++c) {\n var d = a.charCodeAt(c);\n 55296 <= d && 57343 >= d && ++c;\n b += 4;\n }\n return b;\n}, Fd = {};\nfunction Gd(a) {\n var b = Fd[a];\n return void 0 === b ? W(a) : b;\n}\nvar Hd = [];\nfunction Id(a) {\n var b = Hd.length;\n Hd.push(a);\n return b;\n}\nfunction Jd(a, b) {\n for (var c = Array(a), d = 0; d < a; ++d) {\n c[d] = Fc(N[b + 4 * d >> 2], \"parameter \" + d);\n }\n return c;\n}\nvar Kd = [], Ld = [], Md = {}, Od = () => {\n if (!Nd) {\n var a = {USER:\"web_user\", LOGNAME:\"web_user\", PATH:\"/\", PWD:\"/\", HOME:\"/home/web_user\", LANG:(\"object\" == typeof navigator && navigator.languages && navigator.languages[0] || \"C\").replace(\"-\", \"_\") + \".UTF-8\", _:na || \"./this.program\"}, b;\n for (b in Md) {\n void 0 === Md[b] ? delete a[b] : a[b] = Md[b];\n }\n var c = [];\n for (b in a) {\n c.push(`${b}=${a[b]}`);\n }\n Nd = c;\n }\n return Nd;\n}, Nd, Pd = a => 0 === a % 4 && (0 !== a % 100 || 0 === a % 400), Qd = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Rd = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Sd = (a, b, c, d) => {\n function e(k, t, r) {\n for (k = \"number\" == typeof k ? k.toString() : k || \"\"; k.length < t;) {\n k = r[0] + k;\n }\n return k;\n }\n function f(k, t) {\n return e(k, t, \"0\");\n }\n function g(k, t) {\n function r(D) {\n return 0 > D ? -1 : 0 < D ? 1 : 0;\n }\n var B;\n 0 === (B = r(k.getFullYear() - t.getFullYear())) && 0 === (B = r(k.getMonth() - t.getMonth())) && (B = r(k.getDate() - t.getDate()));\n return B;\n }\n function n(k) {\n switch(k.getDay()) {\n case 0:\n return new Date(k.getFullYear() - 1, 11, 29);\n case 1:\n return k;\n case 2:\n return new Date(k.getFullYear(), 0, 3);\n case 3:\n return new Date(k.getFullYear(), 0, 2);\n case 4:\n return new Date(k.getFullYear(), 0, 1);\n case 5:\n return new Date(k.getFullYear() - 1, 11, 31);\n case 6:\n return new Date(k.getFullYear() - 1, 11, 30);\n }\n }\n function p(k) {\n var t = k.ca;\n for (k = new Date((new Date(k.da + 1900, 0, 1)).getTime()); 0 < t;) {\n var r = k.getMonth(), B = (Pd(k.getFullYear()) ? Qd : Rd)[r];\n if (t > B - k.getDate()) {\n t -= B - k.getDate() + 1, k.setDate(1), 11 > r ? k.setMonth(r + 1) : (k.setMonth(0), k.setFullYear(k.getFullYear() + 1));\n } else {\n k.setDate(k.getDate() + t);\n break;\n }\n }\n r = new Date(k.getFullYear() + 1, 0, 4);\n t = n(new Date(k.getFullYear(), 0, 4));\n r = n(r);\n return 0 >= g(t, k) ? 0 >= g(r, k) ? k.getFullYear() + 1 : k.getFullYear() : k.getFullYear() - 1;\n }\n var l = L[d + 40 >> 2];\n d = {wc:L[d >> 2], vc:L[d + 4 >> 2], Fa:L[d + 8 >> 2], Sa:L[d + 12 >> 2], Ga:L[d + 16 >> 2], da:L[d + 20 >> 2], R:L[d + 24 >> 2], ca:L[d + 28 >> 2], Rc:L[d + 32 >> 2], uc:L[d + 36 >> 2], xc:l ? l ? nb(E, l) : \"\" : \"\"};\n c = c ? nb(E, c) : \"\";\n l = {\"%c\":\"%a %b %d %H:%M:%S %Y\", \"%D\":\"%m/%d/%y\", \"%F\":\"%Y-%m-%d\", \"%h\":\"%b\", \"%r\":\"%I:%M:%S %p\", \"%R\":\"%H:%M\", \"%T\":\"%H:%M:%S\", \"%x\":\"%m/%d/%y\", \"%X\":\"%H:%M:%S\", \"%Ec\":\"%c\", \"%EC\":\"%C\", \"%Ex\":\"%m/%d/%y\", \"%EX\":\"%H:%M:%S\", \"%Ey\":\"%y\", \"%EY\":\"%Y\", \"%Od\":\"%d\", \"%Oe\":\"%e\", \"%OH\":\"%H\", \"%OI\":\"%I\", \"%Om\":\"%m\", \"%OM\":\"%M\", \"%OS\":\"%S\", \"%Ou\":\"%u\", \"%OU\":\"%U\", \"%OV\":\"%V\", \"%Ow\":\"%w\", \"%OW\":\"%W\", \"%Oy\":\"%y\",};\n for (var u in l) {\n c = c.replace(new RegExp(u, \"g\"), l[u]);\n }\n var v = \"Sunday Monday Tuesday Wednesday Thursday Friday Saturday\".split(\" \"), x = \"January February March April May June July August September October November December\".split(\" \");\n l = {\"%a\":k => v[k.R].substring(0, 3), \"%A\":k => v[k.R], \"%b\":k => x[k.Ga].substring(0, 3), \"%B\":k => x[k.Ga], \"%C\":k => f((k.da + 1900) / 100 | 0, 2), \"%d\":k => f(k.Sa, 2), \"%e\":k => e(k.Sa, 2, \" \"), \"%g\":k => p(k).toString().substring(2), \"%G\":k => p(k), \"%H\":k => f(k.Fa, 2), \"%I\":k => {\n k = k.Fa;\n 0 == k ? k = 12 : 12 < k && (k -= 12);\n return f(k, 2);\n }, \"%j\":k => {\n for (var t = 0, r = 0; r <= k.Ga - 1; t += (Pd(k.da + 1900) ? Qd : Rd)[r++]) {\n }\n return f(k.Sa + t, 3);\n }, \"%m\":k => f(k.Ga + 1, 2), \"%M\":k => f(k.vc, 2), \"%n\":() => \"\\n\", \"%p\":k => 0 <= k.Fa && 12 > k.Fa ? \"AM\" : \"PM\", \"%S\":k => f(k.wc, 2), \"%t\":() => \"\\t\", \"%u\":k => k.R || 7, \"%U\":k => f(Math.floor((k.ca + 7 - k.R) / 7), 2), \"%V\":k => {\n var t = Math.floor((k.ca + 7 - (k.R + 6) % 7) / 7);\n 2 >= (k.R + 371 - k.ca - 2) % 7 && t++;\n if (t) {\n 53 == t && (r = (k.R + 371 - k.ca) % 7, 4 == r || 3 == r && Pd(k.da) || (t = 1));\n } else {\n t = 52;\n var r = (k.R + 7 - k.ca - 1) % 7;\n (4 == r || 5 == r && Pd(k.da % 400 - 1)) && t++;\n }\n return f(t, 2);\n }, \"%w\":k => k.R, \"%W\":k => f(Math.floor((k.ca + 7 - (k.R + 6) % 7) / 7), 2), \"%y\":k => (k.da + 1900).toString().substring(2), \"%Y\":k => k.da + 1900, \"%z\":k => {\n k = k.uc;\n var t = 0 <= k;\n k = Math.abs(k) / 60;\n return (t ? \"+\" : \"-\") + String(\"0000\" + (k / 60 * 100 + k % 60)).slice(-4);\n }, \"%Z\":k => k.xc, \"%%\":() => \"%\"};\n c = c.replace(/%%/g, \"\\x00\\x00\");\n for (u in l) {\n c.includes(u) && (c = c.replace(new RegExp(u, \"g\"), l[u](d)));\n }\n c = c.replace(/\\0\\0/g, \"%\");\n u = rb(c, !1);\n if (u.length > b) {\n return 0;\n }\n C.set(u, a);\n return u.length - 1;\n};\nfunction Pb(a, b, c, d) {\n a || (a = this);\n this.parent = a;\n this.U = a.U;\n this.wa = null;\n this.id = Hb++;\n this.name = b;\n this.mode = c;\n this.l = {};\n this.m = {};\n this.za = d;\n}\nObject.defineProperties(Pb.prototype, {read:{get:function() {\n return 365 === (this.mode & 365);\n}, set:function(a) {\n a ? this.mode |= 365 : this.mode &= -366;\n}}, write:{get:function() {\n return 146 === (this.mode & 146);\n}, set:function(a) {\n a ? this.mode |= 146 : this.mode &= -147;\n}}});\ngc();\nIb = Array(4096);\nWb(P, \"/\");\nS(\"/tmp\", 16895, 0);\nS(\"/home\", 16895, 0);\nS(\"/home/web_user\", 16895, 0);\n(() => {\n S(\"/dev\", 16895, 0);\n ub(259, {read:() => 0, write:(d, e, f, g) => g,});\n Xb(\"/dev/null\", 259);\n tb(1280, wb);\n tb(1536, xb);\n Xb(\"/dev/tty\", 1280);\n Xb(\"/dev/tty1\", 1536);\n var a = new Uint8Array(1024), b = 0, c = () => {\n 0 === b && (b = kb(a).byteLength);\n return a[--b];\n };\n jc(\"random\", c);\n jc(\"urandom\", c);\n S(\"/dev/shm\", 16895, 0);\n S(\"/dev/shm/tmp\", 16895, 0);\n})();\n(() => {\n S(\"/proc\", 16895, 0);\n var a = S(\"/proc/self\", 16895, 0);\n S(\"/proc/self/fd\", 16895, 0);\n Wb({U:() => {\n var b = Ab(a, \"fd\", 16895, 73);\n b.l = {ka:(c, d) => {\n var e = Tb(+d);\n c = {parent:null, U:{mb:\"fake\"}, l:{ma:() => e.path},};\n return c.parent = c;\n }};\n return b;\n }}, \"/proc/self/fd\");\n})();\nObject.assign(pc.prototype, {get(a) {\n return this.M[a];\n}, has(a) {\n return void 0 !== this.M[a];\n}, pa(a) {\n var b = this.hb.pop() || this.M.length;\n this.M[b] = a;\n return b;\n}, Zb(a) {\n this.M[a] = void 0;\n this.hb.push(a);\n}});\nqc = m.BindingError = class extends Error {\n constructor(a) {\n super(a);\n this.name = \"BindingError\";\n }\n};\nU.M.push({value:void 0}, {value:null}, {value:!0}, {value:!1},);\nU.h = U.M.length;\nm.count_emval_handles = function() {\n for (var a = 0, b = U.h; b < U.M.length; ++b) {\n void 0 !== U.M[b] && ++a;\n }\n return a;\n};\nuc = m.PureVirtualError = tc(\"PureVirtualError\");\nfor (var Td = Array(256), Ud = 0; 256 > Ud; ++Ud) {\n Td[Ud] = String.fromCharCode(Ud);\n}\nvc = Td;\nm.getInheritedInstanceCount = function() {\n return Object.keys(zc).length;\n};\nm.getLiveInheritedInstances = function() {\n var a = [], b;\n for (b in zc) {\n zc.hasOwnProperty(b) && a.push(zc[b]);\n }\n return a;\n};\nm.flushPendingDeletes = xc;\nm.setDelayFunction = function(a) {\n yc = a;\n wc.length && yc && yc(xc);\n};\nMc = m.InternalError = class extends Error {\n constructor(a) {\n super(a);\n this.name = \"InternalError\";\n }\n};\nZc.prototype.isAliasOf = function(a) {\n if (!(this instanceof Zc && a instanceof Zc)) {\n return !1;\n }\n var b = this.g.u.i, c = this.g.o, d = a.g.u.i;\n for (a = a.g.o; b.A;) {\n c = b.na(c), b = b.A;\n }\n for (; d.A;) {\n a = d.na(a), d = d.A;\n }\n return b === d && c === a;\n};\nZc.prototype.clone = function() {\n this.g.o || Yc(this);\n if (this.g.ia) {\n return this.g.count.value += 1, this;\n }\n var a = Pc, b = Object, c = b.create, d = Object.getPrototypeOf(this), e = this.g;\n a = a(c.call(b, d, {g:{value:{count:e.count, fa:e.fa, ia:e.ia, o:e.o, u:e.u, G:e.G, L:e.L,},}}));\n a.g.count.value += 1;\n a.g.fa = !1;\n return a;\n};\nZc.prototype[\"delete\"] = function() {\n this.g.o || Yc(this);\n this.g.fa && !this.g.ia && V(\"Object already scheduled for deletion\");\n Gc(this);\n Ic(this.g);\n this.g.ia || (this.g.G = void 0, this.g.o = void 0);\n};\nZc.prototype.isDeleted = function() {\n return !this.g.o;\n};\nZc.prototype.deleteLater = function() {\n this.g.o || Yc(this);\n this.g.fa && !this.g.ia && V(\"Object already scheduled for deletion\");\n wc.push(this);\n 1 === wc.length && yc && yc(xc);\n this.g.fa = !0;\n return this;\n};\nhd.prototype.Vb = function(a) {\n this.rb && (a = this.rb(a));\n return a;\n};\nhd.prototype.ab = function(a) {\n this.W && this.W(a);\n};\nhd.prototype.argPackAdvance = 8;\nhd.prototype.readValueFromPointer = Sc;\nhd.prototype.deleteObject = function(a) {\n if (null !== a) {\n a[\"delete\"]();\n }\n};\nhd.prototype.fromWireType = function(a) {\n function b() {\n return this.ua ? Oc(this.i.N, {u:this.nc, o:c, L:this, G:a,}) : Oc(this.i.N, {u:this, o:a,});\n }\n var c = this.Vb(a);\n if (!c) {\n return this.ab(a), null;\n }\n var d = Lc(this.i, c);\n if (void 0 !== d) {\n if (0 === d.g.count.value) {\n return d.g.o = c, d.g.G = a, d.clone();\n }\n d = d.clone();\n this.ab(a);\n return d;\n }\n d = this.i.Ub(c);\n d = Kc[d];\n if (!d) {\n return b.call(this);\n }\n d = this.ta ? d.Kb : d.pointerType;\n var e = Jc(c, this.i, d.i);\n return null === e ? b.call(this) : this.ua ? Oc(d.i.N, {u:d, o:e, L:this, G:a,}) : Oc(d.i.N, {u:d, o:e,});\n};\nnd = m.UnboundTypeError = tc(\"UnboundTypeError\");\nvar Xd = {__syscall_fcntl64:function(a, b, c) {\n lc = c;\n try {\n var d = Tb(a);\n switch(b) {\n case 0:\n var e = mc();\n return 0 > e ? -28 : Vb(d, e).X;\n case 1:\n case 2:\n return 0;\n case 3:\n return d.flags;\n case 4:\n return e = mc(), d.flags |= e, 0;\n case 5:\n return e = mc(), Da[e + 0 >> 1] = 2, 0;\n case 6:\n case 7:\n return 0;\n case 16:\n case 8:\n return -28;\n case 9:\n return L[Vd() >> 2] = 28, -1;\n default:\n return -28;\n }\n } catch (f) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== f.name) {\n throw f;\n }\n return -f.aa;\n }\n}, __syscall_ioctl:function(a, b, c) {\n lc = c;\n try {\n var d = Tb(a);\n switch(b) {\n case 21509:\n return d.s ? 0 : -59;\n case 21505:\n if (!d.s) {\n return -59;\n }\n if (d.s.V.bc) {\n b = [3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,];\n var e = mc();\n L[e >> 2] = 25856;\n L[e + 4 >> 2] = 5;\n L[e + 8 >> 2] = 191;\n L[e + 12 >> 2] = 35387;\n for (var f = 0; 32 > f; f++) {\n C[e + f + 17 >> 0] = b[f] || 0;\n }\n }\n return 0;\n case 21510:\n case 21511:\n case 21512:\n return d.s ? 0 : -59;\n case 21506:\n case 21507:\n case 21508:\n if (!d.s) {\n return -59;\n }\n if (d.s.V.cc) {\n for (e = mc(), b = [], f = 0; 32 > f; f++) {\n b.push(C[e + f + 17 >> 0]);\n }\n }\n return 0;\n case 21519:\n if (!d.s) {\n return -59;\n }\n e = mc();\n return L[e >> 2] = 0;\n case 21520:\n return d.s ? -28 : -59;\n case 21531:\n e = mc();\n if (!d.m.ac) {\n throw new O(59);\n }\n return d.m.ac(d, b, e);\n case 21523:\n if (!d.s) {\n return -59;\n }\n d.s.V.dc && (f = [24, 80], e = mc(), Da[e >> 1] = f[0], Da[e + 2 >> 1] = f[1]);\n return 0;\n case 21524:\n return d.s ? 0 : -59;\n case 21515:\n return d.s ? 0 : -59;\n default:\n return -28;\n }\n } catch (g) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== g.name) {\n throw g;\n }\n return -g.aa;\n }\n}, __syscall_openat:function(a, b, c, d) {\n lc = d;\n try {\n b = b ? nb(E, b) : \"\";\n var e = b;\n if (\"/\" === e.charAt(0)) {\n b = e;\n } else {\n var f = -100 === a ? \"/\" : Tb(a).path;\n if (0 == e.length) {\n throw new O(44);\n }\n b = gb(f + \"/\" + e);\n }\n var g = d ? mc() : 0;\n return ec(b, c, g).X;\n } catch (n) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== n.name) {\n throw n;\n }\n return -n.aa;\n }\n}, _embind_create_inheriting_constructor:function(a, b, c) {\n a = W(a);\n b = Fc(b, \"wrapper\");\n c = rc(c);\n var d = [].slice, e = b.i, f = e.N, g = e.A.N, n = e.A.constructor;\n a = oc(a, function() {\n e.A.qb.forEach(function(l) {\n if (this[l] === g[l]) {\n throw new uc(`Pure virtual function ${l} must be implemented in JavaScript`);\n }\n }.bind(this));\n Object.defineProperty(this, \"__parent\", {value:f});\n this.__construct.apply(this, d.call(arguments));\n });\n f.__construct = function() {\n this === f && V(\"Pass correct 'this' to __construct\");\n var l = n.implement.apply(void 0, [this].concat(d.call(arguments)));\n Gc(l);\n var u = l.g;\n l.notifyOnDestruction();\n u.ia = !0;\n Object.defineProperties(this, {g:{value:u}});\n Pc(this);\n l = u.o;\n l = Ac(e, l);\n zc.hasOwnProperty(l) ? V(`Tried to register registered instance: ${l}`) : zc[l] = this;\n };\n f.__destruct = function() {\n this === f && V(\"Pass correct 'this' to __destruct\");\n Gc(this);\n var l = this.g.o;\n l = Ac(e, l);\n zc.hasOwnProperty(l) ? delete zc[l] : V(`Tried to unregister unregistered instance: ${l}`);\n };\n a.prototype = Object.create(f);\n for (var p in c) {\n a.prototype[p] = c[p];\n }\n return sc(a);\n}, _embind_finalize_value_object:function(a) {\n var b = Qc[a];\n delete Qc[a];\n var c = b.Pa, d = b.W, e = b.eb, f = e.map(g => g.Yb).concat(e.map(g => g.rc));\n Y([a], f, g => {\n var n = {};\n e.forEach((p, l) => {\n var u = g[l], v = p.Wb, x = p.Xb, k = g[l + e.length], t = p.qc, r = p.sc;\n n[p.Sb] = {read:B => u.fromWireType(v(x, B)), write:(B, D) => {\n var w = [];\n t(r, B, k.toWireType(w, D));\n Rc(w);\n }};\n });\n return [{name:b.name, fromWireType:function(p) {\n var l = {}, u;\n for (u in n) {\n l[u] = n[u].read(p);\n }\n d(p);\n return l;\n }, toWireType:function(p, l) {\n for (var u in n) {\n if (!(u in l)) {\n throw new TypeError(`Missing field: \"${u}\"`);\n }\n }\n var v = c();\n for (u in n) {\n n[u].write(v, l[u]);\n }\n null !== p && p.push(d, v);\n return v;\n }, argPackAdvance:8, readValueFromPointer:Sc, K:d,}];\n });\n}, _embind_register_bigint:function() {\n}, _embind_register_bool:function(a, b, c, d, e) {\n var f = Wc(c);\n b = W(b);\n Vc(a, {name:b, fromWireType:function(g) {\n return !!g;\n }, toWireType:function(g, n) {\n return n ? d : e;\n }, argPackAdvance:8, readValueFromPointer:function(g) {\n if (1 === c) {\n var n = C;\n } else if (2 === c) {\n n = Da;\n } else if (4 === c) {\n n = L;\n } else {\n throw new TypeError(\"Unknown boolean type size: \" + b);\n }\n return this.fromWireType(n[g >> f]);\n }, K:null,});\n}, _embind_register_class:function(a, b, c, d, e, f, g, n, p, l, u, v, x) {\n u = W(u);\n f = Z(e, f);\n n && (n = Z(g, n));\n l && (l = Z(p, l));\n x = Z(v, x);\n var k = nc(u);\n ad(k, function() {\n od(`Cannot construct ${u} due to unbound types`, [d]);\n });\n Y([a, b, c], d ? [d] : [], function(t) {\n t = t[0];\n if (d) {\n var r = t.i;\n var B = r.N;\n } else {\n B = Zc.prototype;\n }\n t = oc(k, function() {\n if (Object.getPrototypeOf(this) !== D) {\n throw new qc(\"Use 'new' to construct \" + u);\n }\n if (void 0 === w.$) {\n throw new qc(u + \" has no accessible constructor\");\n }\n var T = w.$[arguments.length];\n if (void 0 === T) {\n throw new qc(`Tried to invoke ctor of ${u} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(w.$).toString()}) parameters instead!`);\n }\n return T.apply(this, arguments);\n });\n var D = Object.create(B, {constructor:{value:t},});\n t.prototype = D;\n var w = new bd(u, t, D, x, r, f, n, l);\n w.A && (void 0 === w.A.oa && (w.A.oa = []), w.A.oa.push(w));\n r = new hd(u, w, !0, !1);\n B = new hd(u + \"*\", w, !1, !1);\n var M = new hd(u + \" const*\", w, !1, !0);\n Kc[a] = {pointerType:B, Kb:M};\n jd(k, t);\n return [r, B, M];\n });\n}, _embind_register_class_class_function:function(a, b, c, d, e, f, g) {\n var n = sd(c, d);\n b = W(b);\n f = Z(e, f);\n Y([], [a], function(p) {\n function l() {\n od(`Cannot call ${u} due to unbound types`, n);\n }\n p = p[0];\n var u = `${p.name}.${b}`;\n b.startsWith(\"@@\") && (b = Symbol[b.substring(2)]);\n var v = p.i.constructor;\n void 0 === v[b] ? (l.ea = c - 1, v[b] = l) : ($c(v, b, u), v[b].B[c - 1] = l);\n Y([], n, function(x) {\n x = pd(u, [x[0], null].concat(x.slice(1)), null, f, g);\n void 0 === v[b].B ? (x.ea = c - 1, v[b] = x) : v[b].B[c - 1] = x;\n if (p.i.oa) {\n for (const k of p.i.oa) {\n k.constructor.hasOwnProperty(b) || (k.constructor[b] = x);\n }\n }\n return [];\n });\n return [];\n });\n}, _embind_register_class_class_property:function(a, b, c, d, e, f, g, n) {\n b = W(b);\n f = Z(e, f);\n Y([], [a], function(p) {\n p = p[0];\n var l = `${p.name}.${b}`, u = {get() {\n od(`Cannot access ${l} due to unbound types`, [c]);\n }, enumerable:!0, configurable:!0};\n u.set = n ? () => {\n od(`Cannot access ${l} due to unbound types`, [c]);\n } : () => {\n V(`${l} is a read-only property`);\n };\n Object.defineProperty(p.i.constructor, b, u);\n Y([], [c], function(v) {\n v = v[0];\n var x = {get() {\n return v.fromWireType(f(d));\n }, enumerable:!0};\n n && (n = Z(g, n), x.set = k => {\n var t = [];\n n(d, v.toWireType(t, k));\n Rc(t);\n });\n Object.defineProperty(p.i.constructor, b, x);\n return [];\n });\n return [];\n });\n}, _embind_register_class_constructor:function(a, b, c, d, e, f) {\n var g = sd(b, c);\n e = Z(d, e);\n Y([], [a], function(n) {\n n = n[0];\n var p = `constructor ${n.name}`;\n void 0 === n.i.$ && (n.i.$ = []);\n if (void 0 !== n.i.$[b - 1]) {\n throw new qc(`Cannot register multiple constructors with identical number of parameters (${b - 1}) for class '${n.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);\n }\n n.i.$[b - 1] = () => {\n od(`Cannot construct ${n.name} due to unbound types`, g);\n };\n Y([], g, function(l) {\n l.splice(1, 0, null);\n n.i.$[b - 1] = pd(p, l, null, e, f);\n return [];\n });\n return [];\n });\n}, _embind_register_class_function:function(a, b, c, d, e, f, g, n) {\n var p = sd(c, d);\n b = W(b);\n f = Z(e, f);\n Y([], [a], function(l) {\n function u() {\n od(`Cannot call ${v} due to unbound types`, p);\n }\n l = l[0];\n var v = `${l.name}.${b}`;\n b.startsWith(\"@@\") && (b = Symbol[b.substring(2)]);\n n && l.i.qb.push(b);\n var x = l.i.N, k = x[b];\n void 0 === k || void 0 === k.B && k.className !== l.name && k.ea === c - 2 ? (u.ea = c - 2, u.className = l.name, x[b] = u) : ($c(x, b, v), x[b].B[c - 2] = u);\n Y([], p, function(t) {\n t = pd(v, t, l, f, g);\n void 0 === x[b].B ? (t.ea = c - 2, x[b] = t) : x[b].B[c - 2] = t;\n return [];\n });\n return [];\n });\n}, _embind_register_class_property:function(a, b, c, d, e, f, g, n, p, l) {\n b = W(b);\n e = Z(d, e);\n Y([], [a], function(u) {\n u = u[0];\n var v = `${u.name}.${b}`, x = {get() {\n od(`Cannot access ${v} due to unbound types`, [c, g]);\n }, enumerable:!0, configurable:!0};\n x.set = p ? () => {\n od(`Cannot access ${v} due to unbound types`, [c, g]);\n } : () => {\n V(v + \" is a read-only property\");\n };\n Object.defineProperty(u.i.N, b, x);\n Y([], p ? [c, g] : [c], function(k) {\n var t = k[0], r = {get() {\n var D = td(this, u, v + \" getter\");\n return t.fromWireType(e(f, D));\n }, enumerable:!0};\n if (p) {\n p = Z(n, p);\n var B = k[1];\n r.set = function(D) {\n var w = td(this, u, v + \" setter\"), M = [];\n p(l, w, B.toWireType(M, D));\n Rc(M);\n };\n }\n Object.defineProperty(u.i.N, b, r);\n return [];\n });\n return [];\n });\n}, _embind_register_emval:function(a, b) {\n b = W(b);\n Vc(a, {name:b, fromWireType:function(c) {\n var d = rc(c);\n ud(c);\n return d;\n }, toWireType:function(c, d) {\n return sc(d);\n }, argPackAdvance:8, readValueFromPointer:Sc, K:null,});\n}, _embind_register_enum:function(a, b, c, d) {\n function e() {\n }\n c = Wc(c);\n b = W(b);\n e.values = {};\n Vc(a, {name:b, constructor:e, fromWireType:function(f) {\n return this.constructor.values[f];\n }, toWireType:function(f, g) {\n return g.value;\n }, argPackAdvance:8, readValueFromPointer:vd(b, c, d), K:null,});\n ad(b, e);\n}, _embind_register_enum_value:function(a, b, c) {\n var d = Fc(a, \"enum\");\n b = W(b);\n a = d.constructor;\n d = Object.create(d.constructor.prototype, {value:{value:c}, constructor:{value:oc(`${d.name}_${b}`, function() {\n })},});\n a.values[c] = d;\n a[b] = d;\n}, _embind_register_float:function(a, b, c) {\n c = Wc(c);\n b = W(b);\n Vc(a, {name:b, fromWireType:function(d) {\n return d;\n }, toWireType:function(d, e) {\n return e;\n }, argPackAdvance:8, readValueFromPointer:wd(b, c), K:null,});\n}, _embind_register_function:function(a, b, c, d, e, f) {\n var g = sd(b, c);\n a = W(a);\n e = Z(d, e);\n ad(a, function() {\n od(`Cannot call ${a} due to unbound types`, g);\n }, b - 1);\n Y([], g, function(n) {\n jd(a, pd(a, [n[0], null].concat(n.slice(1)), null, e, f), b - 1);\n return [];\n });\n}, _embind_register_integer:function(a, b, c, d, e) {\n b = W(b);\n -1 === e && (e = 4294967295);\n e = Wc(c);\n var f = n => n;\n if (0 === d) {\n var g = 32 - 8 * c;\n f = n => n << g >>> g;\n }\n c = b.includes(\"unsigned\") ? function(n, p) {\n return p >>> 0;\n } : function(n, p) {\n return p;\n };\n Vc(a, {name:b, fromWireType:f, toWireType:c, argPackAdvance:8, readValueFromPointer:xd(b, e, 0 !== d), K:null,});\n}, _embind_register_memory_view:function(a, b, c) {\n function d(f) {\n f >>= 2;\n var g = N;\n return new e(g.buffer, g[f + 1], g[f]);\n }\n var e = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array,][b];\n c = W(c);\n Vc(a, {name:c, fromWireType:d, argPackAdvance:8, readValueFromPointer:d,}, {$b:!0,});\n}, _embind_register_std_string:function(a, b) {\n b = W(b);\n var c = \"std::string\" === b;\n Vc(a, {name:b, fromWireType:function(d) {\n var e = N[d >> 2], f = d + 4;\n if (c) {\n for (var g = f, n = 0; n <= e; ++n) {\n var p = f + n;\n if (n == e || 0 == E[p]) {\n g = g ? nb(E, g, p - g) : \"\";\n if (void 0 === l) {\n var l = g;\n } else {\n l += String.fromCharCode(0), l += g;\n }\n g = p + 1;\n }\n }\n } else {\n l = Array(e);\n for (n = 0; n < e; ++n) {\n l[n] = String.fromCharCode(E[f + n]);\n }\n l = l.join(\"\");\n }\n Ec(d);\n return l;\n }, toWireType:function(d, e) {\n e instanceof ArrayBuffer && (e = new Uint8Array(e));\n var f = \"string\" == typeof e;\n f || e instanceof Uint8Array || e instanceof Uint8ClampedArray || e instanceof Int8Array || V(\"Cannot pass non-string to std::string\");\n var g = c && f ? pb(e) : e.length;\n var n = Wd(4 + g + 1), p = n + 4;\n N[n >> 2] = g;\n if (c && f) {\n qb(e, E, p, g + 1);\n } else {\n if (f) {\n for (f = 0; f < g; ++f) {\n var l = e.charCodeAt(f);\n 255 < l && (Ec(p), V(\"String has UTF-16 code units that do not fit in 8 bits\"));\n E[p + f] = l;\n }\n } else {\n for (f = 0; f < g; ++f) {\n E[p + f] = e[f];\n }\n }\n }\n null !== d && d.push(Ec, n);\n return n;\n }, argPackAdvance:8, readValueFromPointer:Sc, K:function(d) {\n Ec(d);\n },});\n}, _embind_register_std_wstring:function(a, b, c) {\n c = W(c);\n if (2 === b) {\n var d = zd;\n var e = Ad;\n var f = Bd;\n var g = () => Ea;\n var n = 1;\n } else {\n 4 === b && (d = Cd, e = Dd, f = Ed, g = () => N, n = 2);\n }\n Vc(a, {name:c, fromWireType:function(p) {\n for (var l = N[p >> 2], u = g(), v, x = p + 4, k = 0; k <= l; ++k) {\n var t = p + 4 + k * b;\n if (k == l || 0 == u[t >> n]) {\n x = d(x, t - x), void 0 === v ? v = x : (v += String.fromCharCode(0), v += x), x = t + b;\n }\n }\n Ec(p);\n return v;\n }, toWireType:function(p, l) {\n \"string\" != typeof l && V(`Cannot pass non-string to C++ string type ${c}`);\n var u = f(l), v = Wd(4 + u + b);\n N[v >> 2] = u >> n;\n e(l, v + 4, u + b);\n null !== p && p.push(Ec, v);\n return v;\n }, argPackAdvance:8, readValueFromPointer:Sc, K:function(p) {\n Ec(p);\n },});\n}, _embind_register_value_object:function(a, b, c, d, e, f) {\n Qc[a] = {name:W(b), Pa:Z(c, d), W:Z(e, f), eb:[],};\n}, _embind_register_value_object_field:function(a, b, c, d, e, f, g, n, p, l) {\n Qc[a].eb.push({Sb:W(b), Yb:c, Wb:Z(d, e), Xb:f, rc:g, qc:Z(n, p), sc:l,});\n}, _embind_register_void:function(a, b) {\n b = W(b);\n Vc(a, {fc:!0, name:b, argPackAdvance:0, fromWireType:function() {\n }, toWireType:function() {\n },});\n}, _emscripten_get_now_is_monotonic:() => !0, _emval_as:function(a, b, c) {\n a = rc(a);\n b = Fc(b, \"emval::as\");\n var d = [], e = sc(d);\n N[c >> 2] = e;\n return b.toWireType(d, a);\n}, _emval_call_method:function(a, b, c, d, e) {\n a = Hd[a];\n b = rc(b);\n c = Gd(c);\n var f = [];\n N[d >> 2] = sc(f);\n return a(b, c, f, e);\n}, _emval_call_void_method:function(a, b, c, d) {\n a = Hd[a];\n b = rc(b);\n c = Gd(c);\n a(b, c, null, d);\n}, _emval_decref:ud, _emval_get_method_caller:function(a, b) {\n var c = Jd(a, b), d = c[0];\n b = d.name + \"_$\" + c.slice(1).map(function(g) {\n return g.name;\n }).join(\"_\") + \"$\";\n var e = Kd[b];\n if (void 0 !== e) {\n return e;\n }\n var f = Array(a - 1);\n e = Id((g, n, p, l) => {\n for (var u = 0, v = 0; v < a - 1; ++v) {\n f[v] = c[v + 1].readValueFromPointer(l + u), u += c[v + 1].argPackAdvance;\n }\n g = g[n].apply(g, f);\n for (v = 0; v < a - 1; ++v) {\n c[v + 1].Nb && c[v + 1].Nb(f[v]);\n }\n if (!d.fc) {\n return d.toWireType(p, g);\n }\n });\n return Kd[b] = e;\n}, _emval_get_module_property:function(a) {\n a = Gd(a);\n return sc(m[a]);\n}, _emval_get_property:function(a, b) {\n a = rc(a);\n b = rc(b);\n return sc(a[b]);\n}, _emval_incref:function(a) {\n 4 < a && (U.get(a).tb += 1);\n}, _emval_new_cstring:function(a) {\n return sc(Gd(a));\n}, _emval_new_object:function() {\n return sc({});\n}, _emval_run_destructors:function(a) {\n var b = rc(a);\n Rc(b);\n ud(a);\n}, _emval_set_property:function(a, b, c) {\n a = rc(a);\n b = rc(b);\n c = rc(c);\n a[b] = c;\n}, _emval_take_value:function(a, b) {\n a = Fc(a, \"_emval_take_value\");\n a = a.readValueFromPointer(b);\n return sc(a);\n}, abort:() => {\n Aa(\"\");\n}, emscripten_asm_const_int:(a, b, c) => {\n Ld.length = 0;\n var d;\n for (c >>= 2; d = E[b++];) {\n c += 105 != d & c, Ld.push(105 == d ? L[c] : Ia[c++ >> 1]), ++c;\n }\n return db[a].apply(null, Ld);\n}, emscripten_date_now:function() {\n return Date.now();\n}, emscripten_get_now:() => performance.now(), emscripten_memcpy_big:(a, b, c) => E.copyWithin(a, b, b + c), emscripten_resize_heap:a => {\n var b = E.length;\n a >>>= 0;\n if (2147483648 < a) {\n return !1;\n }\n for (var c = 1; 4 >= c; c *= 2) {\n var d = b * (1 + 0.2 / c);\n d = Math.min(d, a + 100663296);\n var e = Math;\n d = Math.max(a, d);\n a: {\n e = e.min.call(e, 2147483648, d + (65536 - d % 65536) % 65536) - Ba.buffer.byteLength + 65535 >>> 16;\n try {\n Ba.grow(e);\n Ja();\n var f = 1;\n break a;\n } catch (g) {\n }\n f = void 0;\n }\n if (f) {\n return !0;\n }\n }\n return !1;\n}, environ_get:(a, b) => {\n var c = 0;\n Od().forEach(function(d, e) {\n var f = b + c;\n e = N[a + 4 * e >> 2] = f;\n for (f = 0; f < d.length; ++f) {\n C[e++ >> 0] = d.charCodeAt(f);\n }\n C[e >> 0] = 0;\n c += d.length + 1;\n });\n return 0;\n}, environ_sizes_get:(a, b) => {\n var c = Od();\n N[a >> 2] = c.length;\n var d = 0;\n c.forEach(function(e) {\n d += e.length + 1;\n });\n N[b >> 2] = d;\n return 0;\n}, fd_close:function(a) {\n try {\n var b = Tb(a);\n if (null === b.X) {\n throw new O(8);\n }\n b.Ma && (b.Ma = null);\n try {\n b.m.close && b.m.close(b);\n } catch (c) {\n throw c;\n } finally {\n Gb[b.X] = null;\n }\n b.X = null;\n return 0;\n } catch (c) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== c.name) {\n throw c;\n }\n return c.aa;\n }\n}, fd_read:function(a, b, c, d) {\n try {\n a: {\n var e = Tb(a);\n a = b;\n for (var f, g = b = 0; g < c; g++) {\n var n = N[a >> 2], p = N[a + 4 >> 2];\n a += 8;\n var l = e, u = n, v = p, x = f, k = C;\n if (0 > v || 0 > x) {\n throw new O(28);\n }\n if (null === l.X) {\n throw new O(8);\n }\n if (1 === (l.flags & 2097155)) {\n throw new O(8);\n }\n if (16384 === (l.node.mode & 61440)) {\n throw new O(31);\n }\n if (!l.m.read) {\n throw new O(28);\n }\n var t = \"undefined\" != typeof x;\n if (!t) {\n x = l.position;\n } else if (!l.seekable) {\n throw new O(70);\n }\n var r = l.m.read(l, k, u, v, x);\n t || (l.position += r);\n var B = r;\n if (0 > B) {\n var D = -1;\n break a;\n }\n b += B;\n if (B < p) {\n break;\n }\n \"undefined\" !== typeof f && (f += B);\n }\n D = b;\n }\n N[d >> 2] = D;\n return 0;\n } catch (w) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== w.name) {\n throw w;\n }\n return w.aa;\n }\n}, fd_seek:function(a, b, c, d, e) {\n b = c + 2097152 >>> 0 < 4194305 - !!b ? (b >>> 0) + 4294967296 * c : NaN;\n try {\n if (isNaN(b)) {\n return 61;\n }\n var f = Tb(a);\n fc(f, b, d);\n $a = [f.position >>> 0, (Za = f.position, 1.0 <= +Math.abs(Za) ? 0.0 < Za ? +Math.floor(Za / 4294967296.0) >>> 0 : ~~+Math.ceil((Za - +(~~Za >>> 0)) / 4294967296.0) >>> 0 : 0)];\n L[e >> 2] = $a[0];\n L[e + 4 >> 2] = $a[1];\n f.Ma && 0 === b && 0 === d && (f.Ma = null);\n return 0;\n } catch (g) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== g.name) {\n throw g;\n }\n return g.aa;\n }\n}, fd_write:function(a, b, c, d) {\n try {\n a: {\n var e = Tb(a);\n a = b;\n for (var f, g = b = 0; g < c; g++) {\n var n = N[a >> 2], p = N[a + 4 >> 2];\n a += 8;\n var l = e, u = n, v = p, x = f, k = C;\n if (0 > v || 0 > x) {\n throw new O(28);\n }\n if (null === l.X) {\n throw new O(8);\n }\n if (0 === (l.flags & 2097155)) {\n throw new O(8);\n }\n if (16384 === (l.node.mode & 61440)) {\n throw new O(31);\n }\n if (!l.m.write) {\n throw new O(28);\n }\n l.seekable && l.flags & 1024 && fc(l, 0, 2);\n var t = \"undefined\" != typeof x;\n if (!t) {\n x = l.position;\n } else if (!l.seekable) {\n throw new O(70);\n }\n var r = l.m.write(l, k, u, v, x, void 0);\n t || (l.position += r);\n var B = r;\n if (0 > B) {\n var D = -1;\n break a;\n }\n b += B;\n \"undefined\" !== typeof f && (f += B);\n }\n D = b;\n }\n N[d >> 2] = D;\n return 0;\n } catch (w) {\n if (\"undefined\" == typeof kc || \"ErrnoError\" !== w.name) {\n throw w;\n }\n return w.aa;\n }\n}, strftime_l:(a, b, c, d) => Sd(a, b, c, d)};\n(function() {\n function a(c) {\n z = c = c.exports;\n Ba = z.memory;\n Ja();\n Ka = z.__indirect_function_table;\n Ma.unshift(z.__wasm_call_ctors);\n Pa--;\n m.monitorRunDependencies && m.monitorRunDependencies(Pa);\n if (0 == Pa && (null !== Qa && (clearInterval(Qa), Qa = null), Ra)) {\n var d = Ra;\n Ra = null;\n d();\n }\n return c;\n }\n var b = {env:Xd, wasi_snapshot_preview1:Xd,};\n Pa++;\n m.monitorRunDependencies && m.monitorRunDependencies(Pa);\n if (m.instantiateWasm) {\n try {\n return m.instantiateWasm(b, a);\n } catch (c) {\n xa(\"Module.instantiateWasm callback failed with error: \" + c), ea(c);\n }\n }\n Ya(b, function(c) {\n a(c.instance);\n }).catch(ea);\n return {};\n})();\nvar Ec = a => (Ec = z.free)(a), Wd = a => (Wd = z.malloc)(a), ab = m._ma_device__on_notification_unlocked = a => (ab = m._ma_device__on_notification_unlocked = z.ma_device__on_notification_unlocked)(a);\nm._ma_malloc_emscripten = (a, b) => (m._ma_malloc_emscripten = z.ma_malloc_emscripten)(a, b);\nm._ma_free_emscripten = (a, b) => (m._ma_free_emscripten = z.ma_free_emscripten)(a, b);\nvar bb = m._ma_device_process_pcm_frames_capture__webaudio = (a, b, c) => (bb = m._ma_device_process_pcm_frames_capture__webaudio = z.ma_device_process_pcm_frames_capture__webaudio)(a, b, c), cb = m._ma_device_process_pcm_frames_playback__webaudio = (a, b, c) => (cb = m._ma_device_process_pcm_frames_playback__webaudio = z.ma_device_process_pcm_frames_playback__webaudio)(a, b, c), Vd = () => (Vd = z.__errno_location)(), Dc = a => (Dc = z.__getTypeName)(a);\nm.__embind_initialize_bindings = () => (m.__embind_initialize_bindings = z._embind_initialize_bindings)();\nm.dynCall_iiji = (a, b, c, d, e) => (m.dynCall_iiji = z.dynCall_iiji)(a, b, c, d, e);\nm.dynCall_jiji = (a, b, c, d, e) => (m.dynCall_jiji = z.dynCall_jiji)(a, b, c, d, e);\nm.dynCall_iiiji = (a, b, c, d, e, f) => (m.dynCall_iiiji = z.dynCall_iiiji)(a, b, c, d, e, f);\nm.dynCall_iij = (a, b, c, d) => (m.dynCall_iij = z.dynCall_iij)(a, b, c, d);\nm.dynCall_jii = (a, b, c) => (m.dynCall_jii = z.dynCall_jii)(a, b, c);\nm.dynCall_viijii = (a, b, c, d, e, f, g) => (m.dynCall_viijii = z.dynCall_viijii)(a, b, c, d, e, f, g);\nm.dynCall_iiiiij = (a, b, c, d, e, f, g) => (m.dynCall_iiiiij = z.dynCall_iiiiij)(a, b, c, d, e, f, g);\nm.dynCall_iiiiijj = (a, b, c, d, e, f, g, n, p) => (m.dynCall_iiiiijj = z.dynCall_iiiiijj)(a, b, c, d, e, f, g, n, p);\nm.dynCall_iiiiiijj = (a, b, c, d, e, f, g, n, p, l) => (m.dynCall_iiiiiijj = z.dynCall_iiiiiijj)(a, b, c, d, e, f, g, n, p, l);\nvar Yd;\nRa = function Zd() {\n Yd || $d();\n Yd || (Ra = Zd);\n};\nfunction $d() {\n function a() {\n if (!Yd && (Yd = !0, m.calledRun = !0, !Ca)) {\n m.noFSInit || hc || (hc = !0, gc(), m.stdin = m.stdin, m.stdout = m.stdout, m.stderr = m.stderr, m.stdin ? jc(\"stdin\", m.stdin) : cc(\"/dev/tty\", \"/dev/stdin\"), m.stdout ? jc(\"stdout\", null, m.stdout) : cc(\"/dev/tty\", \"/dev/stdout\"), m.stderr ? jc(\"stderr\", null, m.stderr) : cc(\"/dev/tty1\", \"/dev/stderr\"), ec(\"/dev/stdin\", 0), ec(\"/dev/stdout\", 1), ec(\"/dev/stderr\", 1));\n Jb = !1;\n eb(Ma);\n aa(m);\n if (m.onRuntimeInitialized) {\n m.onRuntimeInitialized();\n }\n if (m.postRun) {\n for (\"function\" == typeof m.postRun && (m.postRun = [m.postRun]); m.postRun.length;) {\n var b = m.postRun.shift();\n Na.unshift(b);\n }\n }\n eb(Na);\n }\n }\n if (!(0 < Pa)) {\n if (m.preRun) {\n for (\"function\" == typeof m.preRun && (m.preRun = [m.preRun]); m.preRun.length;) {\n Oa();\n }\n }\n eb(La);\n 0 < Pa || (m.setStatus ? (m.setStatus(\"Running...\"), setTimeout(function() {\n setTimeout(function() {\n m.setStatus(\"\");\n }, 1);\n a();\n }, 1)) : a());\n }\n}\nif (m.preInit) {\n for (\"function\" == typeof m.preInit && (m.preInit = [m.preInit]); 0 < m.preInit.length;) {\n m.preInit.pop()();\n }\n}\n$d();\n\n\n\n return moduleArg.ready\n}\n\n);\n})();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);\n\n/***/ }),\n/* 2 */\n/***/ ((module) => {\n\nmodule.exports = /*#__PURE__*/JSON.parse('{\"name\":\"@rive-app/canvas\",\"version\":\"2.26.4\",\"description\":\"Rive\\'s canvas based web api.\",\"main\":\"rive.js\",\"homepage\":\"https://rive.app\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/rive-app/rive-wasm/tree/master/js\"},\"keywords\":[\"rive\",\"animation\"],\"author\":\"Rive\",\"contributors\":[\"Luigi Rosso (https://rive.app)\",\"Maxwell Talbot (https://rive.app)\",\"Arthur Vivian (https://rive.app)\",\"Umberto Sonnino (https://rive.app)\",\"Matthew Sullivan (mailto:matt.j.sullivan@gmail.com)\"],\"license\":\"MIT\",\"files\":[\"rive.js\",\"rive.js.map\",\"rive.wasm\",\"rive_fallback.wasm\",\"rive.d.ts\",\"rive_advanced.mjs.d.ts\"],\"typings\":\"rive.d.ts\",\"dependencies\":{},\"browser\":{\"fs\":false,\"path\":false}}');\n\n/***/ }),\n/* 3 */\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Animation: () => (/* reexport safe */ _Animation__WEBPACK_IMPORTED_MODULE_0__.Animation)\n/* harmony export */ });\n/* harmony import */ var _Animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);\n\n\n\n/***/ }),\n/* 4 */\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Animation: () => (/* binding */ Animation)\n/* harmony export */ });\n/**\n * Represents an animation that can be played on an Artboard.\n * Wraps animations and instances from the runtime and keeps track of playback state.\n *\n * The `Animation` class manages the state and behavior of a single animation instance,\n * including its current time, loop count, and ability to scrub to a specific time.\n *\n * The class provides methods to advance the animation, apply its interpolated keyframe\n * values to the Artboard, and clean up the underlying animation instance when the\n * animation is no longer needed.\n */\nvar Animation = /** @class */ (function () {\n /**\n * Constructs a new animation\n * @constructor\n * @param {any} animation: runtime animation object\n * @param {any} instance: runtime animation instance object\n */\n function Animation(animation, artboard, runtime, playing) {\n this.animation = animation;\n this.artboard = artboard;\n this.playing = playing;\n this.loopCount = 0;\n /**\n * The time to which the animation should move to on the next render.\n * If not null, the animation will scrub to this time instead of advancing by the given time.\n */\n this.scrubTo = null;\n this.instance = new runtime.LinearAnimationInstance(animation, artboard);\n }\n Object.defineProperty(Animation.prototype, \"name\", {\n /**\n * Returns the animation's name\n */\n get: function () {\n return this.animation.name;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Animation.prototype, \"time\", {\n /**\n * Returns the animation's name\n */\n get: function () {\n return this.instance.time;\n },\n /**\n * Sets the animation's current time\n */\n set: function (value) {\n this.instance.time = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Animation.prototype, \"loopValue\", {\n /**\n * Returns the animation's loop type\n */\n get: function () {\n return this.animation.loopValue;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Animation.prototype, \"needsScrub\", {\n /**\n * Indicates whether the animation needs to be scrubbed.\n * @returns `true` if the animation needs to be scrubbed, `false` otherwise.\n */\n get: function () {\n return this.scrubTo !== null;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Advances the animation by the give time. If the animation needs scrubbing,\n * time is ignored and the stored scrub value is used.\n * @param time the time to advance the animation by if no scrubbing required\n */\n Animation.prototype.advance = function (time) {\n if (this.scrubTo === null) {\n this.instance.advance(time);\n }\n else {\n this.instance.time = 0;\n this.instance.advance(this.scrubTo);\n this.scrubTo = null;\n }\n };\n /**\n * Apply interpolated keyframe values to the artboard. This should be called after calling\n * .advance() on an animation instance so that new values are applied to properties.\n *\n * Note: This does not advance the artboard, which updates all objects on the artboard\n * @param mix - Mix value for the animation from 0 to 1\n */\n Animation.prototype.apply = function (mix) {\n this.instance.apply(mix);\n };\n /**\n * Deletes the backing Wasm animation instance; once this is called, this\n * animation is no more.\n */\n Animation.prototype.cleanup = function () {\n this.instance.delete();\n };\n return Animation;\n}());\n\n\n\n/***/ }),\n/* 5 */\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BLANK_URL: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.BLANK_URL),\n/* harmony export */ registerTouchInteractions: () => (/* reexport safe */ _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__.registerTouchInteractions),\n/* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)\n/* harmony export */ });\n/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);\n/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);\n\n\n\n\n/***/ }),\n/* 6 */\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ registerTouchInteractions: () => (/* binding */ registerTouchInteractions)\n/* harmony export */ });\nvar _this = undefined;\n/**\n * Returns the clientX and clientY properties from touch or mouse events. Also\n * calls preventDefault() on the event if it is a touchstart or touchmove to prevent\n * scrolling the page on mobile devices\n * @param event - Either a TouchEvent or a MouseEvent\n * @returns - Coordinates of the clientX and clientY properties from the touch/mouse event\n */\nvar getClientCoordinates = function (event, isTouchScrollEnabled) {\n var _a, _b;\n if ([\"touchstart\", \"touchmove\"].indexOf(event.type) > -1 &&\n ((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length)) {\n // This flag, if false, prevents touch events on the canvas default behavior\n // which may prevent scrolling if a drag motion on the canvas is performed\n if (!isTouchScrollEnabled) {\n event.preventDefault();\n }\n return {\n clientX: event.touches[0].clientX,\n clientY: event.touches[0].clientY,\n };\n }\n else if (event.type === \"touchend\" &&\n ((_b = event.changedTouches) === null || _b === void 0 ? void 0 : _b.length)) {\n return {\n clientX: event.changedTouches[0].clientX,\n clientY: event.changedTouches[0].clientY,\n };\n }\n else {\n return {\n clientX: event.clientX,\n clientY: event.clientY,\n };\n }\n};\n/**\n * Registers mouse move/up/down callback handlers on the canvas to send meaningful coordinates to\n * the state machine pointer move/up/down functions based on cursor interaction\n */\nvar registerTouchInteractions = function (_a) {\n var canvas = _a.canvas, artboard = _a.artboard, _b = _a.stateMachines, stateMachines = _b === void 0 ? [] : _b, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment, _c = _a.isTouchScrollEnabled, isTouchScrollEnabled = _c === void 0 ? false : _c, _d = _a.layoutScaleFactor, layoutScaleFactor = _d === void 0 ? 1.0 : _d;\n if (!canvas ||\n !stateMachines.length ||\n !renderer ||\n !rive ||\n !artboard ||\n typeof window === \"undefined\") {\n return null;\n }\n /**\n * After a touchend event, some browsers may fire synthetic mouse events\n * (mouseover, mousedown, mousemove, mouseup) if the touch interaction did not cause\n * any default action (such as scrolling).\n *\n * This is done to simulate the behavior of a mouse for applications that do not support\n * touch events.\n *\n * We're keeping track of the previous event to not send the synthetic mouse events if the\n * touch event was a click (touchstart -> touchend).\n *\n * This is only needed when `isTouchScrollEnabled` is false\n * When true, `preventDefault()` is called which prevents this behaviour.\n **/\n var _prevEventType = null;\n var _syntheticEventsActive = false;\n var processEventCallback = function (event) {\n // Exit early out of all synthetic mouse events\n // https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers\n // https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma\n if (_syntheticEventsActive && event instanceof MouseEvent) {\n // Synthetic event finished\n if (event.type == \"mouseup\") {\n _syntheticEventsActive = false;\n }\n return;\n }\n // Test if it's a \"touch click\". This could cause the browser to send\n // synthetic mouse events.\n _syntheticEventsActive =\n isTouchScrollEnabled &&\n event.type === \"touchend\" &&\n _prevEventType === \"touchstart\";\n _prevEventType = event.type;\n var boundingRect = event.currentTarget.getBoundingClientRect();\n var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;\n if (!clientX && !clientY) {\n return;\n }\n var canvasX = clientX - boundingRect.left;\n var canvasY = clientY - boundingRect.top;\n var forwardMatrix = rive.computeAlignment(fit, alignment, {\n minX: 0,\n minY: 0,\n maxX: boundingRect.width,\n maxY: boundingRect.height,\n }, artboard.bounds, layoutScaleFactor);\n var invertedMatrix = new rive.Mat2D();\n forwardMatrix.invert(invertedMatrix);\n var canvasCoordinatesVector = new rive.Vec2D(canvasX, canvasY);\n var transformedVector = rive.mapXY(invertedMatrix, canvasCoordinatesVector);\n var transformedX = transformedVector.x();\n var transformedY = transformedVector.y();\n transformedVector.delete();\n invertedMatrix.delete();\n canvasCoordinatesVector.delete();\n forwardMatrix.delete();\n switch (event.type) {\n /**\n * There's a 2px buffer for a hitRadius when translating the pointer coordinates\n * down to the state machine. In cases where the hitbox is about that much away\n * from the Artboard border, we don't have exact precision on determining pointer\n * exit. We're therefore adding to the translated coordinates on mouseout of a canvas\n * to ensure that we report the mouse has truly exited the hitarea.\n * https://github.com/rive-app/rive-cpp/blob/master/src/animation/state_machine_instance.cpp#L336\n *\n * We add/subtract 10000 to account for when the graphic goes beyond the canvas bound\n * due to for example, a fit: 'cover'. Not perfect, but helps reliably (for now) ensure\n * we report going out of bounds when the mouse is out of the canvas\n */\n case \"mouseout\":\n for (var _i = 0, stateMachines_1 = stateMachines; _i < stateMachines_1.length; _i++) {\n var stateMachine = stateMachines_1[_i];\n stateMachine.pointerMove(transformedX, transformedY);\n }\n break;\n // Pointer moving/hovering on the canvas\n case \"touchmove\":\n case \"mouseover\":\n case \"mousemove\": {\n for (var _b = 0, stateMachines_2 = stateMachines; _b < stateMachines_2.length; _b++) {\n var stateMachine = stateMachines_2[_b];\n stateMachine.pointerMove(transformedX, transformedY);\n }\n break;\n }\n // Pointer click initiated but not released yet on the canvas\n case \"touchstart\":\n case \"mousedown\": {\n for (var _c = 0, stateMachines_3 = stateMachines; _c < stateMachines_3.length; _c++) {\n var stateMachine = stateMachines_3[_c];\n stateMachine.pointerDown(transformedX, transformedY);\n }\n break;\n }\n // Pointer click released on the canvas\n case \"touchend\":\n case \"mouseup\": {\n for (var _d = 0, stateMachines_4 = stateMachines; _d < stateMachines_4.length; _d++) {\n var stateMachine = stateMachines_4[_d];\n stateMachine.pointerUp(transformedX, transformedY);\n }\n break;\n }\n default:\n }\n };\n var callback = processEventCallback.bind(_this);\n canvas.addEventListener(\"mouseover\", callback);\n canvas.addEventListener(\"mouseout\", callback);\n canvas.addEventListener(\"mousemove\", callback);\n canvas.addEventListener(\"mousedown\", callback);\n canvas.addEventListener(\"mouseup\", callback);\n canvas.addEventListener(\"touchmove\", callback, {\n passive: isTouchScrollEnabled,\n });\n canvas.addEventListener(\"touchstart\", callback, {\n passive: isTouchScrollEnabled,\n });\n canvas.addEventListener(\"touchend\", callback);\n return function () {\n canvas.removeEventListener(\"mouseover\", callback);\n canvas.removeEventListener(\"mouseout\", callback);\n canvas.removeEventListener(\"mousemove\", callback);\n canvas.removeEventListener(\"mousedown\", callback);\n canvas.removeEventListener(\"mouseup\", callback);\n canvas.removeEventListener(\"touchmove\", callback);\n canvas.removeEventListener(\"touchstart\", callback);\n canvas.removeEventListener(\"touchend\", callback);\n };\n};\n\n\n/***/ }),\n/* 7 */\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BLANK_URL: () => (/* binding */ BLANK_URL),\n/* harmony export */ sanitizeUrl: () => (/* binding */ sanitizeUrl)\n/* harmony export */ });\n// Reference: https://github.com/braintree/sanitize-url/tree/main\nvar invalidProtocolRegex = /^([^\\w]*)(javascript|data|vbscript)/im;\nvar htmlEntitiesRegex = /&#(\\w+)(^\\w|;)?/g;\nvar htmlCtrlEntityRegex = /&(newline|tab);/gi;\nvar ctrlCharactersRegex = /[\\u0000-\\u001F\\u007F-\\u009F\\u2000-\\u200D\\uFEFF]/gim;\nvar urlSchemeRegex = /^.+(:|:)/gim;\nvar relativeFirstCharacters = [\".\", \"/\"];\nvar BLANK_URL = \"about:blank\";\nfunction isRelativeUrlWithoutProtocol(url) {\n return relativeFirstCharacters.indexOf(url[0]) > -1;\n}\n// adapted from https://stackoverflow.com/a/29824550/2601552\nfunction decodeHtmlCharacters(str) {\n var removedNullByte = str.replace(ctrlCharactersRegex, \"\");\n return removedNullByte.replace(htmlEntitiesRegex, function (match, dec) {\n return String.fromCharCode(dec);\n });\n}\nfunction sanitizeUrl(url) {\n if (!url) {\n return BLANK_URL;\n }\n var sanitizedUrl = decodeHtmlCharacters(url)\n .replace(htmlCtrlEntityRegex, \"\")\n .replace(ctrlCharactersRegex, \"\")\n .trim();\n if (!sanitizedUrl) {\n return BLANK_URL;\n }\n if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {\n return sanitizedUrl;\n }\n var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);\n if (!urlSchemeParseResults) {\n return sanitizedUrl;\n }\n var urlScheme = urlSchemeParseResults[0];\n if (invalidProtocolRegex.test(urlScheme)) {\n return BLANK_URL;\n }\n return sanitizedUrl;\n}\n\n\n/***/ })\n/******/ \t]);\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.\n(() => {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Alignment: () => (/* binding */ Alignment),\n/* harmony export */ EventType: () => (/* binding */ EventType),\n/* harmony export */ Fit: () => (/* binding */ Fit),\n/* harmony export */ Layout: () => (/* binding */ Layout),\n/* harmony export */ LoopType: () => (/* binding */ LoopType),\n/* harmony export */ Rive: () => (/* binding */ Rive),\n/* harmony export */ RiveEventType: () => (/* binding */ RiveEventType),\n/* harmony export */ RiveFile: () => (/* binding */ RiveFile),\n/* harmony export */ RuntimeLoader: () => (/* binding */ RuntimeLoader),\n/* harmony export */ StateMachineInput: () => (/* binding */ StateMachineInput),\n/* harmony export */ StateMachineInputType: () => (/* binding */ StateMachineInputType),\n/* harmony export */ Testing: () => (/* binding */ Testing),\n/* harmony export */ decodeAudio: () => (/* binding */ decodeAudio),\n/* harmony export */ decodeFont: () => (/* binding */ decodeFont),\n/* harmony export */ decodeImage: () => (/* binding */ decodeImage)\n/* harmony export */ });\n/* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);\n/* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n\n\nvar RiveError = /** @class */ (function (_super) {\n __extends(RiveError, _super);\n function RiveError() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.isHandledError = true;\n return _this;\n }\n return RiveError;\n}(Error));\n// #regions helpers\nvar resolveErrorMessage = function (error) {\n return error && error.isHandledError\n ? error.message\n : \"Problem loading file; may be corrupt!\";\n};\n// #region layout\n// Fit options for the canvas\nvar Fit;\n(function (Fit) {\n Fit[\"Cover\"] = \"cover\";\n Fit[\"Contain\"] = \"contain\";\n Fit[\"Fill\"] = \"fill\";\n Fit[\"FitWidth\"] = \"fitWidth\";\n Fit[\"FitHeight\"] = \"fitHeight\";\n Fit[\"None\"] = \"none\";\n Fit[\"ScaleDown\"] = \"scaleDown\";\n Fit[\"Layout\"] = \"layout\";\n})(Fit || (Fit = {}));\n// Alignment options for the canvas\nvar Alignment;\n(function (Alignment) {\n Alignment[\"Center\"] = \"center\";\n Alignment[\"TopLeft\"] = \"topLeft\";\n Alignment[\"TopCenter\"] = \"topCenter\";\n Alignment[\"TopRight\"] = \"topRight\";\n Alignment[\"CenterLeft\"] = \"centerLeft\";\n Alignment[\"CenterRight\"] = \"centerRight\";\n Alignment[\"BottomLeft\"] = \"bottomLeft\";\n Alignment[\"BottomCenter\"] = \"bottomCenter\";\n Alignment[\"BottomRight\"] = \"bottomRight\";\n})(Alignment || (Alignment = {}));\n// Alignment options for Rive animations in a HTML canvas\nvar Layout = /** @class */ (function () {\n function Layout(params) {\n var _a, _b, _c, _d, _e, _f, _g;\n this.fit = (_a = params === null || params === void 0 ? void 0 : params.fit) !== null && _a !== void 0 ? _a : Fit.Contain;\n this.alignment = (_b = params === null || params === void 0 ? void 0 : params.alignment) !== null && _b !== void 0 ? _b : Alignment.Center;\n this.layoutScaleFactor = (_c = params === null || params === void 0 ? void 0 : params.layoutScaleFactor) !== null && _c !== void 0 ? _c : 1;\n this.minX = (_d = params === null || params === void 0 ? void 0 : params.minX) !== null && _d !== void 0 ? _d : 0;\n this.minY = (_e = params === null || params === void 0 ? void 0 : params.minY) !== null && _e !== void 0 ? _e : 0;\n this.maxX = (_f = params === null || params === void 0 ? void 0 : params.maxX) !== null && _f !== void 0 ? _f : 0;\n this.maxY = (_g = params === null || params === void 0 ? void 0 : params.maxY) !== null && _g !== void 0 ? _g : 0;\n }\n // Alternative constructor to build a Layout from an interface/object\n Layout.new = function (_a) {\n var fit = _a.fit, alignment = _a.alignment, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY;\n console.warn(\"This function is deprecated: please use `new Layout({})` instead\");\n return new Layout({ fit: fit, alignment: alignment, minX: minX, minY: minY, maxX: maxX, maxY: maxY });\n };\n /**\n * Makes a copy of the layout, replacing any specified parameters\n */\n Layout.prototype.copyWith = function (_a) {\n var fit = _a.fit, alignment = _a.alignment, layoutScaleFactor = _a.layoutScaleFactor, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY;\n return new Layout({\n fit: fit !== null && fit !== void 0 ? fit : this.fit,\n alignment: alignment !== null && alignment !== void 0 ? alignment : this.alignment,\n layoutScaleFactor: layoutScaleFactor !== null && layoutScaleFactor !== void 0 ? layoutScaleFactor : this.layoutScaleFactor,\n minX: minX !== null && minX !== void 0 ? minX : this.minX,\n minY: minY !== null && minY !== void 0 ? minY : this.minY,\n maxX: maxX !== null && maxX !== void 0 ? maxX : this.maxX,\n maxY: maxY !== null && maxY !== void 0 ? maxY : this.maxY,\n });\n };\n // Returns fit for the Wasm runtime format\n Layout.prototype.runtimeFit = function (rive) {\n if (this.cachedRuntimeFit)\n return this.cachedRuntimeFit;\n var fit;\n if (this.fit === Fit.Cover)\n fit = rive.Fit.cover;\n else if (this.fit === Fit.Contain)\n fit = rive.Fit.contain;\n else if (this.fit === Fit.Fill)\n fit = rive.Fit.fill;\n else if (this.fit === Fit.FitWidth)\n fit = rive.Fit.fitWidth;\n else if (this.fit === Fit.FitHeight)\n fit = rive.Fit.fitHeight;\n else if (this.fit === Fit.ScaleDown)\n fit = rive.Fit.scaleDown;\n else if (this.fit === Fit.Layout)\n fit = rive.Fit.layout;\n else\n fit = rive.Fit.none;\n this.cachedRuntimeFit = fit;\n return fit;\n };\n // Returns alignment for the Wasm runtime format\n Layout.prototype.runtimeAlignment = function (rive) {\n if (this.cachedRuntimeAlignment)\n return this.cachedRuntimeAlignment;\n var alignment;\n if (this.alignment === Alignment.TopLeft)\n alignment = rive.Alignment.topLeft;\n else if (this.alignment === Alignment.TopCenter)\n alignment = rive.Alignment.topCenter;\n else if (this.alignment === Alignment.TopRight)\n alignment = rive.Alignment.topRight;\n else if (this.alignment === Alignment.CenterLeft)\n alignment = rive.Alignment.centerLeft;\n else if (this.alignment === Alignment.CenterRight)\n alignment = rive.Alignment.centerRight;\n else if (this.alignment === Alignment.BottomLeft)\n alignment = rive.Alignment.bottomLeft;\n else if (this.alignment === Alignment.BottomCenter)\n alignment = rive.Alignment.bottomCenter;\n else if (this.alignment === Alignment.BottomRight)\n alignment = rive.Alignment.bottomRight;\n else\n alignment = rive.Alignment.center;\n this.cachedRuntimeAlignment = alignment;\n return alignment;\n };\n return Layout;\n}());\n\n// Runtime singleton; use getInstance to provide a callback that returns the\n// Rive runtime\nvar RuntimeLoader = /** @class */ (function () {\n // Class is never instantiated\n function RuntimeLoader() {\n }\n // Loads the runtime\n RuntimeLoader.loadRuntime = function () {\n _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n // Loads Wasm bundle\n locateFile: function () { return RuntimeLoader.wasmURL; },\n })\n .then(function (rive) {\n var _a;\n RuntimeLoader.runtime = rive;\n // Fire all the callbacks\n while (RuntimeLoader.callBackQueue.length > 0) {\n (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);\n }\n })\n .catch(function (error) {\n // Capture specific error details\n var errorDetails = {\n message: (error === null || error === void 0 ? void 0 : error.message) || \"Unknown error\",\n type: (error === null || error === void 0 ? void 0 : error.name) || \"Error\",\n // Some browsers may provide additional WebAssembly-specific details\n wasmError: error instanceof WebAssembly.CompileError ||\n error instanceof WebAssembly.RuntimeError,\n originalError: error,\n };\n // Log detailed error for debugging\n console.debug(\"Rive WASM load error details:\", errorDetails);\n // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.\n // This `rive_fallback.wasm` is compiled to support older architecture.\n // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.\n var backupJsdelivrUrl = \"https://cdn.jsdelivr.net/npm/\".concat(package_json__WEBPACK_IMPORTED_MODULE_1__.name, \"@\").concat(package_json__WEBPACK_IMPORTED_MODULE_1__.version, \"/rive_fallback.wasm\");\n if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {\n console.warn(\"Failed to load WASM from \".concat(RuntimeLoader.wasmURL, \" (\").concat(errorDetails.message, \"), trying jsdelivr as a backup\"));\n RuntimeLoader.setWasmUrl(backupJsdelivrUrl);\n RuntimeLoader.loadRuntime();\n }\n else {\n var errorMessage = [\n \"Could not load Rive WASM file from \".concat(RuntimeLoader.wasmURL, \" or \").concat(backupJsdelivrUrl, \".\"),\n \"Possible reasons:\",\n \"- Network connection is down\",\n \"- WebAssembly is not supported in this environment\",\n \"- The WASM file is corrupted or incompatible\",\n \"\\nError details:\",\n \"- Type: \".concat(errorDetails.type),\n \"- Message: \".concat(errorDetails.message),\n \"- WebAssembly-specific error: \".concat(errorDetails.wasmError),\n \"\\nTo resolve, you may need to:\",\n \"1. Check your network connection\",\n \"2. Set a new WASM source via RuntimeLoader.setWasmUrl()\",\n \"3. Call RuntimeLoader.loadRuntime() again\",\n ].join(\"\\n\");\n console.error(errorMessage);\n }\n });\n };\n // Provides a runtime instance via a callback\n RuntimeLoader.getInstance = function (callback) {\n // If it's not loading, start loading runtime\n if (!RuntimeLoader.isLoading) {\n RuntimeLoader.isLoading = true;\n RuntimeLoader.loadRuntime();\n }\n if (!RuntimeLoader.runtime) {\n RuntimeLoader.callBackQueue.push(callback);\n }\n else {\n callback(RuntimeLoader.runtime);\n }\n };\n // Provides a runtime instance via a promise\n RuntimeLoader.awaitInstance = function () {\n return new Promise(function (resolve) {\n return RuntimeLoader.getInstance(function (rive) { return resolve(rive); });\n });\n };\n // Manually sets the wasm url\n RuntimeLoader.setWasmUrl = function (url) {\n RuntimeLoader.wasmURL = url;\n };\n // Gets the current wasm url\n RuntimeLoader.getWasmUrl = function () {\n return RuntimeLoader.wasmURL;\n };\n // Flag to indicate that loading has started/completed\n RuntimeLoader.isLoading = false;\n // List of callbacks for the runtime that come in while loading\n RuntimeLoader.callBackQueue = [];\n // Path to the Wasm file; default path works for testing only;\n // if embedded wasm is used then this is never used.\n RuntimeLoader.wasmURL = \"https://unpkg.com/\".concat(package_json__WEBPACK_IMPORTED_MODULE_1__.name, \"@\").concat(package_json__WEBPACK_IMPORTED_MODULE_1__.version, \"/rive.wasm\");\n return RuntimeLoader;\n}());\n\n// #endregion\n// #region state machines\nvar StateMachineInputType;\n(function (StateMachineInputType) {\n StateMachineInputType[StateMachineInputType[\"Number\"] = 56] = \"Number\";\n StateMachineInputType[StateMachineInputType[\"Trigger\"] = 58] = \"Trigger\";\n StateMachineInputType[StateMachineInputType[\"Boolean\"] = 59] = \"Boolean\";\n})(StateMachineInputType || (StateMachineInputType = {}));\n/**\n * An input for a state machine\n */\nvar StateMachineInput = /** @class */ (function () {\n function StateMachineInput(type, runtimeInput) {\n this.type = type;\n this.runtimeInput = runtimeInput;\n }\n Object.defineProperty(StateMachineInput.prototype, \"name\", {\n /**\n * Returns the name of the input\n */\n get: function () {\n return this.runtimeInput.name;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateMachineInput.prototype, \"value\", {\n /**\n * Returns the current value of the input\n */\n get: function () {\n return this.runtimeInput.value;\n },\n /**\n * Sets the value of the input\n */\n set: function (value) {\n this.runtimeInput.value = value;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Fires a trigger; does nothing on Number or Boolean input types\n */\n StateMachineInput.prototype.fire = function () {\n if (this.type === StateMachineInputType.Trigger) {\n this.runtimeInput.fire();\n }\n };\n /**\n * Deletes the input\n */\n StateMachineInput.prototype.delete = function () {\n this.runtimeInput = null;\n };\n return StateMachineInput;\n}());\n\nvar RiveEventType;\n(function (RiveEventType) {\n RiveEventType[RiveEventType[\"General\"] = 128] = \"General\";\n RiveEventType[RiveEventType[\"OpenUrl\"] = 131] = \"OpenUrl\";\n})(RiveEventType || (RiveEventType = {}));\nvar StateMachine = /** @class */ (function () {\n /**\n * @constructor\n * @param stateMachine runtime state machine object\n * @param instance runtime state machine instance object\n */\n function StateMachine(stateMachine, runtime, playing, artboard) {\n this.stateMachine = stateMachine;\n this.playing = playing;\n this.artboard = artboard;\n /**\n * Caches the inputs from the runtime\n */\n this.inputs = [];\n this.instance = new runtime.StateMachineInstance(stateMachine, artboard);\n this.initInputs(runtime);\n }\n Object.defineProperty(StateMachine.prototype, \"name\", {\n get: function () {\n return this.stateMachine.name;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateMachine.prototype, \"statesChanged\", {\n /**\n * Returns a list of state names that have changed on this frame\n */\n get: function () {\n var names = [];\n for (var i = 0; i < this.instance.stateChangedCount(); i++) {\n names.push(this.instance.stateChangedNameByIndex(i));\n }\n return names;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Advances the state machine instance by a given time.\n * @param time - the time to advance the animation by in seconds\n */\n StateMachine.prototype.advance = function (time) {\n this.instance.advance(time);\n };\n /**\n * Advances the state machine instance by a given time and apply changes to artboard.\n * @param time - the time to advance the animation by in seconds\n */\n StateMachine.prototype.advanceAndApply = function (time) {\n this.instance.advanceAndApply(time);\n };\n /**\n * Returns the number of events reported from the last advance call\n * @returns Number of events reported\n */\n StateMachine.prototype.reportedEventCount = function () {\n return this.instance.reportedEventCount();\n };\n /**\n * Returns a RiveEvent object emitted from the last advance call at the given index\n * of a list of potentially multiple events. If an event at the index is not found,\n * undefined is returned.\n * @param i index of the event reported in a list of potentially multiple events\n * @returns RiveEvent or extended RiveEvent object returned, or undefined\n */\n StateMachine.prototype.reportedEventAt = function (i) {\n return this.instance.reportedEventAt(i);\n };\n /**\n * Fetches references to the state machine's inputs and caches them\n * @param runtime an instance of the runtime; needed for the SMIInput types\n */\n StateMachine.prototype.initInputs = function (runtime) {\n // Fetch the inputs from the runtime if we don't have them\n for (var i = 0; i < this.instance.inputCount(); i++) {\n var input = this.instance.input(i);\n this.inputs.push(this.mapRuntimeInput(input, runtime));\n }\n };\n /**\n * Maps a runtime input to it's appropriate type\n * @param input\n */\n StateMachine.prototype.mapRuntimeInput = function (input, runtime) {\n if (input.type === runtime.SMIInput.bool) {\n return new StateMachineInput(StateMachineInputType.Boolean, input.asBool());\n }\n else if (input.type === runtime.SMIInput.number) {\n return new StateMachineInput(StateMachineInputType.Number, input.asNumber());\n }\n else if (input.type === runtime.SMIInput.trigger) {\n return new StateMachineInput(StateMachineInputType.Trigger, input.asTrigger());\n }\n };\n /**\n * Deletes the backing Wasm state machine instance; once this is called, this\n * state machine is no more.\n */\n StateMachine.prototype.cleanup = function () {\n this.inputs.forEach(function (input) {\n input.delete();\n });\n this.inputs.length = 0;\n this.instance.delete();\n };\n return StateMachine;\n}());\n// #endregion\n// #region animator\n/**\n * Manages animation\n */\nvar Animator = /** @class */ (function () {\n /**\n * Constructs a new animator\n * @constructor\n * @param runtime Rive runtime; needed to instance animations & state machines\n * @param artboard the artboard that holds all animations and state machines\n * @param animations optional list of animations\n * @param stateMachines optional list of state machines\n */\n function Animator(runtime, artboard, eventManager, animations, stateMachines) {\n if (animations === void 0) { animations = []; }\n if (stateMachines === void 0) { stateMachines = []; }\n this.runtime = runtime;\n this.artboard = artboard;\n this.eventManager = eventManager;\n this.animations = animations;\n this.stateMachines = stateMachines;\n }\n /**\n * Adds animations and state machines by their names. If names are shared\n * between animations & state machines, then the first one found will be\n * created. Best not to use the same names for these in your Rive file.\n * @param animatable the name(s) of animations and state machines to add\n * @returns a list of names of the playing animations and state machines\n */\n Animator.prototype.add = function (animatables, playing, fireEvent) {\n if (fireEvent === void 0) { fireEvent = true; }\n animatables = mapToStringArray(animatables);\n // If animatables is empty, play or pause everything\n if (animatables.length === 0) {\n this.animations.forEach(function (a) { return (a.playing = playing); });\n this.stateMachines.forEach(function (m) { return (m.playing = playing); });\n }\n else {\n // Play/pause already instanced items, or create new instances\n var instancedAnimationNames = this.animations.map(function (a) { return a.name; });\n var instancedMachineNames = this.stateMachines.map(function (m) { return m.name; });\n for (var i = 0; i < animatables.length; i++) {\n var aIndex = instancedAnimationNames.indexOf(animatables[i]);\n var mIndex = instancedMachineNames.indexOf(animatables[i]);\n if (aIndex >= 0 || mIndex >= 0) {\n if (aIndex >= 0) {\n // Animation is instanced, play/pause it\n this.animations[aIndex].playing = playing;\n }\n else {\n // State machine is instanced, play/pause it\n this.stateMachines[mIndex].playing = playing;\n }\n }\n else {\n // Try to create a new animation instance\n var anim = this.artboard.animationByName(animatables[i]);\n if (anim) {\n var newAnimation = new _animation__WEBPACK_IMPORTED_MODULE_2__.Animation(anim, this.artboard, this.runtime, playing);\n // Display the first frame of the specified animation\n newAnimation.advance(0);\n newAnimation.apply(1.0);\n this.animations.push(newAnimation);\n }\n else {\n // Try to create a new state machine instance\n var sm = this.artboard.stateMachineByName(animatables[i]);\n if (sm) {\n var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);\n this.stateMachines.push(newStateMachine);\n }\n }\n }\n }\n }\n // Fire play/paused events for animations\n if (fireEvent) {\n if (playing) {\n this.eventManager.fire({\n type: EventType.Play,\n data: this.playing,\n });\n }\n else {\n this.eventManager.fire({\n type: EventType.Pause,\n data: this.paused,\n });\n }\n }\n return playing ? this.playing : this.paused;\n };\n /**\n * Adds linear animations by their names.\n * @param animatables the name(s) of animations to add\n * @param playing whether animations should play on instantiation\n */\n Animator.prototype.initLinearAnimations = function (animatables, playing) {\n // Play/pause already instanced items, or create new instances\n // This validation is kept to maintain compatibility with current behavior.\n // But given that it this is called during artboard initialization\n // it should probably be safe to remove.\n var instancedAnimationNames = this.animations.map(function (a) { return a.name; });\n for (var i = 0; i < animatables.length; i++) {\n var aIndex = instancedAnimationNames.indexOf(animatables[i]);\n if (aIndex >= 0) {\n this.animations[aIndex].playing = playing;\n }\n else {\n // Try to create a new animation instance\n var anim = this.artboard.animationByName(animatables[i]);\n if (anim) {\n var newAnimation = new _animation__WEBPACK_IMPORTED_MODULE_2__.Animation(anim, this.artboard, this.runtime, playing);\n // Display the first frame of the specified animation\n newAnimation.advance(0);\n newAnimation.apply(1.0);\n this.animations.push(newAnimation);\n }\n }\n }\n };\n /**\n * Adds state machines by their names.\n * @param animatables the name(s) of state machines to add\n * @param playing whether state machines should play on instantiation\n */\n Animator.prototype.initStateMachines = function (animatables, playing) {\n // Play/pause already instanced items, or create new instances\n // This validation is kept to maintain compatibility with current behavior.\n // But given that it this is called during artboard initialization\n // it should probably be safe to remove.\n var instancedStateMachineNames = this.stateMachines.map(function (a) { return a.name; });\n for (var i = 0; i < animatables.length; i++) {\n var aIndex = instancedStateMachineNames.indexOf(animatables[i]);\n if (aIndex >= 0) {\n this.stateMachines[aIndex].playing = playing;\n }\n else {\n // Try to create a new state machine instance\n var sm = this.artboard.stateMachineByName(animatables[i]);\n if (sm) {\n var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);\n this.stateMachines.push(newStateMachine);\n }\n else {\n // In order to maintain compatibility with current behavior, if a state machine is not found\n // we look for an animation with the same name\n this.initLinearAnimations([animatables[i]], playing);\n }\n }\n }\n };\n /**\n * Play the named animations/state machines\n * @param animatables the names of the animations/machines to play; plays all if empty\n * @returns a list of the playing items\n */\n Animator.prototype.play = function (animatables) {\n return this.add(animatables, true);\n };\n /**\n * Pauses named animations and state machines, or everything if nothing is\n * specified\n * @param animatables names of the animations and state machines to pause\n * @returns a list of names of the animations and state machines paused\n */\n Animator.prototype.pause = function (animatables) {\n return this.add(animatables, false);\n };\n /**\n * Set time of named animations\n * @param animations names of the animations to scrub\n * @param value time scrub value, a floating point number to which the playhead is jumped\n * @returns a list of names of the animations that were scrubbed\n */\n Animator.prototype.scrub = function (animatables, value) {\n var forScrubbing = this.animations.filter(function (a) {\n return animatables.includes(a.name);\n });\n forScrubbing.forEach(function (a) { return (a.scrubTo = value); });\n return forScrubbing.map(function (a) { return a.name; });\n };\n Object.defineProperty(Animator.prototype, \"playing\", {\n /**\n * Returns a list of names of all animations and state machines currently\n * playing\n */\n get: function () {\n return this.animations\n .filter(function (a) { return a.playing; })\n .map(function (a) { return a.name; })\n .concat(this.stateMachines.filter(function (m) { return m.playing; }).map(function (m) { return m.name; }));\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Animator.prototype, \"paused\", {\n /**\n * Returns a list of names of all animations and state machines currently\n * paused\n */\n get: function () {\n return this.animations\n .filter(function (a) { return !a.playing; })\n .map(function (a) { return a.name; })\n .concat(this.stateMachines.filter(function (m) { return !m.playing; }).map(function (m) { return m.name; }));\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Stops and removes all named animations and state machines\n * @param animatables animations and state machines to remove\n * @returns a list of names of removed items\n */\n Animator.prototype.stop = function (animatables) {\n var _this = this;\n animatables = mapToStringArray(animatables);\n // If nothing's specified, wipe them out, all of them\n var removedNames = [];\n // Stop everything\n if (animatables.length === 0) {\n removedNames = this.animations\n .map(function (a) { return a.name; })\n .concat(this.stateMachines.map(function (m) { return m.name; }));\n // Clean up before emptying the arrays\n this.animations.forEach(function (a) { return a.cleanup(); });\n this.stateMachines.forEach(function (m) { return m.cleanup(); });\n // Empty out the arrays\n this.animations.splice(0, this.animations.length);\n this.stateMachines.splice(0, this.stateMachines.length);\n }\n else {\n // Remove only the named animations/state machines\n var animationsToRemove = this.animations.filter(function (a) {\n return animatables.includes(a.name);\n });\n animationsToRemove.forEach(function (a) {\n a.cleanup();\n _this.animations.splice(_this.animations.indexOf(a), 1);\n });\n var machinesToRemove = this.stateMachines.filter(function (m) {\n return animatables.includes(m.name);\n });\n machinesToRemove.forEach(function (m) {\n m.cleanup();\n _this.stateMachines.splice(_this.stateMachines.indexOf(m), 1);\n });\n removedNames = animationsToRemove\n .map(function (a) { return a.name; })\n .concat(machinesToRemove.map(function (m) { return m.name; }));\n }\n this.eventManager.fire({\n type: EventType.Stop,\n data: removedNames,\n });\n // Return the list of animations removed\n return removedNames;\n };\n Object.defineProperty(Animator.prototype, \"isPlaying\", {\n /**\n * Returns true if at least one animation is active\n */\n get: function () {\n return (this.animations.reduce(function (acc, curr) { return acc || curr.playing; }, false) ||\n this.stateMachines.reduce(function (acc, curr) { return acc || curr.playing; }, false));\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Animator.prototype, \"isPaused\", {\n /**\n * Returns true if all animations are paused and there's at least one animation\n */\n get: function () {\n return (!this.isPlaying &&\n (this.animations.length > 0 || this.stateMachines.length > 0));\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Animator.prototype, \"isStopped\", {\n /**\n * Returns true if there are no playing or paused animations/state machines\n */\n get: function () {\n return this.animations.length === 0 && this.stateMachines.length === 0;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * If there are no animations or state machines, add the first one found\n * @returns the name of the animation or state machine instanced\n */\n Animator.prototype.atLeastOne = function (playing, fireEvent) {\n if (fireEvent === void 0) { fireEvent = true; }\n var instancedName;\n if (this.animations.length === 0 && this.stateMachines.length === 0) {\n if (this.artboard.animationCount() > 0) {\n // Add the first animation\n this.add([(instancedName = this.artboard.animationByIndex(0).name)], playing, fireEvent);\n }\n else if (this.artboard.stateMachineCount() > 0) {\n // Add the first state machine\n this.add([(instancedName = this.artboard.stateMachineByIndex(0).name)], playing, fireEvent);\n }\n }\n return instancedName;\n };\n /**\n * Checks if any animations have looped and if so, fire the appropriate event\n */\n Animator.prototype.handleLooping = function () {\n for (var _i = 0, _a = this.animations.filter(function (a) { return a.playing; }); _i < _a.length; _i++) {\n var animation = _a[_i];\n // Emit if the animation looped\n if (animation.loopValue === 0 && animation.loopCount) {\n animation.loopCount = 0;\n // This is a one-shot; if it has ended, delete the instance\n this.stop(animation.name);\n }\n else if (animation.loopValue === 1 && animation.loopCount) {\n this.eventManager.fire({\n type: EventType.Loop,\n data: { animation: animation.name, type: LoopType.Loop },\n });\n animation.loopCount = 0;\n }\n // Wasm indicates a loop at each time the animation\n // changes direction, so a full loop/lap occurs every\n // two loop counts\n else if (animation.loopValue === 2 && animation.loopCount > 1) {\n this.eventManager.fire({\n type: EventType.Loop,\n data: { animation: animation.name, type: LoopType.PingPong },\n });\n animation.loopCount = 0;\n }\n }\n };\n /**\n * Checks if states have changed in state machines and fires a statechange\n * event\n */\n Animator.prototype.handleStateChanges = function () {\n var statesChanged = [];\n for (var _i = 0, _a = this.stateMachines.filter(function (sm) { return sm.playing; }); _i < _a.length; _i++) {\n var stateMachine = _a[_i];\n statesChanged.push.apply(statesChanged, stateMachine.statesChanged);\n }\n if (statesChanged.length > 0) {\n this.eventManager.fire({\n type: EventType.StateChange,\n data: statesChanged,\n });\n }\n };\n Animator.prototype.handleAdvancing = function (time) {\n this.eventManager.fire({\n type: EventType.Advance,\n data: time,\n });\n };\n return Animator;\n}());\n// #endregion\n// #region events\n/**\n * Supported event types triggered in Rive\n */\nvar EventType;\n(function (EventType) {\n EventType[\"Load\"] = \"load\";\n EventType[\"LoadError\"] = \"loaderror\";\n EventType[\"Play\"] = \"play\";\n EventType[\"Pause\"] = \"pause\";\n EventType[\"Stop\"] = \"stop\";\n EventType[\"Loop\"] = \"loop\";\n EventType[\"Draw\"] = \"draw\";\n EventType[\"Advance\"] = \"advance\";\n EventType[\"StateChange\"] = \"statechange\";\n EventType[\"RiveEvent\"] = \"riveevent\";\n EventType[\"AudioStatusChange\"] = \"audiostatuschange\";\n})(EventType || (EventType = {}));\n/**\n * Looping types: one-shot, loop, and ping-pong\n */\nvar LoopType;\n(function (LoopType) {\n LoopType[\"OneShot\"] = \"oneshot\";\n LoopType[\"Loop\"] = \"loop\";\n LoopType[\"PingPong\"] = \"pingpong\";\n})(LoopType || (LoopType = {}));\n// Manages Rive events and listeners\nvar EventManager = /** @class */ (function () {\n function EventManager(listeners) {\n if (listeners === void 0) { listeners = []; }\n this.listeners = listeners;\n }\n // Gets listeners of specified type\n EventManager.prototype.getListeners = function (type) {\n return this.listeners.filter(function (e) { return e.type === type; });\n };\n // Adds a listener\n EventManager.prototype.add = function (listener) {\n if (!this.listeners.includes(listener)) {\n this.listeners.push(listener);\n }\n };\n /**\n * Removes a listener\n * @param listener the listener with the callback to be removed\n */\n EventManager.prototype.remove = function (listener) {\n // We can't simply look for the listener as it'll be a different instance to\n // one originally subscribed. Find all the listeners of the right type and\n // then check their callbacks which should match.\n for (var i = 0; i < this.listeners.length; i++) {\n var currentListener = this.listeners[i];\n if (currentListener.type === listener.type) {\n if (currentListener.callback === listener.callback) {\n this.listeners.splice(i, 1);\n break;\n }\n }\n }\n };\n /**\n * Clears all listeners of specified type, or every listener if no type is\n * specified\n * @param type the type of listeners to clear, or all listeners if not\n * specified\n */\n EventManager.prototype.removeAll = function (type) {\n var _this = this;\n if (!type) {\n this.listeners.splice(0, this.listeners.length);\n }\n else {\n this.listeners\n .filter(function (l) { return l.type === type; })\n .forEach(function (l) { return _this.remove(l); });\n }\n };\n // Fires an event\n EventManager.prototype.fire = function (event) {\n var eventListeners = this.getListeners(event.type);\n eventListeners.forEach(function (listener) { return listener.callback(event); });\n };\n return EventManager;\n}());\n// Manages a queue of tasks\nvar TaskQueueManager = /** @class */ (function () {\n function TaskQueueManager(eventManager) {\n this.eventManager = eventManager;\n this.queue = [];\n }\n // Adds a task top the queue\n TaskQueueManager.prototype.add = function (task) {\n this.queue.push(task);\n };\n // Processes all tasks in the queue\n TaskQueueManager.prototype.process = function () {\n while (this.queue.length > 0) {\n var task = this.queue.shift();\n if (task === null || task === void 0 ? void 0 : task.action) {\n task.action();\n }\n if (task === null || task === void 0 ? void 0 : task.event) {\n this.eventManager.fire(task.event);\n }\n }\n };\n return TaskQueueManager;\n}());\n// #endregion\n// #region Audio\nvar SystemAudioStatus;\n(function (SystemAudioStatus) {\n SystemAudioStatus[SystemAudioStatus[\"AVAILABLE\"] = 0] = \"AVAILABLE\";\n SystemAudioStatus[SystemAudioStatus[\"UNAVAILABLE\"] = 1] = \"UNAVAILABLE\";\n})(SystemAudioStatus || (SystemAudioStatus = {}));\n// Class to handle audio context availability and status changes\nvar AudioManager = /** @class */ (function (_super) {\n __extends(AudioManager, _super);\n function AudioManager() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._started = false;\n _this._enabled = false;\n _this._status = SystemAudioStatus.UNAVAILABLE;\n return _this;\n }\n AudioManager.prototype.delay = function (time) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, time); })];\n });\n });\n };\n AudioManager.prototype.timeout = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (_, reject) { return setTimeout(reject, 50); })];\n });\n });\n };\n // Alerts animations on status changes and removes the listeners to avoid alerting twice.\n AudioManager.prototype.reportToListeners = function () {\n this.fire({ type: EventType.AudioStatusChange });\n this.removeAll();\n };\n /**\n * The audio context has been resolved.\n * Alert any listeners that we can now play audio.\n * Rive will now play audio at the configured volume.\n */\n AudioManager.prototype.enableAudio = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (!this._enabled) {\n this._enabled = true;\n this._status = SystemAudioStatus.AVAILABLE;\n this.reportToListeners();\n }\n return [2 /*return*/];\n });\n });\n };\n /**\n * Check if we are able to play audio.\n *\n * We currently check the audio context, when resume() returns before a timeout we know that the\n * audio context is running and we can enable audio.\n */\n AudioManager.prototype.testAudio = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!(this._status === SystemAudioStatus.UNAVAILABLE &&\n this._audioContext !== null)) return [3 /*break*/, 4];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n return [4 /*yield*/, Promise.race([this._audioContext.resume(), this.timeout()])];\n case 2:\n _b.sent();\n this.enableAudio();\n return [3 /*break*/, 4];\n case 3:\n _a = _b.sent();\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Establish audio for use with rive.\n * We both test if we can use audio intermittently and listen for user interaction.\n * The aim is to enable audio playback as soon as the browser allows this.\n */\n AudioManager.prototype._establishAudio = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this._started) return [3 /*break*/, 5];\n this._started = true;\n if (!(typeof window == \"undefined\")) return [3 /*break*/, 1];\n this.enableAudio();\n return [3 /*break*/, 5];\n case 1:\n this._audioContext = new AudioContext();\n this.listenForUserAction();\n _a.label = 2;\n case 2:\n if (!(this._status === SystemAudioStatus.UNAVAILABLE)) return [3 /*break*/, 5];\n return [4 /*yield*/, this.testAudio()];\n case 3:\n _a.sent();\n return [4 /*yield*/, this.delay(1000)];\n case 4:\n _a.sent();\n return [3 /*break*/, 2];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n AudioManager.prototype.listenForUserAction = function () {\n var _this = this;\n // NOTE: AudioContexts are ready immediately if requested in a ui callback\n // we *could* re request one in this listener.\n var _clickListener = function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n // note this has \"better\" results than calling `await this.testAudio()`\n // as we force audio to be enabled in the current thread, rather than chancing\n // the thread to be passed over for some other async context\n this.enableAudio();\n return [2 /*return*/];\n });\n }); };\n // NOTE: we should test this on mobile/pads\n document.addEventListener(\"pointerdown\", _clickListener, {\n once: true,\n });\n };\n /**\n * Establish the audio context for rive, this lets rive know that we can play audio.\n */\n AudioManager.prototype.establishAudio = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n this._establishAudio();\n return [2 /*return*/];\n });\n });\n };\n Object.defineProperty(AudioManager.prototype, \"systemVolume\", {\n get: function () {\n if (this._status === SystemAudioStatus.UNAVAILABLE) {\n // We do an immediate test to avoid depending on the delay of the running test\n this.testAudio();\n return 0;\n }\n return 1;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AudioManager.prototype, \"status\", {\n get: function () {\n return this._status;\n },\n enumerable: false,\n configurable: true\n });\n return AudioManager;\n}(EventManager));\nvar audioManager = new AudioManager();\nvar FakeResizeObserver = /** @class */ (function () {\n function FakeResizeObserver() {\n }\n FakeResizeObserver.prototype.observe = function () { };\n FakeResizeObserver.prototype.unobserve = function () { };\n FakeResizeObserver.prototype.disconnect = function () { };\n return FakeResizeObserver;\n}());\nvar MyResizeObserver = globalThis.ResizeObserver || FakeResizeObserver;\n/**\n * This class takes care of any observers that will be attached to an animation.\n * It should be treated as a singleton because observers are much more performant\n * when used for observing multiple elements by a single instance.\n */\nvar ObjectObservers = /** @class */ (function () {\n function ObjectObservers() {\n var _this = this;\n this._elementsMap = new Map();\n /**\n * Resize observers trigger both when the element changes its size and also when the\n * element is added or removed from the document.\n */\n this._onObservedEntry = function (entry) {\n var observed = _this._elementsMap.get(entry.target);\n if (observed !== null) {\n observed.onResize(entry.target.clientWidth == 0 || entry.target.clientHeight == 0);\n }\n else {\n _this._resizeObserver.unobserve(entry.target);\n }\n };\n this._onObserved = function (entries) {\n entries.forEach(_this._onObservedEntry);\n };\n this._resizeObserver = new MyResizeObserver(this._onObserved);\n }\n // Adds an observable element\n ObjectObservers.prototype.add = function (element, onResize) {\n var observed = {\n onResize: onResize,\n element: element,\n };\n this._elementsMap.set(element, observed);\n this._resizeObserver.observe(element);\n return observed;\n };\n // Removes an observable element\n ObjectObservers.prototype.remove = function (observed) {\n this._resizeObserver.unobserve(observed.element);\n this._elementsMap.delete(observed.element);\n };\n return ObjectObservers;\n}());\nvar observers = new ObjectObservers();\nvar RiveFile = /** @class */ (function () {\n function RiveFile(params) {\n // Allow the runtime to automatically load assets hosted in Rive's runtime.\n this.enableRiveAssetCDN = true;\n this.referenceCount = 0;\n this.destroyed = false;\n this.src = params.src;\n this.buffer = params.buffer;\n if (params.assetLoader)\n this.assetLoader = params.assetLoader;\n this.enableRiveAssetCDN =\n typeof params.enableRiveAssetCDN == \"boolean\"\n ? params.enableRiveAssetCDN\n : true;\n // New event management system\n this.eventManager = new EventManager();\n if (params.onLoad)\n this.on(EventType.Load, params.onLoad);\n if (params.onLoadError)\n this.on(EventType.LoadError, params.onLoadError);\n }\n RiveFile.prototype.initData = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, loader, _b;\n var _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n if (!this.src) return [3 /*break*/, 2];\n _a = this;\n return [4 /*yield*/, loadRiveFile(this.src)];\n case 1:\n _a.buffer = _d.sent();\n _d.label = 2;\n case 2:\n if (this.destroyed) {\n return [2 /*return*/];\n }\n if (this.assetLoader) {\n loader = new this.runtime.CustomFileAssetLoader({\n loadContents: this.assetLoader,\n });\n }\n // Load the Rive file\n _b = this;\n return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];\n case 3:\n // Load the Rive file\n _b.file = _d.sent();\n if (this.destroyed) {\n (_c = this.file) === null || _c === void 0 ? void 0 : _c.delete();\n this.file = null;\n return [2 /*return*/];\n }\n if (this.file !== null) {\n this.eventManager.fire({\n type: EventType.Load,\n data: this,\n });\n }\n else {\n this.eventManager.fire({\n type: EventType.LoadError,\n data: null,\n });\n throw new Error(RiveFile.fileLoadErrorMessage);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n RiveFile.prototype.init = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n // If no source file url specified, it's a bust\n if (!this.src && !this.buffer) {\n throw new Error(RiveFile.missingErrorMessage);\n }\n _a = this;\n return [4 /*yield*/, RuntimeLoader.awaitInstance()];\n case 1:\n _a.runtime = _b.sent();\n if (this.destroyed) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, this.initData()];\n case 2:\n _b.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Subscribe to Rive-generated events\n * @param type the type of event to subscribe to\n * @param callback callback to fire when the event occurs\n */\n RiveFile.prototype.on = function (type, callback) {\n this.eventManager.add({\n type: type,\n callback: callback,\n });\n };\n /**\n * Unsubscribes from a Rive-generated event\n * @param type the type of event to unsubscribe from\n * @param callback the callback to unsubscribe\n */\n RiveFile.prototype.off = function (type, callback) {\n this.eventManager.remove({\n type: type,\n callback: callback,\n });\n };\n RiveFile.prototype.cleanup = function () {\n var _a;\n this.referenceCount -= 1;\n if (this.referenceCount <= 0) {\n this.removeAllRiveEventListeners();\n (_a = this.file) === null || _a === void 0 ? void 0 : _a.delete();\n this.file = null;\n this.destroyed = true;\n }\n };\n /**\n * Unsubscribes all Rive listeners from an event type, or everything if no type is\n * given\n * @param type the type of event to unsubscribe from, or all types if\n * undefined\n */\n RiveFile.prototype.removeAllRiveEventListeners = function (type) {\n this.eventManager.removeAll(type);\n };\n RiveFile.prototype.getInstance = function () {\n if (this.file !== null) {\n this.referenceCount += 1;\n return this.file;\n }\n };\n // Error message for missing source or buffer\n RiveFile.missingErrorMessage = \"Rive source file or data buffer required\";\n // Error message for file load error\n RiveFile.fileLoadErrorMessage = \"The file failed to load\";\n return RiveFile;\n}());\n\nvar Rive = /** @class */ (function () {\n function Rive(params) {\n var _this = this;\n var _a;\n // Tracks if a Rive file is loaded\n this.loaded = false;\n // Tracks if a Rive file is destroyed\n this.destroyed = false;\n // Reference of an object that handles any observers for the animation\n this._observed = null;\n /**\n * Tracks if a Rive file is loaded; we need this in addition to loaded as some\n * commands (e.g. contents) can be called as soon as the file is loaded.\n * However, playback commands need to be queued and run in order once initial\n * animations and autoplay has been sorted out. This applies to play, pause,\n * and start.\n */\n this.readyForPlaying = false;\n // Runtime artboard\n this.artboard = null;\n // place to clear up event listeners\n this.eventCleanup = null;\n this.shouldDisableRiveListeners = false;\n this.automaticallyHandleEvents = false;\n // Allow the runtime to automatically load assets hosted in Rive's runtime.\n this.enableRiveAssetCDN = true;\n // Keep a local value of the set volume to update it asynchronously\n this._volume = 1;\n // Keep a local value of the set width to update it asynchronously\n this._artboardWidth = undefined;\n // Keep a local value of the set height to update it asynchronously\n this._artboardHeight = undefined;\n // Keep a local value of the device pixel ratio used in rendering and canvas/artboard resizing\n this._devicePixelRatioUsed = 1;\n // Whether the canvas element's size is 0\n this._hasZeroSize = false;\n // Audio event listener\n this._audioEventListener = null;\n // draw method bound to the class\n this._boundDraw = null;\n // Durations to generate a frame for the last second. Used for performance profiling.\n this.durations = [];\n this.frameTimes = [];\n this.frameCount = 0;\n this.isTouchScrollEnabled = false;\n this.onCanvasResize = function (hasZeroSize) {\n var toggledDisplay = _this._hasZeroSize !== hasZeroSize;\n _this._hasZeroSize = hasZeroSize;\n if (!hasZeroSize) {\n if (toggledDisplay) {\n _this.resizeDrawingSurfaceToCanvas();\n }\n }\n else if (!_this._layout.maxX || !_this._layout.maxY) {\n _this.resizeToCanvas();\n }\n };\n /**\n * Used be draw to track when a second of active rendering time has passed.\n * Used for debugging purposes\n */\n this.renderSecondTimer = 0;\n this._boundDraw = this.draw.bind(this);\n this.canvas = params.canvas;\n if (params.canvas.constructor === HTMLCanvasElement) {\n this._observed = observers.add(this.canvas, this.onCanvasResize);\n }\n this.src = params.src;\n this.buffer = params.buffer;\n this.riveFile = params.riveFile;\n this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();\n this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;\n this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;\n this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;\n this.enableRiveAssetCDN =\n params.enableRiveAssetCDN === undefined\n ? true\n : params.enableRiveAssetCDN;\n // New event management system\n this.eventManager = new EventManager();\n if (params.onLoad)\n this.on(EventType.Load, params.onLoad);\n if (params.onLoadError)\n this.on(EventType.LoadError, params.onLoadError);\n if (params.onPlay)\n this.on(EventType.Play, params.onPlay);\n if (params.onPause)\n this.on(EventType.Pause, params.onPause);\n if (params.onStop)\n this.on(EventType.Stop, params.onStop);\n if (params.onLoop)\n this.on(EventType.Loop, params.onLoop);\n if (params.onStateChange)\n this.on(EventType.StateChange, params.onStateChange);\n if (params.onAdvance)\n this.on(EventType.Advance, params.onAdvance);\n /**\n * @deprecated Use camelCase'd versions instead.\n */\n if (params.onload && !params.onLoad)\n this.on(EventType.Load, params.onload);\n if (params.onloaderror && !params.onLoadError)\n this.on(EventType.LoadError, params.onloaderror);\n if (params.onplay && !params.onPlay)\n this.on(EventType.Play, params.onplay);\n if (params.onpause && !params.onPause)\n this.on(EventType.Pause, params.onpause);\n if (params.onstop && !params.onStop)\n this.on(EventType.Stop, params.onstop);\n if (params.onloop && !params.onLoop)\n this.on(EventType.Loop, params.onloop);\n if (params.onstatechange && !params.onStateChange)\n this.on(EventType.StateChange, params.onstatechange);\n /**\n * Asset loading\n */\n if (params.assetLoader)\n this.assetLoader = params.assetLoader;\n // Hook up the task queue\n this.taskQueue = new TaskQueueManager(this.eventManager);\n this.init({\n src: this.src,\n buffer: this.buffer,\n riveFile: this.riveFile,\n autoplay: params.autoplay,\n animations: params.animations,\n stateMachines: params.stateMachines,\n artboard: params.artboard,\n useOffscreenRenderer: params.useOffscreenRenderer,\n });\n }\n // Alternative constructor to build a Rive instance from an interface/object\n Rive.new = function (params) {\n console.warn(\"This function is deprecated: please use `new Rive({})` instead\");\n return new Rive(params);\n };\n // Event handler for when audio context becomes available\n Rive.prototype.onSystemAudioChanged = function () {\n this.volume = this._volume;\n };\n // Initializes the Rive object either from constructor or load()\n Rive.prototype.init = function (_a) {\n var _this = this;\n var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c;\n if (this.destroyed) {\n return;\n }\n this.src = src;\n this.buffer = buffer;\n this.riveFile = riveFile;\n // If no source file url specified, it's a bust\n if (!this.src && !this.buffer && !this.riveFile) {\n throw new RiveError(Rive.missingErrorMessage);\n }\n // List of animations that should be initialized.\n var startingAnimationNames = mapToStringArray(animations);\n // List of state machines that should be initialized\n var startingStateMachineNames = mapToStringArray(stateMachines);\n // Ensure loaded is marked as false if loading new file\n this.loaded = false;\n this.readyForPlaying = false;\n // Ensure the runtime is loaded\n RuntimeLoader.awaitInstance()\n .then(function (runtime) {\n if (_this.destroyed) {\n return;\n }\n _this.runtime = runtime;\n _this.removeRiveListeners();\n _this.deleteRiveRenderer();\n // Get the canvas where you want to render the animation and create a renderer\n _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);\n // Initial size adjustment based on devicePixelRatio if no width/height are\n // specified explicitly\n if (!(_this.canvas.width || _this.canvas.height)) {\n _this.resizeDrawingSurfaceToCanvas();\n }\n // Load Rive data from a source uri or a data buffer\n _this.initData(artboard, startingAnimationNames, startingStateMachineNames, autoplay)\n .then(function () { return _this.setupRiveListeners(); })\n .catch(function (e) {\n console.error(e);\n });\n })\n .catch(function (e) {\n console.error(e);\n });\n };\n /**\n * Setup Rive Listeners on the canvas\n * @param riveListenerOptions - Enables TouchEvent events on the canvas. Set to true to allow\n * touch scrolling on the canvas element on touch-enabled devices\n * i.e. { isTouchScrollEnabled: true }\n */\n Rive.prototype.setupRiveListeners = function (riveListenerOptions) {\n var _this = this;\n if (this.eventCleanup) {\n this.eventCleanup();\n }\n if (!this.shouldDisableRiveListeners) {\n var activeStateMachines = (this.animator.stateMachines || [])\n .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })\n .map(function (sm) { return sm.instance; });\n var touchScrollEnabledOption = this.isTouchScrollEnabled;\n if (riveListenerOptions &&\n \"isTouchScrollEnabled\" in riveListenerOptions) {\n touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;\n }\n this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.registerTouchInteractions)({\n canvas: this.canvas,\n artboard: this.artboard,\n stateMachines: activeStateMachines,\n renderer: this.renderer,\n rive: this.runtime,\n fit: this._layout.runtimeFit(this.runtime),\n alignment: this._layout.runtimeAlignment(this.runtime),\n isTouchScrollEnabled: touchScrollEnabledOption,\n layoutScaleFactor: this._layout.layoutScaleFactor,\n });\n }\n };\n /**\n * Remove Rive Listeners setup on the canvas\n */\n Rive.prototype.removeRiveListeners = function () {\n if (this.eventCleanup) {\n this.eventCleanup();\n this.eventCleanup = null;\n }\n };\n /**\n * If the instance has audio and the system audio is not ready\n * we hook the instance to the audio manager\n */\n Rive.prototype.initializeAudio = function () {\n var _this = this;\n var _a;\n // Initialize audio if needed\n if (audioManager.status == SystemAudioStatus.UNAVAILABLE) {\n if (((_a = this.artboard) === null || _a === void 0 ? void 0 : _a.hasAudio) && this._audioEventListener === null) {\n this._audioEventListener = {\n type: EventType.AudioStatusChange,\n callback: function () { return _this.onSystemAudioChanged(); },\n };\n audioManager.add(this._audioEventListener);\n audioManager.establishAudio();\n }\n }\n };\n Rive.prototype.initArtboardSize = function () {\n if (!this.artboard)\n return;\n // Use preset values if they are not undefined\n this._artboardWidth = this.artboard.width =\n this._artboardWidth || this.artboard.width;\n this._artboardHeight = this.artboard.height =\n this._artboardHeight || this.artboard.height;\n };\n // Initializes runtime with Rive data and preps for playing\n Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {\n return __awaiter(this, void 0, void 0, function () {\n var error_1, msg;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 3, , 4]);\n if (!(this.riveFile == null)) return [3 /*break*/, 2];\n this.riveFile = new RiveFile({\n src: this.src,\n buffer: this.buffer,\n enableRiveAssetCDN: this.enableRiveAssetCDN,\n assetLoader: this.assetLoader,\n });\n return [4 /*yield*/, this.riveFile.init()];\n case 1:\n _b.sent();\n _b.label = 2;\n case 2:\n // Check for riveFile in case it has been cleaned up while initializing;\n if (!this.riveFile) {\n throw new RiveError(Rive.cleanupErrorMessage);\n }\n this.file = this.riveFile.getInstance();\n // Initialize and draw frame\n this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay);\n // Initialize the artboard size\n this.initArtboardSize();\n // Check for audio\n this.initializeAudio();\n // Everything's set up, emit a load event\n this.loaded = true;\n this.eventManager.fire({\n type: EventType.Load,\n data: (_a = this.src) !== null && _a !== void 0 ? _a : \"buffer\",\n });\n // Flag ready for playback commands and clear the task queue; this order\n // is important or it may infinitely recurse\n this.readyForPlaying = true;\n this.taskQueue.process();\n this.drawFrame();\n return [2 /*return*/, Promise.resolve()];\n case 3:\n error_1 = _b.sent();\n msg = resolveErrorMessage(error_1);\n console.warn(msg);\n this.eventManager.fire({ type: EventType.LoadError, data: msg });\n return [2 /*return*/, Promise.reject(msg)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n // Initialize for playback\n Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay) {\n if (!this.file) {\n return;\n }\n // Fetch the artboard\n var rootArtboard = artboardName\n ? this.file.artboardByName(artboardName)\n : this.file.defaultArtboard();\n // Check we have a working artboard\n if (!rootArtboard) {\n var msg = \"Invalid artboard name or no default artboard\";\n console.warn(msg);\n this.eventManager.fire({ type: EventType.LoadError, data: msg });\n return;\n }\n this.artboard = rootArtboard;\n rootArtboard.volume = this._volume * audioManager.systemVolume;\n // Check that the artboard has at least 1 animation\n if (this.artboard.animationCount() < 1) {\n var msg = \"Artboard has no animations\";\n this.eventManager.fire({ type: EventType.LoadError, data: msg });\n throw msg;\n }\n // Initialize the animator\n this.animator = new Animator(this.runtime, this.artboard, this.eventManager);\n // Initialize the animations; as loaded hasn't happened yet, we need to\n // suppress firing the play/pause events until the load event has fired. To\n // do this we tell the animator to suppress firing events, and add event\n // firing to the task queue.\n var instanceNames;\n if (animationNames.length > 0 || stateMachineNames.length > 0) {\n instanceNames = animationNames.concat(stateMachineNames);\n this.animator.initLinearAnimations(animationNames, autoplay);\n this.animator.initStateMachines(stateMachineNames, autoplay);\n }\n else {\n instanceNames = [this.animator.atLeastOne(autoplay, false)];\n }\n // Queue up firing the playback events\n this.taskQueue.add({\n event: {\n type: autoplay ? EventType.Play : EventType.Pause,\n data: instanceNames,\n },\n });\n };\n // Draws the current artboard frame\n Rive.prototype.drawFrame = function () {\n var _a;\n if ((_a = document === null || document === void 0 ? void 0 : document.timeline) === null || _a === void 0 ? void 0 : _a.currentTime) {\n if (this.loaded && this.artboard && !this.frameRequestId) {\n this._boundDraw(document.timeline.currentTime);\n }\n }\n else {\n this.startRendering();\n }\n };\n /**\n * Draw rendering loop; renders animation frames at the correct time interval.\n * @param time the time at which to render a frame\n */\n Rive.prototype.draw = function (time, onSecond) {\n // Clear the frameRequestId, as we're now rendering a fresh frame\n this.frameRequestId = null;\n var before = performance.now();\n // On the first pass, make sure lastTime has a valid value\n if (!this.lastRenderTime) {\n this.lastRenderTime = time;\n }\n // Handle the onSecond callback\n this.renderSecondTimer += time - this.lastRenderTime;\n if (this.renderSecondTimer > 5000) {\n this.renderSecondTimer = 0;\n onSecond === null || onSecond === void 0 ? void 0 : onSecond();\n }\n // Calculate the elapsed time between frames in seconds\n var elapsedTime = (time - this.lastRenderTime) / 1000;\n this.lastRenderTime = time;\n // - Advance non-paused animations by the elapsed number of seconds\n // - Advance any animations that require scrubbing\n // - Advance to the first frame even when autoplay is false\n var activeAnimations = this.animator.animations\n .filter(function (a) { return a.playing || a.needsScrub; })\n // The scrubbed animations must be applied first to prevent weird artifacts\n // if the playing animations conflict with the scrubbed animating attribuates.\n .sort(function (first) { return (first.needsScrub ? -1 : 1); });\n for (var _i = 0, activeAnimations_1 = activeAnimations; _i < activeAnimations_1.length; _i++) {\n var animation = activeAnimations_1[_i];\n animation.advance(elapsedTime);\n if (animation.instance.didLoop) {\n animation.loopCount += 1;\n }\n animation.apply(1.0);\n }\n // - Advance non-paused state machines by the elapsed number of seconds\n // - Advance to the first frame even when autoplay is false\n var activeStateMachines = this.animator.stateMachines.filter(function (a) { return a.playing; });\n for (var _a = 0, activeStateMachines_1 = activeStateMachines; _a < activeStateMachines_1.length; _a++) {\n var stateMachine = activeStateMachines_1[_a];\n // Check for events before the current frame's state machine advance\n var numEventsReported = stateMachine.reportedEventCount();\n if (numEventsReported) {\n for (var i = 0; i < numEventsReported; i++) {\n var event_1 = stateMachine.reportedEventAt(i);\n if (event_1) {\n if (event_1.type === RiveEventType.OpenUrl) {\n this.eventManager.fire({\n type: EventType.RiveEvent,\n data: event_1,\n });\n // Handle the event side effect if explicitly enabled\n if (this.automaticallyHandleEvents) {\n var newAnchorTag = document.createElement(\"a\");\n var _b = event_1, url = _b.url, target = _b.target;\n var sanitizedUrl = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.sanitizeUrl)(url);\n url && newAnchorTag.setAttribute(\"href\", sanitizedUrl);\n target && newAnchorTag.setAttribute(\"target\", target);\n if (sanitizedUrl && sanitizedUrl !== _utils__WEBPACK_IMPORTED_MODULE_3__.BLANK_URL) {\n newAnchorTag.click();\n }\n }\n }\n else {\n this.eventManager.fire({\n type: EventType.RiveEvent,\n data: event_1,\n });\n }\n }\n }\n }\n stateMachine.advanceAndApply(elapsedTime);\n // stateMachine.instance.apply(this.artboard);\n }\n // Once the animations have been applied to the artboard, advance it\n // by the elapsed time.\n if (this.animator.stateMachines.length == 0) {\n this.artboard.advance(elapsedTime);\n }\n var renderer = this.renderer;\n // Canvas must be wiped to prevent artifacts\n renderer.clear();\n renderer.save();\n // Update the renderer alignment if necessary\n this.alignRenderer();\n // Do not draw on 0 canvas size\n if (!this._hasZeroSize) {\n this.artboard.draw(renderer);\n }\n renderer.restore();\n renderer.flush();\n // Check for any animations that looped\n this.animator.handleLooping();\n // Check for any state machines that had a state change\n this.animator.handleStateChanges();\n // Report advanced time\n this.animator.handleAdvancing(elapsedTime);\n // Add duration to create frame to durations array\n this.frameCount++;\n var after = performance.now();\n this.frameTimes.push(after);\n this.durations.push(after - before);\n while (this.frameTimes[0] <= after - 1000) {\n this.frameTimes.shift();\n this.durations.shift();\n }\n // Calling requestAnimationFrame will rerun draw() at the correct rate:\n // https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations\n if (this.animator.isPlaying) {\n // Request a new rendering frame\n this.startRendering();\n }\n else if (this.animator.isPaused) {\n // Reset the end time so on playback it starts at the correct frame\n this.lastRenderTime = 0;\n }\n else if (this.animator.isStopped) {\n // Reset animation instances, artboard and time\n // TODO: implement this properly when we have instancing\n // this.initArtboard();\n // this.drawFrame();\n this.lastRenderTime = 0;\n }\n };\n /**\n * Align the renderer\n */\n Rive.prototype.alignRenderer = function () {\n var _a = this, renderer = _a.renderer, runtime = _a.runtime, _layout = _a._layout, artboard = _a.artboard;\n // Align things up safe in the knowledge we can restore if changed\n renderer.align(_layout.runtimeFit(runtime), _layout.runtimeAlignment(runtime), {\n minX: _layout.minX,\n minY: _layout.minY,\n maxX: _layout.maxX,\n maxY: _layout.maxY,\n }, artboard.bounds, this._devicePixelRatioUsed * _layout.layoutScaleFactor);\n };\n Object.defineProperty(Rive.prototype, \"fps\", {\n get: function () {\n return this.durations.length;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"frameTime\", {\n get: function () {\n if (this.durations.length === 0) {\n return 0;\n }\n return (this.durations.reduce(function (a, b) { return a + b; }, 0) / this.durations.length).toFixed(4);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Cleans up all Wasm-generated objects that need to be manually destroyed:\n * artboard instances, animation instances, state machine instances,\n * renderer instance, file and runtime.\n *\n * Once this is called, you will need to initialise a new instance of the\n * Rive class\n */\n Rive.prototype.cleanup = function () {\n var _a;\n this.destroyed = true;\n // Stop the renderer if it hasn't already been stopped.\n this.stopRendering();\n // Clean up any artboard, animation or state machine instances.\n this.cleanupInstances();\n // Remove from observer\n if (this._observed !== null) {\n observers.remove(this._observed);\n }\n this.removeRiveListeners();\n if (this.file) {\n (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();\n this.file = null;\n }\n this.riveFile = null;\n this.deleteRiveRenderer();\n if (this._audioEventListener !== null) {\n audioManager.remove(this._audioEventListener);\n this._audioEventListener = null;\n }\n };\n /**\n * Cleans up the Renderer object. Only call this API if you no longer\n * need to render Rive content in your session.\n */\n Rive.prototype.deleteRiveRenderer = function () {\n var _a;\n (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.delete();\n this.renderer = null;\n };\n /**\n * Cleans up any Wasm-generated objects that need to be manually destroyed:\n * artboard instances, animation instances, state machine instances.\n *\n * Once this is called, things will need to be reinitialized or bad things\n * might happen.\n */\n Rive.prototype.cleanupInstances = function () {\n if (this.eventCleanup !== null) {\n this.eventCleanup();\n }\n // Delete all animation and state machine instances\n this.stop();\n if (this.artboard) {\n this.artboard.delete();\n this.artboard = null;\n }\n };\n /**\n * Tries to query the setup Artboard for a text run node with the given name.\n *\n * @param textRunName - Name of the text run node associated with a text object\n * @returns - TextValueRun node or undefined if the text run cannot be queried\n */\n Rive.prototype.retrieveTextRun = function (textRunName) {\n var _a;\n if (!textRunName) {\n console.warn(\"No text run name provided\");\n return;\n }\n if (!this.artboard) {\n console.warn(\"Tried to access text run, but the Artboard is null\");\n return;\n }\n var textRun = this.artboard.textRun(textRunName);\n if (!textRun) {\n console.warn(\"Could not access a text run with name '\".concat(textRunName, \"' in the '\").concat((_a = this.artboard) === null || _a === void 0 ? void 0 : _a.name, \"' Artboard. Note that you must rename a text run node in the Rive editor to make it queryable at runtime.\"));\n return;\n }\n return textRun;\n };\n /**\n * Returns a string from a given text run node name, or undefined if the text run\n * cannot be queried.\n *\n * @param textRunName - Name of the text run node associated with a text object\n * @returns - String value of the text run node or undefined\n */\n Rive.prototype.getTextRunValue = function (textRunName) {\n var textRun = this.retrieveTextRun(textRunName);\n return textRun ? textRun.text : undefined;\n };\n /**\n * Sets a text value for a given text run node name if possible\n *\n * @param textRunName - Name of the text run node associated with a text object\n * @param textRunValue - String value to set on the text run node\n */\n Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {\n var textRun = this.retrieveTextRun(textRunName);\n if (textRun) {\n textRun.text = textRunValue;\n }\n };\n // Plays specified animations; if none specified, it unpauses everything.\n Rive.prototype.play = function (animationNames, autoplay) {\n var _this = this;\n animationNames = mapToStringArray(animationNames);\n // If the file's not loaded, queue up the play\n if (!this.readyForPlaying) {\n this.taskQueue.add({\n action: function () { return _this.play(animationNames, autoplay); },\n });\n return;\n }\n this.animator.play(animationNames);\n if (this.eventCleanup) {\n this.eventCleanup();\n }\n this.setupRiveListeners();\n this.startRendering();\n };\n // Pauses specified animations; if none specified, pauses all.\n Rive.prototype.pause = function (animationNames) {\n var _this = this;\n animationNames = mapToStringArray(animationNames);\n // If the file's not loaded, early out, nothing to pause\n if (!this.readyForPlaying) {\n this.taskQueue.add({\n action: function () { return _this.pause(animationNames); },\n });\n return;\n }\n if (this.eventCleanup) {\n this.eventCleanup();\n }\n this.animator.pause(animationNames);\n };\n Rive.prototype.scrub = function (animationNames, value) {\n var _this = this;\n animationNames = mapToStringArray(animationNames);\n // If the file's not loaded, early out, nothing to pause\n if (!this.readyForPlaying) {\n this.taskQueue.add({\n action: function () { return _this.scrub(animationNames, value); },\n });\n return;\n }\n // Scrub the animation time; we draw a single frame here so that if\n // nothing's currently playing, the scrubbed animation is still rendered/\n this.animator.scrub(animationNames, value || 0);\n this.drawFrame();\n };\n // Stops specified animations; if none specifies, stops them all.\n Rive.prototype.stop = function (animationNames) {\n var _this = this;\n animationNames = mapToStringArray(animationNames);\n // If the file's not loaded, early out, nothing to pause\n if (!this.readyForPlaying) {\n this.taskQueue.add({\n action: function () { return _this.stop(animationNames); },\n });\n return;\n }\n // If there is no artboard, this.animator will be undefined\n if (this.animator) {\n this.animator.stop(animationNames);\n }\n if (this.eventCleanup) {\n this.eventCleanup();\n }\n };\n /**\n * Resets the animation\n * @param artboard the name of the artboard, or default if none given\n * @param animations the names of animations for playback\n * @param stateMachines the names of state machines for playback\n * @param autoplay whether to autoplay when reset, defaults to false\n *\n */\n Rive.prototype.reset = function (params) {\n var _a;\n // Get the current artboard, animations, state machines, and playback states\n var artBoardName = params === null || params === void 0 ? void 0 : params.artboard;\n var animationNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.animations);\n var stateMachineNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.stateMachines);\n var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;\n // Stop everything and clean up\n this.cleanupInstances();\n // Reinitialize an artboard instance with the state\n this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay);\n this.taskQueue.process();\n };\n // Loads a new Rive file, keeping listeners in place\n Rive.prototype.load = function (params) {\n this.file = null;\n // Stop all animations\n this.stop();\n // Reinitialize\n this.init(params);\n };\n Object.defineProperty(Rive.prototype, \"layout\", {\n /**\n * Returns the current layout. Note that layout should be treated as\n * immutable. If you want to change the layout, create a new one use the\n * layout setter\n */\n get: function () {\n return this._layout;\n },\n // Sets a new layout\n set: function (layout) {\n this._layout = layout;\n // If the maxX or maxY are 0, then set them to the canvas width and height\n if (!layout.maxX || !layout.maxY) {\n this.resizeToCanvas();\n }\n if (this.loaded && !this.animator.isPlaying) {\n this.drawFrame();\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Sets the layout bounds to the current canvas size; this is typically called\n * when the canvas is resized\n */\n Rive.prototype.resizeToCanvas = function () {\n this._layout = this.layout.copyWith({\n minX: 0,\n minY: 0,\n maxX: this.canvas.width,\n maxY: this.canvas.height,\n });\n };\n /**\n * Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.\n * Uses the size of the backing canvas to set new width/height attributes. Need to re-render\n * and resize the layout to match the new drawing surface afterwards.\n * Useful function for consumers to include in a window resize listener.\n *\n * This method will set the {@link devicePixelRatioUsed} property.\n *\n * Optionally, you can provide a {@link customDevicePixelRatio} to provide a\n * custom value.\n */\n Rive.prototype.resizeDrawingSurfaceToCanvas = function (customDevicePixelRatio) {\n if (this.canvas instanceof HTMLCanvasElement && !!window) {\n var _a = this.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;\n var dpr = customDevicePixelRatio || window.devicePixelRatio || 1;\n this.devicePixelRatioUsed = dpr;\n this.canvas.width = dpr * width;\n this.canvas.height = dpr * height;\n this.resizeToCanvas();\n this.drawFrame();\n if (this.layout.fit === Fit.Layout) {\n var scaleFactor = this._layout.layoutScaleFactor;\n this.artboard.width = width / scaleFactor;\n this.artboard.height = height / scaleFactor;\n }\n }\n };\n Object.defineProperty(Rive.prototype, \"source\", {\n // Returns the animation source, which may be undefined\n get: function () {\n return this.src;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"activeArtboard\", {\n /**\n * Returns the name of the active artboard\n */\n get: function () {\n return this.artboard ? this.artboard.name : \"\";\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"animationNames\", {\n // Returns a list of animation names on the chosen artboard\n get: function () {\n // If the file's not loaded, we got nothing to return\n if (!this.loaded || !this.artboard) {\n return [];\n }\n var animationNames = [];\n for (var i = 0; i < this.artboard.animationCount(); i++) {\n animationNames.push(this.artboard.animationByIndex(i).name);\n }\n return animationNames;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"stateMachineNames\", {\n /**\n * Returns a list of state machine names from the current artboard\n */\n get: function () {\n // If the file's not loaded, we got nothing to return\n if (!this.loaded || !this.artboard) {\n return [];\n }\n var stateMachineNames = [];\n for (var i = 0; i < this.artboard.stateMachineCount(); i++) {\n stateMachineNames.push(this.artboard.stateMachineByIndex(i).name);\n }\n return stateMachineNames;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Returns the inputs for the specified instanced state machine, or an empty\n * list if the name is invalid or the state machine is not instanced\n * @param name the state machine name\n * @returns the inputs for the named state machine\n */\n Rive.prototype.stateMachineInputs = function (name) {\n // If the file's not loaded, early out, nothing to pause\n if (!this.loaded) {\n return;\n }\n var stateMachine = this.animator.stateMachines.find(function (m) { return m.name === name; });\n return stateMachine === null || stateMachine === void 0 ? void 0 : stateMachine.inputs;\n };\n // Returns the input with the provided name at the given path\n Rive.prototype.retrieveInputAtPath = function (name, path) {\n if (!name) {\n console.warn(\"No input name provided for path '\".concat(path, \"'\"));\n return;\n }\n if (!this.artboard) {\n console.warn(\"Tried to access input: '\".concat(name, \"', at path: '\").concat(path, \"', but the Artboard is null\"));\n return;\n }\n var input = this.artboard.inputByPath(name, path);\n if (!input) {\n console.warn(\"Could not access an input with name: '\".concat(name, \"', at path:'\").concat(path, \"'\"));\n return;\n }\n return input;\n };\n /**\n * Set the boolean input with the provided name at the given path with value\n * @param input the state machine input name\n * @param value the value to set the input to\n * @param path the path the input is located at an artboard level\n */\n Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {\n var input = this.retrieveInputAtPath(inputName, path);\n if (!input)\n return;\n if (input.type === StateMachineInputType.Boolean) {\n input.asBool().value = value;\n }\n else {\n console.warn(\"Input with name: '\".concat(inputName, \"', at path:'\").concat(path, \"' is not a boolean\"));\n }\n };\n /**\n * Set the number input with the provided name at the given path with value\n * @param input the state machine input name\n * @param value the value to set the input to\n * @param path the path the input is located at an artboard level\n */\n Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {\n var input = this.retrieveInputAtPath(inputName, path);\n if (!input)\n return;\n if (input.type === StateMachineInputType.Number) {\n input.asNumber().value = value;\n }\n else {\n console.warn(\"Input with name: '\".concat(inputName, \"', at path:'\").concat(path, \"' is not a number\"));\n }\n };\n /**\n * Fire the trigger with the provided name at the given path\n * @param input the state machine input name\n * @param path the path the input is located at an artboard level\n */\n Rive.prototype.fireStateAtPath = function (inputName, path) {\n var input = this.retrieveInputAtPath(inputName, path);\n if (!input)\n return;\n if (input.type === StateMachineInputType.Trigger) {\n input.asTrigger().fire();\n }\n else {\n console.warn(\"Input with name: '\".concat(inputName, \"', at path:'\").concat(path, \"' is not a trigger\"));\n }\n };\n // Returns the TextValueRun object for the provided name at the given path\n Rive.prototype.retrieveTextAtPath = function (name, path) {\n if (!name) {\n console.warn(\"No text name provided for path '\".concat(path, \"'\"));\n return;\n }\n if (!path) {\n console.warn(\"No path provided for text '\".concat(name, \"'\"));\n return;\n }\n if (!this.artboard) {\n console.warn(\"Tried to access text: '\".concat(name, \"', at path: '\").concat(path, \"', but the Artboard is null\"));\n return;\n }\n var text = this.artboard.textByPath(name, path);\n if (!text) {\n console.warn(\"Could not access text with name: '\".concat(name, \"', at path:'\").concat(path, \"'\"));\n return;\n }\n return text;\n };\n /**\n * Retrieves the text value for a specified text run at a given path\n * @param textName The name of the text run\n * @param path The path to the text run within the artboard\n * @returns The text value of the text run, or undefined if not found\n *\n * @example\n * // Get the text value for a text run named \"title\" at one nested artboard deep\n * const titleText = riveInstance.getTextRunValueAtPath(\"title\", \"artboard1\");\n *\n * @example\n * // Get the text value for a text run named \"subtitle\" within a nested group two artboards deep\n * const subtitleText = riveInstance.getTextRunValueAtPath(\"subtitle\", \"group/nestedGroup\");\n *\n * @remarks\n * If the text run cannot be found at the specified path, a warning will be logged to the console.\n */\n Rive.prototype.getTextRunValueAtPath = function (textName, path) {\n var run = this.retrieveTextAtPath(textName, path);\n if (!run) {\n console.warn(\"Could not get text with name: '\".concat(textName, \"', at path:'\").concat(path, \"'\"));\n return;\n }\n return run.text;\n };\n /**\n * Sets the text value for a specified text run at a given path\n * @param textName The name of the text run\n * @param value The new text value to set\n * @param path The path to the text run within the artboard\n * @returns void\n *\n * @example\n * // Set the text value for a text run named \"title\" at one nested artboard deep\n * riveInstance.setTextRunValueAtPath(\"title\", \"New Title\", \"artboard1\");\n *\n * @example\n * // Set the text value for a text run named \"subtitle\" within a nested group two artboards deep\n * riveInstance.setTextRunValueAtPath(\"subtitle\", \"New Subtitle\", \"group/nestedGroup\");\n *\n * @remarks\n * If the text run cannot be found at the specified path, a warning will be logged to the console.\n */\n Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {\n var run = this.retrieveTextAtPath(textName, path);\n if (!run) {\n console.warn(\"Could not set text with name: '\".concat(textName, \"', at path:'\").concat(path, \"'\"));\n return;\n }\n run.text = value;\n };\n Object.defineProperty(Rive.prototype, \"playingStateMachineNames\", {\n // Returns a list of playing machine names\n get: function () {\n // If the file's not loaded, we got nothing to return\n if (!this.loaded) {\n return [];\n }\n return this.animator.stateMachines\n .filter(function (m) { return m.playing; })\n .map(function (m) { return m.name; });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"playingAnimationNames\", {\n // Returns a list of playing animation names\n get: function () {\n // If the file's not loaded, we got nothing to return\n if (!this.loaded) {\n return [];\n }\n return this.animator.animations.filter(function (a) { return a.playing; }).map(function (a) { return a.name; });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"pausedAnimationNames\", {\n // Returns a list of paused animation names\n get: function () {\n // If the file's not loaded, we got nothing to return\n if (!this.loaded) {\n return [];\n }\n return this.animator.animations\n .filter(function (a) { return !a.playing; })\n .map(function (a) { return a.name; });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"pausedStateMachineNames\", {\n /**\n * Returns a list of paused machine names\n * @returns a list of state machine names that are paused\n */\n get: function () {\n // If the file's not loaded, we got nothing to return\n if (!this.loaded) {\n return [];\n }\n return this.animator.stateMachines\n .filter(function (m) { return !m.playing; })\n .map(function (m) { return m.name; });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"isPlaying\", {\n /**\n * @returns true if any animation is playing\n */\n get: function () {\n return this.animator.isPlaying;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"isPaused\", {\n /**\n * @returns true if all instanced animations are paused\n */\n get: function () {\n return this.animator.isPaused;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"isStopped\", {\n /**\n * @returns true if no animations are playing or paused\n */\n get: function () {\n return this.animator.isStopped;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"bounds\", {\n /**\n * @returns the bounds of the current artboard, or undefined if the artboard\n * isn't loaded yet.\n */\n get: function () {\n return this.artboard ? this.artboard.bounds : undefined;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Subscribe to Rive-generated events\n * @param type the type of event to subscribe to\n * @param callback callback to fire when the event occurs\n */\n Rive.prototype.on = function (type, callback) {\n this.eventManager.add({\n type: type,\n callback: callback,\n });\n };\n /**\n * Unsubscribes from a Rive-generated event\n * @param type the type of event to unsubscribe from\n * @param callback the callback to unsubscribe\n */\n Rive.prototype.off = function (type, callback) {\n this.eventManager.remove({\n type: type,\n callback: callback,\n });\n };\n /**\n * Unsubscribes from a Rive-generated event\n * @deprecated\n * @param callback the callback to unsubscribe from\n */\n Rive.prototype.unsubscribe = function (type, callback) {\n console.warn(\"This function is deprecated: please use `off()` instead.\");\n this.off(type, callback);\n };\n /**\n * Unsubscribes all Rive listeners from an event type, or everything if no type is\n * given\n * @param type the type of event to unsubscribe from, or all types if\n * undefined\n */\n Rive.prototype.removeAllRiveEventListeners = function (type) {\n this.eventManager.removeAll(type);\n };\n /**\n * Unsubscribes all listeners from an event type, or everything if no type is\n * given\n * @deprecated\n * @param type the type of event to unsubscribe from, or all types if\n * undefined\n */\n Rive.prototype.unsubscribeAll = function (type) {\n console.warn(\"This function is deprecated: please use `removeAllRiveEventListeners()` instead.\");\n this.removeAllRiveEventListeners(type);\n };\n /**\n * Stops the rendering loop; this is different from pausing in that it doesn't\n * change the state of any animation. It stops rendering from occurring. This\n * is designed for situations such as when Rive isn't visible.\n *\n * The only way to start rendering again is to call `startRendering`.\n * Animations that are marked as playing will start from the position that\n * they would have been at if rendering had not been stopped.\n */\n Rive.prototype.stopRendering = function () {\n if (this.loaded && this.frameRequestId) {\n if (this.runtime.cancelAnimationFrame) {\n this.runtime.cancelAnimationFrame(this.frameRequestId);\n }\n else {\n cancelAnimationFrame(this.frameRequestId);\n }\n this.frameRequestId = null;\n }\n };\n /**\n * Starts the rendering loop if it has been previously stopped. If the\n * renderer is already active, then this will have zero effect.\n */\n Rive.prototype.startRendering = function () {\n if (this.loaded && this.artboard && !this.frameRequestId) {\n if (this.runtime.requestAnimationFrame) {\n this.frameRequestId = this.runtime.requestAnimationFrame(this._boundDraw);\n }\n else {\n this.frameRequestId = requestAnimationFrame(this._boundDraw);\n }\n }\n };\n /**\n * Enables frames-per-second (FPS) reporting for the runtime\n * If no callback is provided, Rive will append a fixed-position div at the top-right corner of\n * the page with the FPS reading\n * @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value\n */\n Rive.prototype.enableFPSCounter = function (fpsCallback) {\n this.runtime.enableFPSCounter(fpsCallback);\n };\n /**\n * Disables frames-per-second (FPS) reporting for the runtime\n */\n Rive.prototype.disableFPSCounter = function () {\n this.runtime.disableFPSCounter();\n };\n Object.defineProperty(Rive.prototype, \"contents\", {\n /**\n * Returns the contents of a Rive file: the artboards, animations, and state machines\n */\n get: function () {\n if (!this.loaded) {\n return undefined;\n }\n var riveContents = {\n artboards: [],\n };\n for (var i = 0; i < this.file.artboardCount(); i++) {\n var artboard = this.file.artboardByIndex(i);\n var artboardContents = {\n name: artboard.name,\n animations: [],\n stateMachines: [],\n };\n for (var j = 0; j < artboard.animationCount(); j++) {\n var animation = artboard.animationByIndex(j);\n artboardContents.animations.push(animation.name);\n }\n for (var k = 0; k < artboard.stateMachineCount(); k++) {\n var stateMachine = artboard.stateMachineByIndex(k);\n var name_1 = stateMachine.name;\n var instance = new this.runtime.StateMachineInstance(stateMachine, artboard);\n var inputContents = [];\n for (var l = 0; l < instance.inputCount(); l++) {\n var input = instance.input(l);\n inputContents.push({ name: input.name, type: input.type });\n }\n artboardContents.stateMachines.push({\n name: name_1,\n inputs: inputContents,\n });\n }\n riveContents.artboards.push(artboardContents);\n }\n return riveContents;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"volume\", {\n /**\n * Getter / Setter for the volume of the artboard\n */\n get: function () {\n if (this.artboard && this.artboard.volume !== this._volume) {\n this._volume = this.artboard.volume;\n }\n return this._volume;\n },\n set: function (value) {\n this._volume = value;\n if (this.artboard) {\n this.artboard.volume = value * audioManager.systemVolume;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"artboardWidth\", {\n /**\n * The width of the artboard.\n *\n * This will return 0 if the artboard is not loaded yet and a custom\n * width has not been set.\n *\n * Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}\n * with a {@link Layout.fit} of {@link Fit.Layout}, as the artboard width is\n * automatically set.\n */\n get: function () {\n var _a;\n if (this.artboard) {\n return this.artboard.width;\n }\n return (_a = this._artboardWidth) !== null && _a !== void 0 ? _a : 0;\n },\n set: function (value) {\n this._artboardWidth = value;\n if (this.artboard) {\n this.artboard.width = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rive.prototype, \"artboardHeight\", {\n /**\n * The height of the artboard.\n *\n * This will return 0 if the artboard is not loaded yet and a custom\n * height has not been set.\n *\n * Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}\n * with a {@link Layout.fit} of {@link Fit.Layout}, as the artboard height is\n * automatically set.\n */\n get: function () {\n var _a;\n if (this.artboard) {\n return this.artboard.height;\n }\n return (_a = this._artboardHeight) !== null && _a !== void 0 ? _a : 0;\n },\n set: function (value) {\n this._artboardHeight = value;\n if (this.artboard) {\n this.artboard.height = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Reset the artboard size to its original values.\n */\n Rive.prototype.resetArtboardSize = function () {\n if (this.artboard) {\n this.artboard.resetArtboardSize();\n this._artboardWidth = this.artboard.width;\n this._artboardHeight = this.artboard.height;\n }\n else {\n // If the artboard isn't loaded, we need to reset the custom width and height\n this._artboardWidth = undefined;\n this._artboardHeight = undefined;\n }\n };\n Object.defineProperty(Rive.prototype, \"devicePixelRatioUsed\", {\n /**\n * The device pixel ratio used in rendering and canvas/artboard resizing.\n *\n * This value will be overidden by the device pixel ratio used in\n * {@link resizeDrawingSurfaceToCanvas}. If you use that method, do not set this value.\n */\n get: function () {\n return this._devicePixelRatioUsed;\n },\n set: function (value) {\n this._devicePixelRatioUsed = value;\n },\n enumerable: false,\n configurable: true\n });\n // Error message for missing source or buffer\n Rive.missingErrorMessage = \"Rive source file or data buffer required\";\n // Error message for removed rive file\n Rive.cleanupErrorMessage = \"Attempt to use file after calling cleanup.\";\n return Rive;\n}());\n\n// Loads Rive data from a URI via fetch.\nvar loadRiveFile = function (src) { return __awaiter(void 0, void 0, void 0, function () {\n var req, res, buffer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n req = new Request(src);\n return [4 /*yield*/, fetch(req)];\n case 1:\n res = _a.sent();\n return [4 /*yield*/, res.arrayBuffer()];\n case 2:\n buffer = _a.sent();\n return [2 /*return*/, buffer];\n }\n });\n}); };\n// #endregion\n// #region utility functions\n/*\n * Utility function to ensure an object is a string array\n */\nvar mapToStringArray = function (obj) {\n if (typeof obj === \"string\") {\n return [obj];\n }\n else if (obj instanceof Array) {\n return obj;\n }\n // If obj is undefined, return empty array\n return [];\n};\n// #endregion\n// #region testing utilities\n// Exports to only be used for tests\nvar Testing = {\n EventManager: EventManager,\n TaskQueueManager: TaskQueueManager,\n};\n// #endregion\n// #region asset loaders\n/**\n * Decodes bytes into an audio asset.\n *\n * Be sure to call `.unref()` on the audio once it is no longer needed. This\n * allows the engine to clean it up when it is not used by any more animations.\n */\nvar decodeAudio = function (bytes) {\n return new Promise(function (resolve) {\n return RuntimeLoader.getInstance(function (rive) {\n rive.decodeAudio(bytes, resolve);\n });\n });\n};\n/**\n * Decodes bytes into an image.\n *\n * Be sure to call `.unref()` on the image once it is no longer needed. This\n * allows the engine to clean it up when it is not used by any more animations.\n */\nvar decodeImage = function (bytes) {\n return new Promise(function (resolve) {\n return RuntimeLoader.getInstance(function (rive) {\n rive.decodeImage(bytes, resolve);\n });\n });\n};\n/**\n * Decodes bytes into a font.\n *\n * Be sure to call `.unref()` on the font once it is no longer needed. This\n * allows the engine to clean it up when it is not used by any more animations.\n */\nvar decodeFont = function (bytes) {\n return new Promise(function (resolve) {\n return RuntimeLoader.getInstance(function (rive) {\n rive.decodeFont(bytes, resolve);\n });\n });\n};\n// #endregion\n\n})();\n\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});\n//# sourceMappingURL=rive.js.map","Object.defineProperty(exports,\"__esModule\",{value:!0});var e=require(\"react\"),t=require(\"@rive-app/canvas\");function n(e){return e&&\"object\"==typeof e&&\"default\"in e?e:{default:e}}var i=/*#__PURE__*/n(e),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&r[r.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]0&&e.height>0&&e.top<(window.innerHeight||document.documentElement.clientHeight)&&e.bottom>0&&e.left<(window.innerWidth||document.documentElement.clientWidth)&&e.right>0&&(null==d||d.startRendering(),t=!1)}};return u&&!1!==p.shouldUseIntersectionObserver&&x(u,function(i){i.isIntersecting?d&&d.startRendering():d&&d.stopRendering(),t=!i.isIntersecting,clearTimeout(e),i.isIntersecting||0!==i.boundingClientRect.width||(e=setTimeout(n,10))}),function(){u&&T(u)}},[x,T,d,u,p.shouldUseIntersectionObserver]),e.useEffect(function(){return function(){d&&(d.cleanup(),v(null))}},[d,u]);var P=null==n?void 0:n.animations;e.useEffect(function(){d&&P&&(d.isPlaying?(d.stop(d.animationNames),d.play(P)):d.isPaused&&(d.stop(d.animationNames),d.pause(P)))},[P,d]);var L=e.useCallback(function(e){return i.default.createElement(E,r({setContainerRef:R,setCanvasRef:m},e))},[m,R]);return{canvas:u,container:l.current,setCanvasRef:m,setContainerRef:R,rive:d,RiveComponent:L}}exports.default=function(e){var t=e.src,n=e.artboard,a=e.animations,u=e.stateMachines,s=e.layout,c=e.useOffscreenRenderer,l=void 0===c||c,f=e.shouldDisableRiveListeners,d=void 0!==f&&f,v=e.shouldResizeCanvasToContainer,h=void 0===v||v,p=e.automaticallyHandleEvents,b=void 0!==p&&p,w=e.children,y=o(e,[\"src\",\"artboard\",\"animations\",\"stateMachines\",\"layout\",\"useOffscreenRenderer\",\"shouldDisableRiveListeners\",\"shouldResizeCanvasToContainer\",\"automaticallyHandleEvents\",\"children\"]),g=O({src:t,artboard:n,animations:a,layout:s,stateMachines:u,autoplay:!0,shouldDisableRiveListeners:d,automaticallyHandleEvents:b},{useOffscreenRenderer:l,shouldResizeCanvasToContainer:h}).RiveComponent;return i.default.createElement(g,r({},y),w)},exports.useResizeCanvas=w,exports.useRive=O,exports.useRiveFile=function(n){var i=this,r=e.useState(null),o=r[0],s=r[1],c=e.useState(\"idle\"),l=c[0],f=c[1];return e.useEffect(function(){var e=null;return a(i,void 0,void 0,function(){return u(this,function(i){try{f(\"loading\"),(e=new t.RiveFile(n)).init(),e.on(t.EventType.Load,function(){null==e||e.getInstance(),s(e),f(\"success\")}),e.on(t.EventType.LoadError,function(){f(\"failed\")}),s(e)}catch(e){console.error(e),f(\"failed\")}return[2]})}),function(){null==e||e.cleanup()}},[n.src,n.buffer]),{riveFile:o,status:l}},exports.useStateMachineInput=function(n,i,r,o){var a=e.useState(null),u=a[0],s=a[1];return e.useEffect(function(){function e(){if(n&&i&&r||s(null),n&&i&&r){var e=n.stateMachineInputs(i);if(e){var t=e.find(function(e){return e.name===r});void 0!==o&&t&&(t.value=o),s(t||null)}}else s(null)}e(),n&&n.on(t.EventType.Load,function(){e()})},[n]),u},Object.keys(t).forEach(function(e){\"default\"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});\n","/**\n * @remix-run/router v1.14.2\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, index];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(branches[i],\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n safelyDecodeURI(pathname));\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname) {\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n if (!match) return null;\n Object.assign(matchedParams, match.params);\n let route = meta.route;\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:([\\w-]+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = safelyDecodeURIComponent(value || \"\", paramName);\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:([\\w-]+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction safelyDecodeURI(value) {\n try {\n return decodeURI(value);\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\nfunction safelyDecodeURIComponent(value, paramName) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(false, \"The value for the URL param \\\"\" + paramName + \"\\\" will not be decoded because\" + (\" the string \\\"\" + value + \"\\\" is a malformed URL segment. This is probably\") + (\" due to a bad percent encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n// Return the array of pathnames for the current route matches - used to\n// generate the routePathnames input for resolveTo()\nfunction getResolveToMatches(matches, v7_relativeSplatPath) {\n let pathMatches = getPathContributingMatches(matches);\n // When v7_relativeSplatPath is enabled, use the full pathname for the leaf\n // match so we include splat values for \".\" links. See:\n // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329\n if (v7_relativeSplatPath) {\n return pathMatches.map((match, idx) => idx === matches.length - 1 ? match.pathname : match.pathnameBase);\n }\n return pathMatches.map(match => match.pathnameBase);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n if (!isPathRelative && toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_partialHydration: false,\n v7_prependBasename: false,\n v7_relativeSplatPath: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialErrors = null;\n if (initialMatches == null) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n let initialized;\n let hasLazyRoutes = initialMatches.some(m => m.route.lazy);\n let hasLoaders = initialMatches.some(m => m.route.loader);\n if (hasLazyRoutes) {\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n initialized = false;\n } else if (!hasLoaders) {\n // If we've got no loaders to run, then we're good to go\n initialized = true;\n } else if (future.v7_partialHydration) {\n // If partial hydration is enabled, we're initialized so long as we were\n // provided with hydrationData for every route with a loader, and no loaders\n // were marked for explicit hydration\n let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n let errors = init.hydrationData ? init.hydrationData.errors : null;\n initialized = initialMatches.every(m => m.route.loader && m.route.loader.hydrate !== true && (loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined));\n } else {\n // Without partial hydration - we're initialized if we were provided any\n // hydrationData - which is expected to be complete\n initialized = init.hydrationData != null;\n }\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = [];\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let ignoreNextHistoryUpdate = false;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n ignoreNextHistoryUpdate = true;\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked\n init.history.go(delta);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location, {\n initialHydration: true\n });\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n unstable_viewTransitionOpts: opts.viewTransitionOpts,\n unstable_flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n cancelledFetcherLoads = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.unstable_flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.unstable_viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial load will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n }, {\n flushSync\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionData;\n let pendingError;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingError = {\n [findNearestBoundary(matches).route.id]: opts.pendingError\n };\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionOutput = await handleAction(request, location, opts.submission, matches, {\n replace: opts.replace,\n flushSync\n });\n if (actionOutput.shortCircuited) {\n return;\n }\n pendingActionData = actionOutput.pendingActionData;\n pendingError = actionOutput.pendingActionError;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = false;\n // Create a GET request for the loaders\n request = new Request(request.url, {\n signal: request.signal\n });\n }\n // Call loaders\n let {\n shortCircuited,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionData, pendingError);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n }, {\n flushSync: opts.flushSync === true\n });\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n replace = result.location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(state, result, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions are REPLACE navigations, but if the\n // action threw an error that'll be rendered in an errorElement, we fall\n // back to PUSH so that the user can use the back button to get back to\n // the pre-submission form location to try again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n // Send back an empty object we can use to clear out any prior actionData\n pendingActionData: {},\n pendingActionError: {\n [boundaryMatch.route.id]: result.error\n }\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n return {\n pendingActionData: {\n [actionMatch.route.id]: result.data\n }\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionData, pendingError) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingError || null\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n return {\n shortCircuited: true\n };\n }\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n // If we have partialHydration enabled, then don't update the state for the\n // initial data load since iot's not a \"navigation\"\n if (!isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration)) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n let actionData = pendingActionData || state.actionData;\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData ? Object.keys(actionData).length === 0 ? {\n actionData: null\n } : {\n actionData\n } : {}, revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n if (fetchControllers.has(rf.key)) {\n abortFetcher(rf.key);\n }\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(results);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n await startRedirectNavigation(state, redirect.result, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n if (fetchControllers.has(key)) abortFetcher(key);\n let flushSync = (opts && opts.unstable_flushSync) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }), {\n flushSync\n });\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n let match = getTargetMatch(matches, path);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, flushSync, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, flushSync, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, flushSync, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n if (!match.route.action && !match.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {\n flushSync\n });\n // Call the action for the fetcher\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResult = await callLoaderOrAction(\"action\", fetchRequest, match, requestMatches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath);\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n // When using v7_fetcherPersist, we don't want errors bubbling up to the UI\n // or redirects processed for unmounted fetchers so we just revert them to\n // idle\n if (future.v7_fetcherPersist && deletedFetchers.has(key)) {\n if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // Let SuccessResult's fall through for revalidation\n } else {\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n updateFetcherState(key, getLoadingFetcher(submission));\n return startRedirectNavigation(state, actionResult, {\n fetcherSubmission: submission\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, {\n [match.route.id]: actionResult.data\n }, undefined // No need to send through errors since we short circuit above\n );\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n if (fetchControllers.has(staleKey)) {\n abortFetcher(staleKey);\n }\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(results);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n return startRedirectNavigation(state, redirect.result);\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n fetchers: new Map(state.fetchers)\n });\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, flushSync, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n // Call the loader for this fetcher route match\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let result = await callLoaderOrAction(\"loader\", fetchRequest, match, matches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath);\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // We don't want errors bubbling up or redirects followed for unmounted\n // fetchers, so short circuit here if it was removed from the UI\n if (deletedFetchers.has(key)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(state, result);\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n setFetcherError(key, routeId, result.error);\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n updateFetcherState(key, getDoneFetcher(result.data));\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(state, redirect, _temp2) {\n let {\n submission,\n fetcherSubmission,\n replace\n } = _temp2 === void 0 ? {} : _temp2;\n if (redirect.revalidate) {\n isRevalidationRequired = true;\n }\n let redirectLocation = createLocation(state.location, redirect.location, {\n _isRedirect: true\n });\n invariant(redirectLocation, \"Expected a location on the redirect navigation\");\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.reloadDocument) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(redirect.location)) {\n const url = init.history.createURL(redirect.location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(redirect.location);\n } else {\n routerWindow.location.assign(redirect.location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType\n } = state.navigation;\n if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {\n submission = getSubmissionFromNavigation(state.navigation);\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n let activeSubmission = submission || fetcherSubmission;\n if (redirectPreserveMethodStatusCodes.has(redirect.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: redirect.location\n }),\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else {\n // If we have a navigation submission, we will preserve it through the\n // redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, submission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Send fetcher submissions through for shouldRevalidate\n fetcherSubmission,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n }\n }\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n // Call all navigation loaders and revalidating fetcher loaders in parallel,\n // then slice off the results into separate arrays so we can handle them\n // accordingly\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath)), ...fetchersToLoad.map(f => {\n if (f.matches && f.match && f.controller) {\n return callLoaderOrAction(\"loader\", createClientSideRequest(init.history, f.path, f.controller.signal), f.match, f.matches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath);\n } else {\n let error = {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n };\n return error;\n }\n })]);\n let loaderResults = results.slice(0, matchesToLoad.length);\n let fetcherResults = results.slice(matchesToLoad.length);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]);\n return {\n results,\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.push(key);\n abortFetcher(key);\n }\n });\n }\n function updateFetcherState(key, fetcher, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function setFetcherError(key, routeId, error, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function getFetcher(key) {\n if (future.v7_fetcherPersist) {\n activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n // If this fetcher was previously marked for deletion, unmark it since we\n // have a new instance\n if (deletedFetchers.has(key)) {\n deletedFetchers.delete(key);\n }\n }\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n deletedFetchers.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n if (future.v7_fetcherPersist) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n } else {\n activeFetchers.set(key, count);\n }\n } else {\n deleteFetcher(key);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n invariant(controller, \"Expected fetch controller: \" + key);\n controller.abort();\n fetchControllers.delete(key);\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n router = {\n get basename() {\n return basename;\n },\n get future() {\n return future;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n get window() {\n return routerWindow;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher: deleteFetcherAndUpdateState,\n dispose,\n getBlocker,\n deleteBlocker,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Config driven behavior flags\n let future = _extends({\n v7_relativeSplatPath: false\n }, opts ? opts.future : null);\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n */\n async function query(request, _temp3) {\n let {\n requestContext\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n */\n async function queryRoute(request, _temp4) {\n let {\n routeId,\n requestContext\n } = _temp4 === void 0 ? {} : _temp4;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction, we throw\n // it to bail out and then return or throw here based on whether the user\n // returned or threw\n if (isQueryRouteResponse(e)) {\n if (e.type === ResultType.error) {\n throw e.response;\n }\n return e.response;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath, {\n isStaticRequest: true,\n isRouteRequest,\n requestContext\n });\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.status,\n headers: {\n Location: result.location\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(request, matches, requestContext, undefined, {\n [boundaryMatch.route.id]: result.error\n });\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n let context = await loadRouteData(loaderRequest, matches, requestContext);\n return _extends({}, context, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionData: {\n [actionMatch.route.id]: result.data\n },\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n async function loadRouteData(request, matches, requestContext, routeMatch, pendingActionError) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : getLoaderMatchesUntilBoundary(matches, Object.keys(pendingActionError || {})[0]);\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionError || null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, manifest, mapRouteProperties, basename, future.v7_relativeSplatPath, {\n isStaticRequest: true,\n isRouteRequest,\n requestContext\n }))]);\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, matchesToLoad, results, pendingActionError, activeDeferreds);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId) {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Add an ?index param for matched index routes if we don't already have one\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref3) => {\n let [name, value] = _ref3;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, isInitialLoad, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError) {\n let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryId = pendingError ? Object.keys(pendingError)[0] : undefined;\n let boundaryMatches = getLoaderMatchesUntilBoundary(matches, boundaryId);\n let navigationMatches = boundaryMatches.filter((match, index) => {\n let {\n route\n } = match;\n if (route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (route.loader == null) {\n return false;\n }\n if (isInitialLoad) {\n if (route.loader.hydrate) {\n return true;\n }\n return state.loaderData[route.id] === undefined && (\n // Don't re-run if the loader ran and threw an error\n !state.errors || state.errors[route.id] === undefined);\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n defaultShouldRevalidate:\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired ||\n // Clicked the same link, resubmitted a GET form\n currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate:\n // - on initial load (shouldn't be any fetchers then anyway)\n // - if fetcher won't be present in the subsequent render\n // - no longer matches the URL (v7_fetcherPersist=false)\n // - was unmounted but persisted due to v7_fetcherPersist=true\n if (isInitialLoad || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.includes(key)) {\n // Always revalidate if the fetcher was cancelled\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n defaultShouldRevalidate: isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\nasync function callLoaderOrAction(type, request, match, matches, manifest, mapRouteProperties, basename, v7_relativeSplatPath, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let resultType;\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n return Promise.race([handler({\n request,\n params: match.params,\n context: opts.requestContext\n }), abortPromise]);\n };\n try {\n let handler = match.route[type];\n if (match.route.lazy) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let handlerError;\n let values = await Promise.all([\n // If the handler throws, don't let it immediately bubble out,\n // since we need to let the lazy() execution finish so we know if this\n // route has a boundary that can handle the error\n runHandler(handler).catch(e => {\n handlerError = e;\n }), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]);\n if (handlerError) {\n throw handlerError;\n }\n result = values[0];\n } else {\n // Load lazy route module, then run any returned handler\n await loadLazyRouteModule(match.route, mapRouteProperties, manifest);\n handler = match.route[type];\n if (handler) {\n // Handler still run even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n data: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n resultType = ResultType.error;\n result = e;\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n if (isResponse(result)) {\n let status = result.status;\n // Process redirects\n if (redirectStatusCodes.has(status)) {\n let location = result.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n // Support relative routing in internal redirects\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n location = normalizeTo(new URL(request.url), matches.slice(0, matches.indexOf(match) + 1), basename, true, location, v7_relativeSplatPath);\n } else if (!opts.isStaticRequest) {\n // Strip off the protocol+origin for same-origin + same-basename absolute\n // redirects. If this is a static request, we can let it go back to the\n // browser as-is\n let currentUrl = new URL(request.url);\n let url = location.startsWith(\"//\") ? new URL(currentUrl.protocol + location) : new URL(location);\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n location = url.pathname + url.search + url.hash;\n }\n }\n // Don't process redirects in the router during static requests requests.\n // Instead, throw the Response and let the server handle it with an HTTP\n // redirect. We also update the Location header in place in this flow so\n // basename and relative routing is taken into account\n if (opts.isStaticRequest) {\n result.headers.set(\"Location\", location);\n throw result;\n }\n return {\n type: ResultType.redirect,\n status,\n location,\n revalidate: result.headers.get(\"X-Remix-Revalidate\") !== null,\n reloadDocument: result.headers.get(\"X-Remix-Reload-Document\") !== null\n };\n }\n // For SSR single-route requests, we want to hand Responses back directly\n // without unwrapping. We do this with the QueryRouteResponse wrapper\n // interface so we can know whether it was returned or thrown\n if (opts.isRouteRequest) {\n let queryRouteResponse = {\n type: resultType === ResultType.error ? ResultType.error : ResultType.data,\n response: result\n };\n throw queryRouteResponse;\n }\n let data;\n try {\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n if (result.body == null) {\n data = null;\n } else {\n data = await result.json();\n }\n } else {\n data = await result.text();\n }\n } catch (e) {\n return {\n type: ResultType.error,\n error: e\n };\n }\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: new ErrorResponseImpl(status, result.statusText, data),\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: result\n };\n }\n if (isDeferredData(result)) {\n var _result$init, _result$init2;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: ((_result$init2 = result.init) == null ? void 0 : _result$init2.headers) && new Headers(result.init.headers)\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n // Process loader results into state.loaderData/state.errors\n results.forEach((result, index) => {\n let id = matchesToLoad[index].route.id;\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n // Look upwards from the matched route for the closest ancestor\n // error boundary, defaulting to the root match\n let boundaryMatch = findNearestBoundary(matches, id);\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError) {\n error = Object.values(pendingError)[0];\n pendingError = undefined;\n }\n errors = errors || {};\n // Prefer higher error values if lower errors bubble to the same boundary\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n } else {\n loaderData[id] = result.data;\n }\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError) {\n errors = pendingError;\n loaderData[Object.keys(pendingError)[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, matchesToLoad, results, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds);\n // Process results from our revalidating fetchers\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match,\n controller\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index];\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp5) {\n let {\n pathname,\n routeId,\n method,\n type\n } = _temp5 === void 0 ? {} : _temp5;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return {\n result,\n idx: i\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isQueryRouteResponse(obj) {\n return obj && isResponse(obj.response) && (obj.type === ResultType.data || obj.type === ResultType.error);\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n let signal = signals[index];\n invariant(signal, \"Expected an AbortSignal for revalidating fetcher deferred result\");\n await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n try {\n let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n if (sessionPositions) {\n let json = JSON.parse(sessionPositions);\n for (let [k, v] of Object.entries(json || {})) {\n if (v && Array.isArray(v)) {\n transitions.set(k, new Set(v || []));\n }\n }\n }\n } catch (e) {\n // no-op, use default empty object\n }\n}\nfunction persistAppliedTransitions(_window, transitions) {\n if (transitions.size > 0) {\n let json = {};\n for (let [k, v] of transitions) {\n json[k] = [...v];\n }\n try {\n _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n } catch (error) {\n warning(false, \"Failed to save applied view transitions in sessionStorage (\" + error + \").\");\n }\n }\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.21.2\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level `` API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a ``.\n *\n * @see https://reactrouter.com/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * ``.\n *\n * @see https://reactrouter.com/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by ``s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n future,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by `` to render child routes.\n *\n * @see https://reactrouter.com/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n future\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an `` to render their child route's\n * element.\n *\n * @see https://reactrouter.com/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState, future) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under ) but the \") + \"parent route path has no trailing \\\"*\\\". This means if you navigate \" + \"deeper, the parent won't match anymore and therefore the child \" + \"routes will never render.\\n\\n\" + (\"Please change the parent to .\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = parentPathnameBase === \"/\" ? pathname : pathname.slice(parentPathnameBase.length) || \"/\";\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \" + \"does not have an element or Component. This means it will render an with a \" + \"null value by default resulting in an \\\"empty\\\" page.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState, future);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error !== undefined ? props.error : state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState, future) {\n var _dataRouterState2;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (future === void 0) {\n future = null;\n }\n if (matches == null) {\n var _dataRouterState;\n if ((_dataRouterState = dataRouterState) != null && _dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState2 = dataRouterState) == null ? void 0 : _dataRouterState2.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n // If we're in a partial hydration mode, detect if we need to render down to\n // a given HydrateFallback while we load the rest of the hydration data\n let renderFallback = false;\n let fallbackIndex = -1;\n if (dataRouterState && future && future.v7_partialHydration) {\n for (let i = 0; i < renderedMatches.length; i++) {\n let match = renderedMatches[i];\n // Track the deepest fallback up until the first route without data\n if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {\n fallbackIndex = i;\n }\n if (match.route.id) {\n let {\n loaderData,\n errors\n } = dataRouterState;\n let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);\n if (match.route.lazy || needsToRunLoader) {\n // We found the first route that's not ready to render (waiting on\n // lazy, or has a loader that hasn't run yet). Flag that we need to\n // render a fallback and render up until the appropriate fallback\n renderFallback = true;\n if (fallbackIndex >= 0) {\n renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n } else {\n renderedMatches = [renderedMatches[0]];\n }\n break;\n }\n }\n }\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n // Only data routers handle errors/fallbacks\n let error;\n let shouldRenderHydrateFallback = false;\n let errorElement = null;\n let hydrateFallbackElement = null;\n if (dataRouterState) {\n error = errors && match.route.id ? errors[match.route.id] : undefined;\n errorElement = match.route.errorElement || defaultErrorElement;\n if (renderFallback) {\n if (fallbackIndex < 0 && index === 0) {\n warningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = null;\n } else if (fallbackIndex === index) {\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = match.route.hydrateFallbackElement || null;\n }\n }\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (shouldRenderHydrateFallback) {\n children = hydrateFallbackElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n return state.actionData ? state.actionData[routeId] : undefined;\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error !== undefined) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor `` value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor `` value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n if (v7_startTransition && startTransitionImpl) {\n startTransitionImpl(() => setStateImpl(newState));\n } else {\n setStateImpl(newState);\n }\n }, [setStateImpl, v7_startTransition]);\n\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a