{"version":3,"file":"main.js","sources":["../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/deflate.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/inflate.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/configuration.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/util/mime-type.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/crc32.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/util/encode-text.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/sjcl.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/aes-crypto.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/zip-crypto.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/codec.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/codec-pool-worker.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/codecs/codec-pool.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/io.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/constants.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/util/cp437-decode.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/util/decode-text.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/engine.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/zip-entry.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/zip-reader.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/core/zip-writer.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/zip-fs.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/lib/z-worker-inline.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@zip.js+zip.js@2.4.1/node_modules/@zip.js/zip.js/index.js","../../../../music_apps_mono_repo/libs/ts_utils/dist/index.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/base-event.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/sync-event.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/EventQueue.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/queued-event.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/async-event.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/objects.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/any-event.js","../../../../music_apps_mono_repo/node_modules/.pnpm/ts-events@3.4.1/node_modules/ts-events/dist/lib/index.js","../../../../music_apps_mono_repo/node_modules/.pnpm/fix-webm-duration@1.0.5/node_modules/fix-webm-duration/fix-webm-duration.js","../../../../music_apps_mono_repo/libs/audio_output/dist/index.mjs","../../../../music_apps_mono_repo/libs/audio_utils/dist/index.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/extensions/Extensions.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/environment-browser/browserExt.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/environment-webworker/webworkerExt.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/point/ObservablePoint.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/misc/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/point/Point.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/matrix/Matrix.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/matrix/groupD8.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/shapes/Rectangle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/data/uid.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/logging/deprecation.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/misc/NOOP.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/misc/pow2.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureStyle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/definedProps.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/BufferImageSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureMatrix.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/data/updateQuadBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/@pixi+colord@2.9.6/node_modules/@pixi/colord/index.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/color/Color.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/@pixi+colord@2.9.6/node_modules/@pixi/colord/plugins/names.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/pool/Pool.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/pool/PoolGroup.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/data/removeItems.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/FilterEffect.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/MaskEffectManager.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/bounds/Bounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/logging/warn.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/checkChildrenDidChange.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/instructions/InstructionSet.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/RenderGroup.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/Container.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/assignWithIgnore.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/culling/cullingMixin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite/Sprite.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/utils/addMaskBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/utils/addMaskLocalBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/alpha/AlphaMask.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/color/ColorMask.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/stencil/StencilMask.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/environment/adapter.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/environment-browser/BrowserAdapter.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/CanvasSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/ImageSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/ticker/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/ticker/TickerListener.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/ticker/Ticker.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/browser/detectVideoAlphaMode.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/VideoSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/utils/convertToList.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/cache/Cache.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/utils/textureFrom.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/path.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/utils/createStringVariations.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/utils/isSingleItem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/resolver/Resolver.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/utils/copySearchParams.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/spritesheet/Spritesheet.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/spritesheet/spritesheetAsset.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/spritesheet/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/FederatedEvent.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/ismobilejs@1.1.1/node_modules/ismobilejs/esm/isMobile.js","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/browser/isMobile.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/accessibility/AccessibilitySystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/accessibility/accessibilityTarget.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/utils/createIdFromString.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/getTestContext.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/getMaxFragmentPrecision.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/preprocessors/setProgramName.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlProgram.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/preprocessors/stripVersion.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/preprocessors/ensurePrecision.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/preprocessors/addProgramDefines.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/preprocessors/insertVersion.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/geometry/utils/getAttributeInfoFromFormat.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/extractAttributesFromGpuProgram.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/extractStructAndGroups.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/GpuProgram.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/removeStructAndGroupDuplicates.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/generateLayoutHash.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/generateGpuLayoutGroups.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/types.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/getDefaultUniformValue.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/UniformGroup.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/types.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/Shader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/state/State.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/Filter.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/environment/autoDetectEnvironment.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/browser/unsafeEvalSupported.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/earcut@2.2.4/node_modules/earcut/src/earcut.js","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/system/SystemRunner.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/system/AbstractRenderer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/browser/isWebGLSupported.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/browser/isWebGPUSupported.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/autoDetectRenderer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/global/globalHooks.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/app/Application.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/app/ResizePlugin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/app/TickerPlugin.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/AbstractBitmapFont.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/fill/FillGradient.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/fill/FillPattern.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/parse-svg-path@0.1.2/node_modules/parse-svg-path/index.js","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/shapes/Circle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/shapes/Polygon.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/gl/utils/checkMaxIfStatementsInShader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/gl/utils/maxRecommendedTextures.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/gpu/getTextureBatchBindGroup.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/data/ViewableBuffer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/buffer/utils/fastCopy.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/state/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/state/getAdjustedBlendModeBlend.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/shared/BatchTextureArray.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/shared/Batcher.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/buffer/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/buffer/Buffer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/geometry/utils/ensureIsBuffer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/geometry/Geometry.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/geometry/utils/getGeometryBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/shared/BatchGeometry.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/geometry/utils/transformVertices.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/BatchableGraphics.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/multiplyHexColors.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildCircle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildLine.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildPolygon.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildRectangle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildTriangle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/geometry/utils/buildUvs.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/GraphicsContextSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveBezier.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArc.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcToSvg.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/path/ShapePath.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/buildCommands/buildArcTo.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/path/roundShape.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/path/GraphicsPath.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/svg/SVGToGraphicsPath.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/svg/SVGParser.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/GraphicsContext.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/utils/generateTextStyleKey.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/TextStyle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/CanvasPool.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/canvas/utils/fontStringFromTextStyle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/canvas/CanvasTextMetrics.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/canvas/utils/getCanvasFillStyle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/utils/resolveCharacters.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/DynamicBitmapFont.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/utils/getBitmapTextLayout.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/BitmapFontManager.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/BitmapFont.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/asset/bitmapFontTextParser.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/asset/bitmapFontXMLParser.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/asset/bitmapFontXMLStringParser.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/asset/loadBitmapFont.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/BackgroundLoader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/Loader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/utils/checkDataUrl.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/utils/checkExtension.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/loadJson.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/loadWebFont.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/network/getResolutionOfUrl.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/textures/utils/createTexture.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/textures/loadSVG.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/_virtual/checkImageBitmap.worker.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/_virtual/loadImageBitmap.worker.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/workers/WorkerManager.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/textures/loadTextures.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/loader/parsers/textures/loadVideoTextures.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/resolver/parsers/resolveTextureUrl.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/resolver/parsers/resolveJsonUrl.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/assets/Assets.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/EventTicker.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/FederatedMouseEvent.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/FederatedPointerEvent.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/FederatedWheelEvent.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/EventBoundary.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/EventSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/FederatedEventTarget.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/FilterPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/FilterSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/mask/mask.frag.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/mask/mask.wgsl.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/mask/MaskFilter.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/mask/mask.vert.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/Graphics.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh/shared/MeshGeometry.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-animated/AnimatedSprite.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/AbstractText.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/Text.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/HtmlTextStyle.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/HTMLTextRenderData.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/addBits.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/compileHooks.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/compileInputs.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/compileOutputs.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/injectBits.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compiler/compileHighShader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/defaultProgramTemplate.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/shader-bits/globalUniformsBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/compileHighShaderToProgram.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/shader-bits/colorBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/shader-bits/generateTextureBatchBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/shader-bits/roundPixelsBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/getBatchSamplersUniformGroup.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/gl/GlBatchAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/gpu/GpuBatchAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/batcher/shared/BatcherPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/shader-bits/localUniformBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/high-shader/shader-bits/textureBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/buildInstructions.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/alpha/AlphaMaskPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/color/ColorMaskPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/mask/stencil/StencilMaskPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/buffer/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBuffer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/context/GlContextSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/ensureAttributes.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/geometry/utils/getGlTypeFromFormat.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/geometry/GlGeometrySystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/GlBackBufferSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/GlColorMaskSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/GlEncoderSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/GlRenderTarget.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/state/GpuStencilModesToPixi.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/GlStencilSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/UboSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/createUboElementsSTD40.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/uniformParsers.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/createUboSyncFunction.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/uboSyncFunctions.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/generateArraySyncSTD40.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/createUboSyncSTD40.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/GlUboSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/renderTarget/GlRenderTargetAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/utils/getCanvasTexture.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/renderTarget/RenderTarget.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/renderTarget/RenderTargetSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/renderTarget/isRenderingToScreen.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/calculateProjection.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/renderTarget/GlRenderTargetSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/buffer/BufferResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlProgramData.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/compileShader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/defaultValue.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/mapType.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/logProgramError.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/generateProgram.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/extractAttributesFromGlProgram.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/getUniformData.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/getUboData.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlShaderSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/GenerateShaderSyncCode.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/generateUniformsSyncTypes.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlUniformGroupSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/generateUniformsSync.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/state/GlStateSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/state/mapWebGLBlendModesToPixi.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/GlTexture.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadBufferImageResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadCompressedTextureResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadImageResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadVideoResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/pixiToGlMaps.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/applyStyleParams.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/GlTextureSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/mapFormatToGlInternalFormat.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/mapFormatToGlType.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/mapFormatToGlFormat.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/gl/GlGraphicsAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh/gl/GlMeshAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/CustomRenderPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/executeInstructions.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/RenderGroupPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/clearList.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/collectRenderGroups.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/mixColors.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/mixHexColors.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/updateRenderGroupTransforms.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/utils/validateRenderables.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/container/RenderGroupSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite/BatchableSprite.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite/SpritePipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/background/BackgroundSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/blendModes/BlendModePipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderTexture.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/extract/GenerateTextureSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/gpu/colorToUniform.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/renderTarget/GlobalUniformSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/sayHello.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/startup/HelloSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureGCSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/system/SharedSystems.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gl/WebGLRenderer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/BindGroupSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/buffer/GpuBufferSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/buffer/UboBatch.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuColorMaskSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuDeviceSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuEncoderSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuStencilSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/createUboElementsWGSL.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/generateArraySyncWGSL.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/utils/createUboSyncFunctionWGSL.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuUboSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/GpuUniformBatchPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/pipeline/PipelineSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/GpuRenderTarget.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/GpuRenderTargetAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/renderTarget/GpuRenderTargetSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/shader/GpuShaderSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/state/GpuBlendModesToPixi.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/state/GpuStateSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/gpu/GpuGraphicsAdaptor.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh/gpu/GpuMeshAdapter.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/gpu/WebGPURenderer.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/rendering/renderers/shared/texture/const.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/shared/GraphicsPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh/shared/BatchableMesh.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh/shared/MeshPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/TilingSpritePipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/utils/QuadGeometry.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/utils/setUvs.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/utils/applyMatrix.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/utils/setPositions.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/sdfShader/shader-bits/localUniformMSDFBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/sdfShader/shader-bits/mSDFBit.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/sdfShader/SdfShader.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/BitmapTextPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/HTMLTextPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/utils/getPo2TextureFromSource.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/HTMLTextSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/browser/isSafari.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/canvas/CanvasTextPipe.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/utils/canvas/getCanvasBoundingBox.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/canvas/CanvasTextSystem.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/rng.js","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/index.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/regex.js","../../../../music_apps_mono_repo/node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/stringify.js","../../../../music_apps_mono_repo/node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/validate.js","../../../../music_apps_mono_repo/node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/v4.js","../../../../music_apps_mono_repo/libs/score_data/dist/index.mjs","../../../../music_apps_mono_repo/libs/score_render/dist/index.mjs","../../../../music_apps_mono_repo/libs/audio_input/dist/index.mjs","../../../../music_apps_mono_repo/libs/sound_lib/dist/index.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/@tweenjs+tween.js@18.6.4/node_modules/@tweenjs/tween.js/dist/tween.esm.js","../../../../music_apps_mono_repo/libs/audio_sequencer/dist/index.mjs","../../../../music_apps_mono_repo/libs/score_performance/dist/index.mjs","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/settings/AppSettings.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/Templates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/AppContainer.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/appContainerTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/playerTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/songMenuTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/pixi_apps.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/audio/SfxPlayer.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/RaAssessmentVisualizer.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/RaAssessorFactory.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/dtos.ts","../../../../music_apps_mono_repo/node_modules/.pnpm/@firebase+util@1.4.3/node_modules/@firebase/util/dist/index.esm2017.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@firebase+component@0.5.10/node_modules/@firebase/component/dist/esm/index.esm2017.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@firebase+logger@0.3.2/node_modules/@firebase/logger/dist/esm/index.esm2017.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@firebase+app@0.7.16/node_modules/@firebase/app/dist/esm/index.esm2017.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.17.2_tslib@2.6.2_typescript@5.4.5/node_modules/tslib/tslib.es6.js","../../../../music_apps_mono_repo/node_modules/.pnpm/@firebase+auth@0.19.8_@firebase+app@0.7.16/node_modules/@firebase/auth/dist/esm2017/index-342f2197.js","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/services/firebase/FbAuth.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/services/Services.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/TeamDO.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/ContestEntryDO.ts","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/errors.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/formats.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/util.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/english.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/formatter.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/invalid.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/zone.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/zones/systemZone.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/zones/IANAZone.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/zones/fixedOffsetZone.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/zones/invalidZone.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/zoneUtil.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/settings.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/locale.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/regexParser.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/duration.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/interval.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/info.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/diff.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/digits.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/tokenParser.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/impl/conversions.js","../../../../music_apps_mono_repo/node_modules/.pnpm/luxon@2.3.0/node_modules/luxon/src/datetime.js","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/ContestManager.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/utilities/LocalStorageHelper.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/Student.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/StudentManager.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/RAButton.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/ScoreMessageBox.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/scoreMessageTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/RAPlayerSettingsWindow.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/playerSettingsTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/RAControls.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/SongDO.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/RAPlayer.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/fingerings/RecorderFingerings.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/fingerings/RecorderFingeringVisualizer.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/fingerings/FingeringDisplayManager.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/fingerings/FingeringVisualizerFactory.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/player/PlayerInitializer.ts","../../../../music_apps_mono_repo/node_modules/.pnpm/firebase@9.6.6/node_modules/firebase/app/dist/index.esm.js","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/services/firebase/FbInit.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/AddStudentDialog.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/addStudentTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/UserRole.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/AppUser.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/UiHelper.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/CreateAccountView.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/EmailConfirmationView.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/FinishAccountView.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/utilities/SubRemover.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/ConfirmationBox.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/confirmationTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/TimedMessageBox.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/ManageAccountView.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/SignInView.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/UserManager.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/user/ui/UserAccountDialog.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/userAccountTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/teams/TeamListItem.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/teamTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/teams/TeamsDialog.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/data/StudentSelectionWindow.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/ui/templates/studentSelectTemplates.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/songSelection/panel_items.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/songSelection/_LeadersSection.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/songSelection/SongPanel.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/songSelection/_SongsSidebar.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/songSelection/_SongSection.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/songSelection/MainMenu.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/RecorderAce.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/src/utilities/analytics.ts","../../../../music_apps_mono_repo/apps/recorder_ace/web/main.ts","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/accessibility/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/app/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/events/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/graphics/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/mesh/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-bitmap/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/text-html/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-tiling/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/scene/sprite-nine-slice/init.mjs","../../../../music_apps_mono_repo/node_modules/.pnpm/pixi.js@8.2.6/node_modules/pixi.js/lib/filters/init.mjs"],"sourcesContent":["/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * This program is based on JZlib 1.0.2 ymnk, JCraft,Inc.\n * JZlib is based on zlib-1.1.3, so all credit should go authors\n * Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)\n * and contributors of zlib.\n */\n\n\"use strict\";\n\n// Global\n\nconst MAX_BITS = 15;\nconst D_CODES = 30;\nconst BL_CODES = 19;\n\nconst LENGTH_CODES = 29;\nconst LITERALS = 256;\nconst L_CODES = (LITERALS + 1 + LENGTH_CODES);\nconst HEAP_SIZE = (2 * L_CODES + 1);\n\nconst END_BLOCK = 256;\n\n// Bit length codes must not exceed MAX_BL_BITS bits\nconst MAX_BL_BITS = 7;\n\n// repeat previous bit length 3-6 times (2 bits of repeat count)\nconst REP_3_6 = 16;\n\n// repeat a zero length 3-10 times (3 bits of repeat count)\nconst REPZ_3_10 = 17;\n\n// repeat a zero length 11-138 times (7 bits of repeat count)\nconst REPZ_11_138 = 18;\n\n// The lengths of the bit length codes are sent in order of decreasing\n// probability, to avoid transmitting the lengths for unused bit\n// length codes.\n\nconst Buf_size = 8 * 2;\n\n// JZlib version : \"1.0.2\"\nconst Z_DEFAULT_COMPRESSION = -1;\n\n// compression strategy\nconst Z_FILTERED = 1;\nconst Z_HUFFMAN_ONLY = 2;\nconst Z_DEFAULT_STRATEGY = 0;\n\nconst Z_NO_FLUSH = 0;\nconst Z_PARTIAL_FLUSH = 1;\nconst Z_FULL_FLUSH = 3;\nconst Z_FINISH = 4;\n\nconst Z_OK = 0;\nconst Z_STREAM_END = 1;\nconst Z_NEED_DICT = 2;\nconst Z_STREAM_ERROR = -2;\nconst Z_DATA_ERROR = -3;\nconst Z_BUF_ERROR = -5;\n\n// Tree\n\nfunction extractArray(array) {\n\treturn flatArray(array.map(([length, value]) => (new Array(length)).fill(value, 0, length)));\n}\n\nfunction flatArray(array) {\n\treturn array.reduce((a, b) => a.concat(Array.isArray(b) ? flatArray(b) : b), []);\n}\n\n// see definition of array dist_code below\nconst _dist_code = [0, 1, 2, 3].concat(...extractArray([\n\t[2, 4], [2, 5], [4, 6], [4, 7], [8, 8], [8, 9], [16, 10], [16, 11], [32, 12], [32, 13], [64, 14], [64, 15], [2, 0], [1, 16],\n\t[1, 17], [2, 18], [2, 19], [4, 20], [4, 21], [8, 22], [8, 23], [16, 24], [16, 25], [32, 26], [32, 27], [64, 28], [64, 29]\n]));\n\nfunction Tree() {\n\tconst that = this;\n\n\t// dyn_tree; // the dynamic tree\n\t// max_code; // largest code with non zero frequency\n\t// stat_desc; // the corresponding static tree\n\n\t// Compute the optimal bit lengths for a tree and update the total bit\n\t// length\n\t// for the current block.\n\t// IN assertion: the fields freq and dad are set, heap[heap_max] and\n\t// above are the tree nodes sorted by increasing frequency.\n\t// OUT assertions: the field len is set to the optimal bit length, the\n\t// array bl_count contains the frequencies for each bit length.\n\t// The length opt_len is updated; static_len is also updated if stree is\n\t// not null.\n\tfunction gen_bitlen(s) {\n\t\tconst tree = that.dyn_tree;\n\t\tconst stree = that.stat_desc.static_tree;\n\t\tconst extra = that.stat_desc.extra_bits;\n\t\tconst base = that.stat_desc.extra_base;\n\t\tconst max_length = that.stat_desc.max_length;\n\t\tlet h; // heap index\n\t\tlet n, m; // iterate over the tree elements\n\t\tlet bits; // bit length\n\t\tlet xbits; // extra bits\n\t\tlet f; // frequency\n\t\tlet overflow = 0; // number of elements with bit length too large\n\n\t\tfor (bits = 0; bits <= MAX_BITS; bits++)\n\t\t\ts.bl_count[bits] = 0;\n\n\t\t// In a first pass, compute the optimal bit lengths (which may\n\t\t// overflow in the case of the bit length tree).\n\t\ttree[s.heap[s.heap_max] * 2 + 1] = 0; // root of the heap\n\n\t\tfor (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n\t\t\tn = s.heap[h];\n\t\t\tbits = tree[tree[n * 2 + 1] * 2 + 1] + 1;\n\t\t\tif (bits > max_length) {\n\t\t\t\tbits = max_length;\n\t\t\t\toverflow++;\n\t\t\t}\n\t\t\ttree[n * 2 + 1] = bits;\n\t\t\t// We overwrite tree[n*2+1] which is no longer needed\n\n\t\t\tif (n > that.max_code)\n\t\t\t\tcontinue; // not a leaf node\n\n\t\t\ts.bl_count[bits]++;\n\t\t\txbits = 0;\n\t\t\tif (n >= base)\n\t\t\t\txbits = extra[n - base];\n\t\t\tf = tree[n * 2];\n\t\t\ts.opt_len += f * (bits + xbits);\n\t\t\tif (stree)\n\t\t\t\ts.static_len += f * (stree[n * 2 + 1] + xbits);\n\t\t}\n\t\tif (overflow === 0)\n\t\t\treturn;\n\n\t\t// This happens for example on obj2 and pic of the Calgary corpus\n\t\t// Find the first bit length which could increase:\n\t\tdo {\n\t\t\tbits = max_length - 1;\n\t\t\twhile (s.bl_count[bits] === 0)\n\t\t\t\tbits--;\n\t\t\ts.bl_count[bits]--; // move one leaf down the tree\n\t\t\ts.bl_count[bits + 1] += 2; // move one overflow item as its brother\n\t\t\ts.bl_count[max_length]--;\n\t\t\t// The brother of the overflow item also moves one step up,\n\t\t\t// but this does not affect bl_count[max_length]\n\t\t\toverflow -= 2;\n\t\t} while (overflow > 0);\n\n\t\tfor (bits = max_length; bits !== 0; bits--) {\n\t\t\tn = s.bl_count[bits];\n\t\t\twhile (n !== 0) {\n\t\t\t\tm = s.heap[--h];\n\t\t\t\tif (m > that.max_code)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (tree[m * 2 + 1] != bits) {\n\t\t\t\t\ts.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2];\n\t\t\t\t\ttree[m * 2 + 1] = bits;\n\t\t\t\t}\n\t\t\t\tn--;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Reverse the first len bits of a code, using straightforward code (a\n\t// faster\n\t// method would use a table)\n\t// IN assertion: 1 <= len <= 15\n\tfunction bi_reverse(code, // the value to invert\n\t\tlen // its bit length\n\t) {\n\t\tlet res = 0;\n\t\tdo {\n\t\t\tres |= code & 1;\n\t\t\tcode >>>= 1;\n\t\t\tres <<= 1;\n\t\t} while (--len > 0);\n\t\treturn res >>> 1;\n\t}\n\n\t// Generate the codes for a given tree and bit counts (which need not be\n\t// optimal).\n\t// IN assertion: the array bl_count contains the bit length statistics for\n\t// the given tree and the field len is set for all tree elements.\n\t// OUT assertion: the field code is set for all tree elements of non\n\t// zero code length.\n\tfunction gen_codes(tree, // the tree to decorate\n\t\tmax_code, // largest code with non zero frequency\n\t\tbl_count // number of codes at each bit length\n\t) {\n\t\tconst next_code = []; // next code value for each\n\t\t// bit length\n\t\tlet code = 0; // running code value\n\t\tlet bits; // bit index\n\t\tlet n; // code index\n\t\tlet len;\n\n\t\t// The distribution counts are first used to generate the code values\n\t\t// without bit reversal.\n\t\tfor (bits = 1; bits <= MAX_BITS; bits++) {\n\t\t\tnext_code[bits] = code = ((code + bl_count[bits - 1]) << 1);\n\t\t}\n\n\t\t// Check that the bit counts in bl_count are consistent. The last code\n\t\t// must be all ones.\n\t\t// Assert (code + bl_count[MAX_BITS]-1 == (1<= 1; n--)\n\t\t\ts.pqdownheap(tree, n);\n\n\t\t// Construct the Huffman tree by repeatedly combining the least two\n\t\t// frequent nodes.\n\n\t\tnode = elems; // next internal node of the tree\n\t\tdo {\n\t\t\t// n = node of least frequency\n\t\t\tn = s.heap[1];\n\t\t\ts.heap[1] = s.heap[s.heap_len--];\n\t\t\ts.pqdownheap(tree, 1);\n\t\t\tm = s.heap[1]; // m = node of next least frequency\n\n\t\t\ts.heap[--s.heap_max] = n; // keep the nodes sorted by frequency\n\t\t\ts.heap[--s.heap_max] = m;\n\n\t\t\t// Create a new node father of n and m\n\t\t\ttree[node * 2] = (tree[n * 2] + tree[m * 2]);\n\t\t\ts.depth[node] = Math.max(s.depth[n], s.depth[m]) + 1;\n\t\t\ttree[n * 2 + 1] = tree[m * 2 + 1] = node;\n\n\t\t\t// and insert the new node in the heap\n\t\t\ts.heap[1] = node++;\n\t\t\ts.pqdownheap(tree, 1);\n\t\t} while (s.heap_len >= 2);\n\n\t\ts.heap[--s.heap_max] = s.heap[1];\n\n\t\t// At this point, the fields freq and dad are set. We can now\n\t\t// generate the bit lengths.\n\n\t\tgen_bitlen(s);\n\n\t\t// The field len is now set, we can generate the bit codes\n\t\tgen_codes(tree, that.max_code, s.bl_count);\n\t};\n\n}\n\nTree._length_code = [0, 1, 2, 3, 4, 5, 6, 7].concat(...extractArray([\n\t[2, 8], [2, 9], [2, 10], [2, 11], [4, 12], [4, 13], [4, 14], [4, 15], [8, 16], [8, 17], [8, 18], [8, 19],\n\t[16, 20], [16, 21], [16, 22], [16, 23], [32, 24], [32, 25], [32, 26], [31, 27], [1, 28]]));\n\nTree.base_length = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0];\n\nTree.base_dist = [0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384,\n\t24576];\n\n// Mapping from a distance to a distance code. dist is the distance - 1 and\n// must not have side effects. _dist_code[256] and _dist_code[257] are never\n// used.\nTree.d_code = function (dist) {\n\treturn ((dist) < 256 ? _dist_code[dist] : _dist_code[256 + ((dist) >>> 7)]);\n};\n\n// extra bits for each length code\nTree.extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];\n\n// extra bits for each distance code\nTree.extra_dbits = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];\n\n// extra bits for each bit length code\nTree.extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];\n\nTree.bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n\n// StaticTree\n\nfunction StaticTree(static_tree, extra_bits, extra_base, elems, max_length) {\n\tconst that = this;\n\tthat.static_tree = static_tree;\n\tthat.extra_bits = extra_bits;\n\tthat.extra_base = extra_base;\n\tthat.elems = elems;\n\tthat.max_length = max_length;\n}\n\nStaticTree.static_ltree = [12, 8, 140, 8, 76, 8, 204, 8, 44, 8, 172, 8, 108, 8, 236, 8, 28, 8, 156, 8, 92, 8, 220, 8, 60, 8, 188, 8, 124, 8, 252, 8, 2, 8,\n\t130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8, 18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8, 10, 8, 138, 8, 74, 8, 202, 8, 42,\n\t8, 170, 8, 106, 8, 234, 8, 26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8, 6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8,\n\t22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8, 14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8, 30, 8, 158, 8, 94, 8,\n\t222, 8, 62, 8, 190, 8, 126, 8, 254, 8, 1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8, 17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113,\n\t8, 241, 8, 9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8, 25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8, 5, 8, 133, 8,\n\t69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8, 21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8, 13, 8, 141, 8, 77, 8, 205, 8, 45, 8,\n\t173, 8, 109, 8, 237, 8, 29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8, 19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9,\n\t51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9, 11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9, 43, 9, 299, 9, 171, 9,\n\t427, 9, 107, 9, 363, 9, 235, 9, 491, 9, 27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9, 59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379,\n\t9, 251, 9, 507, 9, 7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9, 39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9, 23,\n\t9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9, 55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9, 15, 9, 271, 9, 143, 9,\n\t399, 9, 79, 9, 335, 9, 207, 9, 463, 9, 47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9, 31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9,\n\t223, 9, 479, 9, 63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9, 0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7, 8, 7, 72, 7,\n\t40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7, 4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7, 3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8,\n\t99, 8, 227, 8];\n\nStaticTree.static_dtree = [0, 5, 16, 5, 8, 5, 24, 5, 4, 5, 20, 5, 12, 5, 28, 5, 2, 5, 18, 5, 10, 5, 26, 5, 6, 5, 22, 5, 14, 5, 30, 5, 1, 5, 17, 5, 9, 5,\n\t25, 5, 5, 5, 21, 5, 13, 5, 29, 5, 3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5];\n\nStaticTree.static_l_desc = new StaticTree(StaticTree.static_ltree, Tree.extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n\nStaticTree.static_d_desc = new StaticTree(StaticTree.static_dtree, Tree.extra_dbits, 0, D_CODES, MAX_BITS);\n\nStaticTree.static_bl_desc = new StaticTree(null, Tree.extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n// Deflate\n\nconst MAX_MEM_LEVEL = 9;\nconst DEF_MEM_LEVEL = 8;\n\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\tconst that = this;\n\tthat.good_length = good_length;\n\tthat.max_lazy = max_lazy;\n\tthat.nice_length = nice_length;\n\tthat.max_chain = max_chain;\n\tthat.func = func;\n}\n\nconst STORED = 0;\nconst FAST = 1;\nconst SLOW = 2;\nconst config_table = [\n\tnew Config(0, 0, 0, 0, STORED),\n\tnew Config(4, 4, 8, 4, FAST),\n\tnew Config(4, 5, 16, 8, FAST),\n\tnew Config(4, 6, 32, 32, FAST),\n\tnew Config(4, 4, 16, 16, SLOW),\n\tnew Config(8, 16, 32, 32, SLOW),\n\tnew Config(8, 16, 128, 128, SLOW),\n\tnew Config(8, 32, 128, 256, SLOW),\n\tnew Config(32, 128, 258, 1024, SLOW),\n\tnew Config(32, 258, 258, 4096, SLOW)\n];\n\nconst z_errmsg = [\"need dictionary\", // Z_NEED_DICT\n\t// 2\n\t\"stream end\", // Z_STREAM_END 1\n\t\"\", // Z_OK 0\n\t\"\", // Z_ERRNO (-1)\n\t\"stream error\", // Z_STREAM_ERROR (-2)\n\t\"data error\", // Z_DATA_ERROR (-3)\n\t\"\", // Z_MEM_ERROR (-4)\n\t\"buffer error\", // Z_BUF_ERROR (-5)\n\t\"\",// Z_VERSION_ERROR (-6)\n\t\"\"];\n\n// block not completed, need more input or more output\nconst NeedMore = 0;\n\n// block flush performed\nconst BlockDone = 1;\n\n// finish started, need only more output at next deflate\nconst FinishStarted = 2;\n\n// finish done, accept no more input or output\nconst FinishDone = 3;\n\n// preset dictionary flag in zlib header\nconst PRESET_DICT = 0x20;\n\nconst INIT_STATE = 42;\nconst BUSY_STATE = 113;\nconst FINISH_STATE = 666;\n\n// The deflate compression method\nconst Z_DEFLATED = 8;\n\nconst STORED_BLOCK = 0;\nconst STATIC_TREES = 1;\nconst DYN_TREES = 2;\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\nconst MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nfunction smaller(tree, n, m, depth) {\n\tconst tn2 = tree[n * 2];\n\tconst tm2 = tree[m * 2];\n\treturn (tn2 < tm2 || (tn2 == tm2 && depth[n] <= depth[m]));\n}\n\nfunction Deflate() {\n\n\tconst that = this;\n\tlet strm; // pointer back to this zlib stream\n\tlet status; // as the name implies\n\t// pending_buf; // output still pending\n\tlet pending_buf_size; // size of pending_buf\n\t// pending_out; // next pending byte to output to the stream\n\t// pending; // nb of bytes in the pending buffer\n\tlet last_flush; // value of flush param for previous deflate call\n\n\tlet w_size; // LZ77 window size (32K by default)\n\tlet w_bits; // log2(w_size) (8..16)\n\tlet w_mask; // w_size - 1\n\n\tlet window;\n\t// Sliding window. Input bytes are read into the second half of the window,\n\t// and move to the first half later to keep a dictionary of at least wSize\n\t// bytes. With this organization, matches are limited to a distance of\n\t// wSize-MAX_MATCH bytes, but this ensures that IO is always\n\t// performed with a length multiple of the block size. Also, it limits\n\t// the window size to 64K, which is quite useful on MSDOS.\n\t// To do: use the user input buffer as sliding window.\n\n\tlet window_size;\n\t// Actual size of window: 2*wSize, except when the user input buffer\n\t// is directly used as sliding window.\n\n\tlet prev;\n\t// Link to older string with same hash index. To limit the size of this\n\t// array to 64K, this link is maintained only for the last 32K strings.\n\t// An index in this array is thus a window index modulo 32K.\n\n\tlet head; // Heads of the hash chains or NIL.\n\n\tlet ins_h; // hash index of string to be inserted\n\tlet hash_size; // number of elements in hash table\n\tlet hash_bits; // log2(hash_size)\n\tlet hash_mask; // hash_size-1\n\n\t// Number of bits by which ins_h must be shifted at each input\n\t// step. It must be such that after MIN_MATCH steps, the oldest\n\t// byte no longer takes part in the hash key, that is:\n\t// hash_shift * MIN_MATCH >= hash_bits\n\tlet hash_shift;\n\n\t// Window position at the beginning of the current output block. Gets\n\t// negative when the window is moved backwards.\n\n\tlet block_start;\n\n\tlet match_length; // length of best match\n\tlet prev_match; // previous match\n\tlet match_available; // set if previous match exists\n\tlet strstart; // start of string to insert\n\tlet match_start; // start of matching string\n\tlet lookahead; // number of valid bytes ahead in window\n\n\t// Length of the best match at previous step. Matches not greater than this\n\t// are discarded. This is used in the lazy match evaluation.\n\tlet prev_length;\n\n\t// To speed up deflation, hash chains are never searched beyond this\n\t// length. A higher limit improves compression ratio but degrades the speed.\n\tlet max_chain_length;\n\n\t// Attempt to find a better match only when the current match is strictly\n\t// smaller than this value. This mechanism is used only for compression\n\t// levels >= 4.\n\tlet max_lazy_match;\n\n\t// Insert new strings in the hash table only if the match length is not\n\t// greater than this length. This saves time but degrades compression.\n\t// max_insert_length is used only for compression levels <= 3.\n\n\tlet level; // compression level (1..9)\n\tlet strategy; // favor or force Huffman coding\n\n\t// Use a faster search when the previous match is longer than this\n\tlet good_match;\n\n\t// Stop searching when current match exceeds this\n\tlet nice_match;\n\n\tlet dyn_ltree; // literal and length tree\n\tlet dyn_dtree; // distance tree\n\tlet bl_tree; // Huffman tree for bit lengths\n\n\tconst l_desc = new Tree(); // desc for literal tree\n\tconst d_desc = new Tree(); // desc for distance tree\n\tconst bl_desc = new Tree(); // desc for bit length tree\n\n\t// that.heap_len; // number of elements in the heap\n\t// that.heap_max; // element of largest frequency\n\t// The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n\t// The same heap array is used to build all trees.\n\n\t// Depth of each subtree used as tie breaker for trees of equal frequency\n\tthat.depth = [];\n\n\tlet l_buf; // index for literals or lengths */\n\n\t// Size of match buffer for literals/lengths. There are 4 reasons for\n\t// limiting lit_bufsize to 64K:\n\t// - frequencies can be kept in 16 bit counters\n\t// - if compression is not successful for the first block, all input\n\t// data is still in the window so we can still emit a stored block even\n\t// when input comes from standard input. (This can also be done for\n\t// all blocks if lit_bufsize is not greater than 32K.)\n\t// - if compression is not successful for a file smaller than 64K, we can\n\t// even emit a stored file instead of a stored block (saving 5 bytes).\n\t// This is applicable only for zip (not gzip or zlib).\n\t// - creating new Huffman trees less frequently may not provide fast\n\t// adaptation to changes in the input data statistics. (Take for\n\t// example a binary file with poorly compressible code followed by\n\t// a highly compressible string table.) Smaller buffer sizes give\n\t// fast adaptation but have of course the overhead of transmitting\n\t// trees more frequently.\n\t// - I can't count above 4\n\tlet lit_bufsize;\n\n\tlet last_lit; // running index in l_buf\n\n\t// Buffer for distances. To simplify the code, d_buf and l_buf have\n\t// the same number of elements. To use different lengths, an extra flag\n\t// array would be necessary.\n\n\tlet d_buf; // index of pendig_buf\n\n\t// that.opt_len; // bit length of current block with optimal trees\n\t// that.static_len; // bit length of current block with static trees\n\tlet matches; // number of string matches in current block\n\tlet last_eob_len; // bit length of EOB code for last block\n\n\t// Output buffer. bits are inserted starting at the bottom (least\n\t// significant bits).\n\tlet bi_buf;\n\n\t// Number of valid bits in bi_buf. All bits above the last valid bit\n\t// are always zero.\n\tlet bi_valid;\n\n\t// number of codes at each bit length for an optimal tree\n\tthat.bl_count = [];\n\n\t// heap used to build the Huffman trees\n\tthat.heap = [];\n\n\tdyn_ltree = [];\n\tdyn_dtree = [];\n\tbl_tree = [];\n\n\tfunction lm_init() {\n\t\twindow_size = 2 * w_size;\n\n\t\thead[hash_size - 1] = 0;\n\t\tfor (let i = 0; i < hash_size - 1; i++) {\n\t\t\thead[i] = 0;\n\t\t}\n\n\t\t// Set the default configuration parameters:\n\t\tmax_lazy_match = config_table[level].max_lazy;\n\t\tgood_match = config_table[level].good_length;\n\t\tnice_match = config_table[level].nice_length;\n\t\tmax_chain_length = config_table[level].max_chain;\n\n\t\tstrstart = 0;\n\t\tblock_start = 0;\n\t\tlookahead = 0;\n\t\tmatch_length = prev_length = MIN_MATCH - 1;\n\t\tmatch_available = 0;\n\t\tins_h = 0;\n\t}\n\n\tfunction init_block() {\n\t\tlet i;\n\t\t// Initialize the trees.\n\t\tfor (i = 0; i < L_CODES; i++)\n\t\t\tdyn_ltree[i * 2] = 0;\n\t\tfor (i = 0; i < D_CODES; i++)\n\t\t\tdyn_dtree[i * 2] = 0;\n\t\tfor (i = 0; i < BL_CODES; i++)\n\t\t\tbl_tree[i * 2] = 0;\n\n\t\tdyn_ltree[END_BLOCK * 2] = 1;\n\t\tthat.opt_len = that.static_len = 0;\n\t\tlast_lit = matches = 0;\n\t}\n\n\t// Initialize the tree data structures for a new zlib stream.\n\tfunction tr_init() {\n\n\t\tl_desc.dyn_tree = dyn_ltree;\n\t\tl_desc.stat_desc = StaticTree.static_l_desc;\n\n\t\td_desc.dyn_tree = dyn_dtree;\n\t\td_desc.stat_desc = StaticTree.static_d_desc;\n\n\t\tbl_desc.dyn_tree = bl_tree;\n\t\tbl_desc.stat_desc = StaticTree.static_bl_desc;\n\n\t\tbi_buf = 0;\n\t\tbi_valid = 0;\n\t\tlast_eob_len = 8; // enough lookahead for inflate\n\n\t\t// Initialize the first block of the first file:\n\t\tinit_block();\n\t}\n\n\t// Restore the heap property by moving down the tree starting at node k,\n\t// exchanging a node with the smallest of its two sons if necessary,\n\t// stopping\n\t// when the heap property is re-established (each father smaller than its\n\t// two sons).\n\tthat.pqdownheap = function (tree, // the tree to restore\n\t\tk // node to move down\n\t) {\n\t\tconst heap = that.heap;\n\t\tconst v = heap[k];\n\t\tlet j = k << 1; // left son of k\n\t\twhile (j <= that.heap_len) {\n\t\t\t// Set j to the smallest of the two sons:\n\t\t\tif (j < that.heap_len && smaller(tree, heap[j + 1], heap[j], that.depth)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\t// Exit if v is smaller than both sons\n\t\t\tif (smaller(tree, v, heap[j], that.depth))\n\t\t\t\tbreak;\n\n\t\t\t// Exchange v with the smallest son\n\t\t\theap[k] = heap[j];\n\t\t\tk = j;\n\t\t\t// And continue down the tree, setting j to the left son of k\n\t\t\tj <<= 1;\n\t\t}\n\t\theap[k] = v;\n\t};\n\n\t// Scan a literal or distance tree to determine the frequencies of the codes\n\t// in the bit length tree.\n\tfunction scan_tree(tree,// the tree to be scanned\n\t\tmax_code // and its largest code of non zero frequency\n\t) {\n\t\tlet prevlen = -1; // last emitted length\n\t\tlet curlen; // length of current code\n\t\tlet nextlen = tree[0 * 2 + 1]; // length of next code\n\t\tlet count = 0; // repeat count of the current code\n\t\tlet max_count = 7; // max repeat count\n\t\tlet min_count = 4; // min repeat count\n\n\t\tif (nextlen === 0) {\n\t\t\tmax_count = 138;\n\t\t\tmin_count = 3;\n\t\t}\n\t\ttree[(max_code + 1) * 2 + 1] = 0xffff; // guard\n\n\t\tfor (let n = 0; n <= max_code; n++) {\n\t\t\tcurlen = nextlen;\n\t\t\tnextlen = tree[(n + 1) * 2 + 1];\n\t\t\tif (++count < max_count && curlen == nextlen) {\n\t\t\t\tcontinue;\n\t\t\t} else if (count < min_count) {\n\t\t\t\tbl_tree[curlen * 2] += count;\n\t\t\t} else if (curlen !== 0) {\n\t\t\t\tif (curlen != prevlen)\n\t\t\t\t\tbl_tree[curlen * 2]++;\n\t\t\t\tbl_tree[REP_3_6 * 2]++;\n\t\t\t} else if (count <= 10) {\n\t\t\t\tbl_tree[REPZ_3_10 * 2]++;\n\t\t\t} else {\n\t\t\t\tbl_tree[REPZ_11_138 * 2]++;\n\t\t\t}\n\t\t\tcount = 0;\n\t\t\tprevlen = curlen;\n\t\t\tif (nextlen === 0) {\n\t\t\t\tmax_count = 138;\n\t\t\t\tmin_count = 3;\n\t\t\t} else if (curlen == nextlen) {\n\t\t\t\tmax_count = 6;\n\t\t\t\tmin_count = 3;\n\t\t\t} else {\n\t\t\t\tmax_count = 7;\n\t\t\t\tmin_count = 4;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Construct the Huffman tree for the bit lengths and return the index in\n\t// bl_order of the last bit length code to send.\n\tfunction build_bl_tree() {\n\t\tlet max_blindex; // index of last bit length code of non zero freq\n\n\t\t// Determine the bit length frequencies for literal and distance trees\n\t\tscan_tree(dyn_ltree, l_desc.max_code);\n\t\tscan_tree(dyn_dtree, d_desc.max_code);\n\n\t\t// Build the bit length tree:\n\t\tbl_desc.build_tree(that);\n\t\t// opt_len now includes the length of the tree representations, except\n\t\t// the lengths of the bit lengths codes and the 5+5+4 bits for the\n\t\t// counts.\n\n\t\t// Determine the number of bit length codes to send. The pkzip format\n\t\t// requires that at least 4 bit length codes be sent. (appnote.txt says\n\t\t// 3 but the actual value used is 4.)\n\t\tfor (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n\t\t\tif (bl_tree[Tree.bl_order[max_blindex] * 2 + 1] !== 0)\n\t\t\t\tbreak;\n\t\t}\n\t\t// Update opt_len to include the bit length tree and counts\n\t\tthat.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n\n\t\treturn max_blindex;\n\t}\n\n\t// Output a byte on the stream.\n\t// IN assertion: there is enough room in pending_buf.\n\tfunction put_byte(p) {\n\t\tthat.pending_buf[that.pending++] = p;\n\t}\n\n\tfunction put_short(w) {\n\t\tput_byte(w & 0xff);\n\t\tput_byte((w >>> 8) & 0xff);\n\t}\n\n\tfunction putShortMSB(b) {\n\t\tput_byte((b >> 8) & 0xff);\n\t\tput_byte((b & 0xff) & 0xff);\n\t}\n\n\tfunction send_bits(value, length) {\n\t\tlet val;\n\t\tconst len = length;\n\t\tif (bi_valid > Buf_size - len) {\n\t\t\tval = value;\n\t\t\t// bi_buf |= (val << bi_valid);\n\t\t\tbi_buf |= ((val << bi_valid) & 0xffff);\n\t\t\tput_short(bi_buf);\n\t\t\tbi_buf = val >>> (Buf_size - bi_valid);\n\t\t\tbi_valid += len - Buf_size;\n\t\t} else {\n\t\t\t// bi_buf |= (value) << bi_valid;\n\t\t\tbi_buf |= (((value) << bi_valid) & 0xffff);\n\t\t\tbi_valid += len;\n\t\t}\n\t}\n\n\tfunction send_code(c, tree) {\n\t\tconst c2 = c * 2;\n\t\tsend_bits(tree[c2] & 0xffff, tree[c2 + 1] & 0xffff);\n\t}\n\n\t// Send a literal or distance tree in compressed form, using the codes in\n\t// bl_tree.\n\tfunction send_tree(tree,// the tree to be sent\n\t\tmax_code // and its largest code of non zero frequency\n\t) {\n\t\tlet n; // iterates over all tree elements\n\t\tlet prevlen = -1; // last emitted length\n\t\tlet curlen; // length of current code\n\t\tlet nextlen = tree[0 * 2 + 1]; // length of next code\n\t\tlet count = 0; // repeat count of the current code\n\t\tlet max_count = 7; // max repeat count\n\t\tlet min_count = 4; // min repeat count\n\n\t\tif (nextlen === 0) {\n\t\t\tmax_count = 138;\n\t\t\tmin_count = 3;\n\t\t}\n\n\t\tfor (n = 0; n <= max_code; n++) {\n\t\t\tcurlen = nextlen;\n\t\t\tnextlen = tree[(n + 1) * 2 + 1];\n\t\t\tif (++count < max_count && curlen == nextlen) {\n\t\t\t\tcontinue;\n\t\t\t} else if (count < min_count) {\n\t\t\t\tdo {\n\t\t\t\t\tsend_code(curlen, bl_tree);\n\t\t\t\t} while (--count !== 0);\n\t\t\t} else if (curlen !== 0) {\n\t\t\t\tif (curlen != prevlen) {\n\t\t\t\t\tsend_code(curlen, bl_tree);\n\t\t\t\t\tcount--;\n\t\t\t\t}\n\t\t\t\tsend_code(REP_3_6, bl_tree);\n\t\t\t\tsend_bits(count - 3, 2);\n\t\t\t} else if (count <= 10) {\n\t\t\t\tsend_code(REPZ_3_10, bl_tree);\n\t\t\t\tsend_bits(count - 3, 3);\n\t\t\t} else {\n\t\t\t\tsend_code(REPZ_11_138, bl_tree);\n\t\t\t\tsend_bits(count - 11, 7);\n\t\t\t}\n\t\t\tcount = 0;\n\t\t\tprevlen = curlen;\n\t\t\tif (nextlen === 0) {\n\t\t\t\tmax_count = 138;\n\t\t\t\tmin_count = 3;\n\t\t\t} else if (curlen == nextlen) {\n\t\t\t\tmax_count = 6;\n\t\t\t\tmin_count = 3;\n\t\t\t} else {\n\t\t\t\tmax_count = 7;\n\t\t\t\tmin_count = 4;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Send the header for a block using dynamic Huffman trees: the counts, the\n\t// lengths of the bit length codes, the literal tree and the distance tree.\n\t// IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n\tfunction send_all_trees(lcodes, dcodes, blcodes) {\n\t\tlet rank; // index in bl_order\n\n\t\tsend_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt\n\t\tsend_bits(dcodes - 1, 5);\n\t\tsend_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt\n\t\tfor (rank = 0; rank < blcodes; rank++) {\n\t\t\tsend_bits(bl_tree[Tree.bl_order[rank] * 2 + 1], 3);\n\t\t}\n\t\tsend_tree(dyn_ltree, lcodes - 1); // literal tree\n\t\tsend_tree(dyn_dtree, dcodes - 1); // distance tree\n\t}\n\n\t// Flush the bit buffer, keeping at most 7 bits in it.\n\tfunction bi_flush() {\n\t\tif (bi_valid == 16) {\n\t\t\tput_short(bi_buf);\n\t\t\tbi_buf = 0;\n\t\t\tbi_valid = 0;\n\t\t} else if (bi_valid >= 8) {\n\t\t\tput_byte(bi_buf & 0xff);\n\t\t\tbi_buf >>>= 8;\n\t\t\tbi_valid -= 8;\n\t\t}\n\t}\n\n\t// Send one empty static block to give enough lookahead for inflate.\n\t// This takes 10 bits, of which 7 may remain in the bit buffer.\n\t// The current inflate code requires 9 bits of lookahead. If the\n\t// last two codes for the previous block (real code plus EOB) were coded\n\t// on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode\n\t// the last real code. In this case we send two empty static blocks instead\n\t// of one. (There are no problems if the previous block is stored or fixed.)\n\t// To simplify the code, we assume the worst case of last real code encoded\n\t// on one bit only.\n\tfunction _tr_align() {\n\t\tsend_bits(STATIC_TREES << 1, 3);\n\t\tsend_code(END_BLOCK, StaticTree.static_ltree);\n\n\t\tbi_flush();\n\n\t\t// Of the 10 bits for the empty block, we have already sent\n\t\t// (10 - bi_valid) bits. The lookahead for the last real code (before\n\t\t// the EOB of the previous block) was thus at least one plus the length\n\t\t// of the EOB plus what we have just sent of the empty static block.\n\t\tif (1 + last_eob_len + 10 - bi_valid < 9) {\n\t\t\tsend_bits(STATIC_TREES << 1, 3);\n\t\t\tsend_code(END_BLOCK, StaticTree.static_ltree);\n\t\t\tbi_flush();\n\t\t}\n\t\tlast_eob_len = 7;\n\t}\n\n\t// Save the match info and tally the frequency counts. Return true if\n\t// the current block must be flushed.\n\tfunction _tr_tally(dist, // distance of matched string\n\t\tlc // match length-MIN_MATCH or unmatched char (if dist==0)\n\t) {\n\t\tlet out_length, in_length, dcode;\n\t\tthat.pending_buf[d_buf + last_lit * 2] = (dist >>> 8) & 0xff;\n\t\tthat.pending_buf[d_buf + last_lit * 2 + 1] = dist & 0xff;\n\n\t\tthat.pending_buf[l_buf + last_lit] = lc & 0xff;\n\t\tlast_lit++;\n\n\t\tif (dist === 0) {\n\t\t\t// lc is the unmatched char\n\t\t\tdyn_ltree[lc * 2]++;\n\t\t} else {\n\t\t\tmatches++;\n\t\t\t// Here, lc is the match length - MIN_MATCH\n\t\t\tdist--; // dist = match distance - 1\n\t\t\tdyn_ltree[(Tree._length_code[lc] + LITERALS + 1) * 2]++;\n\t\t\tdyn_dtree[Tree.d_code(dist) * 2]++;\n\t\t}\n\n\t\tif ((last_lit & 0x1fff) === 0 && level > 2) {\n\t\t\t// Compute an upper bound for the compressed length\n\t\t\tout_length = last_lit * 8;\n\t\t\tin_length = strstart - block_start;\n\t\t\tfor (dcode = 0; dcode < D_CODES; dcode++) {\n\t\t\t\tout_length += dyn_dtree[dcode * 2] * (5 + Tree.extra_dbits[dcode]);\n\t\t\t}\n\t\t\tout_length >>>= 3;\n\t\t\tif ((matches < Math.floor(last_lit / 2)) && out_length < Math.floor(in_length / 2))\n\t\t\t\treturn true;\n\t\t}\n\n\t\treturn (last_lit == lit_bufsize - 1);\n\t\t// We avoid equality with lit_bufsize because of wraparound at 64K\n\t\t// on 16 bit machines and because stored blocks are restricted to\n\t\t// 64K-1 bytes.\n\t}\n\n\t// Send the block data compressed using the given Huffman trees\n\tfunction compress_block(ltree, dtree) {\n\t\tlet dist; // distance of matched string\n\t\tlet lc; // match length or unmatched char (if dist === 0)\n\t\tlet lx = 0; // running index in l_buf\n\t\tlet code; // the code to send\n\t\tlet extra; // number of extra bits to send\n\n\t\tif (last_lit !== 0) {\n\t\t\tdo {\n\t\t\t\tdist = ((that.pending_buf[d_buf + lx * 2] << 8) & 0xff00) | (that.pending_buf[d_buf + lx * 2 + 1] & 0xff);\n\t\t\t\tlc = (that.pending_buf[l_buf + lx]) & 0xff;\n\t\t\t\tlx++;\n\n\t\t\t\tif (dist === 0) {\n\t\t\t\t\tsend_code(lc, ltree); // send a literal byte\n\t\t\t\t} else {\n\t\t\t\t\t// Here, lc is the match length - MIN_MATCH\n\t\t\t\t\tcode = Tree._length_code[lc];\n\n\t\t\t\t\tsend_code(code + LITERALS + 1, ltree); // send the length\n\t\t\t\t\t// code\n\t\t\t\t\textra = Tree.extra_lbits[code];\n\t\t\t\t\tif (extra !== 0) {\n\t\t\t\t\t\tlc -= Tree.base_length[code];\n\t\t\t\t\t\tsend_bits(lc, extra); // send the extra length bits\n\t\t\t\t\t}\n\t\t\t\t\tdist--; // dist is now the match distance - 1\n\t\t\t\t\tcode = Tree.d_code(dist);\n\n\t\t\t\t\tsend_code(code, dtree); // send the distance code\n\t\t\t\t\textra = Tree.extra_dbits[code];\n\t\t\t\t\tif (extra !== 0) {\n\t\t\t\t\t\tdist -= Tree.base_dist[code];\n\t\t\t\t\t\tsend_bits(dist, extra); // send the extra distance bits\n\t\t\t\t\t}\n\t\t\t\t} // literal or match pair ?\n\n\t\t\t\t// Check that the overlay between pending_buf and d_buf+l_buf is\n\t\t\t\t// ok:\n\t\t\t} while (lx < last_lit);\n\t\t}\n\n\t\tsend_code(END_BLOCK, ltree);\n\t\tlast_eob_len = ltree[END_BLOCK * 2 + 1];\n\t}\n\n\t// Flush the bit buffer and align the output on a byte boundary\n\tfunction bi_windup() {\n\t\tif (bi_valid > 8) {\n\t\t\tput_short(bi_buf);\n\t\t} else if (bi_valid > 0) {\n\t\t\tput_byte(bi_buf & 0xff);\n\t\t}\n\t\tbi_buf = 0;\n\t\tbi_valid = 0;\n\t}\n\n\t// Copy a stored block, storing first the length and its\n\t// one's complement if requested.\n\tfunction copy_block(buf, // the input data\n\t\tlen, // its length\n\t\theader // true if block header must be written\n\t) {\n\t\tbi_windup(); // align on byte boundary\n\t\tlast_eob_len = 8; // enough lookahead for inflate\n\n\t\tif (header) {\n\t\t\tput_short(len);\n\t\t\tput_short(~len);\n\t\t}\n\n\t\tthat.pending_buf.set(window.subarray(buf, buf + len), that.pending);\n\t\tthat.pending += len;\n\t}\n\n\t// Send a stored block\n\tfunction _tr_stored_block(buf, // input block\n\t\tstored_len, // length of input block\n\t\teof // true if this is the last block for a file\n\t) {\n\t\tsend_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3); // send block type\n\t\tcopy_block(buf, stored_len, true); // with header\n\t}\n\n\t// Determine the best encoding for the current block: dynamic trees, static\n\t// trees or store, and output the encoded block to the zip file.\n\tfunction _tr_flush_block(buf, // input block, or NULL if too old\n\t\tstored_len, // length of input block\n\t\teof // true if this is the last block for a file\n\t) {\n\t\tlet opt_lenb, static_lenb;// opt_len and static_len in bytes\n\t\tlet max_blindex = 0; // index of last bit length code of non zero freq\n\n\t\t// Build the Huffman trees unless a stored block is forced\n\t\tif (level > 0) {\n\t\t\t// Construct the literal and distance trees\n\t\t\tl_desc.build_tree(that);\n\n\t\t\td_desc.build_tree(that);\n\n\t\t\t// At this point, opt_len and static_len are the total bit lengths\n\t\t\t// of\n\t\t\t// the compressed block data, excluding the tree representations.\n\n\t\t\t// Build the bit length tree for the above two trees, and get the\n\t\t\t// index\n\t\t\t// in bl_order of the last bit length code to send.\n\t\t\tmax_blindex = build_bl_tree();\n\n\t\t\t// Determine the best encoding. Compute first the block length in\n\t\t\t// bytes\n\t\t\topt_lenb = (that.opt_len + 3 + 7) >>> 3;\n\t\t\tstatic_lenb = (that.static_len + 3 + 7) >>> 3;\n\n\t\t\tif (static_lenb <= opt_lenb)\n\t\t\t\topt_lenb = static_lenb;\n\t\t} else {\n\t\t\topt_lenb = static_lenb = stored_len + 5; // force a stored block\n\t\t}\n\n\t\tif ((stored_len + 4 <= opt_lenb) && buf != -1) {\n\t\t\t// 4: two words for the lengths\n\t\t\t// The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n\t\t\t// Otherwise we can't have processed more than WSIZE input bytes\n\t\t\t// since\n\t\t\t// the last block flush, because compression would have been\n\t\t\t// successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n\t\t\t// transform a block into a stored block.\n\t\t\t_tr_stored_block(buf, stored_len, eof);\n\t\t} else if (static_lenb == opt_lenb) {\n\t\t\tsend_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3);\n\t\t\tcompress_block(StaticTree.static_ltree, StaticTree.static_dtree);\n\t\t} else {\n\t\t\tsend_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3);\n\t\t\tsend_all_trees(l_desc.max_code + 1, d_desc.max_code + 1, max_blindex + 1);\n\t\t\tcompress_block(dyn_ltree, dyn_dtree);\n\t\t}\n\n\t\t// The above check is made mod 2^32, for files larger than 512 MB\n\t\t// and uLong implemented on 32 bits.\n\n\t\tinit_block();\n\n\t\tif (eof) {\n\t\t\tbi_windup();\n\t\t}\n\t}\n\n\tfunction flush_block_only(eof) {\n\t\t_tr_flush_block(block_start >= 0 ? block_start : -1, strstart - block_start, eof);\n\t\tblock_start = strstart;\n\t\tstrm.flush_pending();\n\t}\n\n\t// Fill the window when the lookahead becomes insufficient.\n\t// Updates strstart and lookahead.\n\t//\n\t// IN assertion: lookahead < MIN_LOOKAHEAD\n\t// OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n\t// At least one byte has been read, or avail_in === 0; reads are\n\t// performed for at least two bytes (required for the zip translate_eol\n\t// option -- not supported here).\n\tfunction fill_window() {\n\t\tlet n, m;\n\t\tlet p;\n\t\tlet more; // Amount of free space at the end of the window.\n\n\t\tdo {\n\t\t\tmore = (window_size - lookahead - strstart);\n\n\t\t\t// Deal with !@#$% 64K limit:\n\t\t\tif (more === 0 && strstart === 0 && lookahead === 0) {\n\t\t\t\tmore = w_size;\n\t\t\t} else if (more == -1) {\n\t\t\t\t// Very unlikely, but possible on 16 bit machine if strstart ==\n\t\t\t\t// 0\n\t\t\t\t// and lookahead == 1 (input done one byte at time)\n\t\t\t\tmore--;\n\n\t\t\t\t// If the window is almost full and there is insufficient\n\t\t\t\t// lookahead,\n\t\t\t\t// move the upper half to the lower one to make room in the\n\t\t\t\t// upper half.\n\t\t\t} else if (strstart >= w_size + w_size - MIN_LOOKAHEAD) {\n\t\t\t\twindow.set(window.subarray(w_size, w_size + w_size), 0);\n\n\t\t\t\tmatch_start -= w_size;\n\t\t\t\tstrstart -= w_size; // we now have strstart >= MAX_DIST\n\t\t\t\tblock_start -= w_size;\n\n\t\t\t\t// Slide the hash table (could be avoided with 32 bit values\n\t\t\t\t// at the expense of memory usage). We slide even when level ==\n\t\t\t\t// 0\n\t\t\t\t// to keep the hash table consistent if we switch back to level\n\t\t\t\t// > 0\n\t\t\t\t// later. (Using level 0 permanently is not an optimal usage of\n\t\t\t\t// zlib, so we don't care about this pathological case.)\n\n\t\t\t\tn = hash_size;\n\t\t\t\tp = n;\n\t\t\t\tdo {\n\t\t\t\t\tm = (head[--p] & 0xffff);\n\t\t\t\t\thead[p] = (m >= w_size ? m - w_size : 0);\n\t\t\t\t} while (--n !== 0);\n\n\t\t\t\tn = w_size;\n\t\t\t\tp = n;\n\t\t\t\tdo {\n\t\t\t\t\tm = (prev[--p] & 0xffff);\n\t\t\t\t\tprev[p] = (m >= w_size ? m - w_size : 0);\n\t\t\t\t\t// If n is not on any hash chain, prev[n] is garbage but\n\t\t\t\t\t// its value will never be used.\n\t\t\t\t} while (--n !== 0);\n\t\t\t\tmore += w_size;\n\t\t\t}\n\n\t\t\tif (strm.avail_in === 0)\n\t\t\t\treturn;\n\n\t\t\t// If there was no sliding:\n\t\t\t// strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n\t\t\t// more == window_size - lookahead - strstart\n\t\t\t// => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n\t\t\t// => more >= window_size - 2*WSIZE + 2\n\t\t\t// In the BIG_MEM or MMAP case (not yet supported),\n\t\t\t// window_size == input_size + MIN_LOOKAHEAD &&\n\t\t\t// strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n\t\t\t// Otherwise, window_size == 2*WSIZE so more >= 2.\n\t\t\t// If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n\n\t\t\tn = strm.read_buf(window, strstart + lookahead, more);\n\t\t\tlookahead += n;\n\n\t\t\t// Initialize the hash value now that we have some input:\n\t\t\tif (lookahead >= MIN_MATCH) {\n\t\t\t\tins_h = window[strstart] & 0xff;\n\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;\n\t\t\t}\n\t\t\t// If the whole input has less than MIN_MATCH bytes, ins_h is\n\t\t\t// garbage,\n\t\t\t// but this is not important since only literal bytes will be\n\t\t\t// emitted.\n\t\t} while (lookahead < MIN_LOOKAHEAD && strm.avail_in !== 0);\n\t}\n\n\t// Copy without compression as much as possible from the input stream,\n\t// return\n\t// the current block state.\n\t// This function does not insert new strings in the dictionary since\n\t// uncompressible data is probably not useful. This function is used\n\t// only for the level=0 compression option.\n\t// NOTE: this function should be optimized to avoid extra copying from\n\t// window to pending_buf.\n\tfunction deflate_stored(flush) {\n\t\t// Stored blocks are limited to 0xffff bytes, pending_buf is limited\n\t\t// to pending_buf_size, and each stored block has a 5 byte header:\n\n\t\tlet max_block_size = 0xffff;\n\t\tlet max_start;\n\n\t\tif (max_block_size > pending_buf_size - 5) {\n\t\t\tmax_block_size = pending_buf_size - 5;\n\t\t}\n\n\t\t// Copy as much as possible from input to output:\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\t// Fill the window as much as possible:\n\t\t\tif (lookahead <= 1) {\n\t\t\t\tfill_window();\n\t\t\t\tif (lookahead === 0 && flush == Z_NO_FLUSH)\n\t\t\t\t\treturn NeedMore;\n\t\t\t\tif (lookahead === 0)\n\t\t\t\t\tbreak; // flush the current block\n\t\t\t}\n\n\t\t\tstrstart += lookahead;\n\t\t\tlookahead = 0;\n\n\t\t\t// Emit a stored block if pending_buf will be full:\n\t\t\tmax_start = block_start + max_block_size;\n\t\t\tif (strstart === 0 || strstart >= max_start) {\n\t\t\t\t// strstart === 0 is possible when wraparound on 16-bit machine\n\t\t\t\tlookahead = (strstart - max_start);\n\t\t\t\tstrstart = max_start;\n\n\t\t\t\tflush_block_only(false);\n\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\treturn NeedMore;\n\n\t\t\t}\n\n\t\t\t// Flush if we may have to slide, otherwise block_start may become\n\t\t\t// negative and the data will be gone:\n\t\t\tif (strstart - block_start >= w_size - MIN_LOOKAHEAD) {\n\t\t\t\tflush_block_only(false);\n\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\treturn NeedMore;\n\t\t\t}\n\t\t}\n\n\t\tflush_block_only(flush == Z_FINISH);\n\t\tif (strm.avail_out === 0)\n\t\t\treturn (flush == Z_FINISH) ? FinishStarted : NeedMore;\n\n\t\treturn flush == Z_FINISH ? FinishDone : BlockDone;\n\t}\n\n\tfunction longest_match(cur_match) {\n\t\tlet chain_length = max_chain_length; // max hash chain length\n\t\tlet scan = strstart; // current string\n\t\tlet match; // matched string\n\t\tlet len; // length of current match\n\t\tlet best_len = prev_length; // best match length so far\n\t\tconst limit = strstart > (w_size - MIN_LOOKAHEAD) ? strstart - (w_size - MIN_LOOKAHEAD) : 0;\n\t\tlet _nice_match = nice_match;\n\n\t\t// Stop when cur_match becomes <= limit. To simplify the code,\n\t\t// we prevent matches with the string of window index 0.\n\n\t\tconst wmask = w_mask;\n\n\t\tconst strend = strstart + MAX_MATCH;\n\t\tlet scan_end1 = window[scan + best_len - 1];\n\t\tlet scan_end = window[scan + best_len];\n\n\t\t// The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of\n\t\t// 16.\n\t\t// It is easy to get rid of this optimization if necessary.\n\n\t\t// Do not waste too much time if we already have a good match:\n\t\tif (prev_length >= good_match) {\n\t\t\tchain_length >>= 2;\n\t\t}\n\n\t\t// Do not look for matches beyond the end of the input. This is\n\t\t// necessary\n\t\t// to make deflate deterministic.\n\t\tif (_nice_match > lookahead)\n\t\t\t_nice_match = lookahead;\n\n\t\tdo {\n\t\t\tmatch = cur_match;\n\n\t\t\t// Skip to next match if the match length cannot increase\n\t\t\t// or if the match length is less than 2:\n\t\t\tif (window[match + best_len] != scan_end || window[match + best_len - 1] != scan_end1 || window[match] != window[scan]\n\t\t\t\t|| window[++match] != window[scan + 1])\n\t\t\t\tcontinue;\n\n\t\t\t// The check at best_len-1 can be removed because it will be made\n\t\t\t// again later. (This heuristic is not always a win.)\n\t\t\t// It is not necessary to compare scan[2] and match[2] since they\n\t\t\t// are always equal when the other bytes match, given that\n\t\t\t// the hash keys are equal and that HASH_BITS >= 8.\n\t\t\tscan += 2;\n\t\t\tmatch++;\n\n\t\t\t// We check for insufficient lookahead only every 8th comparison;\n\t\t\t// the 256th check will be made at strstart+258.\n\t\t\t// eslint-disable-next-line no-empty\n\t\t\tdo {\n\t\t\t} while (window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match]\n\t\t\t&& window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match]\n\t\t\t&& window[++scan] == window[++match] && window[++scan] == window[++match] && scan < strend);\n\n\t\t\tlen = MAX_MATCH - (strend - scan);\n\t\t\tscan = strend - MAX_MATCH;\n\n\t\t\tif (len > best_len) {\n\t\t\t\tmatch_start = cur_match;\n\t\t\t\tbest_len = len;\n\t\t\t\tif (len >= _nice_match)\n\t\t\t\t\tbreak;\n\t\t\t\tscan_end1 = window[scan + best_len - 1];\n\t\t\t\tscan_end = window[scan + best_len];\n\t\t\t}\n\n\t\t} while ((cur_match = (prev[cur_match & wmask] & 0xffff)) > limit && --chain_length !== 0);\n\n\t\tif (best_len <= lookahead)\n\t\t\treturn best_len;\n\t\treturn lookahead;\n\t}\n\n\t// Compress as much as possible from the input stream, return the current\n\t// block state.\n\t// This function does not perform lazy evaluation of matches and inserts\n\t// new strings in the dictionary only for unmatched strings or for short\n\t// matches. It is used only for the fast compression options.\n\tfunction deflate_fast(flush) {\n\t\t// short hash_head = 0; // head of the hash chain\n\t\tlet hash_head = 0; // head of the hash chain\n\t\tlet bflush; // set if current block must be flushed\n\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\t// Make sure that we always have enough lookahead, except\n\t\t\t// at the end of the input file. We need MAX_MATCH bytes\n\t\t\t// for the next match, plus MIN_MATCH bytes to insert the\n\t\t\t// string following the next match.\n\t\t\tif (lookahead < MIN_LOOKAHEAD) {\n\t\t\t\tfill_window();\n\t\t\t\tif (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {\n\t\t\t\t\treturn NeedMore;\n\t\t\t\t}\n\t\t\t\tif (lookahead === 0)\n\t\t\t\t\tbreak; // flush the current block\n\t\t\t}\n\n\t\t\t// Insert the string window[strstart .. strstart+2] in the\n\t\t\t// dictionary, and set hash_head to the head of the hash chain:\n\t\t\tif (lookahead >= MIN_MATCH) {\n\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\n\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\thead[ins_h] = strstart;\n\t\t\t}\n\n\t\t\t// Find the longest match, discarding those <= prev_length.\n\t\t\t// At this point we have always match_length < MIN_MATCH\n\n\t\t\tif (hash_head !== 0 && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) {\n\t\t\t\t// To simplify the code, we prevent matches with the string\n\t\t\t\t// of window index 0 (in particular we have to avoid a match\n\t\t\t\t// of the string with itself at the start of the input file).\n\t\t\t\tif (strategy != Z_HUFFMAN_ONLY) {\n\t\t\t\t\tmatch_length = longest_match(hash_head);\n\t\t\t\t}\n\t\t\t\t// longest_match() sets match_start\n\t\t\t}\n\t\t\tif (match_length >= MIN_MATCH) {\n\t\t\t\t// check_match(strstart, match_start, match_length);\n\n\t\t\t\tbflush = _tr_tally(strstart - match_start, match_length - MIN_MATCH);\n\n\t\t\t\tlookahead -= match_length;\n\n\t\t\t\t// Insert new strings in the hash table only if the match length\n\t\t\t\t// is not too large. This saves time but degrades compression.\n\t\t\t\tif (match_length <= max_lazy_match && lookahead >= MIN_MATCH) {\n\t\t\t\t\tmatch_length--; // string at strstart already in hash table\n\t\t\t\t\tdo {\n\t\t\t\t\t\tstrstart++;\n\n\t\t\t\t\t\tins_h = ((ins_h << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\t\t\thead[ins_h] = strstart;\n\n\t\t\t\t\t\t// strstart never exceeds WSIZE-MAX_MATCH, so there are\n\t\t\t\t\t\t// always MIN_MATCH bytes ahead.\n\t\t\t\t\t} while (--match_length !== 0);\n\t\t\t\t\tstrstart++;\n\t\t\t\t} else {\n\t\t\t\t\tstrstart += match_length;\n\t\t\t\t\tmatch_length = 0;\n\t\t\t\t\tins_h = window[strstart] & 0xff;\n\n\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;\n\t\t\t\t\t// If lookahead < MIN_MATCH, ins_h is garbage, but it does\n\t\t\t\t\t// not\n\t\t\t\t\t// matter since it will be recomputed at next deflate call.\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// No match, output a literal byte\n\n\t\t\t\tbflush = _tr_tally(0, window[strstart] & 0xff);\n\t\t\t\tlookahead--;\n\t\t\t\tstrstart++;\n\t\t\t}\n\t\t\tif (bflush) {\n\n\t\t\t\tflush_block_only(false);\n\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\treturn NeedMore;\n\t\t\t}\n\t\t}\n\n\t\tflush_block_only(flush == Z_FINISH);\n\t\tif (strm.avail_out === 0) {\n\t\t\tif (flush == Z_FINISH)\n\t\t\t\treturn FinishStarted;\n\t\t\telse\n\t\t\t\treturn NeedMore;\n\t\t}\n\t\treturn flush == Z_FINISH ? FinishDone : BlockDone;\n\t}\n\n\t// Same as above, but achieves better compression. We use a lazy\n\t// evaluation for matches: a match is finally adopted only if there is\n\t// no better match at the next window position.\n\tfunction deflate_slow(flush) {\n\t\t// short hash_head = 0; // head of hash chain\n\t\tlet hash_head = 0; // head of hash chain\n\t\tlet bflush; // set if current block must be flushed\n\t\tlet max_insert;\n\n\t\t// Process the input block.\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\t// Make sure that we always have enough lookahead, except\n\t\t\t// at the end of the input file. We need MAX_MATCH bytes\n\t\t\t// for the next match, plus MIN_MATCH bytes to insert the\n\t\t\t// string following the next match.\n\n\t\t\tif (lookahead < MIN_LOOKAHEAD) {\n\t\t\t\tfill_window();\n\t\t\t\tif (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {\n\t\t\t\t\treturn NeedMore;\n\t\t\t\t}\n\t\t\t\tif (lookahead === 0)\n\t\t\t\t\tbreak; // flush the current block\n\t\t\t}\n\n\t\t\t// Insert the string window[strstart .. strstart+2] in the\n\t\t\t// dictionary, and set hash_head to the head of the hash chain:\n\n\t\t\tif (lookahead >= MIN_MATCH) {\n\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\thead[ins_h] = strstart;\n\t\t\t}\n\n\t\t\t// Find the longest match, discarding those <= prev_length.\n\t\t\tprev_length = match_length;\n\t\t\tprev_match = match_start;\n\t\t\tmatch_length = MIN_MATCH - 1;\n\n\t\t\tif (hash_head !== 0 && prev_length < max_lazy_match && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) {\n\t\t\t\t// To simplify the code, we prevent matches with the string\n\t\t\t\t// of window index 0 (in particular we have to avoid a match\n\t\t\t\t// of the string with itself at the start of the input file).\n\n\t\t\t\tif (strategy != Z_HUFFMAN_ONLY) {\n\t\t\t\t\tmatch_length = longest_match(hash_head);\n\t\t\t\t}\n\t\t\t\t// longest_match() sets match_start\n\n\t\t\t\tif (match_length <= 5 && (strategy == Z_FILTERED || (match_length == MIN_MATCH && strstart - match_start > 4096))) {\n\n\t\t\t\t\t// If prev_match is also MIN_MATCH, match_start is garbage\n\t\t\t\t\t// but we will ignore the current match anyway.\n\t\t\t\t\tmatch_length = MIN_MATCH - 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If there was a match at the previous step and the current\n\t\t\t// match is not better, output the previous match:\n\t\t\tif (prev_length >= MIN_MATCH && match_length <= prev_length) {\n\t\t\t\tmax_insert = strstart + lookahead - MIN_MATCH;\n\t\t\t\t// Do not insert strings in hash table beyond this.\n\n\t\t\t\t// check_match(strstart-1, prev_match, prev_length);\n\n\t\t\t\tbflush = _tr_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH);\n\n\t\t\t\t// Insert in hash table all strings up to the end of the match.\n\t\t\t\t// strstart-1 and strstart are already inserted. If there is not\n\t\t\t\t// enough lookahead, the last two strings are not inserted in\n\t\t\t\t// the hash table.\n\t\t\t\tlookahead -= prev_length - 1;\n\t\t\t\tprev_length -= 2;\n\t\t\t\tdo {\n\t\t\t\t\tif (++strstart <= max_insert) {\n\t\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\t\t\thead[ins_h] = strstart;\n\t\t\t\t\t}\n\t\t\t\t} while (--prev_length !== 0);\n\t\t\t\tmatch_available = 0;\n\t\t\t\tmatch_length = MIN_MATCH - 1;\n\t\t\t\tstrstart++;\n\n\t\t\t\tif (bflush) {\n\t\t\t\t\tflush_block_only(false);\n\t\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t}\n\t\t\t} else if (match_available !== 0) {\n\n\t\t\t\t// If there was no match at the previous position, output a\n\t\t\t\t// single literal. If there was a match but the current match\n\t\t\t\t// is longer, truncate the previous match to a single literal.\n\n\t\t\t\tbflush = _tr_tally(0, window[strstart - 1] & 0xff);\n\n\t\t\t\tif (bflush) {\n\t\t\t\t\tflush_block_only(false);\n\t\t\t\t}\n\t\t\t\tstrstart++;\n\t\t\t\tlookahead--;\n\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\treturn NeedMore;\n\t\t\t} else {\n\t\t\t\t// There is no previous match to compare with, wait for\n\t\t\t\t// the next step to decide.\n\n\t\t\t\tmatch_available = 1;\n\t\t\t\tstrstart++;\n\t\t\t\tlookahead--;\n\t\t\t}\n\t\t}\n\n\t\tif (match_available !== 0) {\n\t\t\tbflush = _tr_tally(0, window[strstart - 1] & 0xff);\n\t\t\tmatch_available = 0;\n\t\t}\n\t\tflush_block_only(flush == Z_FINISH);\n\n\t\tif (strm.avail_out === 0) {\n\t\t\tif (flush == Z_FINISH)\n\t\t\t\treturn FinishStarted;\n\t\t\telse\n\t\t\t\treturn NeedMore;\n\t\t}\n\n\t\treturn flush == Z_FINISH ? FinishDone : BlockDone;\n\t}\n\n\tfunction deflateReset(strm) {\n\t\tstrm.total_in = strm.total_out = 0;\n\t\tstrm.msg = null; //\n\n\t\tthat.pending = 0;\n\t\tthat.pending_out = 0;\n\n\t\tstatus = BUSY_STATE;\n\n\t\tlast_flush = Z_NO_FLUSH;\n\n\t\ttr_init();\n\t\tlm_init();\n\t\treturn Z_OK;\n\t}\n\n\tthat.deflateInit = function (strm, _level, bits, _method, memLevel, _strategy) {\n\t\tif (!_method)\n\t\t\t_method = Z_DEFLATED;\n\t\tif (!memLevel)\n\t\t\tmemLevel = DEF_MEM_LEVEL;\n\t\tif (!_strategy)\n\t\t\t_strategy = Z_DEFAULT_STRATEGY;\n\n\t\t// byte[] my_version=ZLIB_VERSION;\n\n\t\t//\n\t\t// if (!version || version[0] != my_version[0]\n\t\t// || stream_size != sizeof(z_stream)) {\n\t\t// return Z_VERSION_ERROR;\n\t\t// }\n\n\t\tstrm.msg = null;\n\n\t\tif (_level == Z_DEFAULT_COMPRESSION)\n\t\t\t_level = 6;\n\n\t\tif (memLevel < 1 || memLevel > MAX_MEM_LEVEL || _method != Z_DEFLATED || bits < 9 || bits > 15 || _level < 0 || _level > 9 || _strategy < 0\n\t\t\t|| _strategy > Z_HUFFMAN_ONLY) {\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\n\t\tstrm.dstate = that;\n\n\t\tw_bits = bits;\n\t\tw_size = 1 << w_bits;\n\t\tw_mask = w_size - 1;\n\n\t\thash_bits = memLevel + 7;\n\t\thash_size = 1 << hash_bits;\n\t\thash_mask = hash_size - 1;\n\t\thash_shift = Math.floor((hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n\t\twindow = new Uint8Array(w_size * 2);\n\t\tprev = [];\n\t\thead = [];\n\n\t\tlit_bufsize = 1 << (memLevel + 6); // 16K elements by default\n\n\t\t// We overlay pending_buf and d_buf+l_buf. This works since the average\n\t\t// output size for (length,distance) codes is <= 24 bits.\n\t\tthat.pending_buf = new Uint8Array(lit_bufsize * 4);\n\t\tpending_buf_size = lit_bufsize * 4;\n\n\t\td_buf = Math.floor(lit_bufsize / 2);\n\t\tl_buf = (1 + 2) * lit_bufsize;\n\n\t\tlevel = _level;\n\n\t\tstrategy = _strategy;\n\n\t\treturn deflateReset(strm);\n\t};\n\n\tthat.deflateEnd = function () {\n\t\tif (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE) {\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\t\t// Deallocate in reverse order of allocations:\n\t\tthat.pending_buf = null;\n\t\thead = null;\n\t\tprev = null;\n\t\twindow = null;\n\t\t// free\n\t\tthat.dstate = null;\n\t\treturn status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;\n\t};\n\n\tthat.deflateParams = function (strm, _level, _strategy) {\n\t\tlet err = Z_OK;\n\n\t\tif (_level == Z_DEFAULT_COMPRESSION) {\n\t\t\t_level = 6;\n\t\t}\n\t\tif (_level < 0 || _level > 9 || _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\n\t\tif (config_table[level].func != config_table[_level].func && strm.total_in !== 0) {\n\t\t\t// Flush the last buffer:\n\t\t\terr = strm.deflate(Z_PARTIAL_FLUSH);\n\t\t}\n\n\t\tif (level != _level) {\n\t\t\tlevel = _level;\n\t\t\tmax_lazy_match = config_table[level].max_lazy;\n\t\t\tgood_match = config_table[level].good_length;\n\t\t\tnice_match = config_table[level].nice_length;\n\t\t\tmax_chain_length = config_table[level].max_chain;\n\t\t}\n\t\tstrategy = _strategy;\n\t\treturn err;\n\t};\n\n\tthat.deflateSetDictionary = function (strm, dictionary, dictLength) {\n\t\tlet length = dictLength;\n\t\tlet n, index = 0;\n\n\t\tif (!dictionary || status != INIT_STATE)\n\t\t\treturn Z_STREAM_ERROR;\n\n\t\tif (length < MIN_MATCH)\n\t\t\treturn Z_OK;\n\t\tif (length > w_size - MIN_LOOKAHEAD) {\n\t\t\tlength = w_size - MIN_LOOKAHEAD;\n\t\t\tindex = dictLength - length; // use the tail of the dictionary\n\t\t}\n\t\twindow.set(dictionary.subarray(index, index + length), 0);\n\n\t\tstrstart = length;\n\t\tblock_start = length;\n\n\t\t// Insert all strings in the hash table (except for the last two bytes).\n\t\t// s->lookahead stays null, so s->ins_h will be recomputed at the next\n\t\t// call of fill_window.\n\n\t\tins_h = window[0] & 0xff;\n\t\tins_h = (((ins_h) << hash_shift) ^ (window[1] & 0xff)) & hash_mask;\n\n\t\tfor (n = 0; n <= length - MIN_MATCH; n++) {\n\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(n) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\tprev[n & w_mask] = head[ins_h];\n\t\t\thead[ins_h] = n;\n\t\t}\n\t\treturn Z_OK;\n\t};\n\n\tthat.deflate = function (_strm, flush) {\n\t\tlet i, header, level_flags, old_flush, bstate;\n\n\t\tif (flush > Z_FINISH || flush < 0) {\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\n\t\tif (!_strm.next_out || (!_strm.next_in && _strm.avail_in !== 0) || (status == FINISH_STATE && flush != Z_FINISH)) {\n\t\t\t_strm.msg = z_errmsg[Z_NEED_DICT - (Z_STREAM_ERROR)];\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\t\tif (_strm.avail_out === 0) {\n\t\t\t_strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];\n\t\t\treturn Z_BUF_ERROR;\n\t\t}\n\n\t\tstrm = _strm; // just in case\n\t\told_flush = last_flush;\n\t\tlast_flush = flush;\n\n\t\t// Write the zlib header\n\t\tif (status == INIT_STATE) {\n\t\t\theader = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8;\n\t\t\tlevel_flags = ((level - 1) & 0xff) >> 1;\n\n\t\t\tif (level_flags > 3)\n\t\t\t\tlevel_flags = 3;\n\t\t\theader |= (level_flags << 6);\n\t\t\tif (strstart !== 0)\n\t\t\t\theader |= PRESET_DICT;\n\t\t\theader += 31 - (header % 31);\n\n\t\t\tstatus = BUSY_STATE;\n\t\t\tputShortMSB(header);\n\t\t}\n\n\t\t// Flush as much pending output as possible\n\t\tif (that.pending !== 0) {\n\t\t\tstrm.flush_pending();\n\t\t\tif (strm.avail_out === 0) {\n\t\t\t\t// console.log(\" avail_out==0\");\n\t\t\t\t// Since avail_out is 0, deflate will be called again with\n\t\t\t\t// more output space, but possibly with both pending and\n\t\t\t\t// avail_in equal to zero. There won't be anything to do,\n\t\t\t\t// but this is not an error situation so make sure we\n\t\t\t\t// return OK instead of BUF_ERROR at next call of deflate:\n\t\t\t\tlast_flush = -1;\n\t\t\t\treturn Z_OK;\n\t\t\t}\n\n\t\t\t// Make sure there is something to do and avoid duplicate\n\t\t\t// consecutive\n\t\t\t// flushes. For repeated and useless calls with Z_FINISH, we keep\n\t\t\t// returning Z_STREAM_END instead of Z_BUFF_ERROR.\n\t\t} else if (strm.avail_in === 0 && flush <= old_flush && flush != Z_FINISH) {\n\t\t\tstrm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];\n\t\t\treturn Z_BUF_ERROR;\n\t\t}\n\n\t\t// User must not provide more input after the first FINISH:\n\t\tif (status == FINISH_STATE && strm.avail_in !== 0) {\n\t\t\t_strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];\n\t\t\treturn Z_BUF_ERROR;\n\t\t}\n\n\t\t// Start a new block or continue the current one.\n\t\tif (strm.avail_in !== 0 || lookahead !== 0 || (flush != Z_NO_FLUSH && status != FINISH_STATE)) {\n\t\t\tbstate = -1;\n\t\t\tswitch (config_table[level].func) {\n\t\t\t\tcase STORED:\n\t\t\t\t\tbstate = deflate_stored(flush);\n\t\t\t\t\tbreak;\n\t\t\t\tcase FAST:\n\t\t\t\t\tbstate = deflate_fast(flush);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SLOW:\n\t\t\t\t\tbstate = deflate_slow(flush);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif (bstate == FinishStarted || bstate == FinishDone) {\n\t\t\t\tstatus = FINISH_STATE;\n\t\t\t}\n\t\t\tif (bstate == NeedMore || bstate == FinishStarted) {\n\t\t\t\tif (strm.avail_out === 0) {\n\t\t\t\t\tlast_flush = -1; // avoid BUF_ERROR next call, see above\n\t\t\t\t}\n\t\t\t\treturn Z_OK;\n\t\t\t\t// If flush != Z_NO_FLUSH && avail_out === 0, the next call\n\t\t\t\t// of deflate should use the same flush parameter to make sure\n\t\t\t\t// that the flush is complete. So we don't have to output an\n\t\t\t\t// empty block here, this will be done at next call. This also\n\t\t\t\t// ensures that for a very small output buffer, we emit at most\n\t\t\t\t// one empty block.\n\t\t\t}\n\n\t\t\tif (bstate == BlockDone) {\n\t\t\t\tif (flush == Z_PARTIAL_FLUSH) {\n\t\t\t\t\t_tr_align();\n\t\t\t\t} else { // FULL_FLUSH or SYNC_FLUSH\n\t\t\t\t\t_tr_stored_block(0, 0, false);\n\t\t\t\t\t// For a full flush, this empty block will be recognized\n\t\t\t\t\t// as a special marker by inflate_sync().\n\t\t\t\t\tif (flush == Z_FULL_FLUSH) {\n\t\t\t\t\t\t// state.head[s.hash_size-1]=0;\n\t\t\t\t\t\tfor (i = 0; i < hash_size/*-1*/; i++)\n\t\t\t\t\t\t\t// forget history\n\t\t\t\t\t\t\thead[i] = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstrm.flush_pending();\n\t\t\t\tif (strm.avail_out === 0) {\n\t\t\t\t\tlast_flush = -1; // avoid BUF_ERROR at next call, see above\n\t\t\t\t\treturn Z_OK;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (flush != Z_FINISH)\n\t\t\treturn Z_OK;\n\t\treturn Z_STREAM_END;\n\t};\n}\n\n// ZStream\n\nfunction ZStream() {\n\tconst that = this;\n\tthat.next_in_index = 0;\n\tthat.next_out_index = 0;\n\t// that.next_in; // next input byte\n\tthat.avail_in = 0; // number of bytes available at next_in\n\tthat.total_in = 0; // total nb of input bytes read so far\n\t// that.next_out; // next output byte should be put there\n\tthat.avail_out = 0; // remaining free space at next_out\n\tthat.total_out = 0; // total nb of bytes output so far\n\t// that.msg;\n\t// that.dstate;\n}\n\nZStream.prototype = {\n\tdeflateInit: function (level, bits) {\n\t\tconst that = this;\n\t\tthat.dstate = new Deflate();\n\t\tif (!bits)\n\t\t\tbits = MAX_BITS;\n\t\treturn that.dstate.deflateInit(that, level, bits);\n\t},\n\n\tdeflate: function (flush) {\n\t\tconst that = this;\n\t\tif (!that.dstate) {\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\t\treturn that.dstate.deflate(that, flush);\n\t},\n\n\tdeflateEnd: function () {\n\t\tconst that = this;\n\t\tif (!that.dstate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\tconst ret = that.dstate.deflateEnd();\n\t\tthat.dstate = null;\n\t\treturn ret;\n\t},\n\n\tdeflateParams: function (level, strategy) {\n\t\tconst that = this;\n\t\tif (!that.dstate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\treturn that.dstate.deflateParams(that, level, strategy);\n\t},\n\n\tdeflateSetDictionary: function (dictionary, dictLength) {\n\t\tconst that = this;\n\t\tif (!that.dstate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\treturn that.dstate.deflateSetDictionary(that, dictionary, dictLength);\n\t},\n\n\t// Read a new buffer from the current input stream, update the\n\t// total number of bytes read. All deflate() input goes through\n\t// this function so some applications may wish to modify it to avoid\n\t// allocating a large strm->next_in buffer and copying from it.\n\t// (See also flush_pending()).\n\tread_buf: function (buf, start, size) {\n\t\tconst that = this;\n\t\tlet len = that.avail_in;\n\t\tif (len > size)\n\t\t\tlen = size;\n\t\tif (len === 0)\n\t\t\treturn 0;\n\t\tthat.avail_in -= len;\n\t\tbuf.set(that.next_in.subarray(that.next_in_index, that.next_in_index + len), start);\n\t\tthat.next_in_index += len;\n\t\tthat.total_in += len;\n\t\treturn len;\n\t},\n\n\t// Flush as much pending output as possible. All deflate() output goes\n\t// through this function so some applications may wish to modify it\n\t// to avoid allocating a large strm->next_out buffer and copying into it.\n\t// (See also read_buf()).\n\tflush_pending: function () {\n\t\tconst that = this;\n\t\tlet len = that.dstate.pending;\n\n\t\tif (len > that.avail_out)\n\t\t\tlen = that.avail_out;\n\t\tif (len === 0)\n\t\t\treturn;\n\n\t\t// if (that.dstate.pending_buf.length <= that.dstate.pending_out || that.next_out.length <= that.next_out_index\n\t\t// || that.dstate.pending_buf.length < (that.dstate.pending_out + len) || that.next_out.length < (that.next_out_index +\n\t\t// len)) {\n\t\t// console.log(that.dstate.pending_buf.length + \", \" + that.dstate.pending_out + \", \" + that.next_out.length + \", \" +\n\t\t// that.next_out_index + \", \" + len);\n\t\t// console.log(\"avail_out=\" + that.avail_out);\n\t\t// }\n\n\t\tthat.next_out.set(that.dstate.pending_buf.subarray(that.dstate.pending_out, that.dstate.pending_out + len), that.next_out_index);\n\n\t\tthat.next_out_index += len;\n\t\tthat.dstate.pending_out += len;\n\t\tthat.total_out += len;\n\t\tthat.avail_out -= len;\n\t\tthat.dstate.pending -= len;\n\t\tif (that.dstate.pending === 0) {\n\t\t\tthat.dstate.pending_out = 0;\n\t\t}\n\t}\n};\n\n// Deflate\n\nfunction ZipDeflate(options) {\n\tconst that = this;\n\tconst z = new ZStream();\n\tconst bufsize = getMaximumCompressedSize(options && options.chunkSize ? options.chunkSize : 64 * 1024);\n\tconst flush = Z_NO_FLUSH;\n\tconst buf = new Uint8Array(bufsize);\n\tlet level = options ? options.level : Z_DEFAULT_COMPRESSION;\n\tif (typeof level == \"undefined\")\n\t\tlevel = Z_DEFAULT_COMPRESSION;\n\tz.deflateInit(level);\n\tz.next_out = buf;\n\n\tthat.append = function (data, onprogress) {\n\t\tlet err, array, lastIndex = 0, bufferIndex = 0, bufferSize = 0;\n\t\tconst buffers = [];\n\t\tif (!data.length)\n\t\t\treturn;\n\t\tz.next_in_index = 0;\n\t\tz.next_in = data;\n\t\tz.avail_in = data.length;\n\t\tdo {\n\t\t\tz.next_out_index = 0;\n\t\t\tz.avail_out = bufsize;\n\t\t\terr = z.deflate(flush);\n\t\t\tif (err != Z_OK)\n\t\t\t\tthrow new Error(\"deflating: \" + z.msg);\n\t\t\tif (z.next_out_index)\n\t\t\t\tif (z.next_out_index == bufsize)\n\t\t\t\t\tbuffers.push(new Uint8Array(buf));\n\t\t\t\telse\n\t\t\t\t\tbuffers.push(buf.slice(0, z.next_out_index));\n\t\t\tbufferSize += z.next_out_index;\n\t\t\tif (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) {\n\t\t\t\tonprogress(z.next_in_index);\n\t\t\t\tlastIndex = z.next_in_index;\n\t\t\t}\n\t\t} while (z.avail_in > 0 || z.avail_out === 0);\n\t\tif (buffers.length > 1) {\n\t\t\tarray = new Uint8Array(bufferSize);\n\t\t\tbuffers.forEach(function (chunk) {\n\t\t\t\tarray.set(chunk, bufferIndex);\n\t\t\t\tbufferIndex += chunk.length;\n\t\t\t});\n\t\t} else {\n\t\t\tarray = buffers[0] || new Uint8Array(0);\n\t\t}\n\t\treturn array;\n\t};\n\tthat.flush = function () {\n\t\tlet err, array, bufferIndex = 0, bufferSize = 0;\n\t\tconst buffers = [];\n\t\tdo {\n\t\t\tz.next_out_index = 0;\n\t\t\tz.avail_out = bufsize;\n\t\t\terr = z.deflate(Z_FINISH);\n\t\t\tif (err != Z_STREAM_END && err != Z_OK)\n\t\t\t\tthrow new Error(\"deflating: \" + z.msg);\n\t\t\tif (bufsize - z.avail_out > 0)\n\t\t\t\tbuffers.push(buf.slice(0, z.next_out_index));\n\t\t\tbufferSize += z.next_out_index;\n\t\t} while (z.avail_in > 0 || z.avail_out === 0);\n\t\tz.deflateEnd();\n\t\tarray = new Uint8Array(bufferSize);\n\t\tbuffers.forEach(function (chunk) {\n\t\t\tarray.set(chunk, bufferIndex);\n\t\t\tbufferIndex += chunk.length;\n\t\t});\n\t\treturn array;\n\t};\n}\n\nfunction getMaximumCompressedSize(uncompressedSize) {\n\treturn uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 1));\n}\n\nexport default ZipDeflate;","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * This program is based on JZlib 1.0.2 ymnk, JCraft,Inc.\n * JZlib is based on zlib-1.1.3, so all credit should go authors\n * Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)\n * and contributors of zlib.\n */\n\n\"use strict\";\n\n// Global\nconst MAX_BITS = 15;\n\nconst Z_OK = 0;\nconst Z_STREAM_END = 1;\nconst Z_NEED_DICT = 2;\nconst Z_STREAM_ERROR = -2;\nconst Z_DATA_ERROR = -3;\nconst Z_MEM_ERROR = -4;\nconst Z_BUF_ERROR = -5;\n\nconst inflate_mask = [0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff,\n\t0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff];\n\nconst MANY = 1440;\n\n// JZlib version : \"1.0.2\"\nconst Z_NO_FLUSH = 0;\nconst Z_FINISH = 4;\n\n// InfTree\nconst fixed_bl = 9;\nconst fixed_bd = 5;\n\nconst fixed_tl = [96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9, 192, 80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 160, 0, 8, 0,\n\t0, 8, 128, 0, 8, 64, 0, 9, 224, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 144, 83, 7, 59, 0, 8, 120, 0, 8, 56, 0, 9, 208, 81, 7, 17, 0, 8, 104, 0, 8, 40,\n\t0, 9, 176, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 240, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8, 227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 200, 81, 7, 13,\n\t0, 8, 100, 0, 8, 36, 0, 9, 168, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 232, 80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 152, 84, 7, 83, 0, 8, 124, 0, 8, 60,\n\t0, 9, 216, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 184, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9, 248, 80, 7, 3, 0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7,\n\t35, 0, 8, 114, 0, 8, 50, 0, 9, 196, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 164, 0, 8, 2, 0, 8, 130, 0, 8, 66, 0, 9, 228, 80, 7, 7, 0, 8, 90, 0, 8,\n\t26, 0, 9, 148, 84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 212, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9, 180, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 244, 80,\n\t7, 5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 204, 81, 7, 15, 0, 8, 102, 0, 8, 38, 0, 9, 172, 0, 8, 6, 0, 8, 134, 0,\n\t8, 70, 0, 9, 236, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 156, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9, 220, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9, 188, 0,\n\t8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 252, 96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113, 0, 8, 49, 0, 9, 194, 80, 7, 10, 0, 8, 97,\n\t0, 8, 33, 0, 9, 162, 0, 8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 226, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9, 146, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 210,\n\t81, 7, 17, 0, 8, 105, 0, 8, 41, 0, 9, 178, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 242, 80, 7, 4, 0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117,\n\t0, 8, 53, 0, 9, 202, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 170, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9, 234, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 154,\n\t84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 218, 82, 7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 186, 0, 8, 13, 0, 8, 141, 0, 8, 77, 0, 9, 250, 80, 7, 3, 0, 8, 83,\n\t0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51, 0, 9, 198, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9, 166, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 230,\n\t80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 150, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 214, 82, 7, 19, 0, 8, 107, 0, 8, 43, 0, 9, 182, 0, 8, 11, 0, 8, 139,\n\t0, 8, 75, 0, 9, 246, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55, 0, 9, 206, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 174,\n\t0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 238, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9, 158, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 222, 82, 7, 27, 0, 8, 111,\n\t0, 8, 47, 0, 9, 190, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 254, 96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9,\n\t193, 80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 161, 0, 8, 0, 0, 8, 128, 0, 8, 64, 0, 9, 225, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 145, 83, 7, 59, 0, 8,\n\t120, 0, 8, 56, 0, 9, 209, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0, 9, 177, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 241, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8,\n\t227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 201, 81, 7, 13, 0, 8, 100, 0, 8, 36, 0, 9, 169, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 233, 80, 7, 8, 0, 8,\n\t92, 0, 8, 28, 0, 9, 153, 84, 7, 83, 0, 8, 124, 0, 8, 60, 0, 9, 217, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 185, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9,\n\t249, 80, 7, 3, 0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0, 9, 197, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 165, 0, 8, 2, 0, 8,\n\t130, 0, 8, 66, 0, 9, 229, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 149, 84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 213, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9,\n\t181, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 245, 80, 7, 5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 205, 81, 7, 15, 0, 8,\n\t102, 0, 8, 38, 0, 9, 173, 0, 8, 6, 0, 8, 134, 0, 8, 70, 0, 9, 237, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 157, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9,\n\t221, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9, 189, 0, 8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 253, 96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0,\n\t8, 113, 0, 8, 49, 0, 9, 195, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 163, 0, 8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 227, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9,\n\t147, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 211, 81, 7, 17, 0, 8, 105, 0, 8, 41, 0, 9, 179, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 243, 80, 7, 4, 0, 8,\n\t85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117, 0, 8, 53, 0, 9, 203, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 171, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9,\n\t235, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 155, 84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 219, 82, 7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 187, 0, 8, 13, 0, 8,\n\t141, 0, 8, 77, 0, 9, 251, 80, 7, 3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51, 0, 9, 199, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9,\n\t167, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 231, 80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 151, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 215, 82, 7, 19, 0, 8,\n\t107, 0, 8, 43, 0, 9, 183, 0, 8, 11, 0, 8, 139, 0, 8, 75, 0, 9, 247, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55, 0, 9,\n\t207, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 175, 0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 239, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9, 159, 84, 7, 99, 0, 8,\n\t127, 0, 8, 63, 0, 9, 223, 82, 7, 27, 0, 8, 111, 0, 8, 47, 0, 9, 191, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 255];\nconst fixed_td = [80, 5, 1, 87, 5, 257, 83, 5, 17, 91, 5, 4097, 81, 5, 5, 89, 5, 1025, 85, 5, 65, 93, 5, 16385, 80, 5, 3, 88, 5, 513, 84, 5, 33, 92, 5,\n\t8193, 82, 5, 9, 90, 5, 2049, 86, 5, 129, 192, 5, 24577, 80, 5, 2, 87, 5, 385, 83, 5, 25, 91, 5, 6145, 81, 5, 7, 89, 5, 1537, 85, 5, 97, 93, 5,\n\t24577, 80, 5, 4, 88, 5, 769, 84, 5, 49, 92, 5, 12289, 82, 5, 13, 90, 5, 3073, 86, 5, 193, 192, 5, 24577];\n\n// Tables for deflate from PKZIP's appnote.txt.\nconst cplens = [ // Copy lengths for literal codes 257..285\n\t3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0];\n\n// see note #13 above about 258\nconst cplext = [ // Extra bits for literal codes 257..285\n\t0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112 // 112==invalid\n];\n\nconst cpdist = [ // Copy offsets for distance codes 0..29\n\t1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577];\n\nconst cpdext = [ // Extra bits for distance codes\n\t0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];\n\n// If BMAX needs to be larger than 16, then h and x[] should be uLong.\nconst BMAX = 15; // maximum bit length of any code\n\nfunction InfTree() {\n\tconst that = this;\n\n\tlet hn; // hufts used in space\n\tlet v; // work area for huft_build\n\tlet c; // bit length count table\n\tlet r; // table entry for structure assignment\n\tlet u; // table stack\n\tlet x; // bit offsets, then code stack\n\n\tfunction huft_build(b, // code lengths in bits (all assumed <=\n\t\t// BMAX)\n\t\tbindex, n, // number of codes (assumed <= 288)\n\t\ts, // number of simple-valued codes (0..s-1)\n\t\td, // list of base values for non-simple codes\n\t\te, // list of extra bits for non-simple codes\n\t\tt, // result: starting table\n\t\tm, // maximum lookup bits, returns actual\n\t\thp,// space for trees\n\t\thn,// hufts used in space\n\t\tv // working area: values in order of bit length\n\t) {\n\t\t// Given a list of code lengths and a maximum table size, make a set of\n\t\t// tables to decode that set of codes. Return Z_OK on success,\n\t\t// Z_BUF_ERROR\n\t\t// if the given code set is incomplete (the tables are still built in\n\t\t// this\n\t\t// case), Z_DATA_ERROR if the input is invalid (an over-subscribed set\n\t\t// of\n\t\t// lengths), or Z_MEM_ERROR if not enough memory.\n\n\t\tlet a; // counter for codes of length k\n\t\tlet f; // i repeats in table every f entries\n\t\tlet g; // maximum code length\n\t\tlet h; // table level\n\t\tlet i; // counter, current code\n\t\tlet j; // counter\n\t\tlet k; // number of bits in current code\n\t\tlet l; // bits per table (returned in m)\n\t\tlet mask; // (1 << w) - 1, to avoid cc -O bug on HP\n\t\tlet p; // pointer into c[], b[], or v[]\n\t\tlet q; // points to current table\n\t\tlet w; // bits before this table == (l * h)\n\t\tlet xp; // pointer into x\n\t\tlet y; // number of dummy codes added\n\t\tlet z; // number of entries in current table\n\n\t\t// Generate counts for each bit length\n\n\t\tp = 0;\n\t\ti = n;\n\t\tdo {\n\t\t\tc[b[bindex + p]]++;\n\t\t\tp++;\n\t\t\ti--; // assume all entries <= BMAX\n\t\t} while (i !== 0);\n\n\t\tif (c[0] == n) { // null input--all zero length codes\n\t\t\tt[0] = -1;\n\t\t\tm[0] = 0;\n\t\t\treturn Z_OK;\n\t\t}\n\n\t\t// Find minimum and maximum length, bound *m by those\n\t\tl = m[0];\n\t\tfor (j = 1; j <= BMAX; j++)\n\t\t\tif (c[j] !== 0)\n\t\t\t\tbreak;\n\t\tk = j; // minimum code length\n\t\tif (l < j) {\n\t\t\tl = j;\n\t\t}\n\t\tfor (i = BMAX; i !== 0; i--) {\n\t\t\tif (c[i] !== 0)\n\t\t\t\tbreak;\n\t\t}\n\t\tg = i; // maximum code length\n\t\tif (l > i) {\n\t\t\tl = i;\n\t\t}\n\t\tm[0] = l;\n\n\t\t// Adjust last length count to fill out codes, if needed\n\t\tfor (y = 1 << j; j < i; j++, y <<= 1) {\n\t\t\tif ((y -= c[j]) < 0) {\n\t\t\t\treturn Z_DATA_ERROR;\n\t\t\t}\n\t\t}\n\t\tif ((y -= c[i]) < 0) {\n\t\t\treturn Z_DATA_ERROR;\n\t\t}\n\t\tc[i] += y;\n\n\t\t// Generate starting offsets into the value table for each length\n\t\tx[1] = j = 0;\n\t\tp = 1;\n\t\txp = 2;\n\t\twhile (--i !== 0) { // note that i == g from above\n\t\t\tx[xp] = (j += c[p]);\n\t\t\txp++;\n\t\t\tp++;\n\t\t}\n\n\t\t// Make a table of values in order of bit lengths\n\t\ti = 0;\n\t\tp = 0;\n\t\tdo {\n\t\t\tif ((j = b[bindex + p]) !== 0) {\n\t\t\t\tv[x[j]++] = i;\n\t\t\t}\n\t\t\tp++;\n\t\t} while (++i < n);\n\t\tn = x[g]; // set n to length of v\n\n\t\t// Generate the Huffman codes and for each, make the table entries\n\t\tx[0] = i = 0; // first Huffman code is zero\n\t\tp = 0; // grab values in bit order\n\t\th = -1; // no tables yet--level -1\n\t\tw = -l; // bits decoded == (l * h)\n\t\tu[0] = 0; // just to keep compilers happy\n\t\tq = 0; // ditto\n\t\tz = 0; // ditto\n\n\t\t// go through the bit lengths (k already is bits in shortest code)\n\t\tfor (; k <= g; k++) {\n\t\t\ta = c[k];\n\t\t\twhile (a-- !== 0) {\n\t\t\t\t// here i is the Huffman code of length k bits for value *p\n\t\t\t\t// make tables up to required level\n\t\t\t\twhile (k > w + l) {\n\t\t\t\t\th++;\n\t\t\t\t\tw += l; // previous table always l bits\n\t\t\t\t\t// compute minimum size table less than or equal to l bits\n\t\t\t\t\tz = g - w;\n\t\t\t\t\tz = (z > l) ? l : z; // table size upper limit\n\t\t\t\t\tif ((f = 1 << (j = k - w)) > a + 1) { // try a k-w bit table\n\t\t\t\t\t\t// too few codes for\n\t\t\t\t\t\t// k-w bit table\n\t\t\t\t\t\tf -= a + 1; // deduct codes from patterns left\n\t\t\t\t\t\txp = k;\n\t\t\t\t\t\tif (j < z) {\n\t\t\t\t\t\t\twhile (++j < z) { // try smaller tables up to z bits\n\t\t\t\t\t\t\t\tif ((f <<= 1) <= c[++xp])\n\t\t\t\t\t\t\t\t\tbreak; // enough codes to use up j bits\n\t\t\t\t\t\t\t\tf -= c[xp]; // else deduct codes from patterns\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tz = 1 << j; // table entries for j-bit table\n\n\t\t\t\t\t// allocate new table\n\t\t\t\t\tif (hn[0] + z > MANY) { // (note: doesn't matter for fixed)\n\t\t\t\t\t\treturn Z_DATA_ERROR; // overflow of MANY\n\t\t\t\t\t}\n\t\t\t\t\tu[h] = q = /* hp+ */hn[0]; // DEBUG\n\t\t\t\t\thn[0] += z;\n\n\t\t\t\t\t// connect to last table, if there is one\n\t\t\t\t\tif (h !== 0) {\n\t\t\t\t\t\tx[h] = i; // save pattern for backing up\n\t\t\t\t\t\tr[0] = /* (byte) */j; // bits in this table\n\t\t\t\t\t\tr[1] = /* (byte) */l; // bits to dump before this table\n\t\t\t\t\t\tj = i >>> (w - l);\n\t\t\t\t\t\tr[2] = /* (int) */(q - u[h - 1] - j); // offset to this table\n\t\t\t\t\t\thp.set(r, (u[h - 1] + j) * 3);\n\t\t\t\t\t\t// to\n\t\t\t\t\t\t// last\n\t\t\t\t\t\t// table\n\t\t\t\t\t} else {\n\t\t\t\t\t\tt[0] = q; // first table is returned result\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// set up table entry in r\n\t\t\t\tr[1] = /* (byte) */(k - w);\n\t\t\t\tif (p >= n) {\n\t\t\t\t\tr[0] = 128 + 64; // out of values--invalid code\n\t\t\t\t} else if (v[p] < s) {\n\t\t\t\t\tr[0] = /* (byte) */(v[p] < 256 ? 0 : 32 + 64); // 256 is\n\t\t\t\t\t// end-of-block\n\t\t\t\t\tr[2] = v[p++]; // simple code is just the value\n\t\t\t\t} else {\n\t\t\t\t\tr[0] = /* (byte) */(e[v[p] - s] + 16 + 64); // non-simple--look\n\t\t\t\t\t// up in lists\n\t\t\t\t\tr[2] = d[v[p++] - s];\n\t\t\t\t}\n\n\t\t\t\t// fill code-like entries with r\n\t\t\t\tf = 1 << (k - w);\n\t\t\t\tfor (j = i >>> w; j < z; j += f) {\n\t\t\t\t\thp.set(r, (q + j) * 3);\n\t\t\t\t}\n\n\t\t\t\t// backwards increment the k-bit code i\n\t\t\t\tfor (j = 1 << (k - 1); (i & j) !== 0; j >>>= 1) {\n\t\t\t\t\ti ^= j;\n\t\t\t\t}\n\t\t\t\ti ^= j;\n\n\t\t\t\t// backup over finished tables\n\t\t\t\tmask = (1 << w) - 1; // needed on HP, cc -O bug\n\t\t\t\twhile ((i & mask) != x[h]) {\n\t\t\t\t\th--; // don't need to update q\n\t\t\t\t\tw -= l;\n\t\t\t\t\tmask = (1 << w) - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Return Z_BUF_ERROR if we were given an incomplete table\n\t\treturn y !== 0 && g != 1 ? Z_BUF_ERROR : Z_OK;\n\t}\n\n\tfunction initWorkArea(vsize) {\n\t\tlet i;\n\t\tif (!hn) {\n\t\t\thn = []; // []; //new Array(1);\n\t\t\tv = []; // new Array(vsize);\n\t\t\tc = new Int32Array(BMAX + 1); // new Array(BMAX + 1);\n\t\t\tr = []; // new Array(3);\n\t\t\tu = new Int32Array(BMAX); // new Array(BMAX);\n\t\t\tx = new Int32Array(BMAX + 1); // new Array(BMAX + 1);\n\t\t}\n\t\tif (v.length < vsize) {\n\t\t\tv = []; // new Array(vsize);\n\t\t}\n\t\tfor (i = 0; i < vsize; i++) {\n\t\t\tv[i] = 0;\n\t\t}\n\t\tfor (i = 0; i < BMAX + 1; i++) {\n\t\t\tc[i] = 0;\n\t\t}\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\tr[i] = 0;\n\t\t}\n\t\t// for(int i=0; i 257)) {\n\t\t\tif (result == Z_DATA_ERROR) {\n\t\t\t\tz.msg = \"oversubscribed distance tree\";\n\t\t\t} else if (result == Z_BUF_ERROR) {\n\t\t\t\tz.msg = \"incomplete distance tree\";\n\t\t\t\tresult = Z_DATA_ERROR;\n\t\t\t} else if (result != Z_MEM_ERROR) {\n\t\t\t\tz.msg = \"empty distance tree with lengths\";\n\t\t\t\tresult = Z_DATA_ERROR;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\treturn Z_OK;\n\t};\n\n}\n\nInfTree.inflate_trees_fixed = function (bl, // literal desired/actual bit depth\n\tbd, // distance desired/actual bit depth\n\ttl,// literal/length tree result\n\ttd// distance tree result\n) {\n\tbl[0] = fixed_bl;\n\tbd[0] = fixed_bd;\n\ttl[0] = fixed_tl;\n\ttd[0] = fixed_td;\n\treturn Z_OK;\n};\n\n// InfCodes\n\n// waiting for \"i:\"=input,\n// \"o:\"=output,\n// \"x:\"=nothing\nconst START = 0; // x: set up for LEN\nconst LEN = 1; // i: get length/literal/eob next\nconst LENEXT = 2; // i: getting length extra (have base)\nconst DIST = 3; // i: get distance next\nconst DISTEXT = 4;// i: getting distance extra\nconst COPY = 5; // o: copying bytes in window, waiting\n// for space\nconst LIT = 6; // o: got literal, waiting for output\n// space\nconst WASH = 7; // o: got eob, possibly still output\n// waiting\nconst END = 8; // x: got eob and all data flushed\nconst BADCODE = 9;// x: got error\n\nfunction InfCodes() {\n\tconst that = this;\n\n\tlet mode; // current inflate_codes mode\n\n\t// mode dependent information\n\tlet len = 0;\n\n\tlet tree; // pointer into tree\n\tlet tree_index = 0;\n\tlet need = 0; // bits needed\n\n\tlet lit = 0;\n\n\t// if EXT or COPY, where and how much\n\tlet get = 0; // bits to get for extra\n\tlet dist = 0; // distance back to copy from\n\n\tlet lbits = 0; // ltree bits decoded per branch\n\tlet dbits = 0; // dtree bits decoder per branch\n\tlet ltree; // literal/length/eob tree\n\tlet ltree_index = 0; // literal/length/eob tree\n\tlet dtree; // distance tree\n\tlet dtree_index = 0; // distance tree\n\n\t// Called with number of bytes left to write in window at least 258\n\t// (the maximum string length) and number of input bytes available\n\t// at least ten. The ten bytes are six bytes for the longest length/\n\t// distance pair plus four bytes for overloading the bit buffer.\n\n\tfunction inflate_fast(bl, bd, tl, tl_index, td, td_index, s, z) {\n\t\tlet t; // temporary pointer\n\t\tlet tp; // temporary pointer\n\t\tlet tp_index; // temporary pointer\n\t\tlet e; // extra bits or operation\n\t\tlet b; // bit buffer\n\t\tlet k; // bits in bit buffer\n\t\tlet p; // input data pointer\n\t\tlet n; // bytes available there\n\t\tlet q; // output window write pointer\n\t\tlet m; // bytes to end of window or read pointer\n\t\tlet ml; // mask for literal/length tree\n\t\tlet md; // mask for distance tree\n\t\tlet c; // bytes to copy\n\t\tlet d; // distance back to copy from\n\t\tlet r; // copy source pointer\n\n\t\tlet tp_index_t_3; // (tp_index+t)*3\n\n\t\t// load input, output, bit values\n\t\tp = z.next_in_index;\n\t\tn = z.avail_in;\n\t\tb = s.bitb;\n\t\tk = s.bitk;\n\t\tq = s.write;\n\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\n\t\t// initialize masks\n\t\tml = inflate_mask[bl];\n\t\tmd = inflate_mask[bd];\n\n\t\t// do until not enough input or output space for fast loop\n\t\tdo { // assume called with m >= 258 && n >= 10\n\t\t\t// get literal/length code\n\t\t\twhile (k < (20)) { // max bits for literal/length code\n\t\t\t\tn--;\n\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\tk += 8;\n\t\t\t}\n\n\t\t\tt = b & ml;\n\t\t\ttp = tl;\n\t\t\ttp_index = tl_index;\n\t\t\ttp_index_t_3 = (tp_index + t) * 3;\n\t\t\tif ((e = tp[tp_index_t_3]) === 0) {\n\t\t\t\tb >>= (tp[tp_index_t_3 + 1]);\n\t\t\t\tk -= (tp[tp_index_t_3 + 1]);\n\n\t\t\t\ts.window[q++] = /* (byte) */tp[tp_index_t_3 + 2];\n\t\t\t\tm--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdo {\n\n\t\t\t\tb >>= (tp[tp_index_t_3 + 1]);\n\t\t\t\tk -= (tp[tp_index_t_3 + 1]);\n\n\t\t\t\tif ((e & 16) !== 0) {\n\t\t\t\t\te &= 15;\n\t\t\t\t\tc = tp[tp_index_t_3 + 2] + (/* (int) */b & inflate_mask[e]);\n\n\t\t\t\t\tb >>= e;\n\t\t\t\t\tk -= e;\n\n\t\t\t\t\t// decode distance base of block to copy\n\t\t\t\t\twhile (k < (15)) { // max bits for distance code\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\tt = b & md;\n\t\t\t\t\ttp = td;\n\t\t\t\t\ttp_index = td_index;\n\t\t\t\t\ttp_index_t_3 = (tp_index + t) * 3;\n\t\t\t\t\te = tp[tp_index_t_3];\n\n\t\t\t\t\tdo {\n\n\t\t\t\t\t\tb >>= (tp[tp_index_t_3 + 1]);\n\t\t\t\t\t\tk -= (tp[tp_index_t_3 + 1]);\n\n\t\t\t\t\t\tif ((e & 16) !== 0) {\n\t\t\t\t\t\t\t// get extra bits to add to distance base\n\t\t\t\t\t\t\te &= 15;\n\t\t\t\t\t\t\twhile (k < (e)) { // get extra bits (up to 13)\n\t\t\t\t\t\t\t\tn--;\n\t\t\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\t\t\tk += 8;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\td = tp[tp_index_t_3 + 2] + (b & inflate_mask[e]);\n\n\t\t\t\t\t\t\tb >>= (e);\n\t\t\t\t\t\t\tk -= (e);\n\n\t\t\t\t\t\t\t// do the copy\n\t\t\t\t\t\t\tm -= c;\n\t\t\t\t\t\t\tif (q >= d) { // offset before dest\n\t\t\t\t\t\t\t\t// just copy\n\t\t\t\t\t\t\t\tr = q - d;\n\t\t\t\t\t\t\t\tif (q - r > 0 && 2 > (q - r)) {\n\t\t\t\t\t\t\t\t\ts.window[q++] = s.window[r++]; // minimum\n\t\t\t\t\t\t\t\t\t// count is\n\t\t\t\t\t\t\t\t\t// three,\n\t\t\t\t\t\t\t\t\ts.window[q++] = s.window[r++]; // so unroll\n\t\t\t\t\t\t\t\t\t// loop a\n\t\t\t\t\t\t\t\t\t// little\n\t\t\t\t\t\t\t\t\tc -= 2;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts.window.set(s.window.subarray(r, r + 2), q);\n\t\t\t\t\t\t\t\t\tq += 2;\n\t\t\t\t\t\t\t\t\tr += 2;\n\t\t\t\t\t\t\t\t\tc -= 2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else { // else offset after destination\n\t\t\t\t\t\t\t\tr = q - d;\n\t\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\t\tr += s.end; // force pointer in window\n\t\t\t\t\t\t\t\t} while (r < 0); // covers invalid distances\n\t\t\t\t\t\t\t\te = s.end - r;\n\t\t\t\t\t\t\t\tif (c > e) { // if source crosses,\n\t\t\t\t\t\t\t\t\tc -= e; // wrapped copy\n\t\t\t\t\t\t\t\t\tif (q - r > 0 && e > (q - r)) {\n\t\t\t\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\t\t\t\ts.window[q++] = s.window[r++];\n\t\t\t\t\t\t\t\t\t\t} while (--e !== 0);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts.window.set(s.window.subarray(r, r + e), q);\n\t\t\t\t\t\t\t\t\t\tq += e;\n\t\t\t\t\t\t\t\t\t\tr += e;\n\t\t\t\t\t\t\t\t\t\te = 0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tr = 0; // copy rest from start of window\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// copy all or what's left\n\t\t\t\t\t\t\tif (q - r > 0 && c > (q - r)) {\n\t\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\t\ts.window[q++] = s.window[r++];\n\t\t\t\t\t\t\t\t} while (--c !== 0);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts.window.set(s.window.subarray(r, r + c), q);\n\t\t\t\t\t\t\t\tq += c;\n\t\t\t\t\t\t\t\tr += c;\n\t\t\t\t\t\t\t\tc = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else if ((e & 64) === 0) {\n\t\t\t\t\t\t\tt += tp[tp_index_t_3 + 2];\n\t\t\t\t\t\t\tt += (b & inflate_mask[e]);\n\t\t\t\t\t\t\ttp_index_t_3 = (tp_index + t) * 3;\n\t\t\t\t\t\t\te = tp[tp_index_t_3];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tz.msg = \"invalid distance code\";\n\n\t\t\t\t\t\t\tc = z.avail_in - n;\n\t\t\t\t\t\t\tc = (k >> 3) < c ? k >> 3 : c;\n\t\t\t\t\t\t\tn += c;\n\t\t\t\t\t\t\tp -= c;\n\t\t\t\t\t\t\tk -= c << 3;\n\n\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\ts.write = q;\n\n\t\t\t\t\t\t\treturn Z_DATA_ERROR;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\t\t\t} while (true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ((e & 64) === 0) {\n\t\t\t\t\tt += tp[tp_index_t_3 + 2];\n\t\t\t\t\tt += (b & inflate_mask[e]);\n\t\t\t\t\ttp_index_t_3 = (tp_index + t) * 3;\n\t\t\t\t\tif ((e = tp[tp_index_t_3]) === 0) {\n\n\t\t\t\t\t\tb >>= (tp[tp_index_t_3 + 1]);\n\t\t\t\t\t\tk -= (tp[tp_index_t_3 + 1]);\n\n\t\t\t\t\t\ts.window[q++] = /* (byte) */tp[tp_index_t_3 + 2];\n\t\t\t\t\t\tm--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else if ((e & 32) !== 0) {\n\n\t\t\t\t\tc = z.avail_in - n;\n\t\t\t\t\tc = (k >> 3) < c ? k >> 3 : c;\n\t\t\t\t\tn += c;\n\t\t\t\t\tp -= c;\n\t\t\t\t\tk -= c << 3;\n\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\n\t\t\t\t\treturn Z_STREAM_END;\n\t\t\t\t} else {\n\t\t\t\t\tz.msg = \"invalid literal/length code\";\n\n\t\t\t\t\tc = z.avail_in - n;\n\t\t\t\t\tc = (k >> 3) < c ? k >> 3 : c;\n\t\t\t\t\tn += c;\n\t\t\t\t\tp -= c;\n\t\t\t\t\tk -= c << 3;\n\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\n\t\t\t\t\treturn Z_DATA_ERROR;\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\t} while (true);\n\t\t} while (m >= 258 && n >= 10);\n\n\t\t// not enough input or output--restore pointers and return\n\t\tc = z.avail_in - n;\n\t\tc = (k >> 3) < c ? k >> 3 : c;\n\t\tn += c;\n\t\tp -= c;\n\t\tk -= c << 3;\n\n\t\ts.bitb = b;\n\t\ts.bitk = k;\n\t\tz.avail_in = n;\n\t\tz.total_in += p - z.next_in_index;\n\t\tz.next_in_index = p;\n\t\ts.write = q;\n\n\t\treturn Z_OK;\n\t}\n\n\tthat.init = function (bl, bd, tl, tl_index, td, td_index) {\n\t\tmode = START;\n\t\tlbits = /* (byte) */bl;\n\t\tdbits = /* (byte) */bd;\n\t\tltree = tl;\n\t\tltree_index = tl_index;\n\t\tdtree = td;\n\t\tdtree_index = td_index;\n\t\ttree = null;\n\t};\n\n\tthat.proc = function (s, z, r) {\n\t\tlet j; // temporary storage\n\t\tlet tindex; // temporary pointer\n\t\tlet e; // extra bits or operation\n\t\tlet b = 0; // bit buffer\n\t\tlet k = 0; // bits in bit buffer\n\t\tlet p = 0; // input data pointer\n\t\tlet n; // bytes available there\n\t\tlet q; // output window write pointer\n\t\tlet m; // bytes to end of window or read pointer\n\t\tlet f; // pointer to copy strings from\n\n\t\t// copy input/output information to locals (UPDATE macro restores)\n\t\tp = z.next_in_index;\n\t\tn = z.avail_in;\n\t\tb = s.bitb;\n\t\tk = s.bitk;\n\t\tq = s.write;\n\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\n\t\t// process input and output based on current state\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tswitch (mode) {\n\t\t\t\t// waiting for \"i:\"=input, \"o:\"=output, \"x:\"=nothing\n\t\t\t\tcase START: // x: set up for LEN\n\t\t\t\t\tif (m >= 258 && n >= 10) {\n\n\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\tr = inflate_fast(lbits, dbits, ltree, ltree_index, dtree, dtree_index, s, z);\n\n\t\t\t\t\t\tp = z.next_in_index;\n\t\t\t\t\t\tn = z.avail_in;\n\t\t\t\t\t\tb = s.bitb;\n\t\t\t\t\t\tk = s.bitk;\n\t\t\t\t\t\tq = s.write;\n\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\n\t\t\t\t\t\tif (r != Z_OK) {\n\t\t\t\t\t\t\tmode = r == Z_STREAM_END ? WASH : BADCODE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tneed = lbits;\n\t\t\t\t\ttree = ltree;\n\t\t\t\t\ttree_index = ltree_index;\n\n\t\t\t\t\tmode = LEN;\n\t\t\t\t/* falls through */\n\t\t\t\tcase LEN: // i: get length/literal/eob next\n\t\t\t\t\tj = need;\n\n\t\t\t\t\twhile (k < (j)) {\n\t\t\t\t\t\tif (n !== 0)\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\telse {\n\n\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\ttindex = (tree_index + (b & inflate_mask[j])) * 3;\n\n\t\t\t\t\tb >>>= (tree[tindex + 1]);\n\t\t\t\t\tk -= (tree[tindex + 1]);\n\n\t\t\t\t\te = tree[tindex];\n\n\t\t\t\t\tif (e === 0) { // literal\n\t\t\t\t\t\tlit = tree[tindex + 2];\n\t\t\t\t\t\tmode = LIT;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ((e & 16) !== 0) { // length\n\t\t\t\t\t\tget = e & 15;\n\t\t\t\t\t\tlen = tree[tindex + 2];\n\t\t\t\t\t\tmode = LENEXT;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ((e & 64) === 0) { // next table\n\t\t\t\t\t\tneed = e;\n\t\t\t\t\t\ttree_index = tindex / 3 + tree[tindex + 2];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ((e & 32) !== 0) { // end of block\n\t\t\t\t\t\tmode = WASH;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tmode = BADCODE; // invalid code\n\t\t\t\t\tz.msg = \"invalid literal/length code\";\n\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\t\t\t\t\treturn s.inflate_flush(z, r);\n\n\t\t\t\tcase LENEXT: // i: getting length extra (have base)\n\t\t\t\t\tj = get;\n\n\t\t\t\t\twhile (k < (j)) {\n\t\t\t\t\t\tif (n !== 0)\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\telse {\n\n\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\tlen += (b & inflate_mask[j]);\n\n\t\t\t\t\tb >>= j;\n\t\t\t\t\tk -= j;\n\n\t\t\t\t\tneed = dbits;\n\t\t\t\t\ttree = dtree;\n\t\t\t\t\ttree_index = dtree_index;\n\t\t\t\t\tmode = DIST;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DIST: // i: get distance next\n\t\t\t\t\tj = need;\n\n\t\t\t\t\twhile (k < (j)) {\n\t\t\t\t\t\tif (n !== 0)\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\telse {\n\n\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\ttindex = (tree_index + (b & inflate_mask[j])) * 3;\n\n\t\t\t\t\tb >>= tree[tindex + 1];\n\t\t\t\t\tk -= tree[tindex + 1];\n\n\t\t\t\t\te = (tree[tindex]);\n\t\t\t\t\tif ((e & 16) !== 0) { // distance\n\t\t\t\t\t\tget = e & 15;\n\t\t\t\t\t\tdist = tree[tindex + 2];\n\t\t\t\t\t\tmode = DISTEXT;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ((e & 64) === 0) { // next table\n\t\t\t\t\t\tneed = e;\n\t\t\t\t\t\ttree_index = tindex / 3 + tree[tindex + 2];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tmode = BADCODE; // invalid code\n\t\t\t\t\tz.msg = \"invalid distance code\";\n\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\t\t\t\t\treturn s.inflate_flush(z, r);\n\n\t\t\t\tcase DISTEXT: // i: getting distance extra\n\t\t\t\t\tj = get;\n\n\t\t\t\t\twhile (k < (j)) {\n\t\t\t\t\t\tif (n !== 0)\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\telse {\n\n\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\tdist += (b & inflate_mask[j]);\n\n\t\t\t\t\tb >>= j;\n\t\t\t\t\tk -= j;\n\n\t\t\t\t\tmode = COPY;\n\t\t\t\t/* falls through */\n\t\t\t\tcase COPY: // o: copying bytes in window, waiting for space\n\t\t\t\t\tf = q - dist;\n\t\t\t\t\twhile (f < 0) { // modulo window size-\"while\" instead\n\t\t\t\t\t\tf += s.end; // of \"if\" handles invalid distances\n\t\t\t\t\t}\n\t\t\t\t\twhile (len !== 0) {\n\n\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\tif (q == s.end && s.read !== 0) {\n\t\t\t\t\t\t\t\tq = 0;\n\t\t\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\t\tr = s.inflate_flush(z, r);\n\t\t\t\t\t\t\t\tq = s.write;\n\t\t\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\n\t\t\t\t\t\t\t\tif (q == s.end && s.read !== 0) {\n\t\t\t\t\t\t\t\t\tq = 0;\n\t\t\t\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ts.window[q++] = s.window[f++];\n\t\t\t\t\t\tm--;\n\n\t\t\t\t\t\tif (f == s.end)\n\t\t\t\t\t\t\tf = 0;\n\t\t\t\t\t\tlen--;\n\t\t\t\t\t}\n\t\t\t\t\tmode = START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LIT: // o: got literal, waiting for output space\n\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\tif (q == s.end && s.read !== 0) {\n\t\t\t\t\t\t\tq = 0;\n\t\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\tr = s.inflate_flush(z, r);\n\t\t\t\t\t\t\tq = s.write;\n\t\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\n\t\t\t\t\t\t\tif (q == s.end && s.read !== 0) {\n\t\t\t\t\t\t\t\tq = 0;\n\t\t\t\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tr = Z_OK;\n\n\t\t\t\t\ts.window[q++] = /* (byte) */lit;\n\t\t\t\t\tm--;\n\n\t\t\t\t\tmode = START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase WASH: // o: got eob, possibly more output\n\t\t\t\t\tif (k > 7) { // return unused byte, if any\n\t\t\t\t\t\tk -= 8;\n\t\t\t\t\t\tn++;\n\t\t\t\t\t\tp--; // can always return one\n\t\t\t\t\t}\n\n\t\t\t\t\ts.write = q;\n\t\t\t\t\tr = s.inflate_flush(z, r);\n\t\t\t\t\tq = s.write;\n\t\t\t\t\tm = q < s.read ? s.read - q - 1 : s.end - q;\n\n\t\t\t\t\tif (s.read != s.write) {\n\t\t\t\t\t\ts.bitb = b;\n\t\t\t\t\t\ts.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\ts.write = q;\n\t\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tmode = END;\n\t\t\t\t/* falls through */\n\t\t\t\tcase END:\n\t\t\t\t\tr = Z_STREAM_END;\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\t\t\t\t\treturn s.inflate_flush(z, r);\n\n\t\t\t\tcase BADCODE: // x: got error\n\n\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\t\t\t\t\treturn s.inflate_flush(z, r);\n\n\t\t\t\tdefault:\n\t\t\t\t\tr = Z_STREAM_ERROR;\n\n\t\t\t\t\ts.bitb = b;\n\t\t\t\t\ts.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\ts.write = q;\n\t\t\t\t\treturn s.inflate_flush(z, r);\n\t\t\t}\n\t\t}\n\t};\n\n\tthat.free = function () {\n\t\t// ZFREE(z, c);\n\t};\n\n}\n\n// InfBlocks\n\n// Table for deflate from PKZIP's appnote.txt.\nconst border = [ // Order of the bit length code lengths\n\t16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n\nconst TYPE = 0; // get type bits (3, including end bit)\nconst LENS = 1; // get lengths for stored\nconst STORED = 2;// processing stored block\nconst TABLE = 3; // get table lengths\nconst BTREE = 4; // get bit lengths tree for a dynamic\n// block\nconst DTREE = 5; // get length, distance trees for a\n// dynamic block\nconst CODES = 6; // processing fixed or dynamic block\nconst DRY = 7; // output remaining window bytes\nconst DONELOCKS = 8; // finished last block, done\nconst BADBLOCKS = 9; // ot a data error--stuck here\n\nfunction InfBlocks(z, w) {\n\tconst that = this;\n\n\tlet mode = TYPE; // current inflate_block mode\n\n\tlet left = 0; // if STORED, bytes left to copy\n\n\tlet table = 0; // table lengths (14 bits)\n\tlet index = 0; // index into blens (or border)\n\tlet blens; // bit lengths of codes\n\tconst bb = [0]; // bit length tree depth\n\tconst tb = [0]; // bit length decoding tree\n\n\tconst codes = new InfCodes(); // if CODES, current state\n\n\tlet last = 0; // true if this block is the last block\n\n\tlet hufts = new Int32Array(MANY * 3); // single malloc for tree space\n\tconst check = 0; // check on output\n\tconst inftree = new InfTree();\n\n\tthat.bitk = 0; // bits in bit buffer\n\tthat.bitb = 0; // bit buffer\n\tthat.window = new Uint8Array(w); // sliding window\n\tthat.end = w; // one byte after sliding window\n\tthat.read = 0; // window read pointer\n\tthat.write = 0; // window write pointer\n\n\tthat.reset = function (z, c) {\n\t\tif (c)\n\t\t\tc[0] = check;\n\t\t// if (mode == BTREE || mode == DTREE) {\n\t\t// }\n\t\tif (mode == CODES) {\n\t\t\tcodes.free(z);\n\t\t}\n\t\tmode = TYPE;\n\t\tthat.bitk = 0;\n\t\tthat.bitb = 0;\n\t\tthat.read = that.write = 0;\n\t};\n\n\tthat.reset(z, null);\n\n\t// copy as much as possible from the sliding window to the output area\n\tthat.inflate_flush = function (z, r) {\n\t\tlet n;\n\t\tlet p;\n\t\tlet q;\n\n\t\t// local copies of source and destination pointers\n\t\tp = z.next_out_index;\n\t\tq = that.read;\n\n\t\t// compute number of bytes to copy as far as end of window\n\t\tn = /* (int) */((q <= that.write ? that.write : that.end) - q);\n\t\tif (n > z.avail_out)\n\t\t\tn = z.avail_out;\n\t\tif (n !== 0 && r == Z_BUF_ERROR)\n\t\t\tr = Z_OK;\n\n\t\t// update counters\n\t\tz.avail_out -= n;\n\t\tz.total_out += n;\n\n\t\t// copy as far as end of window\n\t\tz.next_out.set(that.window.subarray(q, q + n), p);\n\t\tp += n;\n\t\tq += n;\n\n\t\t// see if more to copy at beginning of window\n\t\tif (q == that.end) {\n\t\t\t// wrap pointers\n\t\t\tq = 0;\n\t\t\tif (that.write == that.end)\n\t\t\t\tthat.write = 0;\n\n\t\t\t// compute bytes to copy\n\t\t\tn = that.write - q;\n\t\t\tif (n > z.avail_out)\n\t\t\t\tn = z.avail_out;\n\t\t\tif (n !== 0 && r == Z_BUF_ERROR)\n\t\t\t\tr = Z_OK;\n\n\t\t\t// update counters\n\t\t\tz.avail_out -= n;\n\t\t\tz.total_out += n;\n\n\t\t\t// copy\n\t\t\tz.next_out.set(that.window.subarray(q, q + n), p);\n\t\t\tp += n;\n\t\t\tq += n;\n\t\t}\n\n\t\t// update pointers\n\t\tz.next_out_index = p;\n\t\tthat.read = q;\n\n\t\t// done\n\t\treturn r;\n\t};\n\n\tthat.proc = function (z, r) {\n\t\tlet t; // temporary storage\n\t\tlet b; // bit buffer\n\t\tlet k; // bits in bit buffer\n\t\tlet p; // input data pointer\n\t\tlet n; // bytes available there\n\t\tlet q; // output window write pointer\n\t\tlet m; // bytes to end of window or read pointer\n\n\t\tlet i;\n\n\t\t// copy input/output information to locals (UPDATE macro restores)\n\t\t// {\n\t\tp = z.next_in_index;\n\t\tn = z.avail_in;\n\t\tb = that.bitb;\n\t\tk = that.bitk;\n\t\t// }\n\t\t// {\n\t\tq = that.write;\n\t\tm = /* (int) */(q < that.read ? that.read - q - 1 : that.end - q);\n\t\t// }\n\n\t\t// process input based on current state\n\t\t// DEBUG dtree\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tlet bl, bd, tl, td, bl_, bd_, tl_, td_;\n\t\t\tswitch (mode) {\n\t\t\t\tcase TYPE:\n\n\t\t\t\t\twhile (k < (3)) {\n\t\t\t\t\t\tif (n !== 0) {\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\t\t\t\t\tt = /* (int) */(b & 7);\n\t\t\t\t\tlast = t & 1;\n\n\t\t\t\t\tswitch (t >>> 1) {\n\t\t\t\t\t\tcase 0: // stored\n\t\t\t\t\t\t\t// {\n\t\t\t\t\t\t\tb >>>= (3);\n\t\t\t\t\t\t\tk -= (3);\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\tt = k & 7; // go to byte boundary\n\n\t\t\t\t\t\t\t// {\n\t\t\t\t\t\t\tb >>>= (t);\n\t\t\t\t\t\t\tk -= (t);\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\tmode = LENS; // get length of stored block\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 1: // fixed\n\t\t\t\t\t\t\t// {\n\t\t\t\t\t\t\tbl = []; // new Array(1);\n\t\t\t\t\t\t\tbd = []; // new Array(1);\n\t\t\t\t\t\t\ttl = [[]]; // new Array(1);\n\t\t\t\t\t\t\ttd = [[]]; // new Array(1);\n\n\t\t\t\t\t\t\tInfTree.inflate_trees_fixed(bl, bd, tl, td);\n\t\t\t\t\t\t\tcodes.init(bl[0], bd[0], tl[0], 0, td[0], 0);\n\t\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t\t// {\n\t\t\t\t\t\t\tb >>>= (3);\n\t\t\t\t\t\t\tk -= (3);\n\t\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t\tmode = CODES;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 2: // dynamic\n\n\t\t\t\t\t\t\t// {\n\t\t\t\t\t\t\tb >>>= (3);\n\t\t\t\t\t\t\tk -= (3);\n\t\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t\tmode = TABLE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 3: // illegal\n\n\t\t\t\t\t\t\t// {\n\t\t\t\t\t\t\tb >>>= (3);\n\t\t\t\t\t\t\tk -= (3);\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\tmode = BADBLOCKS;\n\t\t\t\t\t\t\tz.msg = \"invalid block type\";\n\t\t\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase LENS:\n\n\t\t\t\t\twhile (k < (32)) {\n\t\t\t\t\t\tif (n !== 0) {\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ((((~b) >>> 16) & 0xffff) != (b & 0xffff)) {\n\t\t\t\t\t\tmode = BADBLOCKS;\n\t\t\t\t\t\tz.msg = \"invalid stored block lengths\";\n\t\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tleft = (b & 0xffff);\n\t\t\t\t\tb = k = 0; // dump bits\n\t\t\t\t\tmode = left !== 0 ? STORED : (last !== 0 ? DRY : TYPE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase STORED:\n\t\t\t\t\tif (n === 0) {\n\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\tif (q == that.end && that.read !== 0) {\n\t\t\t\t\t\t\tq = 0;\n\t\t\t\t\t\t\tm = /* (int) */(q < that.read ? that.read - q - 1 : that.end - q);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\tr = that.inflate_flush(z, r);\n\t\t\t\t\t\t\tq = that.write;\n\t\t\t\t\t\t\tm = /* (int) */(q < that.read ? that.read - q - 1 : that.end - q);\n\t\t\t\t\t\t\tif (q == that.end && that.read !== 0) {\n\t\t\t\t\t\t\t\tq = 0;\n\t\t\t\t\t\t\t\tm = /* (int) */(q < that.read ? that.read - q - 1 : that.end - q);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (m === 0) {\n\t\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tr = Z_OK;\n\n\t\t\t\t\tt = left;\n\t\t\t\t\tif (t > n)\n\t\t\t\t\t\tt = n;\n\t\t\t\t\tif (t > m)\n\t\t\t\t\t\tt = m;\n\t\t\t\t\tthat.window.set(z.read_buf(p, t), q);\n\t\t\t\t\tp += t;\n\t\t\t\t\tn -= t;\n\t\t\t\t\tq += t;\n\t\t\t\t\tm -= t;\n\t\t\t\t\tif ((left -= t) !== 0)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tmode = last !== 0 ? DRY : TYPE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TABLE:\n\n\t\t\t\t\twhile (k < (14)) {\n\t\t\t\t\t\tif (n !== 0) {\n\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\tk += 8;\n\t\t\t\t\t}\n\n\t\t\t\t\ttable = t = (b & 0x3fff);\n\t\t\t\t\tif ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) {\n\t\t\t\t\t\tmode = BADBLOCKS;\n\t\t\t\t\t\tz.msg = \"too many length or distance symbols\";\n\t\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tt = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);\n\t\t\t\t\tif (!blens || blens.length < t) {\n\t\t\t\t\t\tblens = []; // new Array(t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (i = 0; i < t; i++) {\n\t\t\t\t\t\t\tblens[i] = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// {\n\t\t\t\t\tb >>>= (14);\n\t\t\t\t\tk -= (14);\n\t\t\t\t\t// }\n\n\t\t\t\t\tindex = 0;\n\t\t\t\t\tmode = BTREE;\n\t\t\t\t/* falls through */\n\t\t\t\tcase BTREE:\n\t\t\t\t\twhile (index < 4 + (table >>> 10)) {\n\t\t\t\t\t\twhile (k < (3)) {\n\t\t\t\t\t\t\tif (n !== 0) {\n\t\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tn--;\n\t\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\t\tk += 8;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tblens[border[index++]] = b & 7;\n\n\t\t\t\t\t\t// {\n\t\t\t\t\t\tb >>>= (3);\n\t\t\t\t\t\tk -= (3);\n\t\t\t\t\t\t// }\n\t\t\t\t\t}\n\n\t\t\t\t\twhile (index < 19) {\n\t\t\t\t\t\tblens[border[index++]] = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tbb[0] = 7;\n\t\t\t\t\tt = inftree.inflate_trees_bits(blens, bb, tb, hufts, z);\n\t\t\t\t\tif (t != Z_OK) {\n\t\t\t\t\t\tr = t;\n\t\t\t\t\t\tif (r == Z_DATA_ERROR) {\n\t\t\t\t\t\t\tblens = null;\n\t\t\t\t\t\t\tmode = BADBLOCKS;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\n\t\t\t\t\tindex = 0;\n\t\t\t\t\tmode = DTREE;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DTREE:\n\t\t\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\t\t\twhile (true) {\n\t\t\t\t\t\tt = table;\n\t\t\t\t\t\tif (index >= 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet j, c;\n\n\t\t\t\t\t\tt = bb[0];\n\n\t\t\t\t\t\twhile (k < (t)) {\n\t\t\t\t\t\t\tif (n !== 0) {\n\t\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tn--;\n\t\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\t\tk += 8;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if (tb[0] == -1) {\n\t\t\t\t\t\t// System.err.println(\"null...\");\n\t\t\t\t\t\t// }\n\n\t\t\t\t\t\tt = hufts[(tb[0] + (b & inflate_mask[t])) * 3 + 1];\n\t\t\t\t\t\tc = hufts[(tb[0] + (b & inflate_mask[t])) * 3 + 2];\n\n\t\t\t\t\t\tif (c < 16) {\n\t\t\t\t\t\t\tb >>>= (t);\n\t\t\t\t\t\t\tk -= (t);\n\t\t\t\t\t\t\tblens[index++] = c;\n\t\t\t\t\t\t} else { // c == 16..18\n\t\t\t\t\t\t\ti = c == 18 ? 7 : c - 14;\n\t\t\t\t\t\t\tj = c == 18 ? 11 : 3;\n\n\t\t\t\t\t\t\twhile (k < (t + i)) {\n\t\t\t\t\t\t\t\tif (n !== 0) {\n\t\t\t\t\t\t\t\t\tr = Z_OK;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tn--;\n\t\t\t\t\t\t\t\tb |= (z.read_byte(p++) & 0xff) << k;\n\t\t\t\t\t\t\t\tk += 8;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tb >>>= (t);\n\t\t\t\t\t\t\tk -= (t);\n\n\t\t\t\t\t\t\tj += (b & inflate_mask[i]);\n\n\t\t\t\t\t\t\tb >>>= (i);\n\t\t\t\t\t\t\tk -= (i);\n\n\t\t\t\t\t\t\ti = index;\n\t\t\t\t\t\t\tt = table;\n\t\t\t\t\t\t\tif (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || (c == 16 && i < 1)) {\n\t\t\t\t\t\t\t\tblens = null;\n\t\t\t\t\t\t\t\tmode = BADBLOCKS;\n\t\t\t\t\t\t\t\tz.msg = \"invalid bit length repeat\";\n\t\t\t\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tc = c == 16 ? blens[i - 1] : 0;\n\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\tblens[i++] = c;\n\t\t\t\t\t\t\t} while (--j !== 0);\n\t\t\t\t\t\t\tindex = i;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttb[0] = -1;\n\t\t\t\t\t// {\n\t\t\t\t\tbl_ = []; // new Array(1);\n\t\t\t\t\tbd_ = []; // new Array(1);\n\t\t\t\t\ttl_ = []; // new Array(1);\n\t\t\t\t\ttd_ = []; // new Array(1);\n\t\t\t\t\tbl_[0] = 9; // must be <= 9 for lookahead assumptions\n\t\t\t\t\tbd_[0] = 6; // must be <= 9 for lookahead assumptions\n\n\t\t\t\t\tt = table;\n\t\t\t\t\tt = inftree.inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), blens, bl_, bd_, tl_, td_, hufts, z);\n\n\t\t\t\t\tif (t != Z_OK) {\n\t\t\t\t\t\tif (t == Z_DATA_ERROR) {\n\t\t\t\t\t\t\tblens = null;\n\t\t\t\t\t\t\tmode = BADBLOCKS;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tr = t;\n\n\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tcodes.init(bl_[0], bd_[0], hufts, tl_[0], hufts, td_[0]);\n\t\t\t\t\t// }\n\t\t\t\t\tmode = CODES;\n\t\t\t\t/* falls through */\n\t\t\t\tcase CODES:\n\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\tthat.write = q;\n\n\t\t\t\t\tif ((r = codes.proc(that, z, r)) != Z_STREAM_END) {\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tr = Z_OK;\n\t\t\t\t\tcodes.free(z);\n\n\t\t\t\t\tp = z.next_in_index;\n\t\t\t\t\tn = z.avail_in;\n\t\t\t\t\tb = that.bitb;\n\t\t\t\t\tk = that.bitk;\n\t\t\t\t\tq = that.write;\n\t\t\t\t\tm = /* (int) */(q < that.read ? that.read - q - 1 : that.end - q);\n\n\t\t\t\t\tif (last === 0) {\n\t\t\t\t\t\tmode = TYPE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tmode = DRY;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DRY:\n\t\t\t\t\tthat.write = q;\n\t\t\t\t\tr = that.inflate_flush(z, r);\n\t\t\t\t\tq = that.write;\n\t\t\t\t\tm = /* (int) */(q < that.read ? that.read - q - 1 : that.end - q);\n\t\t\t\t\tif (that.read != that.write) {\n\t\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\t\tthat.write = q;\n\t\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\t\t}\n\t\t\t\t\tmode = DONELOCKS;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DONELOCKS:\n\t\t\t\t\tr = Z_STREAM_END;\n\n\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\tthat.write = q;\n\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t\tcase BADBLOCKS:\n\t\t\t\t\tr = Z_DATA_ERROR;\n\n\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\tthat.write = q;\n\t\t\t\t\treturn that.inflate_flush(z, r);\n\n\t\t\t\tdefault:\n\t\t\t\t\tr = Z_STREAM_ERROR;\n\n\t\t\t\t\tthat.bitb = b;\n\t\t\t\t\tthat.bitk = k;\n\t\t\t\t\tz.avail_in = n;\n\t\t\t\t\tz.total_in += p - z.next_in_index;\n\t\t\t\t\tz.next_in_index = p;\n\t\t\t\t\tthat.write = q;\n\t\t\t\t\treturn that.inflate_flush(z, r);\n\t\t\t}\n\t\t}\n\t};\n\n\tthat.free = function (z) {\n\t\tthat.reset(z, null);\n\t\tthat.window = null;\n\t\thufts = null;\n\t\t// ZFREE(z, s);\n\t};\n\n\tthat.set_dictionary = function (d, start, n) {\n\t\tthat.window.set(d.subarray(start, start + n), 0);\n\t\tthat.read = that.write = n;\n\t};\n\n\t// Returns true if inflate is currently at the end of a block generated\n\t// by Z_SYNC_FLUSH or Z_FULL_FLUSH.\n\tthat.sync_point = function () {\n\t\treturn mode == LENS ? 1 : 0;\n\t};\n\n}\n\n// Inflate\n\n// preset dictionary flag in zlib header\nconst PRESET_DICT = 0x20;\n\nconst Z_DEFLATED = 8;\n\nconst METHOD = 0; // waiting for method byte\nconst FLAG = 1; // waiting for flag byte\nconst DICT4 = 2; // four dictionary check bytes to go\nconst DICT3 = 3; // three dictionary check bytes to go\nconst DICT2 = 4; // two dictionary check bytes to go\nconst DICT1 = 5; // one dictionary check byte to go\nconst DICT0 = 6; // waiting for inflateSetDictionary\nconst BLOCKS = 7; // decompressing blocks\nconst DONE = 12; // finished check, done\nconst BAD = 13; // got an error--stay here\n\nconst mark = [0, 0, 0xff, 0xff];\n\nfunction Inflate() {\n\tconst that = this;\n\n\tthat.mode = 0; // current inflate mode\n\n\t// mode dependent information\n\tthat.method = 0; // if FLAGS, method byte\n\n\t// if CHECK, check values to compare\n\tthat.was = [0]; // new Array(1); // computed check value\n\tthat.need = 0; // stream check value\n\n\t// if BAD, inflateSync's marker bytes count\n\tthat.marker = 0;\n\n\t// mode independent information\n\tthat.wbits = 0; // log2(window size) (8..15, defaults to 15)\n\n\t// this.blocks; // current inflate_blocks state\n\n\tfunction inflateReset(z) {\n\t\tif (!z || !z.istate)\n\t\t\treturn Z_STREAM_ERROR;\n\n\t\tz.total_in = z.total_out = 0;\n\t\tz.msg = null;\n\t\tz.istate.mode = BLOCKS;\n\t\tz.istate.blocks.reset(z, null);\n\t\treturn Z_OK;\n\t}\n\n\tthat.inflateEnd = function (z) {\n\t\tif (that.blocks)\n\t\t\tthat.blocks.free(z);\n\t\tthat.blocks = null;\n\t\t// ZFREE(z, z->state);\n\t\treturn Z_OK;\n\t};\n\n\tthat.inflateInit = function (z, w) {\n\t\tz.msg = null;\n\t\tthat.blocks = null;\n\n\t\t// set window size\n\t\tif (w < 8 || w > 15) {\n\t\t\tthat.inflateEnd(z);\n\t\t\treturn Z_STREAM_ERROR;\n\t\t}\n\t\tthat.wbits = w;\n\n\t\tz.istate.blocks = new InfBlocks(z, 1 << w);\n\n\t\t// reset state\n\t\tinflateReset(z);\n\t\treturn Z_OK;\n\t};\n\n\tthat.inflate = function (z, f) {\n\t\tlet r;\n\t\tlet b;\n\n\t\tif (!z || !z.istate || !z.next_in)\n\t\t\treturn Z_STREAM_ERROR;\n\t\tconst istate = z.istate;\n\t\tf = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;\n\t\tr = Z_BUF_ERROR;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tswitch (istate.mode) {\n\t\t\t\tcase METHOD:\n\n\t\t\t\t\tif (z.avail_in === 0)\n\t\t\t\t\t\treturn r;\n\t\t\t\t\tr = f;\n\n\t\t\t\t\tz.avail_in--;\n\t\t\t\t\tz.total_in++;\n\t\t\t\t\tif (((istate.method = z.read_byte(z.next_in_index++)) & 0xf) != Z_DEFLATED) {\n\t\t\t\t\t\tistate.mode = BAD;\n\t\t\t\t\t\tz.msg = \"unknown compression method\";\n\t\t\t\t\t\tistate.marker = 5; // can't try inflateSync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ((istate.method >> 4) + 8 > istate.wbits) {\n\t\t\t\t\t\tistate.mode = BAD;\n\t\t\t\t\t\tz.msg = \"invalid window size\";\n\t\t\t\t\t\tistate.marker = 5; // can't try inflateSync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tistate.mode = FLAG;\n\t\t\t\t/* falls through */\n\t\t\t\tcase FLAG:\n\n\t\t\t\t\tif (z.avail_in === 0)\n\t\t\t\t\t\treturn r;\n\t\t\t\t\tr = f;\n\n\t\t\t\t\tz.avail_in--;\n\t\t\t\t\tz.total_in++;\n\t\t\t\t\tb = (z.read_byte(z.next_in_index++)) & 0xff;\n\n\t\t\t\t\tif ((((istate.method << 8) + b) % 31) !== 0) {\n\t\t\t\t\t\tistate.mode = BAD;\n\t\t\t\t\t\tz.msg = \"incorrect header check\";\n\t\t\t\t\t\tistate.marker = 5; // can't try inflateSync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ((b & PRESET_DICT) === 0) {\n\t\t\t\t\t\tistate.mode = BLOCKS;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tistate.mode = DICT4;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DICT4:\n\n\t\t\t\t\tif (z.avail_in === 0)\n\t\t\t\t\t\treturn r;\n\t\t\t\t\tr = f;\n\n\t\t\t\t\tz.avail_in--;\n\t\t\t\t\tz.total_in++;\n\t\t\t\t\tistate.need = ((z.read_byte(z.next_in_index++) & 0xff) << 24) & 0xff000000;\n\t\t\t\t\tistate.mode = DICT3;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DICT3:\n\n\t\t\t\t\tif (z.avail_in === 0)\n\t\t\t\t\t\treturn r;\n\t\t\t\t\tr = f;\n\n\t\t\t\t\tz.avail_in--;\n\t\t\t\t\tz.total_in++;\n\t\t\t\t\tistate.need += ((z.read_byte(z.next_in_index++) & 0xff) << 16) & 0xff0000;\n\t\t\t\t\tistate.mode = DICT2;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DICT2:\n\n\t\t\t\t\tif (z.avail_in === 0)\n\t\t\t\t\t\treturn r;\n\t\t\t\t\tr = f;\n\n\t\t\t\t\tz.avail_in--;\n\t\t\t\t\tz.total_in++;\n\t\t\t\t\tistate.need += ((z.read_byte(z.next_in_index++) & 0xff) << 8) & 0xff00;\n\t\t\t\t\tistate.mode = DICT1;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DICT1:\n\n\t\t\t\t\tif (z.avail_in === 0)\n\t\t\t\t\t\treturn r;\n\t\t\t\t\tr = f;\n\n\t\t\t\t\tz.avail_in--;\n\t\t\t\t\tz.total_in++;\n\t\t\t\t\tistate.need += (z.read_byte(z.next_in_index++) & 0xff);\n\t\t\t\t\tistate.mode = DICT0;\n\t\t\t\t\treturn Z_NEED_DICT;\n\t\t\t\tcase DICT0:\n\t\t\t\t\tistate.mode = BAD;\n\t\t\t\t\tz.msg = \"need dictionary\";\n\t\t\t\t\tistate.marker = 0; // can try inflateSync\n\t\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t\tcase BLOCKS:\n\n\t\t\t\t\tr = istate.blocks.proc(z, r);\n\t\t\t\t\tif (r == Z_DATA_ERROR) {\n\t\t\t\t\t\tistate.mode = BAD;\n\t\t\t\t\t\tistate.marker = 0; // can try inflateSync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (r == Z_OK) {\n\t\t\t\t\t\tr = f;\n\t\t\t\t\t}\n\t\t\t\t\tif (r != Z_STREAM_END) {\n\t\t\t\t\t\treturn r;\n\t\t\t\t\t}\n\t\t\t\t\tr = f;\n\t\t\t\t\tistate.blocks.reset(z, istate.was);\n\t\t\t\t\tistate.mode = DONE;\n\t\t\t\t/* falls through */\n\t\t\t\tcase DONE:\n\t\t\t\t\treturn Z_STREAM_END;\n\t\t\t\tcase BAD:\n\t\t\t\t\treturn Z_DATA_ERROR;\n\t\t\t\tdefault:\n\t\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\t\t}\n\t};\n\n\tthat.inflateSetDictionary = function (z, dictionary, dictLength) {\n\t\tlet index = 0, length = dictLength;\n\t\tif (!z || !z.istate || z.istate.mode != DICT0)\n\t\t\treturn Z_STREAM_ERROR;\n\t\tconst istate = z.istate;\n\t\tif (length >= (1 << istate.wbits)) {\n\t\t\tlength = (1 << istate.wbits) - 1;\n\t\t\tindex = dictLength - length;\n\t\t}\n\t\tistate.blocks.set_dictionary(dictionary, index, length);\n\t\tistate.mode = BLOCKS;\n\t\treturn Z_OK;\n\t};\n\n\tthat.inflateSync = function (z) {\n\t\tlet n; // number of bytes to look at\n\t\tlet p; // pointer to bytes\n\t\tlet m; // number of marker bytes found in a row\n\t\tlet r, w; // temporaries to save total_in and total_out\n\n\t\t// set up\n\t\tif (!z || !z.istate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\tconst istate = z.istate;\n\t\tif (istate.mode != BAD) {\n\t\t\tistate.mode = BAD;\n\t\t\tistate.marker = 0;\n\t\t}\n\t\tif ((n = z.avail_in) === 0)\n\t\t\treturn Z_BUF_ERROR;\n\t\tp = z.next_in_index;\n\t\tm = istate.marker;\n\n\t\t// search\n\t\twhile (n !== 0 && m < 4) {\n\t\t\tif (z.read_byte(p) == mark[m]) {\n\t\t\t\tm++;\n\t\t\t} else if (z.read_byte(p) !== 0) {\n\t\t\t\tm = 0;\n\t\t\t} else {\n\t\t\t\tm = 4 - m;\n\t\t\t}\n\t\t\tp++;\n\t\t\tn--;\n\t\t}\n\n\t\t// restore\n\t\tz.total_in += p - z.next_in_index;\n\t\tz.next_in_index = p;\n\t\tz.avail_in = n;\n\t\tistate.marker = m;\n\n\t\t// return no joy or set up to restart on a new block\n\t\tif (m != 4) {\n\t\t\treturn Z_DATA_ERROR;\n\t\t}\n\t\tr = z.total_in;\n\t\tw = z.total_out;\n\t\tinflateReset(z);\n\t\tz.total_in = r;\n\t\tz.total_out = w;\n\t\tistate.mode = BLOCKS;\n\t\treturn Z_OK;\n\t};\n\n\t// Returns true if inflate is currently at the end of a block generated\n\t// by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP\n\t// implementation to provide an additional safety check. PPP uses\n\t// Z_SYNC_FLUSH\n\t// but removes the length bytes of the resulting empty stored block. When\n\t// decompressing, PPP checks that at the end of input packet, inflate is\n\t// waiting for these length bytes.\n\tthat.inflateSyncPoint = function (z) {\n\t\tif (!z || !z.istate || !z.istate.blocks)\n\t\t\treturn Z_STREAM_ERROR;\n\t\treturn z.istate.blocks.sync_point();\n\t};\n}\n\n// ZStream\n\nfunction ZStream() {\n}\n\nZStream.prototype = {\n\tinflateInit: function (bits) {\n\t\tconst that = this;\n\t\tthat.istate = new Inflate();\n\t\tif (!bits)\n\t\t\tbits = MAX_BITS;\n\t\treturn that.istate.inflateInit(that, bits);\n\t},\n\n\tinflate: function (f) {\n\t\tconst that = this;\n\t\tif (!that.istate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\treturn that.istate.inflate(that, f);\n\t},\n\n\tinflateEnd: function () {\n\t\tconst that = this;\n\t\tif (!that.istate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\tconst ret = that.istate.inflateEnd(that);\n\t\tthat.istate = null;\n\t\treturn ret;\n\t},\n\n\tinflateSync: function () {\n\t\tconst that = this;\n\t\tif (!that.istate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\treturn that.istate.inflateSync(that);\n\t},\n\tinflateSetDictionary: function (dictionary, dictLength) {\n\t\tconst that = this;\n\t\tif (!that.istate)\n\t\t\treturn Z_STREAM_ERROR;\n\t\treturn that.istate.inflateSetDictionary(that, dictionary, dictLength);\n\t},\n\tread_byte: function (start) {\n\t\tconst that = this;\n\t\treturn that.next_in[start];\n\t},\n\tread_buf: function (start, size) {\n\t\tconst that = this;\n\t\treturn that.next_in.subarray(start, start + size);\n\t}\n};\n\n// Inflater\n\nfunction ZipInflate(options) {\n\tconst that = this;\n\tconst z = new ZStream();\n\tconst bufsize = options && options.chunkSize ? Math.floor(options.chunkSize * 2) : 128 * 1024;\n\tconst flush = Z_NO_FLUSH;\n\tconst buf = new Uint8Array(bufsize);\n\tlet nomoreinput = false;\n\n\tz.inflateInit();\n\tz.next_out = buf;\n\n\tthat.append = function (data, onprogress) {\n\t\tconst buffers = [];\n\t\tlet err, array, lastIndex = 0, bufferIndex = 0, bufferSize = 0;\n\t\tif (data.length === 0)\n\t\t\treturn;\n\t\tz.next_in_index = 0;\n\t\tz.next_in = data;\n\t\tz.avail_in = data.length;\n\t\tdo {\n\t\t\tz.next_out_index = 0;\n\t\t\tz.avail_out = bufsize;\n\t\t\tif ((z.avail_in === 0) && (!nomoreinput)) { // if buffer is empty and more input is available, refill it\n\t\t\t\tz.next_in_index = 0;\n\t\t\t\tnomoreinput = true;\n\t\t\t}\n\t\t\terr = z.inflate(flush);\n\t\t\tif (nomoreinput && (err === Z_BUF_ERROR)) {\n\t\t\t\tif (z.avail_in !== 0)\n\t\t\t\t\tthrow new Error(\"inflating: bad input\");\n\t\t\t} else if (err !== Z_OK && err !== Z_STREAM_END)\n\t\t\t\tthrow new Error(\"inflating: \" + z.msg);\n\t\t\tif ((nomoreinput || err === Z_STREAM_END) && (z.avail_in === data.length))\n\t\t\t\tthrow new Error(\"inflating: bad input\");\n\t\t\tif (z.next_out_index)\n\t\t\t\tif (z.next_out_index === bufsize)\n\t\t\t\t\tbuffers.push(new Uint8Array(buf));\n\t\t\t\telse\n\t\t\t\t\tbuffers.push(buf.slice(0, z.next_out_index));\n\t\t\tbufferSize += z.next_out_index;\n\t\t\tif (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) {\n\t\t\t\tonprogress(z.next_in_index);\n\t\t\t\tlastIndex = z.next_in_index;\n\t\t\t}\n\t\t} while (z.avail_in > 0 || z.avail_out === 0);\n\t\tif (buffers.length > 1) {\n\t\t\tarray = new Uint8Array(bufferSize);\n\t\t\tbuffers.forEach(function (chunk) {\n\t\t\t\tarray.set(chunk, bufferIndex);\n\t\t\t\tbufferIndex += chunk.length;\n\t\t\t});\n\t\t} else {\n\t\t\tarray = buffers[0] || new Uint8Array(0);\n\t\t}\n\t\treturn array;\n\t};\n\tthat.flush = function () {\n\t\tz.inflateEnd();\n\t};\n}\n\nexport default ZipInflate;","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global navigator */\n\n\"use strict\";\n\nconst DEFAULT_CONFIGURATION = {\n\tchunkSize: 512 * 1024,\n\tmaxWorkers: (typeof navigator != \"undefined\" && navigator.hardwareConcurrency) || 2,\n\tterminateWorkerTimeout: 5000,\n\tuseWebWorkers: true,\n\tworkerScripts: undefined\n};\n\nconst config = Object.assign({}, DEFAULT_CONFIGURATION);\n\nexport {\n\tconfigure,\n\tgetConfiguration\n};\n\nfunction getConfiguration() {\n\treturn config;\n}\n\nfunction configure(configuration) {\n\tif (configuration.baseURL !== undefined) {\n\t\tconfig.baseURL = configuration.baseURL;\n\t}\n\tif (configuration.chunkSize !== undefined) {\n\t\tconfig.chunkSize = configuration.chunkSize;\n\t}\n\tif (configuration.maxWorkers !== undefined) {\n\t\tconfig.maxWorkers = configuration.maxWorkers;\n\t}\n\tif (configuration.terminateWorkerTimeout !== undefined) {\n\t\tconfig.terminateWorkerTimeout = configuration.terminateWorkerTimeout;\n\t}\n\tif (configuration.useWebWorkers !== undefined) {\n\t\tconfig.useWebWorkers = configuration.useWebWorkers;\n\t}\n\tif (configuration.Deflate !== undefined) {\n\t\tconfig.Deflate = configuration.Deflate;\n\t}\n\tif (configuration.Inflate !== undefined) {\n\t\tconfig.Inflate = configuration.Inflate;\n\t}\n\tif (configuration.workerScripts !== undefined) {\n\t\tif (configuration.workerScripts.deflate) {\n\t\t\tif (!Array.isArray(configuration.workerScripts.deflate)) {\n\t\t\t\tthrow new Error(\"workerScripts.deflate must be an array\");\n\t\t\t}\n\t\t\tif (!config.workerScripts) {\n\t\t\t\tconfig.workerScripts = {};\n\t\t\t}\n\t\t\tconfig.workerScripts.deflate = configuration.workerScripts.deflate;\n\t\t}\n\t\tif (configuration.workerScripts.inflate) {\n\t\t\tif (!Array.isArray(configuration.workerScripts.inflate)) {\n\t\t\t\tthrow new Error(\"workerScripts.inflate must be an array\");\n\t\t\t}\n\t\t\tif (!config.workerScripts) {\n\t\t\t\tconfig.workerScripts = {};\n\t\t\t}\n\t\t\tconfig.workerScripts.inflate = configuration.workerScripts.inflate;\n\t\t}\n\t}\n}\n","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nconst table = {\n\t\"application\": {\n\t\t\"andrew-inset\": \"ez\",\n\t\t\"annodex\": \"anx\",\n\t\t\"atom+xml\": \"atom\",\n\t\t\"atomcat+xml\": \"atomcat\",\n\t\t\"atomserv+xml\": \"atomsrv\",\n\t\t\"bbolin\": \"lin\",\n\t\t\"cap\": [\"cap\", \"pcap\"],\n\t\t\"cu-seeme\": \"cu\",\n\t\t\"davmount+xml\": \"davmount\",\n\t\t\"dsptype\": \"tsp\",\n\t\t\"ecmascript\": [\"es\", \"ecma\"],\n\t\t\"futuresplash\": \"spl\",\n\t\t\"hta\": \"hta\",\n\t\t\"java-archive\": \"jar\",\n\t\t\"java-serialized-object\": \"ser\",\n\t\t\"java-vm\": \"class\",\n\t\t\"javascript\": \"js\",\n\t\t\"m3g\": \"m3g\",\n\t\t\"mac-binhex40\": \"hqx\",\n\t\t\"mathematica\": [\"nb\", \"ma\", \"mb\"],\n\t\t\"msaccess\": \"mdb\",\n\t\t\"msword\": [\"doc\", \"dot\"],\n\t\t\"mxf\": \"mxf\",\n\t\t\"oda\": \"oda\",\n\t\t\"ogg\": \"ogx\",\n\t\t\"pdf\": \"pdf\",\n\t\t\"pgp-keys\": \"key\",\n\t\t\"pgp-signature\": [\"asc\", \"sig\"],\n\t\t\"pics-rules\": \"prf\",\n\t\t\"postscript\": [\"ps\", \"ai\", \"eps\", \"epsi\", \"epsf\", \"eps2\", \"eps3\"],\n\t\t\"rar\": \"rar\",\n\t\t\"rdf+xml\": \"rdf\",\n\t\t\"rss+xml\": \"rss\",\n\t\t\"rtf\": \"rtf\",\n\t\t\"smil\": [\"smi\", \"smil\"],\n\t\t\"xhtml+xml\": [\"xhtml\", \"xht\"],\n\t\t\"xml\": [\"xml\", \"xsl\", \"xsd\"],\n\t\t\"xspf+xml\": \"xspf\",\n\t\t\"zip\": \"zip\",\n\t\t\"vnd.android.package-archive\": \"apk\",\n\t\t\"vnd.cinderella\": \"cdy\",\n\t\t\"vnd.google-earth.kml+xml\": \"kml\",\n\t\t\"vnd.google-earth.kmz\": \"kmz\",\n\t\t\"vnd.mozilla.xul+xml\": \"xul\",\n\t\t\"vnd.ms-excel\": [\"xls\", \"xlb\", \"xlt\", \"xlm\", \"xla\", \"xlc\", \"xlw\"],\n\t\t\"vnd.ms-pki.seccat\": \"cat\",\n\t\t\"vnd.ms-pki.stl\": \"stl\",\n\t\t\"vnd.ms-powerpoint\": [\"ppt\", \"pps\", \"pot\"],\n\t\t\"vnd.oasis.opendocument.chart\": \"odc\",\n\t\t\"vnd.oasis.opendocument.database\": \"odb\",\n\t\t\"vnd.oasis.opendocument.formula\": \"odf\",\n\t\t\"vnd.oasis.opendocument.graphics\": \"odg\",\n\t\t\"vnd.oasis.opendocument.graphics-template\": \"otg\",\n\t\t\"vnd.oasis.opendocument.image\": \"odi\",\n\t\t\"vnd.oasis.opendocument.presentation\": \"odp\",\n\t\t\"vnd.oasis.opendocument.presentation-template\": \"otp\",\n\t\t\"vnd.oasis.opendocument.spreadsheet\": \"ods\",\n\t\t\"vnd.oasis.opendocument.spreadsheet-template\": \"ots\",\n\t\t\"vnd.oasis.opendocument.text\": \"odt\",\n\t\t\"vnd.oasis.opendocument.text-master\": \"odm\",\n\t\t\"vnd.oasis.opendocument.text-template\": \"ott\",\n\t\t\"vnd.oasis.opendocument.text-web\": \"oth\",\n\t\t\"vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"xlsx\",\n\t\t\"vnd.openxmlformats-officedocument.spreadsheetml.template\": \"xltx\",\n\t\t\"vnd.openxmlformats-officedocument.presentationml.presentation\": \"pptx\",\n\t\t\"vnd.openxmlformats-officedocument.presentationml.slideshow\": \"ppsx\",\n\t\t\"vnd.openxmlformats-officedocument.presentationml.template\": \"potx\",\n\t\t\"vnd.openxmlformats-officedocument.wordprocessingml.document\": \"docx\",\n\t\t\"vnd.openxmlformats-officedocument.wordprocessingml.template\": \"dotx\",\n\t\t\"vnd.smaf\": \"mmf\",\n\t\t\"vnd.stardivision.calc\": \"sdc\",\n\t\t\"vnd.stardivision.chart\": \"sds\",\n\t\t\"vnd.stardivision.draw\": \"sda\",\n\t\t\"vnd.stardivision.impress\": \"sdd\",\n\t\t\"vnd.stardivision.math\": [\"sdf\", \"smf\"],\n\t\t\"vnd.stardivision.writer\": [\"sdw\", \"vor\"],\n\t\t\"vnd.stardivision.writer-global\": \"sgl\",\n\t\t\"vnd.sun.xml.calc\": \"sxc\",\n\t\t\"vnd.sun.xml.calc.template\": \"stc\",\n\t\t\"vnd.sun.xml.draw\": \"sxd\",\n\t\t\"vnd.sun.xml.draw.template\": \"std\",\n\t\t\"vnd.sun.xml.impress\": \"sxi\",\n\t\t\"vnd.sun.xml.impress.template\": \"sti\",\n\t\t\"vnd.sun.xml.math\": \"sxm\",\n\t\t\"vnd.sun.xml.writer\": \"sxw\",\n\t\t\"vnd.sun.xml.writer.global\": \"sxg\",\n\t\t\"vnd.sun.xml.writer.template\": \"stw\",\n\t\t\"vnd.symbian.install\": [\"sis\", \"sisx\"],\n\t\t\"vnd.visio\": [\"vsd\", \"vst\", \"vss\", \"vsw\"],\n\t\t\"vnd.wap.wbxml\": \"wbxml\",\n\t\t\"vnd.wap.wmlc\": \"wmlc\",\n\t\t\"vnd.wap.wmlscriptc\": \"wmlsc\",\n\t\t\"vnd.wordperfect\": \"wpd\",\n\t\t\"vnd.wordperfect5.1\": \"wp5\",\n\t\t\"x-123\": \"wk\",\n\t\t\"x-7z-compressed\": \"7z\",\n\t\t\"x-abiword\": \"abw\",\n\t\t\"x-apple-diskimage\": \"dmg\",\n\t\t\"x-bcpio\": \"bcpio\",\n\t\t\"x-bittorrent\": \"torrent\",\n\t\t\"x-cbr\": [\"cbr\", \"cba\", \"cbt\", \"cb7\"],\n\t\t\"x-cbz\": \"cbz\",\n\t\t\"x-cdf\": [\"cdf\", \"cda\"],\n\t\t\"x-cdlink\": \"vcd\",\n\t\t\"x-chess-pgn\": \"pgn\",\n\t\t\"x-cpio\": \"cpio\",\n\t\t\"x-csh\": \"csh\",\n\t\t\"x-debian-package\": [\"deb\", \"udeb\"],\n\t\t\"x-director\": [\"dcr\", \"dir\", \"dxr\", \"cst\", \"cct\", \"cxt\", \"w3d\", \"fgd\", \"swa\"],\n\t\t\"x-dms\": \"dms\",\n\t\t\"x-doom\": \"wad\",\n\t\t\"x-dvi\": \"dvi\",\n\t\t\"x-httpd-eruby\": \"rhtml\",\n\t\t\"x-font\": \"pcf.Z\",\n\t\t\"x-freemind\": \"mm\",\n\t\t\"x-gnumeric\": \"gnumeric\",\n\t\t\"x-go-sgf\": \"sgf\",\n\t\t\"x-graphing-calculator\": \"gcf\",\n\t\t\"x-gtar\": [\"gtar\", \"taz\"],\n\t\t\"x-hdf\": \"hdf\",\n\t\t\"x-httpd-php\": [\"phtml\", \"pht\", \"php\"],\n\t\t\"x-httpd-php-source\": \"phps\",\n\t\t\"x-httpd-php3\": \"php3\",\n\t\t\"x-httpd-php3-preprocessed\": \"php3p\",\n\t\t\"x-httpd-php4\": \"php4\",\n\t\t\"x-httpd-php5\": \"php5\",\n\t\t\"x-ica\": \"ica\",\n\t\t\"x-info\": \"info\",\n\t\t\"x-internet-signup\": [\"ins\", \"isp\"],\n\t\t\"x-iphone\": \"iii\",\n\t\t\"x-iso9660-image\": \"iso\",\n\t\t\"x-java-jnlp-file\": \"jnlp\",\n\t\t\"x-jmol\": \"jmz\",\n\t\t\"x-killustrator\": \"kil\",\n\t\t\"x-koan\": [\"skp\", \"skd\", \"skt\", \"skm\"],\n\t\t\"x-kpresenter\": [\"kpr\", \"kpt\"],\n\t\t\"x-kword\": [\"kwd\", \"kwt\"],\n\t\t\"x-latex\": \"latex\",\n\t\t\"x-lha\": \"lha\",\n\t\t\"x-lyx\": \"lyx\",\n\t\t\"x-lzh\": \"lzh\",\n\t\t\"x-lzx\": \"lzx\",\n\t\t\"x-maker\": [\"frm\", \"maker\", \"frame\", \"fm\", \"fb\", \"book\", \"fbdoc\"],\n\t\t\"x-ms-wmd\": \"wmd\",\n\t\t\"x-ms-wmz\": \"wmz\",\n\t\t\"x-msdos-program\": [\"com\", \"exe\", \"bat\", \"dll\"],\n\t\t\"x-msi\": \"msi\",\n\t\t\"x-netcdf\": [\"nc\", \"cdf\"],\n\t\t\"x-ns-proxy-autoconfig\": [\"pac\", \"dat\"],\n\t\t\"x-nwc\": \"nwc\",\n\t\t\"x-object\": \"o\",\n\t\t\"x-oz-application\": \"oza\",\n\t\t\"x-pkcs7-certreqresp\": \"p7r\",\n\t\t\"x-python-code\": [\"pyc\", \"pyo\"],\n\t\t\"x-qgis\": [\"qgs\", \"shp\", \"shx\"],\n\t\t\"x-quicktimeplayer\": \"qtl\",\n\t\t\"x-redhat-package-manager\": \"rpm\",\n\t\t\"x-ruby\": \"rb\",\n\t\t\"x-sh\": \"sh\",\n\t\t\"x-shar\": \"shar\",\n\t\t\"x-shockwave-flash\": [\"swf\", \"swfl\"],\n\t\t\"x-silverlight\": \"scr\",\n\t\t\"x-stuffit\": \"sit\",\n\t\t\"x-sv4cpio\": \"sv4cpio\",\n\t\t\"x-sv4crc\": \"sv4crc\",\n\t\t\"x-tar\": \"tar\",\n\t\t\"x-tcl\": \"tcl\",\n\t\t\"x-tex-gf\": \"gf\",\n\t\t\"x-tex-pk\": \"pk\",\n\t\t\"x-texinfo\": [\"texinfo\", \"texi\"],\n\t\t\"x-trash\": [\"~\", \"%\", \"bak\", \"old\", \"sik\"],\n\t\t\"x-troff\": [\"t\", \"tr\", \"roff\"],\n\t\t\"x-troff-man\": \"man\",\n\t\t\"x-troff-me\": \"me\",\n\t\t\"x-troff-ms\": \"ms\",\n\t\t\"x-ustar\": \"ustar\",\n\t\t\"x-wais-source\": \"src\",\n\t\t\"x-wingz\": \"wz\",\n\t\t\"x-x509-ca-cert\": [\"crt\", \"der\", \"cer\"],\n\t\t\"x-xcf\": \"xcf\",\n\t\t\"x-xfig\": \"fig\",\n\t\t\"x-xpinstall\": \"xpi\",\n\t\t\"applixware\": \"aw\",\n\t\t\"atomsvc+xml\": \"atomsvc\",\n\t\t\"ccxml+xml\": \"ccxml\",\n\t\t\"cdmi-capability\": \"cdmia\",\n\t\t\"cdmi-container\": \"cdmic\",\n\t\t\"cdmi-domain\": \"cdmid\",\n\t\t\"cdmi-object\": \"cdmio\",\n\t\t\"cdmi-queue\": \"cdmiq\",\n\t\t\"docbook+xml\": \"dbk\",\n\t\t\"dssc+der\": \"dssc\",\n\t\t\"dssc+xml\": \"xdssc\",\n\t\t\"emma+xml\": \"emma\",\n\t\t\"epub+zip\": \"epub\",\n\t\t\"exi\": \"exi\",\n\t\t\"font-tdpfr\": \"pfr\",\n\t\t\"gml+xml\": \"gml\",\n\t\t\"gpx+xml\": \"gpx\",\n\t\t\"gxf\": \"gxf\",\n\t\t\"hyperstudio\": \"stk\",\n\t\t\"inkml+xml\": [\"ink\", \"inkml\"],\n\t\t\"ipfix\": \"ipfix\",\n\t\t\"json\": \"json\",\n\t\t\"jsonml+json\": \"jsonml\",\n\t\t\"lost+xml\": \"lostxml\",\n\t\t\"mads+xml\": \"mads\",\n\t\t\"marc\": \"mrc\",\n\t\t\"marcxml+xml\": \"mrcx\",\n\t\t\"mathml+xml\": \"mathml\",\n\t\t\"mbox\": \"mbox\",\n\t\t\"mediaservercontrol+xml\": \"mscml\",\n\t\t\"metalink+xml\": \"metalink\",\n\t\t\"metalink4+xml\": \"meta4\",\n\t\t\"mets+xml\": \"mets\",\n\t\t\"mods+xml\": \"mods\",\n\t\t\"mp21\": [\"m21\", \"mp21\"],\n\t\t\"mp4\": \"mp4s\",\n\t\t\"oebps-package+xml\": \"opf\",\n\t\t\"omdoc+xml\": \"omdoc\",\n\t\t\"onenote\": [\"onetoc\", \"onetoc2\", \"onetmp\", \"onepkg\"],\n\t\t\"oxps\": \"oxps\",\n\t\t\"patch-ops-error+xml\": \"xer\",\n\t\t\"pgp-encrypted\": \"pgp\",\n\t\t\"pkcs10\": \"p10\",\n\t\t\"pkcs7-mime\": [\"p7m\", \"p7c\"],\n\t\t\"pkcs7-signature\": \"p7s\",\n\t\t\"pkcs8\": \"p8\",\n\t\t\"pkix-attr-cert\": \"ac\",\n\t\t\"pkix-crl\": \"crl\",\n\t\t\"pkix-pkipath\": \"pkipath\",\n\t\t\"pkixcmp\": \"pki\",\n\t\t\"pls+xml\": \"pls\",\n\t\t\"prs.cww\": \"cww\",\n\t\t\"pskc+xml\": \"pskcxml\",\n\t\t\"reginfo+xml\": \"rif\",\n\t\t\"relax-ng-compact-syntax\": \"rnc\",\n\t\t\"resource-lists+xml\": \"rl\",\n\t\t\"resource-lists-diff+xml\": \"rld\",\n\t\t\"rls-services+xml\": \"rs\",\n\t\t\"rpki-ghostbusters\": \"gbr\",\n\t\t\"rpki-manifest\": \"mft\",\n\t\t\"rpki-roa\": \"roa\",\n\t\t\"rsd+xml\": \"rsd\",\n\t\t\"sbml+xml\": \"sbml\",\n\t\t\"scvp-cv-request\": \"scq\",\n\t\t\"scvp-cv-response\": \"scs\",\n\t\t\"scvp-vp-request\": \"spq\",\n\t\t\"scvp-vp-response\": \"spp\",\n\t\t\"sdp\": \"sdp\",\n\t\t\"set-payment-initiation\": \"setpay\",\n\t\t\"set-registration-initiation\": \"setreg\",\n\t\t\"shf+xml\": \"shf\",\n\t\t\"sparql-query\": \"rq\",\n\t\t\"sparql-results+xml\": \"srx\",\n\t\t\"srgs\": \"gram\",\n\t\t\"srgs+xml\": \"grxml\",\n\t\t\"sru+xml\": \"sru\",\n\t\t\"ssdl+xml\": \"ssdl\",\n\t\t\"ssml+xml\": \"ssml\",\n\t\t\"tei+xml\": [\"tei\", \"teicorpus\"],\n\t\t\"thraud+xml\": \"tfi\",\n\t\t\"timestamped-data\": \"tsd\",\n\t\t\"vnd.3gpp.pic-bw-large\": \"plb\",\n\t\t\"vnd.3gpp.pic-bw-small\": \"psb\",\n\t\t\"vnd.3gpp.pic-bw-var\": \"pvb\",\n\t\t\"vnd.3gpp2.tcap\": \"tcap\",\n\t\t\"vnd.3m.post-it-notes\": \"pwn\",\n\t\t\"vnd.accpac.simply.aso\": \"aso\",\n\t\t\"vnd.accpac.simply.imp\": \"imp\",\n\t\t\"vnd.acucobol\": \"acu\",\n\t\t\"vnd.acucorp\": [\"atc\", \"acutc\"],\n\t\t\"vnd.adobe.air-application-installer-package+zip\": \"air\",\n\t\t\"vnd.adobe.formscentral.fcdt\": \"fcdt\",\n\t\t\"vnd.adobe.fxp\": [\"fxp\", \"fxpl\"],\n\t\t\"vnd.adobe.xdp+xml\": \"xdp\",\n\t\t\"vnd.adobe.xfdf\": \"xfdf\",\n\t\t\"vnd.ahead.space\": \"ahead\",\n\t\t\"vnd.airzip.filesecure.azf\": \"azf\",\n\t\t\"vnd.airzip.filesecure.azs\": \"azs\",\n\t\t\"vnd.amazon.ebook\": \"azw\",\n\t\t\"vnd.americandynamics.acc\": \"acc\",\n\t\t\"vnd.amiga.ami\": \"ami\",\n\t\t\"vnd.anser-web-certificate-issue-initiation\": \"cii\",\n\t\t\"vnd.anser-web-funds-transfer-initiation\": \"fti\",\n\t\t\"vnd.antix.game-component\": \"atx\",\n\t\t\"vnd.apple.installer+xml\": \"mpkg\",\n\t\t\"vnd.apple.mpegurl\": \"m3u8\",\n\t\t\"vnd.aristanetworks.swi\": \"swi\",\n\t\t\"vnd.astraea-software.iota\": \"iota\",\n\t\t\"vnd.audiograph\": \"aep\",\n\t\t\"vnd.blueice.multipass\": \"mpm\",\n\t\t\"vnd.bmi\": \"bmi\",\n\t\t\"vnd.businessobjects\": \"rep\",\n\t\t\"vnd.chemdraw+xml\": \"cdxml\",\n\t\t\"vnd.chipnuts.karaoke-mmd\": \"mmd\",\n\t\t\"vnd.claymore\": \"cla\",\n\t\t\"vnd.cloanto.rp9\": \"rp9\",\n\t\t\"vnd.clonk.c4group\": [\"c4g\", \"c4d\", \"c4f\", \"c4p\", \"c4u\"],\n\t\t\"vnd.cluetrust.cartomobile-config\": \"c11amc\",\n\t\t\"vnd.cluetrust.cartomobile-config-pkg\": \"c11amz\",\n\t\t\"vnd.commonspace\": \"csp\",\n\t\t\"vnd.contact.cmsg\": \"cdbcmsg\",\n\t\t\"vnd.cosmocaller\": \"cmc\",\n\t\t\"vnd.crick.clicker\": \"clkx\",\n\t\t\"vnd.crick.clicker.keyboard\": \"clkk\",\n\t\t\"vnd.crick.clicker.palette\": \"clkp\",\n\t\t\"vnd.crick.clicker.template\": \"clkt\",\n\t\t\"vnd.crick.clicker.wordbank\": \"clkw\",\n\t\t\"vnd.criticaltools.wbs+xml\": \"wbs\",\n\t\t\"vnd.ctc-posml\": \"pml\",\n\t\t\"vnd.cups-ppd\": \"ppd\",\n\t\t\"vnd.curl.car\": \"car\",\n\t\t\"vnd.curl.pcurl\": \"pcurl\",\n\t\t\"vnd.dart\": \"dart\",\n\t\t\"vnd.data-vision.rdz\": \"rdz\",\n\t\t\"vnd.dece.data\": [\"uvf\", \"uvvf\", \"uvd\", \"uvvd\"],\n\t\t\"vnd.dece.ttml+xml\": [\"uvt\", \"uvvt\"],\n\t\t\"vnd.dece.unspecified\": [\"uvx\", \"uvvx\"],\n\t\t\"vnd.dece.zip\": [\"uvz\", \"uvvz\"],\n\t\t\"vnd.denovo.fcselayout-link\": \"fe_launch\",\n\t\t\"vnd.dna\": \"dna\",\n\t\t\"vnd.dolby.mlp\": \"mlp\",\n\t\t\"vnd.dpgraph\": \"dpg\",\n\t\t\"vnd.dreamfactory\": \"dfac\",\n\t\t\"vnd.ds-keypoint\": \"kpxx\",\n\t\t\"vnd.dvb.ait\": \"ait\",\n\t\t\"vnd.dvb.service\": \"svc\",\n\t\t\"vnd.dynageo\": \"geo\",\n\t\t\"vnd.ecowin.chart\": \"mag\",\n\t\t\"vnd.enliven\": \"nml\",\n\t\t\"vnd.epson.esf\": \"esf\",\n\t\t\"vnd.epson.msf\": \"msf\",\n\t\t\"vnd.epson.quickanime\": \"qam\",\n\t\t\"vnd.epson.salt\": \"slt\",\n\t\t\"vnd.epson.ssf\": \"ssf\",\n\t\t\"vnd.eszigno3+xml\": [\"es3\", \"et3\"],\n\t\t\"vnd.ezpix-album\": \"ez2\",\n\t\t\"vnd.ezpix-package\": \"ez3\",\n\t\t\"vnd.fdf\": \"fdf\",\n\t\t\"vnd.fdsn.mseed\": \"mseed\",\n\t\t\"vnd.fdsn.seed\": [\"seed\", \"dataless\"],\n\t\t\"vnd.flographit\": \"gph\",\n\t\t\"vnd.fluxtime.clip\": \"ftc\",\n\t\t\"vnd.framemaker\": [\"fm\", \"frame\", \"maker\", \"book\"],\n\t\t\"vnd.frogans.fnc\": \"fnc\",\n\t\t\"vnd.frogans.ltf\": \"ltf\",\n\t\t\"vnd.fsc.weblaunch\": \"fsc\",\n\t\t\"vnd.fujitsu.oasys\": \"oas\",\n\t\t\"vnd.fujitsu.oasys2\": \"oa2\",\n\t\t\"vnd.fujitsu.oasys3\": \"oa3\",\n\t\t\"vnd.fujitsu.oasysgp\": \"fg5\",\n\t\t\"vnd.fujitsu.oasysprs\": \"bh2\",\n\t\t\"vnd.fujixerox.ddd\": \"ddd\",\n\t\t\"vnd.fujixerox.docuworks\": \"xdw\",\n\t\t\"vnd.fujixerox.docuworks.binder\": \"xbd\",\n\t\t\"vnd.fuzzysheet\": \"fzs\",\n\t\t\"vnd.genomatix.tuxedo\": \"txd\",\n\t\t\"vnd.geogebra.file\": \"ggb\",\n\t\t\"vnd.geogebra.tool\": \"ggt\",\n\t\t\"vnd.geometry-explorer\": [\"gex\", \"gre\"],\n\t\t\"vnd.geonext\": \"gxt\",\n\t\t\"vnd.geoplan\": \"g2w\",\n\t\t\"vnd.geospace\": \"g3w\",\n\t\t\"vnd.gmx\": \"gmx\",\n\t\t\"vnd.grafeq\": [\"gqf\", \"gqs\"],\n\t\t\"vnd.groove-account\": \"gac\",\n\t\t\"vnd.groove-help\": \"ghf\",\n\t\t\"vnd.groove-identity-message\": \"gim\",\n\t\t\"vnd.groove-injector\": \"grv\",\n\t\t\"vnd.groove-tool-message\": \"gtm\",\n\t\t\"vnd.groove-tool-template\": \"tpl\",\n\t\t\"vnd.groove-vcard\": \"vcg\",\n\t\t\"vnd.hal+xml\": \"hal\",\n\t\t\"vnd.handheld-entertainment+xml\": \"zmm\",\n\t\t\"vnd.hbci\": \"hbci\",\n\t\t\"vnd.hhe.lesson-player\": \"les\",\n\t\t\"vnd.hp-hpgl\": \"hpgl\",\n\t\t\"vnd.hp-hpid\": \"hpid\",\n\t\t\"vnd.hp-hps\": \"hps\",\n\t\t\"vnd.hp-jlyt\": \"jlt\",\n\t\t\"vnd.hp-pcl\": \"pcl\",\n\t\t\"vnd.hp-pclxl\": \"pclxl\",\n\t\t\"vnd.hydrostatix.sof-data\": \"sfd-hdstx\",\n\t\t\"vnd.ibm.minipay\": \"mpy\",\n\t\t\"vnd.ibm.modcap\": [\"afp\", \"listafp\", \"list3820\"],\n\t\t\"vnd.ibm.rights-management\": \"irm\",\n\t\t\"vnd.ibm.secure-container\": \"sc\",\n\t\t\"vnd.iccprofile\": [\"icc\", \"icm\"],\n\t\t\"vnd.igloader\": \"igl\",\n\t\t\"vnd.immervision-ivp\": \"ivp\",\n\t\t\"vnd.immervision-ivu\": \"ivu\",\n\t\t\"vnd.insors.igm\": \"igm\",\n\t\t\"vnd.intercon.formnet\": [\"xpw\", \"xpx\"],\n\t\t\"vnd.intergeo\": \"i2g\",\n\t\t\"vnd.intu.qbo\": \"qbo\",\n\t\t\"vnd.intu.qfx\": \"qfx\",\n\t\t\"vnd.ipunplugged.rcprofile\": \"rcprofile\",\n\t\t\"vnd.irepository.package+xml\": \"irp\",\n\t\t\"vnd.is-xpr\": \"xpr\",\n\t\t\"vnd.isac.fcs\": \"fcs\",\n\t\t\"vnd.jam\": \"jam\",\n\t\t\"vnd.jcp.javame.midlet-rms\": \"rms\",\n\t\t\"vnd.jisp\": \"jisp\",\n\t\t\"vnd.joost.joda-archive\": \"joda\",\n\t\t\"vnd.kahootz\": [\"ktz\", \"ktr\"],\n\t\t\"vnd.kde.karbon\": \"karbon\",\n\t\t\"vnd.kde.kchart\": \"chrt\",\n\t\t\"vnd.kde.kformula\": \"kfo\",\n\t\t\"vnd.kde.kivio\": \"flw\",\n\t\t\"vnd.kde.kontour\": \"kon\",\n\t\t\"vnd.kde.kpresenter\": [\"kpr\", \"kpt\"],\n\t\t\"vnd.kde.kspread\": \"ksp\",\n\t\t\"vnd.kde.kword\": [\"kwd\", \"kwt\"],\n\t\t\"vnd.kenameaapp\": \"htke\",\n\t\t\"vnd.kidspiration\": \"kia\",\n\t\t\"vnd.kinar\": [\"kne\", \"knp\"],\n\t\t\"vnd.koan\": [\"skp\", \"skd\", \"skt\", \"skm\"],\n\t\t\"vnd.kodak-descriptor\": \"sse\",\n\t\t\"vnd.las.las+xml\": \"lasxml\",\n\t\t\"vnd.llamagraphics.life-balance.desktop\": \"lbd\",\n\t\t\"vnd.llamagraphics.life-balance.exchange+xml\": \"lbe\",\n\t\t\"vnd.lotus-1-2-3\": \"123\",\n\t\t\"vnd.lotus-approach\": \"apr\",\n\t\t\"vnd.lotus-freelance\": \"pre\",\n\t\t\"vnd.lotus-notes\": \"nsf\",\n\t\t\"vnd.lotus-organizer\": \"org\",\n\t\t\"vnd.lotus-screencam\": \"scm\",\n\t\t\"vnd.lotus-wordpro\": \"lwp\",\n\t\t\"vnd.macports.portpkg\": \"portpkg\",\n\t\t\"vnd.mcd\": \"mcd\",\n\t\t\"vnd.medcalcdata\": \"mc1\",\n\t\t\"vnd.mediastation.cdkey\": \"cdkey\",\n\t\t\"vnd.mfer\": \"mwf\",\n\t\t\"vnd.mfmp\": \"mfm\",\n\t\t\"vnd.micrografx.flo\": \"flo\",\n\t\t\"vnd.micrografx.igx\": \"igx\",\n\t\t\"vnd.mif\": \"mif\",\n\t\t\"vnd.mobius.daf\": \"daf\",\n\t\t\"vnd.mobius.dis\": \"dis\",\n\t\t\"vnd.mobius.mbk\": \"mbk\",\n\t\t\"vnd.mobius.mqy\": \"mqy\",\n\t\t\"vnd.mobius.msl\": \"msl\",\n\t\t\"vnd.mobius.plc\": \"plc\",\n\t\t\"vnd.mobius.txf\": \"txf\",\n\t\t\"vnd.mophun.application\": \"mpn\",\n\t\t\"vnd.mophun.certificate\": \"mpc\",\n\t\t\"vnd.ms-artgalry\": \"cil\",\n\t\t\"vnd.ms-cab-compressed\": \"cab\",\n\t\t\"vnd.ms-excel.addin.macroenabled.12\": \"xlam\",\n\t\t\"vnd.ms-excel.sheet.binary.macroenabled.12\": \"xlsb\",\n\t\t\"vnd.ms-excel.sheet.macroenabled.12\": \"xlsm\",\n\t\t\"vnd.ms-excel.template.macroenabled.12\": \"xltm\",\n\t\t\"vnd.ms-fontobject\": \"eot\",\n\t\t\"vnd.ms-htmlhelp\": \"chm\",\n\t\t\"vnd.ms-ims\": \"ims\",\n\t\t\"vnd.ms-lrm\": \"lrm\",\n\t\t\"vnd.ms-officetheme\": \"thmx\",\n\t\t\"vnd.ms-powerpoint.addin.macroenabled.12\": \"ppam\",\n\t\t\"vnd.ms-powerpoint.presentation.macroenabled.12\": \"pptm\",\n\t\t\"vnd.ms-powerpoint.slide.macroenabled.12\": \"sldm\",\n\t\t\"vnd.ms-powerpoint.slideshow.macroenabled.12\": \"ppsm\",\n\t\t\"vnd.ms-powerpoint.template.macroenabled.12\": \"potm\",\n\t\t\"vnd.ms-project\": [\"mpp\", \"mpt\"],\n\t\t\"vnd.ms-word.document.macroenabled.12\": \"docm\",\n\t\t\"vnd.ms-word.template.macroenabled.12\": \"dotm\",\n\t\t\"vnd.ms-works\": [\"wps\", \"wks\", \"wcm\", \"wdb\"],\n\t\t\"vnd.ms-wpl\": \"wpl\",\n\t\t\"vnd.ms-xpsdocument\": \"xps\",\n\t\t\"vnd.mseq\": \"mseq\",\n\t\t\"vnd.musician\": \"mus\",\n\t\t\"vnd.muvee.style\": \"msty\",\n\t\t\"vnd.mynfc\": \"taglet\",\n\t\t\"vnd.neurolanguage.nlu\": \"nlu\",\n\t\t\"vnd.nitf\": [\"ntf\", \"nitf\"],\n\t\t\"vnd.noblenet-directory\": \"nnd\",\n\t\t\"vnd.noblenet-sealer\": \"nns\",\n\t\t\"vnd.noblenet-web\": \"nnw\",\n\t\t\"vnd.nokia.n-gage.data\": \"ngdat\",\n\t\t\"vnd.nokia.n-gage.symbian.install\": \"n-gage\",\n\t\t\"vnd.nokia.radio-preset\": \"rpst\",\n\t\t\"vnd.nokia.radio-presets\": \"rpss\",\n\t\t\"vnd.novadigm.edm\": \"edm\",\n\t\t\"vnd.novadigm.edx\": \"edx\",\n\t\t\"vnd.novadigm.ext\": \"ext\",\n\t\t\"vnd.oasis.opendocument.chart-template\": \"otc\",\n\t\t\"vnd.oasis.opendocument.formula-template\": \"odft\",\n\t\t\"vnd.oasis.opendocument.image-template\": \"oti\",\n\t\t\"vnd.olpc-sugar\": \"xo\",\n\t\t\"vnd.oma.dd2+xml\": \"dd2\",\n\t\t\"vnd.openofficeorg.extension\": \"oxt\",\n\t\t\"vnd.openxmlformats-officedocument.presentationml.slide\": \"sldx\",\n\t\t\"vnd.osgeo.mapguide.package\": \"mgp\",\n\t\t\"vnd.osgi.dp\": \"dp\",\n\t\t\"vnd.osgi.subsystem\": \"esa\",\n\t\t\"vnd.palm\": [\"pdb\", \"pqa\", \"oprc\"],\n\t\t\"vnd.pawaafile\": \"paw\",\n\t\t\"vnd.pg.format\": \"str\",\n\t\t\"vnd.pg.osasli\": \"ei6\",\n\t\t\"vnd.picsel\": \"efif\",\n\t\t\"vnd.pmi.widget\": \"wg\",\n\t\t\"vnd.pocketlearn\": \"plf\",\n\t\t\"vnd.powerbuilder6\": \"pbd\",\n\t\t\"vnd.previewsystems.box\": \"box\",\n\t\t\"vnd.proteus.magazine\": \"mgz\",\n\t\t\"vnd.publishare-delta-tree\": \"qps\",\n\t\t\"vnd.pvi.ptid1\": \"ptid\",\n\t\t\"vnd.quark.quarkxpress\": [\"qxd\", \"qxt\", \"qwd\", \"qwt\", \"qxl\", \"qxb\"],\n\t\t\"vnd.realvnc.bed\": \"bed\",\n\t\t\"vnd.recordare.musicxml\": \"mxl\",\n\t\t\"vnd.recordare.musicxml+xml\": \"musicxml\",\n\t\t\"vnd.rig.cryptonote\": \"cryptonote\",\n\t\t\"vnd.rn-realmedia\": \"rm\",\n\t\t\"vnd.rn-realmedia-vbr\": \"rmvb\",\n\t\t\"vnd.route66.link66+xml\": \"link66\",\n\t\t\"vnd.sailingtracker.track\": \"st\",\n\t\t\"vnd.seemail\": \"see\",\n\t\t\"vnd.sema\": \"sema\",\n\t\t\"vnd.semd\": \"semd\",\n\t\t\"vnd.semf\": \"semf\",\n\t\t\"vnd.shana.informed.formdata\": \"ifm\",\n\t\t\"vnd.shana.informed.formtemplate\": \"itp\",\n\t\t\"vnd.shana.informed.interchange\": \"iif\",\n\t\t\"vnd.shana.informed.package\": \"ipk\",\n\t\t\"vnd.simtech-mindmapper\": [\"twd\", \"twds\"],\n\t\t\"vnd.smart.teacher\": \"teacher\",\n\t\t\"vnd.solent.sdkm+xml\": [\"sdkm\", \"sdkd\"],\n\t\t\"vnd.spotfire.dxp\": \"dxp\",\n\t\t\"vnd.spotfire.sfs\": \"sfs\",\n\t\t\"vnd.stepmania.package\": \"smzip\",\n\t\t\"vnd.stepmania.stepchart\": \"sm\",\n\t\t\"vnd.sus-calendar\": [\"sus\", \"susp\"],\n\t\t\"vnd.svd\": \"svd\",\n\t\t\"vnd.syncml+xml\": \"xsm\",\n\t\t\"vnd.syncml.dm+wbxml\": \"bdm\",\n\t\t\"vnd.syncml.dm+xml\": \"xdm\",\n\t\t\"vnd.tao.intent-module-archive\": \"tao\",\n\t\t\"vnd.tcpdump.pcap\": [\"pcap\", \"cap\", \"dmp\"],\n\t\t\"vnd.tmobile-livetv\": \"tmo\",\n\t\t\"vnd.trid.tpt\": \"tpt\",\n\t\t\"vnd.triscape.mxs\": \"mxs\",\n\t\t\"vnd.trueapp\": \"tra\",\n\t\t\"vnd.ufdl\": [\"ufd\", \"ufdl\"],\n\t\t\"vnd.uiq.theme\": \"utz\",\n\t\t\"vnd.umajin\": \"umj\",\n\t\t\"vnd.unity\": \"unityweb\",\n\t\t\"vnd.uoml+xml\": \"uoml\",\n\t\t\"vnd.vcx\": \"vcx\",\n\t\t\"vnd.visionary\": \"vis\",\n\t\t\"vnd.vsf\": \"vsf\",\n\t\t\"vnd.webturbo\": \"wtb\",\n\t\t\"vnd.wolfram.player\": \"nbp\",\n\t\t\"vnd.wqd\": \"wqd\",\n\t\t\"vnd.wt.stf\": \"stf\",\n\t\t\"vnd.xara\": \"xar\",\n\t\t\"vnd.xfdl\": \"xfdl\",\n\t\t\"vnd.yamaha.hv-dic\": \"hvd\",\n\t\t\"vnd.yamaha.hv-script\": \"hvs\",\n\t\t\"vnd.yamaha.hv-voice\": \"hvp\",\n\t\t\"vnd.yamaha.openscoreformat\": \"osf\",\n\t\t\"vnd.yamaha.openscoreformat.osfpvg+xml\": \"osfpvg\",\n\t\t\"vnd.yamaha.smaf-audio\": \"saf\",\n\t\t\"vnd.yamaha.smaf-phrase\": \"spf\",\n\t\t\"vnd.yellowriver-custom-menu\": \"cmp\",\n\t\t\"vnd.zul\": [\"zir\", \"zirz\"],\n\t\t\"vnd.zzazz.deck+xml\": \"zaz\",\n\t\t\"voicexml+xml\": \"vxml\",\n\t\t\"widget\": \"wgt\",\n\t\t\"winhlp\": \"hlp\",\n\t\t\"wsdl+xml\": \"wsdl\",\n\t\t\"wspolicy+xml\": \"wspolicy\",\n\t\t\"x-ace-compressed\": \"ace\",\n\t\t\"x-authorware-bin\": [\"aab\", \"x32\", \"u32\", \"vox\"],\n\t\t\"x-authorware-map\": \"aam\",\n\t\t\"x-authorware-seg\": \"aas\",\n\t\t\"x-blorb\": [\"blb\", \"blorb\"],\n\t\t\"x-bzip\": \"bz\",\n\t\t\"x-bzip2\": [\"bz2\", \"boz\"],\n\t\t\"x-cfs-compressed\": \"cfs\",\n\t\t\"x-chat\": \"chat\",\n\t\t\"x-conference\": \"nsc\",\n\t\t\"x-dgc-compressed\": \"dgc\",\n\t\t\"x-dtbncx+xml\": \"ncx\",\n\t\t\"x-dtbook+xml\": \"dtb\",\n\t\t\"x-dtbresource+xml\": \"res\",\n\t\t\"x-eva\": \"eva\",\n\t\t\"x-font-bdf\": \"bdf\",\n\t\t\"x-font-ghostscript\": \"gsf\",\n\t\t\"x-font-linux-psf\": \"psf\",\n\t\t\"x-font-otf\": \"otf\",\n\t\t\"x-font-pcf\": \"pcf\",\n\t\t\"x-font-snf\": \"snf\",\n\t\t\"x-font-ttf\": [\"ttf\", \"ttc\"],\n\t\t\"x-font-type1\": [\"pfa\", \"pfb\", \"pfm\", \"afm\"],\n\t\t\"x-font-woff\": \"woff\",\n\t\t\"x-freearc\": \"arc\",\n\t\t\"x-gca-compressed\": \"gca\",\n\t\t\"x-glulx\": \"ulx\",\n\t\t\"x-gramps-xml\": \"gramps\",\n\t\t\"x-install-instructions\": \"install\",\n\t\t\"x-lzh-compressed\": [\"lzh\", \"lha\"],\n\t\t\"x-mie\": \"mie\",\n\t\t\"x-mobipocket-ebook\": [\"prc\", \"mobi\"],\n\t\t\"x-ms-application\": \"application\",\n\t\t\"x-ms-shortcut\": \"lnk\",\n\t\t\"x-ms-xbap\": \"xbap\",\n\t\t\"x-msbinder\": \"obd\",\n\t\t\"x-mscardfile\": \"crd\",\n\t\t\"x-msclip\": \"clp\",\n\t\t\"x-msdownload\": [\"exe\", \"dll\", \"com\", \"bat\", \"msi\"],\n\t\t\"x-msmediaview\": [\"mvb\", \"m13\", \"m14\"],\n\t\t\"x-msmetafile\": [\"wmf\", \"wmz\", \"emf\", \"emz\"],\n\t\t\"x-msmoney\": \"mny\",\n\t\t\"x-mspublisher\": \"pub\",\n\t\t\"x-msschedule\": \"scd\",\n\t\t\"x-msterminal\": \"trm\",\n\t\t\"x-mswrite\": \"wri\",\n\t\t\"x-nzb\": \"nzb\",\n\t\t\"x-pkcs12\": [\"p12\", \"pfx\"],\n\t\t\"x-pkcs7-certificates\": [\"p7b\", \"spc\"],\n\t\t\"x-research-info-systems\": \"ris\",\n\t\t\"x-silverlight-app\": \"xap\",\n\t\t\"x-sql\": \"sql\",\n\t\t\"x-stuffitx\": \"sitx\",\n\t\t\"x-subrip\": \"srt\",\n\t\t\"x-t3vm-image\": \"t3\",\n\t\t\"x-tads\": \"gam\",\n\t\t\"x-tex\": \"tex\",\n\t\t\"x-tex-tfm\": \"tfm\",\n\t\t\"x-tgif\": \"obj\",\n\t\t\"x-xliff+xml\": \"xlf\",\n\t\t\"x-xz\": \"xz\",\n\t\t\"x-zmachine\": [\"z1\", \"z2\", \"z3\", \"z4\", \"z5\", \"z6\", \"z7\", \"z8\"],\n\t\t\"xaml+xml\": \"xaml\",\n\t\t\"xcap-diff+xml\": \"xdf\",\n\t\t\"xenc+xml\": \"xenc\",\n\t\t\"xml-dtd\": \"dtd\",\n\t\t\"xop+xml\": \"xop\",\n\t\t\"xproc+xml\": \"xpl\",\n\t\t\"xslt+xml\": \"xslt\",\n\t\t\"xv+xml\": [\"mxml\", \"xhvml\", \"xvml\", \"xvm\"],\n\t\t\"yang\": \"yang\",\n\t\t\"yin+xml\": \"yin\",\n\t\t\"envoy\": \"evy\",\n\t\t\"fractals\": \"fif\",\n\t\t\"internet-property-stream\": \"acx\",\n\t\t\"olescript\": \"axs\",\n\t\t\"vnd.ms-outlook\": \"msg\",\n\t\t\"vnd.ms-pkicertstore\": \"sst\",\n\t\t\"x-compress\": \"z\",\n\t\t\"x-compressed\": \"tgz\",\n\t\t\"x-gzip\": \"gz\",\n\t\t\"x-perfmon\": [\"pma\", \"pmc\", \"pml\", \"pmr\", \"pmw\"],\n\t\t\"x-pkcs7-mime\": [\"p7c\", \"p7m\"],\n\t\t\"ynd.ms-pkipko\": \"pko\"\n\t},\n\t\"audio\": {\n\t\t\"amr\": \"amr\",\n\t\t\"amr-wb\": \"awb\",\n\t\t\"annodex\": \"axa\",\n\t\t\"basic\": [\"au\", \"snd\"],\n\t\t\"flac\": \"flac\",\n\t\t\"midi\": [\"mid\", \"midi\", \"kar\", \"rmi\"],\n\t\t\"mpeg\": [\"mpga\", \"mpega\", \"mp2\", \"mp3\", \"m4a\", \"mp2a\", \"m2a\", \"m3a\"],\n\t\t\"mpegurl\": \"m3u\",\n\t\t\"ogg\": [\"oga\", \"ogg\", \"spx\"],\n\t\t\"prs.sid\": \"sid\",\n\t\t\"x-aiff\": [\"aif\", \"aiff\", \"aifc\"],\n\t\t\"x-gsm\": \"gsm\",\n\t\t\"x-ms-wma\": \"wma\",\n\t\t\"x-ms-wax\": \"wax\",\n\t\t\"x-pn-realaudio\": \"ram\",\n\t\t\"x-realaudio\": \"ra\",\n\t\t\"x-sd2\": \"sd2\",\n\t\t\"x-wav\": \"wav\",\n\t\t\"adpcm\": \"adp\",\n\t\t\"mp4\": \"mp4a\",\n\t\t\"s3m\": \"s3m\",\n\t\t\"silk\": \"sil\",\n\t\t\"vnd.dece.audio\": [\"uva\", \"uvva\"],\n\t\t\"vnd.digital-winds\": \"eol\",\n\t\t\"vnd.dra\": \"dra\",\n\t\t\"vnd.dts\": \"dts\",\n\t\t\"vnd.dts.hd\": \"dtshd\",\n\t\t\"vnd.lucent.voice\": \"lvp\",\n\t\t\"vnd.ms-playready.media.pya\": \"pya\",\n\t\t\"vnd.nuera.ecelp4800\": \"ecelp4800\",\n\t\t\"vnd.nuera.ecelp7470\": \"ecelp7470\",\n\t\t\"vnd.nuera.ecelp9600\": \"ecelp9600\",\n\t\t\"vnd.rip\": \"rip\",\n\t\t\"webm\": \"weba\",\n\t\t\"x-aac\": \"aac\",\n\t\t\"x-caf\": \"caf\",\n\t\t\"x-matroska\": \"mka\",\n\t\t\"x-pn-realaudio-plugin\": \"rmp\",\n\t\t\"xm\": \"xm\",\n\t\t\"mid\": [\"mid\", \"rmi\"]\n\t},\n\t\"chemical\": {\n\t\t\"x-alchemy\": \"alc\",\n\t\t\"x-cache\": [\"cac\", \"cache\"],\n\t\t\"x-cache-csf\": \"csf\",\n\t\t\"x-cactvs-binary\": [\"cbin\", \"cascii\", \"ctab\"],\n\t\t\"x-cdx\": \"cdx\",\n\t\t\"x-chem3d\": \"c3d\",\n\t\t\"x-cif\": \"cif\",\n\t\t\"x-cmdf\": \"cmdf\",\n\t\t\"x-cml\": \"cml\",\n\t\t\"x-compass\": \"cpa\",\n\t\t\"x-crossfire\": \"bsd\",\n\t\t\"x-csml\": [\"csml\", \"csm\"],\n\t\t\"x-ctx\": \"ctx\",\n\t\t\"x-cxf\": [\"cxf\", \"cef\"],\n\t\t\"x-embl-dl-nucleotide\": [\"emb\", \"embl\"],\n\t\t\"x-gamess-input\": [\"inp\", \"gam\", \"gamin\"],\n\t\t\"x-gaussian-checkpoint\": [\"fch\", \"fchk\"],\n\t\t\"x-gaussian-cube\": \"cub\",\n\t\t\"x-gaussian-input\": [\"gau\", \"gjc\", \"gjf\"],\n\t\t\"x-gaussian-log\": \"gal\",\n\t\t\"x-gcg8-sequence\": \"gcg\",\n\t\t\"x-genbank\": \"gen\",\n\t\t\"x-hin\": \"hin\",\n\t\t\"x-isostar\": [\"istr\", \"ist\"],\n\t\t\"x-jcamp-dx\": [\"jdx\", \"dx\"],\n\t\t\"x-kinemage\": \"kin\",\n\t\t\"x-macmolecule\": \"mcm\",\n\t\t\"x-macromodel-input\": [\"mmd\", \"mmod\"],\n\t\t\"x-mdl-molfile\": \"mol\",\n\t\t\"x-mdl-rdfile\": \"rd\",\n\t\t\"x-mdl-rxnfile\": \"rxn\",\n\t\t\"x-mdl-sdfile\": [\"sd\", \"sdf\"],\n\t\t\"x-mdl-tgf\": \"tgf\",\n\t\t\"x-mmcif\": \"mcif\",\n\t\t\"x-mol2\": \"mol2\",\n\t\t\"x-molconn-Z\": \"b\",\n\t\t\"x-mopac-graph\": \"gpt\",\n\t\t\"x-mopac-input\": [\"mop\", \"mopcrt\", \"mpc\", \"zmt\"],\n\t\t\"x-mopac-out\": \"moo\",\n\t\t\"x-ncbi-asn1\": \"asn\",\n\t\t\"x-ncbi-asn1-ascii\": [\"prt\", \"ent\"],\n\t\t\"x-ncbi-asn1-binary\": [\"val\", \"aso\"],\n\t\t\"x-pdb\": [\"pdb\", \"ent\"],\n\t\t\"x-rosdal\": \"ros\",\n\t\t\"x-swissprot\": \"sw\",\n\t\t\"x-vamas-iso14976\": \"vms\",\n\t\t\"x-vmd\": \"vmd\",\n\t\t\"x-xtel\": \"xtel\",\n\t\t\"x-xyz\": \"xyz\"\n\t},\n\t\"image\": {\n\t\t\"gif\": \"gif\",\n\t\t\"ief\": \"ief\",\n\t\t\"jpeg\": [\"jpeg\", \"jpg\", \"jpe\"],\n\t\t\"pcx\": \"pcx\",\n\t\t\"png\": \"png\",\n\t\t\"svg+xml\": [\"svg\", \"svgz\"],\n\t\t\"tiff\": [\"tiff\", \"tif\"],\n\t\t\"vnd.djvu\": [\"djvu\", \"djv\"],\n\t\t\"vnd.wap.wbmp\": \"wbmp\",\n\t\t\"x-canon-cr2\": \"cr2\",\n\t\t\"x-canon-crw\": \"crw\",\n\t\t\"x-cmu-raster\": \"ras\",\n\t\t\"x-coreldraw\": \"cdr\",\n\t\t\"x-coreldrawpattern\": \"pat\",\n\t\t\"x-coreldrawtemplate\": \"cdt\",\n\t\t\"x-corelphotopaint\": \"cpt\",\n\t\t\"x-epson-erf\": \"erf\",\n\t\t\"x-icon\": \"ico\",\n\t\t\"x-jg\": \"art\",\n\t\t\"x-jng\": \"jng\",\n\t\t\"x-nikon-nef\": \"nef\",\n\t\t\"x-olympus-orf\": \"orf\",\n\t\t\"x-photoshop\": \"psd\",\n\t\t\"x-portable-anymap\": \"pnm\",\n\t\t\"x-portable-bitmap\": \"pbm\",\n\t\t\"x-portable-graymap\": \"pgm\",\n\t\t\"x-portable-pixmap\": \"ppm\",\n\t\t\"x-rgb\": \"rgb\",\n\t\t\"x-xbitmap\": \"xbm\",\n\t\t\"x-xpixmap\": \"xpm\",\n\t\t\"x-xwindowdump\": \"xwd\",\n\t\t\"bmp\": \"bmp\",\n\t\t\"cgm\": \"cgm\",\n\t\t\"g3fax\": \"g3\",\n\t\t\"ktx\": \"ktx\",\n\t\t\"prs.btif\": \"btif\",\n\t\t\"sgi\": \"sgi\",\n\t\t\"vnd.dece.graphic\": [\"uvi\", \"uvvi\", \"uvg\", \"uvvg\"],\n\t\t\"vnd.dwg\": \"dwg\",\n\t\t\"vnd.dxf\": \"dxf\",\n\t\t\"vnd.fastbidsheet\": \"fbs\",\n\t\t\"vnd.fpx\": \"fpx\",\n\t\t\"vnd.fst\": \"fst\",\n\t\t\"vnd.fujixerox.edmics-mmr\": \"mmr\",\n\t\t\"vnd.fujixerox.edmics-rlc\": \"rlc\",\n\t\t\"vnd.ms-modi\": \"mdi\",\n\t\t\"vnd.ms-photo\": \"wdp\",\n\t\t\"vnd.net-fpx\": \"npx\",\n\t\t\"vnd.xiff\": \"xif\",\n\t\t\"webp\": \"webp\",\n\t\t\"x-3ds\": \"3ds\",\n\t\t\"x-cmx\": \"cmx\",\n\t\t\"x-freehand\": [\"fh\", \"fhc\", \"fh4\", \"fh5\", \"fh7\"],\n\t\t\"x-pict\": [\"pic\", \"pct\"],\n\t\t\"x-tga\": \"tga\",\n\t\t\"cis-cod\": \"cod\",\n\t\t\"pipeg\": \"jfif\"\n\t},\n\t\"message\": {\n\t\t\"rfc822\": [\"eml\", \"mime\", \"mht\", \"mhtml\", \"nws\"]\n\t},\n\t\"model\": {\n\t\t\"iges\": [\"igs\", \"iges\"],\n\t\t\"mesh\": [\"msh\", \"mesh\", \"silo\"],\n\t\t\"vrml\": [\"wrl\", \"vrml\"],\n\t\t\"x3d+vrml\": [\"x3dv\", \"x3dvz\"],\n\t\t\"x3d+xml\": [\"x3d\", \"x3dz\"],\n\t\t\"x3d+binary\": [\"x3db\", \"x3dbz\"],\n\t\t\"vnd.collada+xml\": \"dae\",\n\t\t\"vnd.dwf\": \"dwf\",\n\t\t\"vnd.gdl\": \"gdl\",\n\t\t\"vnd.gtw\": \"gtw\",\n\t\t\"vnd.mts\": \"mts\",\n\t\t\"vnd.vtu\": \"vtu\"\n\t},\n\t\"text\": {\n\t\t\"cache-manifest\": [\"manifest\", \"appcache\"],\n\t\t\"calendar\": [\"ics\", \"icz\", \"ifb\"],\n\t\t\"css\": \"css\",\n\t\t\"csv\": \"csv\",\n\t\t\"h323\": \"323\",\n\t\t\"html\": [\"html\", \"htm\", \"shtml\", \"stm\"],\n\t\t\"iuls\": \"uls\",\n\t\t\"mathml\": \"mml\",\n\t\t\"plain\": [\"txt\", \"text\", \"brf\", \"conf\", \"def\", \"list\", \"log\", \"in\", \"bas\"],\n\t\t\"richtext\": \"rtx\",\n\t\t\"scriptlet\": [\"sct\", \"wsc\"],\n\t\t\"texmacs\": [\"tm\", \"ts\"],\n\t\t\"tab-separated-values\": \"tsv\",\n\t\t\"vnd.sun.j2me.app-descriptor\": \"jad\",\n\t\t\"vnd.wap.wml\": \"wml\",\n\t\t\"vnd.wap.wmlscript\": \"wmls\",\n\t\t\"x-bibtex\": \"bib\",\n\t\t\"x-boo\": \"boo\",\n\t\t\"x-c++hdr\": [\"h++\", \"hpp\", \"hxx\", \"hh\"],\n\t\t\"x-c++src\": [\"c++\", \"cpp\", \"cxx\", \"cc\"],\n\t\t\"x-component\": \"htc\",\n\t\t\"x-dsrc\": \"d\",\n\t\t\"x-diff\": [\"diff\", \"patch\"],\n\t\t\"x-haskell\": \"hs\",\n\t\t\"x-java\": \"java\",\n\t\t\"x-literate-haskell\": \"lhs\",\n\t\t\"x-moc\": \"moc\",\n\t\t\"x-pascal\": [\"p\", \"pas\"],\n\t\t\"x-pcs-gcd\": \"gcd\",\n\t\t\"x-perl\": [\"pl\", \"pm\"],\n\t\t\"x-python\": \"py\",\n\t\t\"x-scala\": \"scala\",\n\t\t\"x-setext\": \"etx\",\n\t\t\"x-tcl\": [\"tcl\", \"tk\"],\n\t\t\"x-tex\": [\"tex\", \"ltx\", \"sty\", \"cls\"],\n\t\t\"x-vcalendar\": \"vcs\",\n\t\t\"x-vcard\": \"vcf\",\n\t\t\"n3\": \"n3\",\n\t\t\"prs.lines.tag\": \"dsc\",\n\t\t\"sgml\": [\"sgml\", \"sgm\"],\n\t\t\"troff\": [\"t\", \"tr\", \"roff\", \"man\", \"me\", \"ms\"],\n\t\t\"turtle\": \"ttl\",\n\t\t\"uri-list\": [\"uri\", \"uris\", \"urls\"],\n\t\t\"vcard\": \"vcard\",\n\t\t\"vnd.curl\": \"curl\",\n\t\t\"vnd.curl.dcurl\": \"dcurl\",\n\t\t\"vnd.curl.scurl\": \"scurl\",\n\t\t\"vnd.curl.mcurl\": \"mcurl\",\n\t\t\"vnd.dvb.subtitle\": \"sub\",\n\t\t\"vnd.fly\": \"fly\",\n\t\t\"vnd.fmi.flexstor\": \"flx\",\n\t\t\"vnd.graphviz\": \"gv\",\n\t\t\"vnd.in3d.3dml\": \"3dml\",\n\t\t\"vnd.in3d.spot\": \"spot\",\n\t\t\"x-asm\": [\"s\", \"asm\"],\n\t\t\"x-c\": [\"c\", \"cc\", \"cxx\", \"cpp\", \"h\", \"hh\", \"dic\"],\n\t\t\"x-fortran\": [\"f\", \"for\", \"f77\", \"f90\"],\n\t\t\"x-opml\": \"opml\",\n\t\t\"x-nfo\": \"nfo\",\n\t\t\"x-sfv\": \"sfv\",\n\t\t\"x-uuencode\": \"uu\",\n\t\t\"webviewhtml\": \"htt\"\n\t},\n\t\"video\": {\n\t\t\"avif\": \".avif\",\n\t\t\"3gpp\": \"3gp\",\n\t\t\"annodex\": \"axv\",\n\t\t\"dl\": \"dl\",\n\t\t\"dv\": [\"dif\", \"dv\"],\n\t\t\"fli\": \"fli\",\n\t\t\"gl\": \"gl\",\n\t\t\"mpeg\": [\"mpeg\", \"mpg\", \"mpe\", \"m1v\", \"m2v\", \"mp2\", \"mpa\", \"mpv2\"],\n\t\t\"mp4\": [\"mp4\", \"mp4v\", \"mpg4\"],\n\t\t\"quicktime\": [\"qt\", \"mov\"],\n\t\t\"ogg\": \"ogv\",\n\t\t\"vnd.mpegurl\": [\"mxu\", \"m4u\"],\n\t\t\"x-flv\": \"flv\",\n\t\t\"x-la-asf\": [\"lsf\", \"lsx\"],\n\t\t\"x-mng\": \"mng\",\n\t\t\"x-ms-asf\": [\"asf\", \"asx\", \"asr\"],\n\t\t\"x-ms-wm\": \"wm\",\n\t\t\"x-ms-wmv\": \"wmv\",\n\t\t\"x-ms-wmx\": \"wmx\",\n\t\t\"x-ms-wvx\": \"wvx\",\n\t\t\"x-msvideo\": \"avi\",\n\t\t\"x-sgi-movie\": \"movie\",\n\t\t\"x-matroska\": [\"mpv\", \"mkv\", \"mk3d\", \"mks\"],\n\t\t\"3gpp2\": \"3g2\",\n\t\t\"h261\": \"h261\",\n\t\t\"h263\": \"h263\",\n\t\t\"h264\": \"h264\",\n\t\t\"jpeg\": \"jpgv\",\n\t\t\"jpm\": [\"jpm\", \"jpgm\"],\n\t\t\"mj2\": [\"mj2\", \"mjp2\"],\n\t\t\"vnd.dece.hd\": [\"uvh\", \"uvvh\"],\n\t\t\"vnd.dece.mobile\": [\"uvm\", \"uvvm\"],\n\t\t\"vnd.dece.pd\": [\"uvp\", \"uvvp\"],\n\t\t\"vnd.dece.sd\": [\"uvs\", \"uvvs\"],\n\t\t\"vnd.dece.video\": [\"uvv\", \"uvvv\"],\n\t\t\"vnd.dvb.file\": \"dvb\",\n\t\t\"vnd.fvt\": \"fvt\",\n\t\t\"vnd.ms-playready.media.pyv\": \"pyv\",\n\t\t\"vnd.uvvu.mp4\": [\"uvu\", \"uvvu\"],\n\t\t\"vnd.vivo\": \"viv\",\n\t\t\"webm\": \"webm\",\n\t\t\"x-f4v\": \"f4v\",\n\t\t\"x-m4v\": \"m4v\",\n\t\t\"x-ms-vob\": \"vob\",\n\t\t\"x-smv\": \"smv\"\t\t\n\t},\n\t\"x-conference\": {\n\t\t\"x-cooltalk\": \"ice\"\n\t},\n\t\"x-world\": {\n\t\t\"x-vrml\": [\"vrm\", \"vrml\", \"wrl\", \"flr\", \"wrz\", \"xaf\", \"xof\"]\n\t}\n};\n\nconst mimeTypes = (() => {\n\tconst mimeTypes = {};\n\tfor (let type in table) {\n\t\t// eslint-disable-next-line no-prototype-builtins\n\t\tif (table.hasOwnProperty(type)) {\n\t\t\tfor (let subtype in table[type]) {\n\t\t\t\t// eslint-disable-next-line no-prototype-builtins\n\t\t\t\tif (table[type].hasOwnProperty(subtype)) {\n\t\t\t\t\tconst value = table[type][subtype];\n\t\t\t\t\tif (typeof value == \"string\") {\n\t\t\t\t\t\tmimeTypes[value] = type + \"/\" + subtype;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (let indexMimeType = 0; indexMimeType < value.length; indexMimeType++) {\n\t\t\t\t\t\t\tmimeTypes[value[indexMimeType]] = type + \"/\" + subtype;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn mimeTypes;\n})();\n\nexport default getMimeType;\n\nfunction getMimeType(filename) {\n\tconst defaultValue = \"application/octet-stream\";\n\treturn filename && mimeTypes[filename.split(\".\").pop().toLowerCase()] || defaultValue;\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nconst table = [];\nfor (let i = 0; i < 256; i++) {\n\tlet t = i;\n\tfor (let j = 0; j < 8; j++) {\n\t\tif (t & 1) {\n\t\t\tt = (t >>> 1) ^ 0xEDB88320;\n\t\t} else {\n\t\t\tt = t >>> 1;\n\t\t}\n\t}\n\ttable[i] = t;\n}\n\nclass Crc32 {\n\n\tconstructor(crc) {\n\t\tthis.crc = crc || -1;\n\t}\n\n\tappend(data) {\n\t\tlet crc = this.crc | 0;\n\t\tfor (let offset = 0, length = data.length | 0; offset < length; offset++) {\n\t\t\tcrc = (crc >>> 8) ^ table[(crc ^ data[offset]) & 0xFF];\n\t\t}\n\t\tthis.crc = crc;\n\t}\n\n\tget() {\n\t\treturn ~this.crc;\n\t}\n}\n\nexport default Crc32;","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global TextEncoder */\n\n\"use strict\";\n\nexport default encodeText;\n\nfunction encodeText(value) {\n\tif (typeof TextEncoder == \"undefined\") {\n\t\tvalue = unescape(encodeURIComponent(value));\n\t\tconst result = new Uint8Array(value.length);\n\t\tfor (let i = 0; i < result.length; i++) {\n\t\t\tresult[i] = value.charCodeAt(i);\n\t\t}\n\t\treturn result;\n\t} else {\n\t\treturn new TextEncoder().encode(value);\n\t}\n}","// Derived from https://github.com/xqdoo00o/jszip/blob/master/lib/sjcl.js\n\n/** @fileOverview Javascript cryptography implementation.\n *\n * Crush to remove comments, shorten variable names and\n * generally reduce transmission size.\n *\n * @author Emily Stark\n * @author Mike Hamburg\n * @author Dan Boneh\n */\n\n\"use strict\";\n/*jslint indent: 2, bitwise: false, nomen: false, plusplus: false, white: false, regexp: false */\n\n/** @fileOverview Arrays of bits, encoded as arrays of Numbers.\n *\n * @author Emily Stark\n * @author Mike Hamburg\n * @author Dan Boneh\n */\n\n/**\n * Arrays of bits, encoded as arrays of Numbers.\n * @namespace\n * @description\n *

\n * These objects are the currency accepted by SJCL's crypto functions.\n *

\n *\n *

\n * Most of our crypto primitives operate on arrays of 4-byte words internally,\n * but many of them can take arguments that are not a multiple of 4 bytes.\n * This library encodes arrays of bits (whose size need not be a multiple of 8\n * bits) as arrays of 32-bit words. The bits are packed, big-endian, into an\n * array of words, 32 bits at a time. Since the words are double-precision\n * floating point numbers, they fit some extra data. We use this (in a private,\n * possibly-changing manner) to encode the number of bits actually present\n * in the last word of the array.\n *

\n *\n *

\n * Because bitwise ops clear this out-of-band data, these arrays can be passed\n * to ciphers like AES which want arrays of words.\n *

\n */\nconst bitArray = {\n\t/**\n\t * Concatenate two bit arrays.\n\t * @param {bitArray} a1 The first array.\n\t * @param {bitArray} a2 The second array.\n\t * @return {bitArray} The concatenation of a1 and a2.\n\t */\n\tconcat(a1, a2) {\n\t\tif (a1.length === 0 || a2.length === 0) {\n\t\t\treturn a1.concat(a2);\n\t\t}\n\n\t\tconst last = a1[a1.length - 1], shift = bitArray.getPartial(last);\n\t\tif (shift === 32) {\n\t\t\treturn a1.concat(a2);\n\t\t} else {\n\t\t\treturn bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1));\n\t\t}\n\t},\n\n\t/**\n\t * Find the length of an array of bits.\n\t * @param {bitArray} a The array.\n\t * @return {Number} The length of a, in bits.\n\t */\n\tbitLength(a) {\n\t\tconst l = a.length;\n\t\tif (l === 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tconst x = a[l - 1];\n\t\treturn (l - 1) * 32 + bitArray.getPartial(x);\n\t},\n\n\t/**\n\t * Truncate an array.\n\t * @param {bitArray} a The array.\n\t * @param {Number} len The length to truncate to, in bits.\n\t * @return {bitArray} A new array, truncated to len bits.\n\t */\n\tclamp(a, len) {\n\t\tif (a.length * 32 < len) {\n\t\t\treturn a;\n\t\t}\n\t\ta = a.slice(0, Math.ceil(len / 32));\n\t\tconst l = a.length;\n\t\tlen = len & 31;\n\t\tif (l > 0 && len) {\n\t\t\ta[l - 1] = bitArray.partial(len, a[l - 1] & 0x80000000 >> (len - 1), 1);\n\t\t}\n\t\treturn a;\n\t},\n\n\t/**\n\t * Make a partial word for a bit array.\n\t * @param {Number} len The number of bits in the word.\n\t * @param {Number} x The bits.\n\t * @param {Number} [_end=0] Pass 1 if x has already been shifted to the high side.\n\t * @return {Number} The partial word.\n\t */\n\tpartial(len, x, _end) {\n\t\tif (len === 32) {\n\t\t\treturn x;\n\t\t}\n\t\treturn (_end ? x | 0 : x << (32 - len)) + len * 0x10000000000;\n\t},\n\n\t/**\n\t * Get the number of bits used by a partial word.\n\t * @param {Number} x The partial word.\n\t * @return {Number} The number of bits used by the partial word.\n\t */\n\tgetPartial(x) {\n\t\treturn Math.round(x / 0x10000000000) || 32;\n\t},\n\n\t/** Shift an array right.\n\t * @param {bitArray} a The array to shift.\n\t * @param {Number} shift The number of bits to shift.\n\t * @param {Number} [carry=0] A byte to carry in\n\t * @param {bitArray} [out=[]] An array to prepend to the output.\n\t * @private\n\t */\n\t_shiftRight(a, shift, carry, out) {\n\t\tif (out === undefined) {\n\t\t\tout = [];\n\t\t}\n\n\t\tfor (; shift >= 32; shift -= 32) {\n\t\t\tout.push(carry);\n\t\t\tcarry = 0;\n\t\t}\n\t\tif (shift === 0) {\n\t\t\treturn out.concat(a);\n\t\t}\n\n\t\tfor (let i = 0; i < a.length; i++) {\n\t\t\tout.push(carry | a[i] >>> shift);\n\t\t\tcarry = a[i] << (32 - shift);\n\t\t}\n\t\tconst last2 = a.length ? a[a.length - 1] : 0;\n\t\tconst shift2 = bitArray.getPartial(last2);\n\t\tout.push(bitArray.partial(shift + shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(), 1));\n\t\treturn out;\n\t}\n};\n\n/** @fileOverview Bit array codec implementations.\n *\n * @author Emily Stark\n * @author Mike Hamburg\n * @author Dan Boneh\n */\n\n/**\n * Arrays of bytes\n * @namespace\n */\nconst codec = {\n\tbytes: {\n\t\t/** Convert from a bitArray to an array of bytes. */\n\t\tfromBits(arr) {\n\t\t\tconst bl = bitArray.bitLength(arr);\n\t\t\tconst byteLength = bl / 8;\n\t\t\tconst out = new Uint8Array(byteLength);\n\t\t\tlet tmp;\n\t\t\tfor (let i = 0; i < byteLength; i++) {\n\t\t\t\tif ((i & 3) === 0) {\n\t\t\t\t\ttmp = arr[i / 4];\n\t\t\t\t}\n\t\t\t\tout[i] = tmp >>> 24;\n\t\t\t\ttmp <<= 8;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\t\t/** Convert from an array of bytes to a bitArray. */\n\t\ttoBits(bytes) {\n\t\t\tconst out = [];\n\t\t\tlet i;\n\t\t\tlet tmp = 0;\n\t\t\tfor (i = 0; i < bytes.length; i++) {\n\t\t\t\ttmp = tmp << 8 | bytes[i];\n\t\t\t\tif ((i & 3) === 3) {\n\t\t\t\t\tout.push(tmp);\n\t\t\t\t\ttmp = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i & 3) {\n\t\t\t\tout.push(bitArray.partial(8 * (i & 3), tmp));\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t}\n};\n\nconst hash = {};\n\n/**\n * Context for a SHA-1 operation in progress.\n * @constructor\n */\nhash.sha1 = function (hash) {\n\tif (hash) {\n\t\tthis._h = hash._h.slice(0);\n\t\tthis._buffer = hash._buffer.slice(0);\n\t\tthis._length = hash._length;\n\t} else {\n\t\tthis.reset();\n\t}\n};\n\nhash.sha1.prototype = {\n\t/**\n\t * The hash's block size, in bits.\n\t * @constant\n\t */\n\tblockSize: 512,\n\n\t/**\n\t * Reset the hash state.\n\t * @return this\n\t */\n\treset: function () {\n\t\tconst sha1 = this;\n\t\tsha1._h = this._init.slice(0);\n\t\tsha1._buffer = [];\n\t\tsha1._length = 0;\n\t\treturn sha1;\n\t},\n\n\t/**\n\t * Input several words to the hash.\n\t * @param {bitArray|String} data the data to hash.\n\t * @return this\n\t */\n\tupdate: function (data) {\n\t\tconst sha1 = this;\n\t\tif (typeof data === \"string\") {\n\t\t\tdata = codec.utf8String.toBits(data);\n\t\t}\n\t\tconst b = sha1._buffer = bitArray.concat(sha1._buffer, data);\n\t\tconst ol = sha1._length;\n\t\tconst nl = sha1._length = ol + bitArray.bitLength(data);\n\t\tif (nl > 9007199254740991) {\n\t\t\tthrow new Error(\"Cannot hash more than 2^53 - 1 bits\");\n\t\t}\n\t\tconst c = new Uint32Array(b);\n\t\tlet j = 0;\n\t\tfor (let i = sha1.blockSize + ol - ((sha1.blockSize + ol) & (sha1.blockSize - 1)); i <= nl;\n\t\t\ti += sha1.blockSize) {\n\t\t\tsha1._block(c.subarray(16 * j, 16 * (j + 1)));\n\t\t\tj += 1;\n\t\t}\n\t\tb.splice(0, 16 * j);\n\t\treturn sha1;\n\t},\n\n\t/**\n\t * Complete hashing and output the hash value.\n\t * @return {bitArray} The hash value, an array of 5 big-endian words. TODO\n\t */\n\tfinalize: function () {\n\t\tconst sha1 = this;\n\t\tlet b = sha1._buffer;\n\t\tconst h = sha1._h;\n\n\t\t// Round out and push the buffer\n\t\tb = bitArray.concat(b, [bitArray.partial(1, 1)]);\n\t\t// Round out the buffer to a multiple of 16 words, less the 2 length words.\n\t\tfor (let i = b.length + 2; i & 15; i++) {\n\t\t\tb.push(0);\n\t\t}\n\n\t\t// append the length\n\t\tb.push(Math.floor(sha1._length / 0x100000000));\n\t\tb.push(sha1._length | 0);\n\n\t\twhile (b.length) {\n\t\t\tsha1._block(b.splice(0, 16));\n\t\t}\n\n\t\tsha1.reset();\n\t\treturn h;\n\t},\n\n\t/**\n\t * The SHA-1 initialization vector.\n\t * @private\n\t */\n\t_init: [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0],\n\n\t/**\n\t * The SHA-1 hash key.\n\t * @private\n\t */\n\t_key: [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6],\n\n\t/**\n\t * The SHA-1 logical functions f(0), f(1), ..., f(79).\n\t * @private\n\t */\n\t_f: function (t, b, c, d) {\n\t\tif (t <= 19) {\n\t\t\treturn (b & c) | (~b & d);\n\t\t} else if (t <= 39) {\n\t\t\treturn b ^ c ^ d;\n\t\t} else if (t <= 59) {\n\t\t\treturn (b & c) | (b & d) | (c & d);\n\t\t} else if (t <= 79) {\n\t\t\treturn b ^ c ^ d;\n\t\t}\n\t},\n\n\t/**\n\t * Circular left-shift operator.\n\t * @private\n\t */\n\t_S: function (n, x) {\n\t\treturn (x << n) | (x >>> 32 - n);\n\t},\n\n\t/**\n\t * Perform one cycle of SHA-1.\n\t * @param {Uint32Array|bitArray} words one block of words.\n\t * @private\n\t */\n\t_block: function (words) {\n\t\tconst sha1 = this;\n\t\tconst h = sha1._h;\n\t\t// When words is passed to _block, it has 16 elements. SHA1 _block\n\t\t// function extends words with new elements (at the end there are 80 elements). \n\t\t// The problem is that if we use Uint32Array instead of Array, \n\t\t// the length of Uint32Array cannot be changed. Thus, we replace words with a \n\t\t// normal Array here.\n\t\tconst w = Array(80); // do not use Uint32Array here as the instantiation is slower\n\t\tfor (let j = 0; j < 16; j++) {\n\t\t\tw[j] = words[j];\n\t\t}\n\n\t\tlet a = h[0];\n\t\tlet b = h[1];\n\t\tlet c = h[2];\n\t\tlet d = h[3];\n\t\tlet e = h[4];\n\n\t\tfor (let t = 0; t <= 79; t++) {\n\t\t\tif (t >= 16) {\n\t\t\t\tw[t] = sha1._S(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);\n\t\t\t}\n\t\t\tconst tmp = (sha1._S(5, a) + sha1._f(t, b, c, d) + e + w[t] +\n\t\t\t\tsha1._key[Math.floor(t / 20)]) | 0;\n\t\t\te = d;\n\t\t\td = c;\n\t\t\tc = sha1._S(30, b);\n\t\t\tb = a;\n\t\t\ta = tmp;\n\t\t}\n\n\t\th[0] = (h[0] + a) | 0;\n\t\th[1] = (h[1] + b) | 0;\n\t\th[2] = (h[2] + c) | 0;\n\t\th[3] = (h[3] + d) | 0;\n\t\th[4] = (h[4] + e) | 0;\n\t}\n};\n\n/** @fileOverview Low-level AES implementation.\n *\n * This file contains a low-level implementation of AES, optimized for\n * size and for efficiency on several browsers. It is based on\n * OpenSSL's aes_core.c, a public-domain implementation by Vincent\n * Rijmen, Antoon Bosselaers and Paulo Barreto.\n *\n * An older version of this implementation is available in the public\n * domain, but this one is (c) Emily Stark, Mike Hamburg, Dan Boneh,\n * Stanford University 2008-2010 and BSD-licensed for liability\n * reasons.\n *\n * @author Emily Stark\n * @author Mike Hamburg\n * @author Dan Boneh\n */\n\nconst cipher = {};\n\n/**\n * Schedule out an AES key for both encryption and decryption. This\n * is a low-level class. Use a cipher mode to do bulk encryption.\n *\n * @constructor\n * @param {Array} key The key as an array of 4, 6 or 8 words.\n */\ncipher.aes = class {\n\tconstructor(key) {\n\t\t/**\n\t\t * The expanded S-box and inverse S-box tables. These will be computed\n\t\t * on the client so that we don't have to send them down the wire.\n\t\t *\n\t\t * There are two tables, _tables[0] is for encryption and\n\t\t * _tables[1] is for decryption.\n\t\t *\n\t\t * The first 4 sub-tables are the expanded S-box with MixColumns. The\n\t\t * last (_tables[01][4]) is the S-box itself.\n\t\t *\n\t\t * @private\n\t\t */\n\t\tconst aes = this;\n\t\taes._tables = [[[], [], [], [], []], [[], [], [], [], []]];\n\n\t\tif (!aes._tables[0][0][0]) {\n\t\t\taes._precompute();\n\t\t}\n\n\t\tconst sbox = aes._tables[0][4];\n\t\tconst decTable = aes._tables[1];\n\t\tconst keyLen = key.length;\n\n\t\tlet i, encKey, decKey, rcon = 1;\n\n\t\tif (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {\n\t\t\tthrow new Error(\"invalid aes key size\");\n\t\t}\n\n\t\taes._key = [encKey = key.slice(0), decKey = []];\n\n\t\t// schedule encryption keys\n\t\tfor (i = keyLen; i < 4 * keyLen + 28; i++) {\n\t\t\tlet tmp = encKey[i - 1];\n\n\t\t\t// apply sbox\n\t\t\tif (i % keyLen === 0 || (keyLen === 8 && i % keyLen === 4)) {\n\t\t\t\ttmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];\n\n\t\t\t\t// shift rows and add rcon\n\t\t\t\tif (i % keyLen === 0) {\n\t\t\t\t\ttmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;\n\t\t\t\t\trcon = rcon << 1 ^ (rcon >> 7) * 283;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tencKey[i] = encKey[i - keyLen] ^ tmp;\n\t\t}\n\n\t\t// schedule decryption keys\n\t\tfor (let j = 0; i; j++, i--) {\n\t\t\tconst tmp = encKey[j & 3 ? i : i - 4];\n\t\t\tif (i <= 4 || j < 4) {\n\t\t\t\tdecKey[j] = tmp;\n\t\t\t} else {\n\t\t\t\tdecKey[j] = decTable[0][sbox[tmp >>> 24]] ^\n\t\t\t\t\tdecTable[1][sbox[tmp >> 16 & 255]] ^\n\t\t\t\t\tdecTable[2][sbox[tmp >> 8 & 255]] ^\n\t\t\t\t\tdecTable[3][sbox[tmp & 255]];\n\t\t\t}\n\t\t}\n\t}\n\t// public\n\t/* Something like this might appear here eventually\n\tname: \"AES\",\n\tblockSize: 4,\n\tkeySizes: [4,6,8],\n\t*/\n\n\t/**\n\t * Encrypt an array of 4 big-endian words.\n\t * @param {Array} data The plaintext.\n\t * @return {Array} The ciphertext.\n\t */\n\tencrypt(data) {\n\t\treturn this._crypt(data, 0);\n\t}\n\n\t/**\n\t * Decrypt an array of 4 big-endian words.\n\t * @param {Array} data The ciphertext.\n\t * @return {Array} The plaintext.\n\t */\n\tdecrypt(data) {\n\t\treturn this._crypt(data, 1);\n\t}\n\n\t/**\n\t * Expand the S-box tables.\n\t *\n\t * @private\n\t */\n\t_precompute() {\n\t\tconst encTable = this._tables[0];\n\t\tconst decTable = this._tables[1];\n\t\tconst sbox = encTable[4];\n\t\tconst sboxInv = decTable[4];\n\t\tconst d = [];\n\t\tconst th = [];\n\t\tlet xInv, x2, x4, x8;\n\n\t\t// Compute double and third tables\n\t\tfor (let i = 0; i < 256; i++) {\n\t\t\tth[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n\t\t}\n\n\t\tfor (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n\t\t\t// Compute sbox\n\t\t\tlet s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n\t\t\ts = s >> 8 ^ s & 255 ^ 99;\n\t\t\tsbox[x] = s;\n\t\t\tsboxInv[s] = x;\n\n\t\t\t// Compute MixColumns\n\t\t\tx8 = d[x4 = d[x2 = d[x]]];\n\t\t\tlet tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n\t\t\tlet tEnc = d[s] * 0x101 ^ s * 0x1010100;\n\n\t\t\tfor (let i = 0; i < 4; i++) {\n\t\t\t\tencTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n\t\t\t\tdecTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n\t\t\t}\n\t\t}\n\n\t\t// Compactify. Considerable speedup on Firefox.\n\t\tfor (let i = 0; i < 5; i++) {\n\t\t\tencTable[i] = encTable[i].slice(0);\n\t\t\tdecTable[i] = decTable[i].slice(0);\n\t\t}\n\t}\n\n\t/**\n\t * Encryption and decryption core.\n\t * @param {Array} input Four words to be encrypted or decrypted.\n\t * @param dir The direction, 0 for encrypt and 1 for decrypt.\n\t * @return {Array} The four encrypted or decrypted words.\n\t * @private\n\t */\n\t_crypt(input, dir) {\n\t\tif (input.length !== 4) {\n\t\t\tthrow new Error(\"invalid aes block size\");\n\t\t}\n\n\t\tconst key = this._key[dir];\n\n\t\tconst nInnerRounds = key.length / 4 - 2;\n\t\tconst out = [0, 0, 0, 0];\n\t\tconst table = this._tables[dir];\n\n\t\t// load up the tables\n\t\tconst t0 = table[0];\n\t\tconst t1 = table[1];\n\t\tconst t2 = table[2];\n\t\tconst t3 = table[3];\n\t\tconst sbox = table[4];\n\n\t\t// state variables a,b,c,d are loaded with pre-whitened data\n\t\tlet a = input[0] ^ key[0];\n\t\tlet b = input[dir ? 3 : 1] ^ key[1];\n\t\tlet c = input[2] ^ key[2];\n\t\tlet d = input[dir ? 1 : 3] ^ key[3];\n\t\tlet kIndex = 4;\n\t\tlet a2, b2, c2;\n\n\t\t// Inner rounds. Cribbed from OpenSSL.\n\t\tfor (let i = 0; i < nInnerRounds; i++) {\n\t\t\ta2 = t0[a >>> 24] ^ t1[b >> 16 & 255] ^ t2[c >> 8 & 255] ^ t3[d & 255] ^ key[kIndex];\n\t\t\tb2 = t0[b >>> 24] ^ t1[c >> 16 & 255] ^ t2[d >> 8 & 255] ^ t3[a & 255] ^ key[kIndex + 1];\n\t\t\tc2 = t0[c >>> 24] ^ t1[d >> 16 & 255] ^ t2[a >> 8 & 255] ^ t3[b & 255] ^ key[kIndex + 2];\n\t\t\td = t0[d >>> 24] ^ t1[a >> 16 & 255] ^ t2[b >> 8 & 255] ^ t3[c & 255] ^ key[kIndex + 3];\n\t\t\tkIndex += 4;\n\t\t\ta = a2; b = b2; c = c2;\n\t\t}\n\n\t\t// Last round.\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tout[dir ? 3 & -i : i] =\n\t\t\t\tsbox[a >>> 24] << 24 ^\n\t\t\t\tsbox[b >> 16 & 255] << 16 ^\n\t\t\t\tsbox[c >> 8 & 255] << 8 ^\n\t\t\t\tsbox[d & 255] ^\n\t\t\t\tkey[kIndex++];\n\t\t\ta2 = a; a = b; b = c; c = d; d = a2;\n\t\t}\n\n\t\treturn out;\n\t}\n};\n\n/** @fileOverview CTR mode implementation.\n *\n * Special thanks to Roy Nicholson for pointing out a bug in our\n * implementation.\n *\n * @author Emily Stark\n * @author Mike Hamburg\n * @author Dan Boneh\n */\n\n/** Brian Gladman's CTR Mode.\n* @constructor\n* @param {Object} _prf The aes instance to generate key.\n* @param {bitArray} _iv The iv for ctr mode, it must be 128 bits.\n*/\n\nconst mode = {};\n\n/**\n * Brian Gladman's CTR Mode.\n * @namespace\n */\nmode.ctrGladman = class {\n\tconstructor(prf, iv) {\n\t\tthis._prf = prf;\n\t\tthis._initIv = iv;\n\t\tthis._iv = iv;\n\t}\n\n\treset() {\n\t\tthis._iv = this._initIv;\n\t}\n\n\t/** Input some data to calculate.\n\t * @param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last.\n\t */\n\tupdate(data) {\n\t\treturn this.calculate(this._prf, data, this._iv);\n\t}\n\n\tincWord(word) {\n\t\tif (((word >> 24) & 0xff) === 0xff) { //overflow\n\t\t\tlet b1 = (word >> 16) & 0xff;\n\t\t\tlet b2 = (word >> 8) & 0xff;\n\t\t\tlet b3 = word & 0xff;\n\n\t\t\tif (b1 === 0xff) { // overflow b1 \n\t\t\t\tb1 = 0;\n\t\t\t\tif (b2 === 0xff) {\n\t\t\t\t\tb2 = 0;\n\t\t\t\t\tif (b3 === 0xff) {\n\t\t\t\t\t\tb3 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t++b3;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t++b2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t++b1;\n\t\t\t}\n\n\t\t\tword = 0;\n\t\t\tword += (b1 << 16);\n\t\t\tword += (b2 << 8);\n\t\t\tword += b3;\n\t\t} else {\n\t\t\tword += (0x01 << 24);\n\t\t}\n\t\treturn word;\n\t}\n\n\tincCounter(counter) {\n\t\tif ((counter[0] = this.incWord(counter[0])) === 0) {\n\t\t\t// encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8\n\t\t\tcounter[1] = this.incWord(counter[1]);\n\t\t}\n\t}\n\n\tcalculate(prf, data, iv) {\n\t\tlet l;\n\t\tif (!(l = data.length)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst bl = bitArray.bitLength(data);\n\t\tfor (let i = 0; i < l; i += 4) {\n\t\t\tthis.incCounter(iv);\n\t\t\tconst e = prf.encrypt(iv);\n\t\t\tdata[i] ^= e[0];\n\t\t\tdata[i + 1] ^= e[1];\n\t\t\tdata[i + 2] ^= e[2];\n\t\t\tdata[i + 3] ^= e[3];\n\t\t}\n\t\treturn bitArray.clamp(data, bl);\n\t}\n};\n\n\nconst misc = {};\n\n/** @fileOverview HMAC implementation.\n *\n * @author Emily Stark\n * @author Mike Hamburg\n * @author Dan Boneh\n */\n\n/** HMAC with the specified hash function.\n * @constructor\n * @param {bitArray} key the key for HMAC.\n * @param {Object} [Hash=hash.sha1] The hash function to use.\n */\nmisc.hmacSha1 = class {\n\n\tconstructor(key) {\n\t\tconst hmac = this;\n\t\tconst Hash = hmac._hash = hash.sha1;\n\t\tconst exKey = [[], []];\n\t\tconst bs = Hash.prototype.blockSize / 32;\n\t\thmac._baseHash = [new Hash(), new Hash()];\n\n\t\tif (key.length > bs) {\n\t\t\tkey = Hash.hash(key);\n\t\t}\n\n\t\tfor (let i = 0; i < bs; i++) {\n\t\t\texKey[0][i] = key[i] ^ 0x36363636;\n\t\t\texKey[1][i] = key[i] ^ 0x5C5C5C5C;\n\t\t}\n\n\t\thmac._baseHash[0].update(exKey[0]);\n\t\thmac._baseHash[1].update(exKey[1]);\n\t\thmac._resultHash = new Hash(hmac._baseHash[0]);\n\t}\n\treset() {\n\t\tconst hmac = this;\n\t\thmac._resultHash = new hmac._hash(hmac._baseHash[0]);\n\t\thmac._updated = false;\n\t}\n\n\tupdate(data) {\n\t\tconst hmac = this;\n\t\thmac._updated = true;\n\t\thmac._resultHash.update(data);\n\t}\n\n\tdigest() {\n\t\tconst hmac = this;\n\t\tconst w = hmac._resultHash.finalize();\n\t\tconst result = new (hmac._hash)(hmac._baseHash[1]).update(w).finalize();\n\n\t\thmac.reset();\n\n\t\treturn result;\n\t}\n};\n\nexport {\n\tcipher,\n\tcodec,\n\tmisc,\n\tmode\n};","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global crypto */\n\n\"use strict\";\n\nimport encodeText from \"./../util/encode-text.js\";\nimport { cipher, codec, misc, mode } from \"./sjcl.js\";\n\nconst ERR_INVALID_PASSWORD = \"Invalid pasword\";\nconst BLOCK_LENGTH = 16;\nconst RAW_FORMAT = \"raw\";\nconst PBKDF2_ALGORITHM = { name: \"PBKDF2\" };\nconst HASH_ALGORITHM = { name: \"HMAC\" };\nconst HASH_FUNCTION = \"SHA-1\";\nconst BASE_KEY_ALGORITHM = Object.assign({ hash: HASH_ALGORITHM }, PBKDF2_ALGORITHM);\nconst DERIVED_BITS_ALGORITHM = Object.assign({ iterations: 1000, hash: { name: HASH_FUNCTION } }, PBKDF2_ALGORITHM);\nconst DERIVED_BITS_USAGE = [\"deriveBits\"];\nconst SALT_LENGTH = [8, 12, 16];\nconst KEY_LENGTH = [16, 24, 32];\nconst SIGNATURE_LENGTH = 10;\nconst COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];\nconst codecBytes = codec.bytes;\nconst Aes = cipher.aes;\nconst CtrGladman = mode.ctrGladman;\nconst HmacSha1 = misc.hmacSha1;\nclass AESDecrypt {\n\n\tconstructor(password, signed, strength) {\n\t\tObject.assign(this, {\n\t\t\tpassword,\n\t\t\tsigned,\n\t\t\tstrength: strength - 1,\n\t\t\tpendingInput: new Uint8Array(0)\n\t\t});\n\t}\n\n\tasync append(input) {\n\t\tconst aesCrypto = this;\n\t\tif (aesCrypto.password) {\n\t\t\tconst preamble = subarray(input, 0, SALT_LENGTH[aesCrypto.strength] + 2);\n\t\t\tawait createDecryptionKeys(aesCrypto, preamble, aesCrypto.password);\n\t\t\taesCrypto.password = null;\n\t\t\taesCrypto.aesCtrGladman = new CtrGladman(new Aes(aesCrypto.keys.key), Array.from(COUNTER_DEFAULT_VALUE));\n\t\t\taesCrypto.hmac = new HmacSha1(aesCrypto.keys.authentication);\n\t\t\tinput = subarray(input, SALT_LENGTH[aesCrypto.strength] + 2);\n\t\t}\n\t\tconst output = new Uint8Array(input.length - SIGNATURE_LENGTH - ((input.length - SIGNATURE_LENGTH) % BLOCK_LENGTH));\n\t\treturn append(aesCrypto, input, output, 0, SIGNATURE_LENGTH, true);\n\t}\n\n\tflush() {\n\t\tconst aesCrypto = this;\n\t\tconst pendingInput = aesCrypto.pendingInput;\n\t\tconst chunkToDecrypt = subarray(pendingInput, 0, pendingInput.length - SIGNATURE_LENGTH);\n\t\tconst originalSignature = subarray(pendingInput, pendingInput.length - SIGNATURE_LENGTH);\n\t\tlet decryptedChunkArray = new Uint8Array(0);\n\t\tif (chunkToDecrypt.length) {\n\t\t\tconst encryptedChunk = codecBytes.toBits(chunkToDecrypt);\n\t\t\taesCrypto.hmac.update(encryptedChunk);\n\t\t\tconst decryptedChunk = aesCrypto.aesCtrGladman.update(encryptedChunk);\n\t\t\tdecryptedChunkArray = codecBytes.fromBits(decryptedChunk);\n\t\t}\n\t\tlet valid = true;\n\t\tif (aesCrypto.signed) {\n\t\t\tconst signature = subarray(codecBytes.fromBits(aesCrypto.hmac.digest()), 0, SIGNATURE_LENGTH);\n\t\t\tfor (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {\n\t\t\t\tif (signature[indexSignature] != originalSignature[indexSignature]) {\n\t\t\t\t\tvalid = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tvalid,\n\t\t\tdata: decryptedChunkArray\n\t\t};\n\t}\n}\n\nclass AESEncrypt {\n\n\tconstructor(password, strength) {\n\t\tObject.assign(this, {\n\t\t\tpassword,\n\t\t\tstrength: strength - 1,\n\t\t\tpendingInput: new Uint8Array(0)\n\t\t});\n\t}\n\n\tasync append(input) {\n\t\tconst aesCrypto = this;\n\t\tlet preamble = new Uint8Array(0);\n\t\tif (aesCrypto.password) {\n\t\t\tpreamble = await createEncryptionKeys(aesCrypto, aesCrypto.password);\n\t\t\taesCrypto.password = null;\n\t\t\taesCrypto.aesCtrGladman = new CtrGladman(new Aes(aesCrypto.keys.key), Array.from(COUNTER_DEFAULT_VALUE));\n\t\t\taesCrypto.hmac = new HmacSha1(aesCrypto.keys.authentication);\n\t\t}\n\t\tconst output = new Uint8Array(preamble.length + input.length - (input.length % BLOCK_LENGTH));\n\t\toutput.set(preamble, 0);\n\t\treturn append(aesCrypto, input, output, preamble.length, 0);\n\t}\n\n\tflush() {\n\t\tconst aesCrypto = this;\n\t\tlet encryptedChunkArray = new Uint8Array(0);\n\t\tif (aesCrypto.pendingInput.length) {\n\t\t\tconst encryptedChunk = aesCrypto.aesCtrGladman.update(codecBytes.toBits(aesCrypto.pendingInput));\n\t\t\taesCrypto.hmac.update(encryptedChunk);\n\t\t\tencryptedChunkArray = codecBytes.fromBits(encryptedChunk);\n\t\t}\n\t\tconst signature = subarray(codecBytes.fromBits(aesCrypto.hmac.digest()), 0, SIGNATURE_LENGTH);\n\t\treturn {\n\t\t\tdata: concat(encryptedChunkArray, signature),\n\t\t\tsignature\n\t\t};\n\t}\n}\n\nexport {\n\tAESDecrypt,\n\tAESEncrypt,\n\tERR_INVALID_PASSWORD\n};\n\nfunction append(aesCrypto, input, output, paddingStart, paddingEnd, verifySignature) {\n\tconst inputLength = input.length - paddingEnd;\n\tif (aesCrypto.pendingInput.length) {\n\t\tinput = concat(aesCrypto.pendingInput, input);\n\t\toutput = expand(output, inputLength - (inputLength % BLOCK_LENGTH));\n\t}\n\tlet offset;\n\tfor (offset = 0; offset <= inputLength - BLOCK_LENGTH; offset += BLOCK_LENGTH) {\n\t\tconst inputChunk = codecBytes.toBits(subarray(input, offset, offset + BLOCK_LENGTH));\n\t\tif (verifySignature) {\n\t\t\taesCrypto.hmac.update(inputChunk);\n\t\t}\n\t\tconst outputChunk = aesCrypto.aesCtrGladman.update(inputChunk);\n\t\tif (!verifySignature) {\n\t\t\taesCrypto.hmac.update(outputChunk);\n\t\t}\n\t\toutput.set(codecBytes.fromBits(outputChunk), offset + paddingStart);\n\t}\n\taesCrypto.pendingInput = subarray(input, offset);\n\treturn output;\n}\n\nasync function createDecryptionKeys(decrypt, preambleArray, password) {\n\tawait createKeys(decrypt, password, subarray(preambleArray, 0, SALT_LENGTH[decrypt.strength]));\n\tconst passwordVerification = subarray(preambleArray, SALT_LENGTH[decrypt.strength]);\n\tconst passwordVerificationKey = decrypt.keys.passwordVerification;\n\tif (passwordVerificationKey[0] != passwordVerification[0] || passwordVerificationKey[1] != passwordVerification[1]) {\n\t\tthrow new Error(ERR_INVALID_PASSWORD);\n\t}\n}\n\nasync function createEncryptionKeys(encrypt, password) {\n\tconst salt = crypto.getRandomValues(new Uint8Array(SALT_LENGTH[encrypt.strength]));\n\tawait createKeys(encrypt, password, salt);\n\treturn concat(salt, encrypt.keys.passwordVerification);\n}\n\nasync function createKeys(target, password, salt) {\n\tconst encodedPassword = encodeText(password);\n\tconst basekey = await crypto.subtle.importKey(RAW_FORMAT, encodedPassword, BASE_KEY_ALGORITHM, false, DERIVED_BITS_USAGE);\n\tconst derivedBits = await crypto.subtle.deriveBits(Object.assign({ salt }, DERIVED_BITS_ALGORITHM), basekey, 8 * ((KEY_LENGTH[target.strength] * 2) + 2));\n\tconst compositeKey = new Uint8Array(derivedBits);\n\ttarget.keys = {\n\t\tkey: codecBytes.toBits(subarray(compositeKey, 0, KEY_LENGTH[target.strength])),\n\t\tauthentication: codecBytes.toBits(subarray(compositeKey, KEY_LENGTH[target.strength], KEY_LENGTH[target.strength] * 2)),\n\t\tpasswordVerification: subarray(compositeKey, KEY_LENGTH[target.strength] * 2)\n\t};\n}\n\nfunction concat(leftArray, rightArray) {\n\tlet array = leftArray;\n\tif (leftArray.length + rightArray.length) {\n\t\tarray = new Uint8Array(leftArray.length + rightArray.length);\n\t\tarray.set(leftArray, 0);\n\t\tarray.set(rightArray, leftArray.length);\n\t}\n\treturn array;\n}\n\nfunction expand(inputArray, length) {\n\tif (length && length > inputArray.length) {\n\t\tconst array = inputArray;\n\t\tinputArray = new Uint8Array(length);\n\t\tinputArray.set(array, 0);\n\t}\n\treturn inputArray;\n}\n\nfunction subarray(array, begin, end) {\n\treturn array.subarray(begin, end);\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global crypto */\n\n\"use strict\";\n\nimport Crc32 from \"./crc32.js\";\nimport { ERR_INVALID_PASSWORD } from \"./aes-crypto.js\";\n\nconst HEADER_LENGTH = 12;\n\nclass ZipCryptoDecrypt {\n\n\tconstructor(password, passwordVerification) {\n\t\tconst zipCrypto = this;\n\t\tObject.assign(zipCrypto, {\n\t\t\tpassword,\n\t\t\tpasswordVerification\n\t\t});\n\t\tcreateKeys(zipCrypto, password);\n\t}\n\n\tappend(input) {\n\t\tconst zipCrypto = this;\n\t\tif (zipCrypto.password) {\n\t\t\tconst decryptedHeader = decrypt(zipCrypto, input.subarray(0, HEADER_LENGTH));\n\t\t\tzipCrypto.password = null;\n\t\t\tif (decryptedHeader[HEADER_LENGTH - 1] != zipCrypto.passwordVerification) {\n\t\t\t\tthrow new Error(ERR_INVALID_PASSWORD);\n\t\t\t}\n\t\t\tinput = input.subarray(HEADER_LENGTH);\n\t\t}\n\t\treturn decrypt(zipCrypto, input);\n\t}\n\n\tflush() {\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\tdata: new Uint8Array(0)\n\t\t};\n\t}\n}\n\nclass ZipCryptoEncrypt {\n\n\tconstructor(password, passwordVerification) {\n\t\tconst zipCrypto = this;\n\t\tObject.assign(zipCrypto, {\n\t\t\tpassword,\n\t\t\tpasswordVerification\n\t\t});\n\t\tcreateKeys(zipCrypto, password);\n\t}\n\n\tappend(input) {\n\t\tconst zipCrypto = this;\n\t\tlet output;\n\t\tlet offset;\n\t\tif (zipCrypto.password) {\n\t\t\tzipCrypto.password = null;\n\t\t\tconst header = crypto.getRandomValues(new Uint8Array(HEADER_LENGTH));\n\t\t\theader[HEADER_LENGTH - 1] = zipCrypto.passwordVerification;\n\t\t\toutput = new Uint8Array(input.length + header.length);\n\t\t\toutput.set(encrypt(zipCrypto, header), 0);\n\t\t\toffset = HEADER_LENGTH;\n\t\t} else {\n\t\t\toutput = new Uint8Array(input.length);\n\t\t\toffset = 0;\n\t\t}\n\t\toutput.set(encrypt(zipCrypto, input), offset);\n\t\treturn output;\n\t}\n\n\tflush() {\n\t\treturn {\n\t\t\tdata: new Uint8Array(0)\n\t\t};\n\t}\n}\n\nexport {\n\tZipCryptoDecrypt,\n\tZipCryptoEncrypt,\n\tERR_INVALID_PASSWORD\n};\n\nfunction decrypt(target, input) {\n\tconst output = new Uint8Array(input.length);\n\tfor (let index = 0; index < input.length; index++) {\n\t\toutput[index] = getByte(target) ^ input[index];\n\t\tupdateKeys(target, output[index]);\n\t}\n\treturn output;\n}\n\nfunction encrypt(target, input) {\n\tconst output = new Uint8Array(input.length);\n\tfor (let index = 0; index < input.length; index++) {\n\t\toutput[index] = getByte(target) ^ input[index];\n\t\tupdateKeys(target, input[index]);\n\t}\n\treturn output;\n}\n\nfunction createKeys(target, password) {\n\ttarget.keys = [0x12345678, 0x23456789, 0x34567890];\n\ttarget.crcKey0 = new Crc32(target.keys[0]);\n\ttarget.crcKey2 = new Crc32(target.keys[2]);\n\tfor (let index = 0; index < password.length; index++) {\n\t\tupdateKeys(target, password.charCodeAt(index));\n\t}\n}\n\nfunction updateKeys(target, byte) {\n\ttarget.crcKey0.append([byte]);\n\ttarget.keys[0] = ~target.crcKey0.get();\n\ttarget.keys[1] = getInt32(target.keys[1] + getInt8(target.keys[0]));\n\ttarget.keys[1] = getInt32(Math.imul(target.keys[1], 134775813) + 1);\n\ttarget.crcKey2.append([target.keys[1] >>> 24]);\n\ttarget.keys[2] = ~target.crcKey2.get();\n}\n\nfunction getByte(target) {\n\tconst temp = target.keys[2] | 2;\n\treturn getInt8(Math.imul(temp, (temp ^ 1)) >>> 8);\n}\n\nfunction getInt8(number) {\n\treturn number & 0xFF;\n}\n\nfunction getInt32(number) {\n\treturn number & 0xFFFFFFFF;\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nimport Crc32 from \"./crc32.js\";\nimport { AESEncrypt, AESDecrypt, ERR_INVALID_PASSWORD } from \"./aes-crypto.js\";\nimport { ZipCryptoDecrypt, ZipCryptoEncrypt } from \"./zip-crypto.js\";\n\nconst CODEC_DEFLATE = \"deflate\";\nconst CODEC_INFLATE = \"inflate\";\nconst ERR_INVALID_SIGNATURE = \"Invalid signature\";\n\nclass Inflate {\n\n\tconstructor(codecConstructor, {\n\t\tsignature,\n\t\tpassword,\n\t\tsigned,\n\t\tcompressed,\n\t\tzipCrypto,\n\t\tpasswordVerification,\n\t\tencryptionStrength\n\t}, { chunkSize }) {\n\t\tconst encrypted = Boolean(password);\n\t\tObject.assign(this, {\n\t\t\tsignature,\n\t\t\tencrypted,\n\t\t\tsigned,\n\t\t\tcompressed,\n\t\t\tinflate: compressed && new codecConstructor({ chunkSize }),\n\t\t\tcrc32: signed && new Crc32(),\n\t\t\tzipCrypto,\n\t\t\tdecrypt: encrypted && zipCrypto ?\n\t\t\t\tnew ZipCryptoDecrypt(password, passwordVerification) :\n\t\t\t\tnew AESDecrypt(password, signed, encryptionStrength)\n\t\t});\n\t}\n\n\tasync append(data) {\n\t\tconst codec = this;\n\t\tif (codec.encrypted && data.length) {\n\t\t\tdata = await codec.decrypt.append(data);\n\t\t}\n\t\tif (codec.compressed && data.length) {\n\t\t\tdata = await codec.inflate.append(data);\n\t\t}\n\t\tif ((!codec.encrypted || codec.zipCrypto) && codec.signed && data.length) {\n\t\t\tcodec.crc32.append(data);\n\t\t}\n\t\treturn data;\n\t}\n\n\tasync flush() {\n\t\tconst codec = this;\n\t\tlet signature;\n\t\tlet data = new Uint8Array(0);\n\t\tif (codec.encrypted) {\n\t\t\tconst result = codec.decrypt.flush();\n\t\t\tif (!result.valid) {\n\t\t\t\tthrow new Error(ERR_INVALID_SIGNATURE);\n\t\t\t}\n\t\t\tdata = result.data;\n\t\t}\n\t\tif ((!codec.encrypted || codec.zipCrypto) && codec.signed) {\n\t\t\tconst dataViewSignature = new DataView(new Uint8Array(4).buffer);\n\t\t\tsignature = codec.crc32.get();\n\t\t\tdataViewSignature.setUint32(0, signature);\n\t\t\tif (codec.signature != dataViewSignature.getUint32(0, false)) {\n\t\t\t\tthrow new Error(ERR_INVALID_SIGNATURE);\n\t\t\t}\n\t\t}\n\t\tif (codec.compressed) {\n\t\t\tdata = (await codec.inflate.append(data)) || new Uint8Array(0);\n\t\t\tawait codec.inflate.flush();\n\t\t}\n\t\treturn { data, signature };\n\t}\n}\n\nclass Deflate {\n\n\tconstructor(codecConstructor, {\n\t\tencrypted,\n\t\tsigned,\n\t\tcompressed,\n\t\tlevel,\n\t\tzipCrypto,\n\t\tpassword,\n\t\tpasswordVerification,\n\t\tencryptionStrength\n\t}, { chunkSize }) {\n\t\tObject.assign(this, {\n\t\t\tencrypted,\n\t\t\tsigned,\n\t\t\tcompressed,\n\t\t\tdeflate: compressed && new codecConstructor({ level: level || 5, chunkSize }),\n\t\t\tcrc32: signed && new Crc32(),\n\t\t\tzipCrypto,\n\t\t\tencrypt: encrypted && zipCrypto ?\n\t\t\t\tnew ZipCryptoEncrypt(password, passwordVerification) :\n\t\t\t\tnew AESEncrypt(password, encryptionStrength)\n\t\t});\n\t}\n\n\tasync append(inputData) {\n\t\tconst codec = this;\n\t\tlet data = inputData;\n\t\tif (codec.compressed && inputData.length) {\n\t\t\tdata = await codec.deflate.append(inputData);\n\t\t}\n\t\tif (codec.encrypted && data.length) {\n\t\t\tdata = await codec.encrypt.append(data);\n\t\t}\n\t\tif ((!codec.encrypted || codec.zipCrypto) && codec.signed && inputData.length) {\n\t\t\tcodec.crc32.append(inputData);\n\t\t}\n\t\treturn data;\n\t}\n\n\tasync flush() {\n\t\tconst codec = this;\n\t\tlet signature;\n\t\tlet data = new Uint8Array(0);\n\t\tif (codec.compressed) {\n\t\t\tdata = (await codec.deflate.flush()) || new Uint8Array(0);\n\t\t}\n\t\tif (codec.encrypted) {\n\t\t\tdata = await codec.encrypt.append(data);\n\t\t\tconst result = codec.encrypt.flush();\n\t\t\tsignature = result.signature;\n\t\t\tconst newData = new Uint8Array(data.length + result.data.length);\n\t\t\tnewData.set(data, 0);\n\t\t\tnewData.set(result.data, data.length);\n\t\t\tdata = newData;\n\t\t}\n\t\tif ((!codec.encrypted || codec.zipCrypto) && codec.signed) {\n\t\t\tsignature = codec.crc32.get();\n\t\t}\n\t\treturn { data, signature };\n\t}\n}\n\nexport {\n\tInflate,\n\tDeflate,\n\tcreateCodec,\n\tCODEC_DEFLATE,\n\tCODEC_INFLATE,\n\tERR_INVALID_SIGNATURE,\n\tERR_INVALID_PASSWORD\n};\n\nfunction createCodec(codecConstructor, options, config) {\n\tif (options.codecType.startsWith(CODEC_DEFLATE)) {\n\t\treturn new Deflate(codecConstructor, options, config);\n\t} else if (options.codecType.startsWith(CODEC_INFLATE)) {\n\t\treturn new Inflate(codecConstructor, options, config);\n\t}\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global Worker, URL */\n\n\"use strict\";\n\nimport { createCodec } from \"./codec.js\";\n\nconst MESSAGE_INIT = \"init\";\nconst MESSAGE_APPEND = \"append\";\nconst MESSAGE_FLUSH = \"flush\";\nconst MESSAGE_EVENT_TYPE = \"message\";\n\nlet classicWorkersSupported = true;\n\nexport default (workerData, codecConstructor, options, config, onTaskFinished, webWorker, scripts) => {\n\tObject.assign(workerData, {\n\t\tbusy: true,\n\t\tcodecConstructor,\n\t\toptions: Object.assign({}, options),\n\t\tscripts,\n\t\tterminate() {\n\t\t\tif (workerData.worker && !workerData.busy) {\n\t\t\t\tworkerData.worker.terminate();\n\t\t\t\tworkerData.interface = null;\n\t\t\t}\n\t\t},\n\t\tonTaskFinished() {\n\t\t\tworkerData.busy = false;\n\t\t\tonTaskFinished(workerData);\n\t\t}\n\t});\n\treturn webWorker ? createWebWorkerInterface(workerData, config) : createWorkerInterface(workerData, config);\n};\n\nfunction createWorkerInterface(workerData, config) {\n\tconst interfaceCodec = createCodec(workerData.codecConstructor, workerData.options, config);\n\treturn {\n\t\tasync append(data) {\n\t\t\ttry {\n\t\t\t\treturn await interfaceCodec.append(data);\n\t\t\t} catch (error) {\n\t\t\t\tworkerData.onTaskFinished();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t\tasync flush() {\n\t\t\ttry {\n\t\t\t\treturn await interfaceCodec.flush();\n\t\t\t} finally {\n\t\t\t\tworkerData.onTaskFinished();\n\t\t\t}\n\t\t}\n\t};\n}\n\nfunction createWebWorkerInterface(workerData, config) {\n\tlet messageTask;\n\tconst workerOptions = { type: \"module\" };\n\tif (!workerData.interface) {\n\t\tif (!classicWorkersSupported) {\n\t\t\tworkerData.worker = getWorker(workerOptions, config.baseURL);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tworkerData.worker = getWorker({}, config.baseURL);\n\t\t\t} catch (error) {\n\t\t\t\tclassicWorkersSupported = false;\n\t\t\t\tworkerData.worker = getWorker(workerOptions, config.baseURL);\n\t\t\t}\n\t\t}\n\t\tworkerData.worker.addEventListener(MESSAGE_EVENT_TYPE, onMessage, false);\n\t\tworkerData.interface = {\n\t\t\tappend(data) {\n\t\t\t\treturn initAndSendMessage({ type: MESSAGE_APPEND, data });\n\t\t\t},\n\t\t\tflush() {\n\t\t\t\treturn initAndSendMessage({ type: MESSAGE_FLUSH });\n\t\t\t}\n\t\t};\n\t}\n\treturn workerData.interface;\n\n\tfunction getWorker(options, baseURL) {\n\t\tlet url;\n\t\ttry {\n\t\t\turl = new URL(workerData.scripts[0], baseURL);\n\t\t} catch (error) {\n\t\t\turl = workerData.scripts[0];\n\t\t}\n\t\treturn new Worker(url, options);\n\t}\n\n\tasync function initAndSendMessage(message) {\n\t\tif (!messageTask) {\n\t\t\tconst options = workerData.options;\n\t\t\tconst scripts = workerData.scripts.slice(1);\n\t\t\tawait sendMessage({ scripts, type: MESSAGE_INIT, options, config: { chunkSize: config.chunkSize } });\n\t\t}\n\t\treturn sendMessage(message);\n\t}\n\n\tfunction sendMessage(message) {\n\t\tconst worker = workerData.worker;\n\t\tconst result = new Promise((resolve, reject) => messageTask = { resolve, reject });\n\t\ttry {\n\t\t\tif (message.data) {\n\t\t\t\ttry {\n\t\t\t\t\tmessage.data = message.data.buffer;\n\t\t\t\t\tworker.postMessage(message, [message.data]);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tworker.postMessage(message);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tworker.postMessage(message);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tmessageTask.reject(error);\n\t\t\tmessageTask = null;\n\t\t\tworkerData.onTaskFinished();\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction onMessage(event) {\n\t\tconst message = event.data;\n\t\tif (messageTask) {\n\t\t\tconst reponseError = message.error;\n\t\t\tconst type = message.type;\n\t\t\tif (reponseError) {\n\t\t\t\tconst error = new Error(reponseError.message);\n\t\t\t\terror.stack = reponseError.stack;\n\t\t\t\tmessageTask.reject(error);\n\t\t\t\tmessageTask = null;\n\t\t\t\tworkerData.onTaskFinished();\n\t\t\t} else if (type == MESSAGE_INIT || type == MESSAGE_FLUSH || type == MESSAGE_APPEND) {\n\t\t\t\tconst data = message.data;\n\t\t\t\tif (type == MESSAGE_FLUSH) {\n\t\t\t\t\tmessageTask.resolve({ data: new Uint8Array(data), signature: message.signature });\n\t\t\t\t\tmessageTask = null;\n\t\t\t\t\tworkerData.onTaskFinished();\n\t\t\t\t} else {\n\t\t\t\t\tmessageTask.resolve(data && new Uint8Array(data));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global setTimeout, clearTimeout */\n\n\"use strict\";\n\nimport { CODEC_INFLATE, CODEC_DEFLATE, ERR_INVALID_SIGNATURE, ERR_INVALID_PASSWORD } from \"./codec.js\";\nimport getWorker from \"./codec-pool-worker.js\";\n\nlet pool = [];\nlet pendingRequests = [];\n\nexport {\n\tcreateCodec,\n\tterminateWorkers,\n\tCODEC_DEFLATE,\n\tCODEC_INFLATE,\n\tERR_INVALID_SIGNATURE,\n\tERR_INVALID_PASSWORD\n};\n\nfunction createCodec(codecConstructor, options, config) {\n\tconst streamCopy = !options.compressed && !options.signed && !options.encrypted;\n\tconst webWorker = !streamCopy && (options.useWebWorkers || (options.useWebWorkers === undefined && config.useWebWorkers));\n\tconst scripts = webWorker && config.workerScripts ? config.workerScripts[options.codecType] : [];\n\tif (pool.length < config.maxWorkers) {\n\t\tconst workerData = {};\n\t\tpool.push(workerData);\n\t\treturn getWorker(workerData, codecConstructor, options, config, onTaskFinished, webWorker, scripts);\n\t} else {\n\t\tconst workerData = pool.find(workerData => !workerData.busy);\n\t\tif (workerData) {\n\t\t\tclearTerminateTimeout(workerData);\n\t\t\treturn getWorker(workerData, codecConstructor, options, config, onTaskFinished, webWorker, scripts);\n\t\t} else {\n\t\t\treturn new Promise(resolve => pendingRequests.push({ resolve, codecConstructor, options, webWorker, scripts }));\n\t\t}\n\t}\n\n\tfunction onTaskFinished(workerData) {\n\t\tif (pendingRequests.length) {\n\t\t\tconst [{ resolve, codecConstructor, options, webWorker, scripts }] = pendingRequests.splice(0, 1);\n\t\t\tresolve(getWorker(workerData, codecConstructor, options, config, onTaskFinished, webWorker, scripts));\n\t\t} else if (workerData.worker) {\n\t\t\tclearTerminateTimeout(workerData);\n\t\t\tif (Number.isFinite(config.terminateWorkerTimeout) && config.terminateWorkerTimeout >= 0) {\n\t\t\t\tworkerData.terminateTimeout = setTimeout(() => {\n\t\t\t\t\tpool = pool.filter(data => data != workerData);\n\t\t\t\t\tworkerData.terminate();\n\t\t\t\t}, config.terminateWorkerTimeout);\n\t\t\t}\n\t\t} else {\n\t\t\tpool = pool.filter(data => data != workerData);\n\t\t}\n\t}\n}\n\nfunction clearTerminateTimeout(workerData) {\n\tif (workerData.terminateTimeout) {\n\t\tclearTimeout(workerData.terminateTimeout);\n\t\tworkerData.terminateTimeout = null;\n\t}\n}\n\nfunction terminateWorkers() {\n\tpool.forEach(workerData => {\n\t\tclearTerminateTimeout(workerData);\n\t\tworkerData.terminate();\n\t});\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global Blob, FileReader, atob, btoa, XMLHttpRequest, document, fetch */\n\n\"use strict\";\n\nconst ERR_HTTP_STATUS = \"HTTP error \";\nconst ERR_HTTP_RANGE = \"HTTP Range not supported\";\n\nconst CONTENT_TYPE_TEXT_PLAIN = \"text/plain\";\nconst HTTP_HEADER_CONTENT_LENGTH = \"Content-Length\";\nconst HTTP_HEADER_CONTENT_RANGE = \"Content-Range\";\nconst HTTP_HEADER_ACCEPT_RANGES = \"Accept-Ranges\";\nconst HTTP_HEADER_RANGE = \"Range\";\nconst HTTP_METHOD_HEAD = \"HEAD\";\nconst HTTP_METHOD_GET = \"GET\";\nconst HTTP_RANGE_UNIT = \"bytes\";\n\nclass Stream {\n\n\tconstructor() {\n\t\tthis.size = 0;\n\t}\n\n\tinit() {\n\t\tthis.initialized = true;\n\t}\n}\n\nclass Reader extends Stream {\n}\n\nclass Writer extends Stream {\n\n\twriteUint8Array(array) {\n\t\tthis.size += array.length;\n\t}\n}\n\nclass TextReader extends Reader {\n\n\tconstructor(text) {\n\t\tsuper();\n\t\tthis.blobReader = new BlobReader(new Blob([text], { type: CONTENT_TYPE_TEXT_PLAIN }));\n\t}\n\n\tasync init() {\n\t\tsuper.init();\n\t\tthis.blobReader.init();\n\t\tthis.size = this.blobReader.size;\n\t}\n\n\tasync readUint8Array(offset, length) {\n\t\treturn this.blobReader.readUint8Array(offset, length);\n\t}\n}\n\nclass TextWriter extends Writer {\n\n\tconstructor(encoding) {\n\t\tsuper();\n\t\tthis.encoding = encoding;\n\t\tthis.blob = new Blob([], { type: CONTENT_TYPE_TEXT_PLAIN });\n\t}\n\n\tasync writeUint8Array(array) {\n\t\tsuper.writeUint8Array(array);\n\t\tthis.blob = new Blob([this.blob, array.buffer], { type: CONTENT_TYPE_TEXT_PLAIN });\n\t}\n\n\tgetData() {\n\t\tif (this.blob.text) {\n\t\t\treturn this.blob.text();\n\t\t} else {\n\t\t\tconst reader = new FileReader();\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\treader.onload = event => resolve(event.target.result);\n\t\t\t\treader.onerror = () => reject(reader.error);\n\t\t\t\treader.readAsText(this.blob, this.encoding);\n\t\t\t});\n\t\t}\n\t}\n}\n\nclass Data64URIReader extends Reader {\n\n\tconstructor(dataURI) {\n\t\tsuper();\n\t\tthis.dataURI = dataURI;\n\t\tlet dataEnd = dataURI.length;\n\t\twhile (dataURI.charAt(dataEnd - 1) == \"=\") {\n\t\t\tdataEnd--;\n\t\t}\n\t\tthis.dataStart = dataURI.indexOf(\",\") + 1;\n\t\tthis.size = Math.floor((dataEnd - this.dataStart) * 0.75);\n\t}\n\n\tasync readUint8Array(offset, length) {\n\t\tconst dataArray = new Uint8Array(length);\n\t\tconst start = Math.floor(offset / 3) * 4;\n\t\tconst bytes = atob(this.dataURI.substring(start + this.dataStart, Math.ceil((offset + length) / 3) * 4 + this.dataStart));\n\t\tconst delta = offset - Math.floor(start / 4) * 3;\n\t\tfor (let indexByte = delta; indexByte < delta + length; indexByte++) {\n\t\t\tdataArray[indexByte - delta] = bytes.charCodeAt(indexByte);\n\t\t}\n\t\treturn dataArray;\n\t}\n}\n\nclass Data64URIWriter extends Writer {\n\n\tconstructor(contentType) {\n\t\tsuper();\n\t\tthis.data = \"data:\" + (contentType || \"\") + \";base64,\";\n\t\tthis.pending = [];\n\t}\n\n\tasync writeUint8Array(array) {\n\t\tsuper.writeUint8Array(array);\n\t\tlet indexArray = 0;\n\t\tlet dataString = this.pending;\n\t\tconst delta = this.pending.length;\n\t\tthis.pending = \"\";\n\t\tfor (indexArray = 0; indexArray < (Math.floor((delta + array.length) / 3) * 3) - delta; indexArray++) {\n\t\t\tdataString += String.fromCharCode(array[indexArray]);\n\t\t}\n\t\tfor (; indexArray < array.length; indexArray++) {\n\t\t\tthis.pending += String.fromCharCode(array[indexArray]);\n\t\t}\n\t\tif (dataString.length > 2) {\n\t\t\tthis.data += btoa(dataString);\n\t\t} else {\n\t\t\tthis.pending = dataString;\n\t\t}\n\t}\n\n\tgetData() {\n\t\treturn this.data + btoa(this.pending);\n\t}\n}\n\nclass BlobReader extends Reader {\n\n\tconstructor(blob) {\n\t\tsuper();\n\t\tthis.blob = blob;\n\t\tthis.size = blob.size;\n\t}\n\n\tasync readUint8Array(offset, length) {\n\t\tif (this.blob.arrayBuffer) {\n\t\t\treturn new Uint8Array(await this.blob.slice(offset, offset + length).arrayBuffer());\n\t\t} else {\n\t\t\tconst reader = new FileReader();\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\treader.onload = event => resolve(new Uint8Array(event.target.result));\n\t\t\t\treader.onerror = () => reject(reader.error);\n\t\t\t\treader.readAsArrayBuffer(this.blob.slice(offset, offset + length));\n\t\t\t});\n\t\t}\n\t}\n}\n\nclass BlobWriter extends Writer {\n\n\tconstructor(contentType) {\n\t\tsuper();\n\t\tthis.contentType = contentType;\n\t\tthis.arrayBuffers = [];\n\t}\n\n\tasync writeUint8Array(array) {\n\t\tsuper.writeUint8Array(array);\n\t\tthis.arrayBuffers.push(array.buffer);\n\t}\n\n\tgetData() {\n\t\tif (!this.blob) {\n\t\t\tthis.blob = new Blob(this.arrayBuffers, { type: this.contentType });\n\t\t}\n\t\treturn this.blob;\n\t}\n}\n\nclass FetchReader extends Reader {\n\n\tconstructor(url, options) {\n\t\tsuper();\n\t\tthis.url = url;\n\t\tthis.preventHeadRequest = options.preventHeadRequest;\n\t\tthis.useRangeHeader = options.useRangeHeader;\n\t\tthis.forceRangeRequests = options.forceRangeRequests;\n\t\tthis.options = Object.assign({}, options);\n\t\tdelete this.options.preventHeadRequest;\n\t\tdelete this.options.useRangeHeader;\n\t\tdelete this.options.forceRangeRequests;\n\t\tdelete this.options.useXHR;\n\t}\n\n\tasync init() {\n\t\tsuper.init();\n\t\tawait initHttpReader(this, sendFetchRequest, getFetchRequestData);\n\t}\n\n\tasync readUint8Array(index, length) {\n\t\treturn readUint8ArrayHttpReader(this, index, length, sendFetchRequest, getFetchRequestData);\n\t}\n}\n\nclass XHRReader extends Reader {\n\n\tconstructor(url, options) {\n\t\tsuper();\n\t\tthis.url = url;\n\t\tthis.preventHeadRequest = options.preventHeadRequest;\n\t\tthis.useRangeHeader = options.useRangeHeader;\n\t\tthis.forceRangeRequests = options.forceRangeRequests;\n\t\tthis.options = options;\n\t}\n\n\tasync init() {\n\t\tsuper.init();\n\t\tawait initHttpReader(this, sendXMLHttpRequest, getXMLHttpRequestData);\n\t}\n\n\tasync readUint8Array(index, length) {\n\t\treturn readUint8ArrayHttpReader(this, index, length, sendXMLHttpRequest, getXMLHttpRequestData);\n\t}\n}\n\nasync function initHttpReader(httpReader, sendRequest, getRequestData) {\n\tif (isHttpFamily(httpReader.url) && (httpReader.useRangeHeader || httpReader.forceRangeRequests)) {\n\t\tconst response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader));\n\t\tif (!httpReader.forceRangeRequests && response.headers.get(HTTP_HEADER_ACCEPT_RANGES) != HTTP_RANGE_UNIT) {\n\t\t\tthrow new Error(ERR_HTTP_RANGE);\n\t\t} else {\n\t\t\tlet contentSize;\n\t\t\tconst contentRangeHeader = response.headers.get(HTTP_HEADER_CONTENT_RANGE);\n\t\t\tif (contentRangeHeader) {\n\t\t\t\tconst splitHeader = contentRangeHeader.trim().split(/\\s*\\/\\s*/);\n\t\t\t\tif (splitHeader.length) {\n\t\t\t\t\tconst headerValue = splitHeader[1];\n\t\t\t\t\tif (headerValue && headerValue != \"*\") {\n\t\t\t\t\t\tcontentSize = Number(headerValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (contentSize === undefined) {\n\t\t\t\tawait getContentLength(httpReader, sendRequest, getRequestData);\n\t\t\t} else {\n\t\t\t\thttpReader.size = contentSize;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tawait getContentLength(httpReader, sendRequest, getRequestData);\n\t}\n}\n\nasync function readUint8ArrayHttpReader(httpReader, index, length, sendRequest, getRequestData) {\n\tif (httpReader.useRangeHeader || httpReader.forceRangeRequests) {\n\t\tconst response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));\n\t\tif (response.status != 206) {\n\t\t\tthrow new Error(ERR_HTTP_RANGE);\n\t\t}\n\t\treturn new Uint8Array(await response.arrayBuffer());\n\t} else {\n\t\tif (!httpReader.data) {\n\t\t\tawait getRequestData(httpReader, httpReader.options);\n\t\t}\n\t\treturn new Uint8Array(httpReader.data.subarray(index, index + length));\n\t}\n}\n\nfunction getRangeHeaders(httpReader, index = 0, length = 1) {\n\treturn Object.assign({}, getHeaders(httpReader), { [HTTP_HEADER_RANGE]: HTTP_RANGE_UNIT + \"=\" + index + \"-\" + (index + length - 1) });\n}\n\nfunction getHeaders(httpReader) {\n\tlet headers = httpReader.options.headers;\n\tif (headers) {\n\t\tif (Symbol.iterator in headers) {\n\t\t\treturn Object.fromEntries(headers);\n\t\t} else {\n\t\t\treturn headers;\n\t\t}\n\t}\n}\n\nasync function getFetchRequestData(httpReader) {\n\tawait getRequestData(httpReader, sendFetchRequest);\n}\n\nasync function getXMLHttpRequestData(httpReader) {\n\tawait getRequestData(httpReader, sendXMLHttpRequest);\n}\n\nasync function getRequestData(httpReader, sendRequest) {\n\tconst response = await sendRequest(HTTP_METHOD_GET, httpReader, getHeaders(httpReader));\n\thttpReader.data = new Uint8Array(await response.arrayBuffer());\n\tif (!httpReader.size) {\n\t\thttpReader.size = httpReader.data.length;\n\t}\n}\n\nasync function getContentLength(httpReader, sendRequest, getRequestData) {\n\tif (httpReader.preventHeadRequest) {\n\t\tawait getRequestData(httpReader, httpReader.options);\n\t} else {\n\t\tconst response = await sendRequest(HTTP_METHOD_HEAD, httpReader, getHeaders(httpReader));\n\t\tconst contentLength = response.headers.get(HTTP_HEADER_CONTENT_LENGTH);\n\t\tif (contentLength) {\n\t\t\thttpReader.size = Number(contentLength);\n\t\t} else {\n\t\t\tawait getRequestData(httpReader, httpReader.options);\n\t\t}\n\t}\n}\n\nasync function sendFetchRequest(method, { options, url }, headers) {\n\tconst response = await fetch(url, Object.assign({}, options, { method, headers }));\n\tif (response.status < 400) {\n\t\treturn response;\n\t} else {\n\t\tthrow new Error(ERR_HTTP_STATUS + (response.statusText || response.status));\n\t}\n}\n\nfunction sendXMLHttpRequest(method, { url }, headers) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst request = new XMLHttpRequest();\n\t\trequest.addEventListener(\"load\", () => {\n\t\t\tif (request.status < 400) {\n\t\t\t\tconst headers = [];\n\t\t\t\trequest.getAllResponseHeaders().trim().split(/[\\r\\n]+/).forEach(header => {\n\t\t\t\t\tconst splitHeader = header.trim().split(/\\s*:\\s*/);\n\t\t\t\t\tsplitHeader[0] = splitHeader[0].trim().replace(/^[a-z]|-[a-z]/g, value => value.toUpperCase());\n\t\t\t\t\theaders.push(splitHeader);\n\t\t\t\t});\n\t\t\t\tresolve({\n\t\t\t\t\tstatus: request.status,\n\t\t\t\t\tarrayBuffer: () => request.response,\n\t\t\t\t\theaders: new Map(headers)\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treject(new Error(ERR_HTTP_STATUS + (request.statusText || request.status)));\n\t\t\t}\n\t\t}, false);\n\t\trequest.addEventListener(\"error\", event => reject(event.detail.error), false);\n\t\trequest.open(method, url);\n\t\tif (headers) {\n\t\t\tfor (const entry of Object.entries(headers)) {\n\t\t\t\trequest.setRequestHeader(entry[0], entry[1]);\n\t\t\t}\n\t\t}\n\t\trequest.responseType = \"arraybuffer\";\n\t\trequest.send();\n\t});\n}\n\nclass HttpReader extends Reader {\n\n\tconstructor(url, options = {}) {\n\t\tsuper();\n\t\tthis.url = url;\n\t\tif (options.useXHR) {\n\t\t\tthis.reader = new XHRReader(url, options);\n\t\t} else {\n\t\t\tthis.reader = new FetchReader(url, options);\n\t\t}\n\t}\n\n\tset size(value) {\n\t\t// ignored\n\t}\n\n\tget size() {\n\t\treturn this.reader.size;\n\t}\n\n\tasync init() {\n\t\tsuper.init();\n\t\tawait this.reader.init();\n\t}\n\n\tasync readUint8Array(index, length) {\n\t\treturn this.reader.readUint8Array(index, length);\n\t}\n}\n\nclass HttpRangeReader extends HttpReader {\n\n\tconstructor(url, options = {}) {\n\t\toptions.useRangeHeader = true;\n\t\tsuper(url, options);\n\t}\n}\n\n\nclass Uint8ArrayReader extends Reader {\n\n\tconstructor(array) {\n\t\tsuper();\n\t\tthis.array = array;\n\t\tthis.size = array.length;\n\t}\n\n\tasync readUint8Array(index, length) {\n\t\treturn this.array.slice(index, index + length);\n\t}\n}\n\nclass Uint8ArrayWriter extends Writer {\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.array = new Uint8Array(0);\n\t}\n\n\tasync writeUint8Array(array) {\n\t\tsuper.writeUint8Array(array);\n\t\tconst previousArray = this.array;\n\t\tthis.array = new Uint8Array(previousArray.length + array.length);\n\t\tthis.array.set(previousArray);\n\t\tthis.array.set(array, previousArray.length);\n\t}\n\n\tgetData() {\n\t\treturn this.array;\n\t}\n}\n\nfunction isHttpFamily(url) {\n\tif (typeof document != \"undefined\") {\n\t\tconst anchor = document.createElement(\"a\");\n\t\tanchor.href = url;\n\t\treturn anchor.protocol == \"http:\" || anchor.protocol == \"https:\";\n\t} else {\n\t\treturn /^https?:\\/\\//i.test(url);\n\t}\n}\n\nexport {\n\tReader,\n\tWriter,\n\tTextReader,\n\tTextWriter,\n\tData64URIReader,\n\tData64URIWriter,\n\tBlobReader,\n\tBlobWriter,\n\tUint8ArrayReader,\n\tUint8ArrayWriter,\n\tHttpReader,\n\tHttpRangeReader,\n\tERR_HTTP_RANGE\n};\n","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nconst MAX_32_BITS = 0xffffffff;\nconst MAX_16_BITS = 0xffff;\nconst COMPRESSION_METHOD_DEFLATE = 0x08;\nconst COMPRESSION_METHOD_STORE = 0x00;\nconst COMPRESSION_METHOD_AES = 0x63;\n\nconst LOCAL_FILE_HEADER_SIGNATURE = 0x04034b50;\nconst DATA_DESCRIPTOR_RECORD_SIGNATURE = 0x08074b50;\nconst CENTRAL_FILE_HEADER_SIGNATURE = 0x02014b50;\nconst END_OF_CENTRAL_DIR_SIGNATURE = 0x06054b50;\nconst ZIP64_END_OF_CENTRAL_DIR_SIGNATURE = 0x06064b50;\nconst ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE = 0x07064b50;\nconst END_OF_CENTRAL_DIR_LENGTH = 22;\nconst ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH = 20;\nconst ZIP64_END_OF_CENTRAL_DIR_LENGTH = 56;\nconst ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH = END_OF_CENTRAL_DIR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LENGTH;\n\nconst ZIP64_TOTAL_NUMBER_OF_DISKS = 1;\n\nconst EXTRAFIELD_TYPE_ZIP64 = 0x0001;\nconst EXTRAFIELD_TYPE_AES = 0x9901;\nconst EXTRAFIELD_TYPE_NTFS = 0x000a;\nconst EXTRAFIELD_TYPE_NTFS_TAG1 = 0x0001;\nconst EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP = 0x5455;\nconst EXTRAFIELD_TYPE_UNICODE_PATH = 0x7075;\nconst EXTRAFIELD_TYPE_UNICODE_COMMENT = 0x6375;\n\nconst BITFLAG_ENCRYPTED = 0x01;\nconst BITFLAG_LEVEL = 0x06;\nconst BITFLAG_DATA_DESCRIPTOR = 0x0008;\nconst BITFLAG_LANG_ENCODING_FLAG = 0x0800;\nconst FILE_ATTR_MSDOS_DIR_MASK = 0x10;\n\nconst VERSION_DEFLATE = 0x14;\nconst VERSION_ZIP64 = 0x2D;\nconst VERSION_AES = 0x33;\n\nconst DIRECTORY_SIGNATURE = \"/\";\n\nconst MAX_DATE = new Date(2107, 11, 31);\nconst MIN_DATE = new Date(1980, 0, 1);\n\nexport {\n\tMAX_32_BITS,\n\tMAX_16_BITS,\n\tCOMPRESSION_METHOD_DEFLATE,\n\tCOMPRESSION_METHOD_STORE,\n\tCOMPRESSION_METHOD_AES,\n\tLOCAL_FILE_HEADER_SIGNATURE,\n\tDATA_DESCRIPTOR_RECORD_SIGNATURE,\n\tCENTRAL_FILE_HEADER_SIGNATURE,\n\tEND_OF_CENTRAL_DIR_SIGNATURE,\n\tZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE,\n\tZIP64_END_OF_CENTRAL_DIR_SIGNATURE,\n\tEXTRAFIELD_TYPE_ZIP64,\n\tEXTRAFIELD_TYPE_AES,\n\tEXTRAFIELD_TYPE_NTFS,\n\tEXTRAFIELD_TYPE_NTFS_TAG1,\n\tEXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,\n\tEXTRAFIELD_TYPE_UNICODE_PATH,\n\tEXTRAFIELD_TYPE_UNICODE_COMMENT,\n\tEND_OF_CENTRAL_DIR_LENGTH,\n\tZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH,\n\tZIP64_END_OF_CENTRAL_DIR_LENGTH,\n\tZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH,\n\tZIP64_TOTAL_NUMBER_OF_DISKS,\n\tBITFLAG_ENCRYPTED,\n\tBITFLAG_LEVEL,\n\tBITFLAG_DATA_DESCRIPTOR,\n\tBITFLAG_LANG_ENCODING_FLAG,\n\tFILE_ATTR_MSDOS_DIR_MASK,\n\tVERSION_DEFLATE,\n\tVERSION_ZIP64,\n\tVERSION_AES,\n\tDIRECTORY_SIGNATURE,\n\tMIN_DATE,\n\tMAX_DATE\n};","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nconst CP437 = \"\\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \".split(\"\");\n\nexport default stringValue => {\n\tlet result = \"\";\n\tfor (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {\n\t\tresult += CP437[stringValue[indexCharacter]];\n\t}\n\treturn result;\n};","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global TextDecoder, FileReader, Blob */\n\nimport decodeCP437 from \"./cp437-decode.js\";\n\nexport default decodeText;\n\nasync function decodeText(value, encoding) {\n\tif (encoding && encoding.trim().toLowerCase() == \"cp437\") {\n\t\treturn decodeCP437(value);\n\t} else if (typeof TextDecoder == \"undefined\") {\n\t\tconst fileReader = new FileReader();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tfileReader.onload = event => resolve(event.target.result);\n\t\t\tfileReader.onerror = () => reject(fileReader.error);\n\t\t\tfileReader.readAsText(new Blob([value]));\n\t\t});\n\t} else {\n\t\treturn new TextDecoder(encoding).decode(value);\n\t}\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nconst MINIMUM_CHUNK_SIZE = 64;\nconst ERR_ABORT = \"Abort error\";\n\nexport {\n\tERR_ABORT,\n\tprocessData\n};\n\nasync function processData(codec, reader, writer, offset, inputLength, config, options) {\n\tconst chunkSize = Math.max(config.chunkSize, MINIMUM_CHUNK_SIZE);\n\treturn processChunk();\n\n\tasync function processChunk(chunkOffset = 0, outputLength = 0) {\n\t\tconst signal = options.signal;\n\t\tif (chunkOffset < inputLength) {\n\t\t\ttestAborted(signal, codec);\n\t\t\tconst inputData = await reader.readUint8Array(chunkOffset + offset, Math.min(chunkSize, inputLength - chunkOffset));\n\t\t\tconst chunkLength = inputData.length;\n\t\t\ttestAborted(signal, codec);\n\t\t\tconst data = await codec.append(inputData);\n\t\t\ttestAborted(signal, codec);\n\t\t\toutputLength += await writeData(writer, data);\n\t\t\tif (options.onprogress) {\n\t\t\t\ttry {\n\t\t\t\t\toptions.onprogress(chunkOffset + chunkLength, inputLength);\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// ignored\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn processChunk(chunkOffset + chunkSize, outputLength);\n\t\t} else {\n\t\t\tconst result = await codec.flush();\n\t\t\toutputLength += await writeData(writer, result.data);\n\t\t\treturn { signature: result.signature, length: outputLength };\n\t\t}\n\t}\n}\n\nfunction testAborted(signal, codec) {\n\tif (signal && signal.aborted) {\n\t\tcodec.flush();\n\t\tthrow new Error(ERR_ABORT);\n\t}\n}\n\nasync function writeData(writer, data) {\n\tif (data.length) {\n\t\tawait writer.writeUint8Array(data);\n\t}\n\treturn data.length;\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nconst PROPERTY_NAMES = [\n\t\"filename\", \"rawFilename\", \"directory\", \"encrypted\", \"compressedSize\", \"uncompressedSize\",\n\t\"lastModDate\", \"rawLastModDate\", \"comment\", \"rawComment\", \"signature\", \"extraField\",\n\t\"rawExtraField\", \"bitFlag\", \"extraFieldZip64\", \"extraFieldUnicodePath\", \"extraFieldUnicodeComment\",\n\t\"extraFieldAES\", \"filenameUTF8\", \"commentUTF8\", \"offset\", \"zip64\", \"compressionMethod\",\n\t\"extraFieldNTFS\", \"lastAccessDate\", \"creationDate\", \"extraFieldExtendedTimestamp\",\n\t\"version\", \"versionMadeBy\", \"msDosCompatible\", \"internalFileAttribute\", \"externalFileAttribute\"];\n\nexport default class Entry {\n\n\tconstructor(data) {\n\t\tPROPERTY_NAMES.forEach(name => this[name] = data[name]);\n\t}\n\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global BigInt */\n\n\"use strict\";\n\nimport {\n\tMAX_32_BITS,\n\tMAX_16_BITS,\n\tCOMPRESSION_METHOD_DEFLATE,\n\tCOMPRESSION_METHOD_STORE,\n\tCOMPRESSION_METHOD_AES,\n\tLOCAL_FILE_HEADER_SIGNATURE,\n\tCENTRAL_FILE_HEADER_SIGNATURE,\n\tEND_OF_CENTRAL_DIR_SIGNATURE,\n\tZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE,\n\tZIP64_END_OF_CENTRAL_DIR_SIGNATURE,\n\tEXTRAFIELD_TYPE_ZIP64,\n\tEXTRAFIELD_TYPE_UNICODE_PATH,\n\tEXTRAFIELD_TYPE_UNICODE_COMMENT,\n\tEXTRAFIELD_TYPE_AES,\n\tEXTRAFIELD_TYPE_NTFS,\n\tEXTRAFIELD_TYPE_NTFS_TAG1,\n\tEXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,\n\tEND_OF_CENTRAL_DIR_LENGTH,\n\tZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH,\n\tZIP64_END_OF_CENTRAL_DIR_LENGTH,\n\tBITFLAG_ENCRYPTED,\n\tBITFLAG_LEVEL,\n\tBITFLAG_DATA_DESCRIPTOR,\n\tBITFLAG_LANG_ENCODING_FLAG,\n\tFILE_ATTR_MSDOS_DIR_MASK,\n\tDIRECTORY_SIGNATURE\n} from \"./constants.js\";\nimport { getConfiguration } from \"./configuration.js\";\nimport { createCodec, CODEC_INFLATE, ERR_INVALID_SIGNATURE, ERR_INVALID_PASSWORD } from \"./codecs/codec-pool.js\";\nimport decodeText from \"./util/decode-text.js\";\nimport Crc32 from \"./codecs/crc32.js\";\nimport { processData } from \"./engine.js\";\nimport Entry from \"./zip-entry.js\";\n\nconst ERR_BAD_FORMAT = \"File format is not recognized\";\nconst ERR_EOCDR_NOT_FOUND = \"End of central directory not found\";\nconst ERR_EOCDR_ZIP64_NOT_FOUND = \"End of Zip64 central directory not found\";\nconst ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = \"End of Zip64 central directory locator not found\";\nconst ERR_CENTRAL_DIRECTORY_NOT_FOUND = \"Central directory header not found\";\nconst ERR_LOCAL_FILE_HEADER_NOT_FOUND = \"Local file header not found\";\nconst ERR_EXTRAFIELD_ZIP64_NOT_FOUND = \"Zip64 extra field not found\";\nconst ERR_ENCRYPTED = \"File contains encrypted entry\";\nconst ERR_UNSUPPORTED_ENCRYPTION = \"Encryption method not supported\";\nconst ERR_UNSUPPORTED_COMPRESSION = \"Compression method not supported\";\nconst CHARSET_UTF8 = \"utf-8\";\nconst CHARSET_CP437 = \"cp437\";\nconst ZIP64_PROPERTIES = [\"uncompressedSize\", \"compressedSize\", \"offset\"];\n\nclass ZipReader {\n\n\tconstructor(reader, options = {}) {\n\t\tObject.assign(this, {\n\t\t\treader,\n\t\t\toptions,\n\t\t\tconfig: getConfiguration()\n\t\t});\n\t}\n\n\tasync getEntries(options = {}) {\n\t\tconst zipReader = this;\n\t\tconst reader = zipReader.reader;\n\t\tif (!reader.initialized) {\n\t\t\tawait reader.init();\n\t\t}\n\t\tif (reader.size < END_OF_CENTRAL_DIR_LENGTH) {\n\t\t\tthrow new Error(ERR_BAD_FORMAT);\n\t\t}\n\t\tconst endOfDirectoryInfo = await seekSignature(reader, END_OF_CENTRAL_DIR_SIGNATURE, reader.size, END_OF_CENTRAL_DIR_LENGTH, MAX_16_BITS * 16);\n\t\tif (!endOfDirectoryInfo) {\n\t\t\tthrow new Error(ERR_EOCDR_NOT_FOUND);\n\t\t}\n\t\tconst endOfDirectoryView = getDataView(endOfDirectoryInfo);\n\t\tlet directoryDataLength = getUint32(endOfDirectoryView, 12);\n\t\tlet directoryDataOffset = getUint32(endOfDirectoryView, 16);\n\t\tlet filesLength = getUint16(endOfDirectoryView, 8);\n\t\tlet prependedDataLength = 0;\n\t\tif (directoryDataOffset == MAX_32_BITS || directoryDataLength == MAX_32_BITS || filesLength == MAX_16_BITS) {\n\t\t\tconst endOfDirectoryLocatorArray = await readUint8Array(reader, endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH);\n\t\t\tconst endOfDirectoryLocatorView = getDataView(endOfDirectoryLocatorArray);\n\t\t\tif (getUint32(endOfDirectoryLocatorView, 0) != ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) {\n\t\t\t\tthrow new Error(ERR_EOCDR_ZIP64_NOT_FOUND);\n\t\t\t}\n\t\t\tdirectoryDataOffset = getBigUint64(endOfDirectoryLocatorView, 8);\n\t\t\tlet endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH);\n\t\t\tlet endOfDirectoryView = getDataView(endOfDirectoryArray);\n\t\t\tconst expectedDirectoryDataOffset = endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH - ZIP64_END_OF_CENTRAL_DIR_LENGTH;\n\t\t\tif (getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {\n\t\t\t\tconst originalDirectoryDataOffset = directoryDataOffset;\n\t\t\t\tdirectoryDataOffset = expectedDirectoryDataOffset;\n\t\t\t\tprependedDataLength = directoryDataOffset - originalDirectoryDataOffset;\n\t\t\t\tendOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH);\n\t\t\t\tendOfDirectoryView = getDataView(endOfDirectoryArray);\n\t\t\t}\n\t\t\tif (getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) {\n\t\t\t\tthrow new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);\n\t\t\t}\n\t\t\tfilesLength = getBigUint64(endOfDirectoryView, 32);\n\t\t\tdirectoryDataLength = getBigUint64(endOfDirectoryView, 40);\n\t\t\tdirectoryDataOffset -= directoryDataLength;\n\t\t}\n\t\tif (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {\n\t\t\tthrow new Error(ERR_BAD_FORMAT);\n\t\t}\n\t\tlet offset = 0;\n\t\tlet directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength);\n\t\tlet directoryView = getDataView(directoryArray);\n\t\tconst expectedDirectoryDataOffset = endOfDirectoryInfo.offset - directoryDataLength;\n\t\tif (getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {\n\t\t\tconst originalDirectoryDataOffset = directoryDataOffset;\n\t\t\tdirectoryDataOffset = expectedDirectoryDataOffset;\n\t\t\tprependedDataLength = directoryDataOffset - originalDirectoryDataOffset;\n\t\t\tdirectoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength);\n\t\t\tdirectoryView = getDataView(directoryArray);\n\t\t}\n\t\tif (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {\n\t\t\tthrow new Error(ERR_BAD_FORMAT);\n\t\t}\n\t\tconst entries = [];\n\t\tfor (let indexFile = 0; indexFile < filesLength; indexFile++) {\n\t\t\tconst fileEntry = new ZipEntry(reader, zipReader.config, zipReader.options);\n\t\t\tif (getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE) {\n\t\t\t\tthrow new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);\n\t\t\t}\n\t\t\treadCommonHeader(fileEntry, directoryView, offset + 6);\n\t\t\tconst languageEncodingFlag = Boolean(fileEntry.bitFlag.languageEncodingFlag);\n\t\t\tconst filenameOffset = offset + 46;\n\t\t\tconst extraFieldOffset = filenameOffset + fileEntry.filenameLength;\n\t\t\tconst commentOffset = extraFieldOffset + fileEntry.extraFieldLength;\n\t\t\tconst versionMadeBy = getUint16(directoryView, offset + 4);\n\t\t\tconst msDosCompatible = (versionMadeBy & 0) == 0;\n\t\t\tObject.assign(fileEntry, {\n\t\t\t\tversionMadeBy,\n\t\t\t\tmsDosCompatible,\n\t\t\t\tcompressedSize: 0,\n\t\t\t\tuncompressedSize: 0,\n\t\t\t\tcommentLength: getUint16(directoryView, offset + 32),\n\t\t\t\tdirectory: msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK),\n\t\t\t\toffset: getUint32(directoryView, offset + 42) + prependedDataLength,\n\t\t\t\tinternalFileAttribute: getUint32(directoryView, offset + 34),\n\t\t\t\texternalFileAttribute: getUint32(directoryView, offset + 38),\n\t\t\t\trawFilename: directoryArray.subarray(filenameOffset, extraFieldOffset),\n\t\t\t\tfilenameUTF8: languageEncodingFlag,\n\t\t\t\tcommentUTF8: languageEncodingFlag,\n\t\t\t\trawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)\n\t\t\t});\n\t\t\tconst endOffset = commentOffset + fileEntry.commentLength;\n\t\t\tfileEntry.rawComment = directoryArray.subarray(commentOffset, endOffset);\n\t\t\tconst filenameEncoding = getOptionValue(zipReader, options, \"filenameEncoding\");\n\t\t\tconst commentEncoding = getOptionValue(zipReader, options, \"commentEncoding\");\n\t\t\tconst [filename, comment] = await Promise.all([\n\t\t\t\tdecodeText(fileEntry.rawFilename, fileEntry.filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),\n\t\t\t\tdecodeText(fileEntry.rawComment, fileEntry.commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)\n\t\t\t]);\n\t\t\tfileEntry.filename = filename;\n\t\t\tfileEntry.comment = comment;\n\t\t\tif (!fileEntry.directory && fileEntry.filename.endsWith(DIRECTORY_SIGNATURE)) {\n\t\t\t\tfileEntry.directory = true;\n\t\t\t}\n\t\t\tawait readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);\n\t\t\tconst entry = new Entry(fileEntry);\n\t\t\tentry.getData = (writer, options) => fileEntry.getData(writer, entry, options);\n\t\t\tentries.push(entry);\n\t\t\toffset = endOffset;\n\t\t\tif (options.onprogress) {\n\t\t\t\ttry {\n\t\t\t\t\toptions.onprogress(indexFile + 1, filesLength, new Entry(fileEntry));\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// ignored\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn entries;\n\t}\n\n\tasync close() {\n\t}\n}\n\nexport {\n\tZipReader,\n\tERR_BAD_FORMAT,\n\tERR_EOCDR_NOT_FOUND,\n\tERR_EOCDR_ZIP64_NOT_FOUND,\n\tERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,\n\tERR_CENTRAL_DIRECTORY_NOT_FOUND,\n\tERR_LOCAL_FILE_HEADER_NOT_FOUND,\n\tERR_EXTRAFIELD_ZIP64_NOT_FOUND,\n\tERR_ENCRYPTED,\n\tERR_UNSUPPORTED_ENCRYPTION,\n\tERR_UNSUPPORTED_COMPRESSION,\n\tERR_INVALID_SIGNATURE,\n\tERR_INVALID_PASSWORD\n};\n\nclass ZipEntry {\n\n\tconstructor(reader, config, options) {\n\t\tObject.assign(this, {\n\t\t\treader,\n\t\t\tconfig,\n\t\t\toptions\n\t\t});\n\t}\n\n\tasync getData(writer, fileEntry, options = {}) {\n\t\tconst zipEntry = this;\n\t\tconst {\n\t\t\treader,\n\t\t\toffset,\n\t\t\textraFieldAES,\n\t\t\tcompressionMethod,\n\t\t\tconfig,\n\t\t\tbitFlag,\n\t\t\tsignature,\n\t\t\trawLastModDate,\n\t\t\tcompressedSize\n\t\t} = zipEntry;\n\t\tconst localDirectory = zipEntry.localDirectory = {};\n\t\tif (!reader.initialized) {\n\t\t\tawait reader.init();\n\t\t}\n\t\tlet dataArray = await readUint8Array(reader, offset, 30);\n\t\tconst dataView = getDataView(dataArray);\n\t\tlet password = getOptionValue(zipEntry, options, \"password\");\n\t\tpassword = password && password.length && password;\n\t\tif (extraFieldAES) {\n\t\t\tif (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {\n\t\t\t\tthrow new Error(ERR_UNSUPPORTED_COMPRESSION);\n\t\t\t}\n\t\t}\n\t\tif (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) {\n\t\t\tthrow new Error(ERR_UNSUPPORTED_COMPRESSION);\n\t\t}\n\t\tif (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {\n\t\t\tthrow new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);\n\t\t}\n\t\treadCommonHeader(localDirectory, dataView, 4);\n\t\tdataArray = await readUint8Array(reader, offset, 30 + localDirectory.filenameLength + localDirectory.extraFieldLength);\n\t\tlocalDirectory.rawExtraField = dataArray.subarray(30 + localDirectory.filenameLength);\n\t\tawait readCommonFooter(zipEntry, localDirectory, dataView, 4);\n\t\tfileEntry.lastAccessDate = localDirectory.lastAccessDate;\n\t\tfileEntry.creationDate = localDirectory.creationDate;\n\t\tconst encrypted = zipEntry.encrypted && localDirectory.encrypted;\n\t\tconst zipCrypto = encrypted && !extraFieldAES;\n\t\tif (encrypted) {\n\t\t\tif (!zipCrypto && extraFieldAES.strength === undefined) {\n\t\t\t\tthrow new Error(ERR_UNSUPPORTED_ENCRYPTION);\n\t\t\t} else if (!password) {\n\t\t\t\tthrow new Error(ERR_ENCRYPTED);\n\t\t\t}\n\t\t}\n\t\tconst codec = await createCodec(config.Inflate, {\n\t\t\tcodecType: CODEC_INFLATE,\n\t\t\tpassword,\n\t\t\tzipCrypto,\n\t\t\tencryptionStrength: extraFieldAES && extraFieldAES.strength,\n\t\t\tsigned: getOptionValue(zipEntry, options, \"checkSignature\"),\n\t\t\tpasswordVerification: zipCrypto && (bitFlag.dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),\n\t\t\tsignature,\n\t\t\tcompressed: compressionMethod != 0,\n\t\t\tencrypted,\n\t\t\tuseWebWorkers: getOptionValue(zipEntry, options, \"useWebWorkers\")\n\t\t}, config);\n\t\tif (!writer.initialized) {\n\t\t\tawait writer.init();\n\t\t}\n\t\tconst signal = getOptionValue(zipEntry, options, \"signal\");\n\t\tconst dataOffset = offset + 30 + localDirectory.filenameLength + localDirectory.extraFieldLength;\n\t\tawait processData(codec, reader, writer, dataOffset, compressedSize, config, { onprogress: options.onprogress, signal });\n\t\treturn writer.getData();\n\t}\n}\n\nfunction readCommonHeader(directory, dataView, offset) {\n\tconst rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2);\n\tconst encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;\n\tconst rawLastModDate = getUint32(dataView, offset + 6);\n\tObject.assign(directory, {\n\t\tencrypted,\n\t\tversion: getUint16(dataView, offset),\n\t\tbitFlag: {\n\t\t\tlevel: (rawBitFlag & BITFLAG_LEVEL) >> 1,\n\t\t\tdataDescriptor: (rawBitFlag & BITFLAG_DATA_DESCRIPTOR) == BITFLAG_DATA_DESCRIPTOR,\n\t\t\tlanguageEncodingFlag: (rawBitFlag & BITFLAG_LANG_ENCODING_FLAG) == BITFLAG_LANG_ENCODING_FLAG\n\t\t},\n\t\trawLastModDate,\n\t\tlastModDate: getDate(rawLastModDate),\n\t\tfilenameLength: getUint16(dataView, offset + 22),\n\t\textraFieldLength: getUint16(dataView, offset + 24)\n\t});\n}\n\nasync function readCommonFooter(fileEntry, directory, dataView, offset) {\n\tconst rawExtraField = directory.rawExtraField;\n\tconst extraField = directory.extraField = new Map();\n\tconst rawExtraFieldView = getDataView(new Uint8Array(rawExtraField));\n\tlet offsetExtraField = 0;\n\ttry {\n\t\twhile (offsetExtraField < rawExtraField.length) {\n\t\t\tconst type = getUint16(rawExtraFieldView, offsetExtraField);\n\t\t\tconst size = getUint16(rawExtraFieldView, offsetExtraField + 2);\n\t\t\textraField.set(type, {\n\t\t\t\ttype,\n\t\t\t\tdata: rawExtraField.slice(offsetExtraField + 4, offsetExtraField + 4 + size)\n\t\t\t});\n\t\t\toffsetExtraField += 4 + size;\n\t\t}\n\t} catch (error) {\n\t\t// ignored\n\t}\n\tconst compressionMethod = getUint16(dataView, offset + 4);\n\tdirectory.signature = getUint32(dataView, offset + 10);\n\tdirectory.uncompressedSize = getUint32(dataView, offset + 18);\n\tdirectory.compressedSize = getUint32(dataView, offset + 14);\n\tconst extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);\n\tif (extraFieldZip64) {\n\t\treadExtraFieldZip64(extraFieldZip64, directory);\n\t\tdirectory.extraFieldZip64 = extraFieldZip64;\n\t}\n\tconst extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);\n\tif (extraFieldUnicodePath) {\n\t\tawait readExtraFieldUnicode(extraFieldUnicodePath, \"filename\", \"rawFilename\", directory, fileEntry);\n\t\tdirectory.extraFieldUnicodePath = extraFieldUnicodePath;\n\t}\n\tconst extraFieldUnicodeComment = extraField.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);\n\tif (extraFieldUnicodeComment) {\n\t\tawait readExtraFieldUnicode(extraFieldUnicodeComment, \"comment\", \"rawComment\", directory, fileEntry);\n\t\tdirectory.extraFieldUnicodeComment = extraFieldUnicodeComment;\n\t}\n\tconst extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);\n\tif (extraFieldAES) {\n\t\treadExtraFieldAES(extraFieldAES, directory, compressionMethod);\n\t\tdirectory.extraFieldAES = extraFieldAES;\n\t} else {\n\t\tdirectory.compressionMethod = compressionMethod;\n\t}\n\tconst extraFieldNTFS = extraField.get(EXTRAFIELD_TYPE_NTFS);\n\tif (extraFieldNTFS) {\n\t\treadExtraFieldNTFS(extraFieldNTFS, directory);\n\t\tdirectory.extraFieldNTFS = extraFieldNTFS;\n\t}\n\tconst extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);\n\tif (extraFieldExtendedTimestamp) {\n\t\treadExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory);\n\t\tdirectory.extraFieldExtendedTimestamp = extraFieldExtendedTimestamp;\n\t}\n}\n\nfunction readExtraFieldZip64(extraFieldZip64, directory) {\n\tdirectory.zip64 = true;\n\tconst extraFieldView = getDataView(extraFieldZip64.data);\n\textraFieldZip64.values = [];\n\tfor (let indexValue = 0; indexValue < Math.floor(extraFieldZip64.data.length / 8); indexValue++) {\n\t\textraFieldZip64.values.push(getBigUint64(extraFieldView, 0 + indexValue * 8));\n\t}\n\tconst missingProperties = ZIP64_PROPERTIES.filter(propertyName => directory[propertyName] == MAX_32_BITS);\n\tfor (let indexMissingProperty = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) {\n\t\textraFieldZip64[missingProperties[indexMissingProperty]] = extraFieldZip64.values[indexMissingProperty];\n\t}\n\tZIP64_PROPERTIES.forEach(propertyName => {\n\t\tif (directory[propertyName] == MAX_32_BITS) {\n\t\t\tif (extraFieldZip64[propertyName] !== undefined) {\n\t\t\t\tdirectory[propertyName] = extraFieldZip64[propertyName];\n\t\t\t} else {\n\t\t\t\tthrow new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);\n\t\t\t}\n\t\t}\n\t});\n}\n\nasync function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {\n\tconst extraFieldView = getDataView(extraFieldUnicode.data);\n\textraFieldUnicode.version = getUint8(extraFieldView, 0);\n\textraFieldUnicode.signature = getUint32(extraFieldView, 1);\n\tconst crc32 = new Crc32();\n\tcrc32.append(fileEntry[rawPropertyName]);\n\tconst dataViewSignature = getDataView(new Uint8Array(4));\n\tdataViewSignature.setUint32(0, crc32.get(), true);\n\textraFieldUnicode[propertyName] = await decodeText(extraFieldUnicode.data.subarray(5));\n\textraFieldUnicode.valid = !fileEntry.bitFlag.languageEncodingFlag && extraFieldUnicode.signature == getUint32(dataViewSignature, 0);\n\tif (extraFieldUnicode.valid) {\n\t\tdirectory[propertyName] = extraFieldUnicode[propertyName];\n\t\tdirectory[propertyName + \"UTF8\"] = true;\n\t}\n}\n\nfunction readExtraFieldAES(extraFieldAES, directory, compressionMethod) {\n\tconst extraFieldView = getDataView(extraFieldAES.data);\n\textraFieldAES.vendorVersion = getUint8(extraFieldView, 0);\n\textraFieldAES.vendorId = getUint8(extraFieldView, 2);\n\tconst strength = getUint8(extraFieldView, 4);\n\textraFieldAES.strength = strength;\n\textraFieldAES.originalCompressionMethod = compressionMethod;\n\tdirectory.compressionMethod = extraFieldAES.compressionMethod = getUint16(extraFieldView, 5);\n}\n\nfunction readExtraFieldNTFS(extraFieldNTFS, directory) {\n\tconst extraFieldView = getDataView(extraFieldNTFS.data);\n\tlet offsetExtraField = 4;\n\tlet tag1Data;\n\ttry {\n\t\twhile (offsetExtraField < extraFieldNTFS.data.length && !tag1Data) {\n\t\t\tconst tagValue = getUint16(extraFieldView, offsetExtraField);\n\t\t\tconst attributeSize = getUint16(extraFieldView, offsetExtraField + 2);\n\t\t\tif (tagValue == EXTRAFIELD_TYPE_NTFS_TAG1) {\n\t\t\t\ttag1Data = extraFieldNTFS.data.slice(offsetExtraField + 4, offsetExtraField + 4 + attributeSize);\n\t\t\t}\n\t\t\toffsetExtraField += 4 + attributeSize;\n\t\t}\n\t} catch (error) {\n\t\t// ignored\n\t}\n\ttry {\n\t\tif (tag1Data && tag1Data.length == 24) {\n\t\t\tconst tag1View = getDataView(tag1Data);\n\t\t\tconst rawLastModDate = tag1View.getBigUint64(0, true);\n\t\t\tconst rawLastAccessDate = tag1View.getBigUint64(8, true);\n\t\t\tconst rawCreationDate = tag1View.getBigUint64(16, true);\n\t\t\tObject.assign(extraFieldNTFS, {\n\t\t\t\trawLastModDate,\n\t\t\t\trawLastAccessDate,\n\t\t\t\trawCreationDate\n\t\t\t});\n\t\t\tconst lastModDate = getDateNTFS(rawLastModDate);\n\t\t\tconst lastAccessDate = getDateNTFS(rawLastAccessDate);\n\t\t\tconst creationDate = getDateNTFS(rawCreationDate);\n\t\t\tconst extraFieldData = { lastModDate, lastAccessDate, creationDate };\n\t\t\tObject.assign(extraFieldNTFS, extraFieldData);\n\t\t\tObject.assign(directory, extraFieldData);\n\t\t}\n\t} catch (error) {\n\t\t// ignored\n\t}\n}\n\nfunction readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory) {\n\tconst extraFieldView = getDataView(extraFieldExtendedTimestamp.data);\n\tconst flags = getUint8(extraFieldView, 0);\n\tconst timeProperties = [];\n\tconst timeRawProperties = [];\n\tif ((flags & 0x1) == 0x1) {\n\t\ttimeProperties.push(\"lastModDate\");\n\t\ttimeRawProperties.push(\"rawLastModDate\");\n\t}\n\tif ((flags & 0x2) == 0x2) {\n\t\ttimeProperties.push(\"lastAccessDate\");\n\t\ttimeRawProperties.push(\"rawLastAccessDate\");\n\t}\n\tif ((flags & 0x4) == 0x4) {\n\t\ttimeProperties.push(\"creationDate\");\n\t\ttimeRawProperties.push(\"rawCreationDate\");\n\t}\n\tlet offset = 1;\n\ttimeProperties.forEach((propertyName, indexProperty) => {\n\t\tif (extraFieldExtendedTimestamp.data.length >= offset + 4) {\n\t\t\tconst time = getUint32(extraFieldView, offset);\n\t\t\tdirectory[propertyName] = extraFieldExtendedTimestamp[propertyName] = new Date(time * 1000);\n\t\t\tconst rawPropertyName = timeRawProperties[indexProperty];\n\t\t\textraFieldExtendedTimestamp[rawPropertyName] = time;\n\t\t}\n\t\toffset += 4;\n\t});\n}\n\nasync function seekSignature(reader, signature, startOffset, minimumBytes, maximumLength) {\n\tconst signatureArray = new Uint8Array(4);\n\tconst signatureView = getDataView(signatureArray);\n\tsetUint32(signatureView, 0, signature);\n\tconst maximumBytes = minimumBytes + maximumLength;\n\treturn (await seek(minimumBytes)) || await seek(Math.min(maximumBytes, startOffset));\n\n\tasync function seek(length) {\n\t\tconst offset = startOffset - length;\n\t\tconst bytes = await readUint8Array(reader, offset, length);\n\t\tfor (let indexByte = bytes.length - minimumBytes; indexByte >= 0; indexByte--) {\n\t\t\tif (bytes[indexByte] == signatureArray[0] && bytes[indexByte + 1] == signatureArray[1] &&\n\t\t\t\tbytes[indexByte + 2] == signatureArray[2] && bytes[indexByte + 3] == signatureArray[3]) {\n\t\t\t\treturn {\n\t\t\t\t\toffset: offset + indexByte,\n\t\t\t\t\tbuffer: bytes.slice(indexByte, indexByte + minimumBytes).buffer\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction getOptionValue(zipReader, options, name) {\n\treturn options[name] === undefined ? zipReader.options[name] : options[name];\n}\n\nfunction getDate(timeRaw) {\n\tconst date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;\n\ttry {\n\t\treturn new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);\n\t} catch (error) {\n\t\t// ignored\n\t}\n}\n\nfunction getDateNTFS(timeRaw) {\n\treturn new Date((Number((timeRaw / BigInt(10000)) - BigInt(11644473600000))));\n}\n\nfunction getUint8(view, offset) {\n\treturn view.getUint8(offset);\n}\n\nfunction getUint16(view, offset) {\n\treturn view.getUint16(offset, true);\n}\n\nfunction getUint32(view, offset) {\n\treturn view.getUint32(offset, true);\n}\n\nfunction getBigUint64(view, offset) {\n\treturn Number(view.getBigUint64(offset, true));\n}\n\nfunction setUint32(view, offset, value) {\n\tview.setUint32(offset, value, true);\n}\n\nfunction getDataView(array) {\n\treturn new DataView(array.buffer);\n}\n\nfunction readUint8Array(reader, offset, size) {\n\treturn reader.readUint8Array(offset, size);\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global BigInt, FileReader */\n\n\"use strict\";\n\nimport {\n\tMAX_32_BITS,\n\tMAX_16_BITS,\n\tCOMPRESSION_METHOD_DEFLATE,\n\tCOMPRESSION_METHOD_STORE,\n\tCOMPRESSION_METHOD_AES,\n\tLOCAL_FILE_HEADER_SIGNATURE,\n\tDATA_DESCRIPTOR_RECORD_SIGNATURE,\n\tCENTRAL_FILE_HEADER_SIGNATURE,\n\tEND_OF_CENTRAL_DIR_SIGNATURE,\n\tZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE,\n\tZIP64_END_OF_CENTRAL_DIR_SIGNATURE,\n\tZIP64_TOTAL_NUMBER_OF_DISKS,\n\tEXTRAFIELD_TYPE_AES,\n\tEXTRAFIELD_TYPE_ZIP64,\n\tEXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,\n\tEXTRAFIELD_TYPE_NTFS,\n\tEXTRAFIELD_TYPE_NTFS_TAG1,\n\tEND_OF_CENTRAL_DIR_LENGTH,\n\tZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH,\n\tBITFLAG_ENCRYPTED,\n\tBITFLAG_DATA_DESCRIPTOR,\n\tBITFLAG_LANG_ENCODING_FLAG,\n\tFILE_ATTR_MSDOS_DIR_MASK,\n\tVERSION_DEFLATE,\n\tVERSION_ZIP64,\n\tVERSION_AES,\n\tDIRECTORY_SIGNATURE,\n\tMIN_DATE,\n\tMAX_DATE\n} from \"./constants.js\";\nimport { getConfiguration } from \"./configuration.js\";\nimport { CODEC_DEFLATE, createCodec } from \"./codecs/codec-pool.js\";\nimport encodeText from \"./util/encode-text.js\";\nimport { BlobWriter } from \"./io.js\";\nimport { processData } from \"./engine.js\";\nimport Entry from \"./zip-entry.js\";\n\nconst ERR_DUPLICATED_NAME = \"File already exists\";\nconst ERR_INVALID_COMMENT = \"Zip file comment exceeds 64KB\";\nconst ERR_INVALID_ENTRY_COMMENT = \"File entry comment exceeds 64KB\";\nconst ERR_INVALID_ENTRY_NAME = \"File entry name exceeds 64KB\";\nconst ERR_INVALID_VERSION = \"Version exceeds 65535\";\nconst ERR_INVALID_ENCRYPTION_STRENGTH = \"The strength must equal 1, 2, or 3\";\nconst ERR_INVALID_EXTRAFIELD_TYPE = \"Extra field type exceeds 65535\";\nconst ERR_INVALID_EXTRAFIELD_DATA = \"Extra field data exceeds 64KB\";\nconst ERR_UNSUPPORTED_FORMAT = \"Zip64 is not supported\";\n\nconst EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);\nconst EXTRAFIELD_LENGTH_ZIP64 = 24;\n\nlet workers = 0;\n\nclass ZipWriter {\n\n\tconstructor(writer, options = {}) {\n\t\tObject.assign(this, {\n\t\t\twriter,\n\t\t\toptions,\n\t\t\tconfig: getConfiguration(),\n\t\t\tfiles: new Map(),\n\t\t\toffset: writer.size,\n\t\t\tpendingCompressedSize: 0,\n\t\t\tpendingEntries: []\n\t\t});\n\t}\n\n\tasync add(name = \"\", reader, options = {}) {\n\t\tconst zipWriter = this;\n\t\tif (workers < zipWriter.config.maxWorkers) {\n\t\t\tworkers++;\n\t\t\ttry {\n\t\t\t\treturn await addFile(zipWriter, name, reader, options);\n\t\t\t} finally {\n\t\t\t\tworkers--;\n\t\t\t\tconst pendingEntry = zipWriter.pendingEntries.shift();\n\t\t\t\tif (pendingEntry) {\n\t\t\t\t\tzipWriter.add(pendingEntry.name, pendingEntry.reader, pendingEntry.options)\n\t\t\t\t\t\t.then(pendingEntry.resolve)\n\t\t\t\t\t\t.catch(pendingEntry.reject);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn new Promise((resolve, reject) => zipWriter.pendingEntries.push({ name, reader, options, resolve, reject }));\n\t\t}\n\t}\n\n\tasync close(comment = new Uint8Array(0), options = {}) {\n\t\tawait closeFile(this, comment, options);\n\t\treturn this.writer.getData();\n\t}\n}\n\nexport {\n\tZipWriter,\n\tERR_DUPLICATED_NAME,\n\tERR_INVALID_COMMENT,\n\tERR_INVALID_ENTRY_NAME,\n\tERR_INVALID_ENTRY_COMMENT,\n\tERR_INVALID_VERSION,\n\tERR_INVALID_EXTRAFIELD_TYPE,\n\tERR_INVALID_EXTRAFIELD_DATA,\n\tERR_INVALID_ENCRYPTION_STRENGTH,\n\tERR_UNSUPPORTED_FORMAT\n};\n\nasync function addFile(zipWriter, name, reader, options) {\n\tname = name.trim();\n\tif (options.directory && (!name.endsWith(DIRECTORY_SIGNATURE))) {\n\t\tname += DIRECTORY_SIGNATURE;\n\t} else {\n\t\toptions.directory = name.endsWith(DIRECTORY_SIGNATURE);\n\t}\n\tif (zipWriter.files.has(name)) {\n\t\tthrow new Error(ERR_DUPLICATED_NAME);\n\t}\n\tconst rawFilename = encodeText(name);\n\tif (rawFilename.length > MAX_16_BITS) {\n\t\tthrow new Error(ERR_INVALID_ENTRY_NAME);\n\t}\n\tconst comment = options.comment || \"\";\n\tconst rawComment = encodeText(comment);\n\tif (rawComment.length > MAX_16_BITS) {\n\t\tthrow new Error(ERR_INVALID_ENTRY_COMMENT);\n\t}\n\tconst version = zipWriter.options.version || options.version || 0;\n\tif (version > MAX_16_BITS) {\n\t\tthrow new Error(ERR_INVALID_VERSION);\n\t}\n\tconst versionMadeBy = zipWriter.options.versionMadeBy || options.versionMadeBy || 20;\n\tif (versionMadeBy > MAX_16_BITS) {\n\t\tthrow new Error(ERR_INVALID_VERSION);\n\t}\n\tconst lastModDate = getOptionValue(zipWriter, options, \"lastModDate\") || new Date();\n\tconst lastAccessDate = getOptionValue(zipWriter, options, \"lastAccessDate\");\n\tconst creationDate = getOptionValue(zipWriter, options, \"creationDate\");\n\tconst password = getOptionValue(zipWriter, options, \"password\");\n\tconst encryptionStrength = getOptionValue(zipWriter, options, \"encryptionStrength\") || 3;\n\tconst zipCrypto = getOptionValue(zipWriter, options, \"zipCrypto\");\n\tif (password !== undefined && encryptionStrength !== undefined && (encryptionStrength < 1 || encryptionStrength > 3)) {\n\t\tthrow new Error(ERR_INVALID_ENCRYPTION_STRENGTH);\n\t}\n\tlet rawExtraField = new Uint8Array(0);\n\tconst extraField = options.extraField;\n\tif (extraField) {\n\t\tlet extraFieldSize = 0;\n\t\tlet offset = 0;\n\t\textraField.forEach(data => extraFieldSize += 4 + data.length);\n\t\trawExtraField = new Uint8Array(extraFieldSize);\n\t\textraField.forEach((data, type) => {\n\t\t\tif (type > MAX_16_BITS) {\n\t\t\t\tthrow new Error(ERR_INVALID_EXTRAFIELD_TYPE);\n\t\t\t}\n\t\t\tif (data.length > MAX_16_BITS) {\n\t\t\t\tthrow new Error(ERR_INVALID_EXTRAFIELD_DATA);\n\t\t\t}\n\t\t\tarraySet(rawExtraField, new Uint16Array([type]), offset);\n\t\t\tarraySet(rawExtraField, new Uint16Array([data.length]), offset + 2);\n\t\t\tarraySet(rawExtraField, data, offset + 4);\n\t\t\toffset += 4 + data.length;\n\t\t});\n\t}\n\tlet extendedTimestamp = getOptionValue(zipWriter, options, \"extendedTimestamp\");\n\tif (extendedTimestamp === undefined) {\n\t\textendedTimestamp = true;\n\t}\n\tlet maximumCompressedSize = 0;\n\tlet keepOrder = getOptionValue(zipWriter, options, \"keepOrder\");\n\tif (keepOrder === undefined) {\n\t\tkeepOrder = true;\n\t}\n\tlet uncompressedSize = 0;\n\tlet msDosCompatible = getOptionValue(zipWriter, options, \"msDosCompatible\");\n\tif (msDosCompatible === undefined) {\n\t\tmsDosCompatible = true;\n\t}\n\tconst internalFileAttribute = getOptionValue(zipWriter, options, \"internalFileAttribute\") || 0;\n\tconst externalFileAttribute = getOptionValue(zipWriter, options, \"externalFileAttribute\") || 0;\n\tif (reader) {\n\t\tif (!reader.initialized) {\n\t\t\tawait reader.init();\n\t\t}\n\t\tuncompressedSize = reader.size;\n\t\tmaximumCompressedSize = getMaximumCompressedSize(uncompressedSize);\n\t}\n\tlet zip64 = options.zip64 || zipWriter.options.zip64 || false;\n\tif (zipWriter.offset + zipWriter.pendingCompressedSize >= MAX_32_BITS ||\n\t\tuncompressedSize >= MAX_32_BITS ||\n\t\tmaximumCompressedSize >= MAX_32_BITS) {\n\t\tif (options.zip64 === false || zipWriter.options.zip64 === false || !keepOrder) {\n\t\t\tthrow new Error(ERR_UNSUPPORTED_FORMAT);\n\t\t} else {\n\t\t\tzip64 = true;\n\t\t}\n\t}\n\tzipWriter.pendingCompressedSize += maximumCompressedSize;\n\tawait Promise.resolve();\n\tconst level = getOptionValue(zipWriter, options, \"level\");\n\tconst useWebWorkers = getOptionValue(zipWriter, options, \"useWebWorkers\");\n\tconst bufferedWrite = getOptionValue(zipWriter, options, \"bufferedWrite\");\n\tlet dataDescriptor = getOptionValue(zipWriter, options, \"dataDescriptor\");\n\tlet dataDescriptorSignature = getOptionValue(zipWriter, options, \"dataDescriptorSignature\");\n\tconst signal = getOptionValue(zipWriter, options, \"signal\");\n\tif (dataDescriptor === undefined) {\n\t\tdataDescriptor = true;\n\t}\n\tif (dataDescriptor && dataDescriptorSignature === undefined) {\n\t\tdataDescriptorSignature = true;\n\t}\n\tconst fileEntry = await getFileEntry(zipWriter, name, reader, Object.assign({}, options, {\n\t\trawFilename,\n\t\trawComment,\n\t\tversion,\n\t\tversionMadeBy,\n\t\tlastModDate,\n\t\tlastAccessDate,\n\t\tcreationDate,\n\t\trawExtraField,\n\t\tzip64,\n\t\tpassword,\n\t\tlevel,\n\t\tuseWebWorkers,\n\t\tencryptionStrength,\n\t\textendedTimestamp,\n\t\tzipCrypto,\n\t\tbufferedWrite,\n\t\tkeepOrder,\n\t\tdataDescriptor,\n\t\tdataDescriptorSignature,\n\t\tsignal,\n\t\tmsDosCompatible,\n\t\tinternalFileAttribute,\n\t\texternalFileAttribute\n\t}));\n\tif (maximumCompressedSize) {\n\t\tzipWriter.pendingCompressedSize -= maximumCompressedSize;\n\t}\n\tObject.assign(fileEntry, { name, comment, extraField });\n\treturn new Entry(fileEntry);\n}\n\nasync function getFileEntry(zipWriter, name, reader, options) {\n\tconst files = zipWriter.files;\n\tconst writer = zipWriter.writer;\n\tconst previousFileEntry = Array.from(files.values()).pop();\n\tlet fileEntry = {};\n\tlet bufferedWrite;\n\tlet resolveLockUnbufferedWrite;\n\tlet resolveLockCurrentFileEntry;\n\tfiles.set(name, fileEntry);\n\ttry {\n\t\tlet lockPreviousFileEntry;\n\t\tlet fileWriter;\n\t\tlet lockCurrentFileEntry;\n\t\tif (options.keepOrder) {\n\t\t\tlockPreviousFileEntry = previousFileEntry && previousFileEntry.lock;\n\t\t}\n\t\tfileEntry.lock = lockCurrentFileEntry = new Promise(resolve => resolveLockCurrentFileEntry = resolve);\n\t\tif (options.bufferedWrite || zipWriter.lockWrite || !options.dataDescriptor) {\n\t\t\tfileWriter = new BlobWriter();\n\t\t\tfileWriter.init();\n\t\t\tbufferedWrite = true;\n\t\t} else {\n\t\t\tzipWriter.lockWrite = new Promise(resolve => resolveLockUnbufferedWrite = resolve);\n\t\t\tif (!writer.initialized) {\n\t\t\t\tawait writer.init();\n\t\t\t}\n\t\t\tfileWriter = writer;\n\t\t}\n\t\tfileEntry = await createFileEntry(reader, fileWriter, zipWriter.config, options);\n\t\tfileEntry.lock = lockCurrentFileEntry;\n\t\tfiles.set(name, fileEntry);\n\t\tfileEntry.filename = name;\n\t\tif (bufferedWrite) {\n\t\t\tlet indexWrittenData = 0;\n\t\t\tconst blob = fileWriter.getData();\n\t\t\tawait Promise.all([zipWriter.lockWrite, lockPreviousFileEntry]);\n\t\t\tlet pendingFileEntry;\n\t\t\tdo {\n\t\t\t\tpendingFileEntry = Array.from(files.values()).find(fileEntry => fileEntry.writingBufferedData);\n\t\t\t\tif (pendingFileEntry) {\n\t\t\t\t\tawait pendingFileEntry.lock;\n\t\t\t\t}\n\t\t\t} while (pendingFileEntry && pendingFileEntry.lock);\n\t\t\tfileEntry.writingBufferedData = true;\n\t\t\tif (!options.dataDescriptor) {\n\t\t\t\tconst headerLength = 26;\n\t\t\t\tconst arrayBuffer = await sliceAsArrayBuffer(blob, 0, headerLength);\n\t\t\t\tconst arrayBufferView = new DataView(arrayBuffer);\n\t\t\t\tif (!fileEntry.encrypted || options.zipCrypto) {\n\t\t\t\t\tsetUint32(arrayBufferView, 14, fileEntry.signature);\n\t\t\t\t}\n\t\t\t\tif (fileEntry.zip64) {\n\t\t\t\t\tsetUint32(arrayBufferView, 18, MAX_32_BITS);\n\t\t\t\t\tsetUint32(arrayBufferView, 22, MAX_32_BITS);\n\t\t\t\t} else {\n\t\t\t\t\tsetUint32(arrayBufferView, 18, fileEntry.compressedSize);\n\t\t\t\t\tsetUint32(arrayBufferView, 22, fileEntry.uncompressedSize);\n\t\t\t\t}\n\t\t\t\tawait writer.writeUint8Array(new Uint8Array(arrayBuffer));\n\t\t\t\tindexWrittenData = headerLength;\n\t\t\t}\n\t\t\tawait writeBlob(writer, blob, indexWrittenData);\n\t\t\tdelete fileEntry.writingBufferedData;\n\t\t}\n\t\tfileEntry.offset = zipWriter.offset;\n\t\tif (fileEntry.zip64) {\n\t\t\tconst rawExtraFieldZip64View = getDataView(fileEntry.rawExtraFieldZip64);\n\t\t\tsetBigUint64(rawExtraFieldZip64View, 20, BigInt(fileEntry.offset));\n\t\t} else if (fileEntry.offset >= MAX_32_BITS) {\n\t\t\tthrow new Error(ERR_UNSUPPORTED_FORMAT);\n\t\t}\n\t\tzipWriter.offset += fileEntry.length;\n\t\treturn fileEntry;\n\t} catch (error) {\n\t\tif ((bufferedWrite && fileEntry.writingBufferedData) || (!bufferedWrite && fileEntry.dataWritten)) {\n\t\t\terror.corruptedEntry = zipWriter.hasCorruptedEntries = true;\n\t\t\tif (fileEntry.uncompressedSize) {\n\t\t\t\tzipWriter.offset += fileEntry.uncompressedSize;\n\t\t\t}\n\t\t}\n\t\tfiles.delete(name);\n\t\tthrow error;\n\t} finally {\n\t\tresolveLockCurrentFileEntry();\n\t\tif (resolveLockUnbufferedWrite) {\n\t\t\tresolveLockUnbufferedWrite();\n\t\t}\n\t}\n}\n\nasync function createFileEntry(reader, writer, config, options) {\n\tconst {\n\t\trawFilename,\n\t\tlastAccessDate,\n\t\tcreationDate,\n\t\tpassword,\n\t\tlevel,\n\t\tzip64,\n\t\tzipCrypto,\n\t\tdataDescriptor,\n\t\tdataDescriptorSignature,\n\t\tdirectory,\n\t\tversion,\n\t\tversionMadeBy,\n\t\trawComment,\n\t\trawExtraField,\n\t\tuseWebWorkers,\n\t\tonprogress,\n\t\tsignal,\n\t\tencryptionStrength,\n\t\textendedTimestamp,\n\t\tmsDosCompatible,\n\t\tinternalFileAttribute,\n\t\texternalFileAttribute\n\t} = options;\n\tconst encrypted = Boolean(password && password.length);\n\tconst compressed = level !== 0 && !directory;\n\tlet rawExtraFieldAES;\n\tif (encrypted && !zipCrypto) {\n\t\trawExtraFieldAES = new Uint8Array(EXTRAFIELD_DATA_AES.length + 2);\n\t\tconst extraFieldAESView = getDataView(rawExtraFieldAES);\n\t\tsetUint16(extraFieldAESView, 0, EXTRAFIELD_TYPE_AES);\n\t\tarraySet(rawExtraFieldAES, EXTRAFIELD_DATA_AES, 2);\n\t\tsetUint8(extraFieldAESView, 8, encryptionStrength);\n\t} else {\n\t\trawExtraFieldAES = new Uint8Array(0);\n\t}\n\tlet rawExtraFieldNTFS;\n\tlet rawExtraFieldExtendedTimestamp;\n\tif (extendedTimestamp) {\n\t\trawExtraFieldExtendedTimestamp = new Uint8Array(9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0));\n\t\tconst extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);\n\t\tsetUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);\n\t\tsetUint16(extraFieldExtendedTimestampView, 2, rawExtraFieldExtendedTimestamp.length - 4);\n\t\tconst extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);\n\t\tsetUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);\n\t\tsetUint32(extraFieldExtendedTimestampView, 5, Math.floor(options.lastModDate.getTime() / 1000));\n\t\tif (lastAccessDate) {\n\t\t\tsetUint32(extraFieldExtendedTimestampView, 9, Math.floor(lastAccessDate.getTime() / 1000));\n\t\t}\n\t\tif (creationDate) {\n\t\t\tsetUint32(extraFieldExtendedTimestampView, 13, Math.floor(creationDate.getTime() / 1000));\n\t\t}\n\t\ttry {\n\t\t\trawExtraFieldNTFS = new Uint8Array(36);\n\t\t\tconst extraFieldNTFSView = getDataView(rawExtraFieldNTFS);\n\t\t\tconst lastModTimeNTFS = getTimeNTFS(options.lastModDate);\n\t\t\tsetUint16(extraFieldNTFSView, 0, EXTRAFIELD_TYPE_NTFS);\n\t\t\tsetUint16(extraFieldNTFSView, 2, 32);\n\t\t\tsetUint16(extraFieldNTFSView, 8, EXTRAFIELD_TYPE_NTFS_TAG1);\n\t\t\tsetUint16(extraFieldNTFSView, 10, 24);\n\t\t\tsetBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);\n\t\t\tsetBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);\n\t\t\tsetBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);\n\t\t} catch (error) {\n\t\t\trawExtraFieldNTFS = new Uint8Array(0);\n\t\t}\n\t} else {\n\t\trawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array(0);\n\t}\n\tconst fileEntry = {\n\t\tversion: version || VERSION_DEFLATE,\n\t\tversionMadeBy,\n\t\tzip64,\n\t\tdirectory: Boolean(directory),\n\t\tfilenameUTF8: true,\n\t\trawFilename,\n\t\tcommentUTF8: true,\n\t\trawComment,\n\t\trawExtraFieldZip64: zip64 ? new Uint8Array(EXTRAFIELD_LENGTH_ZIP64 + 4) : new Uint8Array(0),\n\t\trawExtraFieldExtendedTimestamp,\n\t\trawExtraFieldNTFS,\n\t\trawExtraFieldAES,\n\t\trawExtraField,\n\t\textendedTimestamp,\n\t\tmsDosCompatible,\n\t\tinternalFileAttribute,\n\t\texternalFileAttribute\n\t};\n\tlet uncompressedSize = fileEntry.uncompressedSize = 0;\n\tlet bitFlag = BITFLAG_LANG_ENCODING_FLAG;\n\tif (dataDescriptor) {\n\t\tbitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;\n\t}\n\tlet compressionMethod = COMPRESSION_METHOD_STORE;\n\tif (compressed) {\n\t\tcompressionMethod = COMPRESSION_METHOD_DEFLATE;\n\t}\n\tif (zip64) {\n\t\tfileEntry.version = fileEntry.version > VERSION_ZIP64 ? fileEntry.version : VERSION_ZIP64;\n\t}\n\tif (encrypted) {\n\t\tbitFlag = bitFlag | BITFLAG_ENCRYPTED;\n\t\tif (!zipCrypto) {\n\t\t\tfileEntry.version = fileEntry.version > VERSION_AES ? fileEntry.version : VERSION_AES;\n\t\t\tcompressionMethod = COMPRESSION_METHOD_AES;\n\t\t\tif (compressed) {\n\t\t\t\tfileEntry.rawExtraFieldAES[9] = COMPRESSION_METHOD_DEFLATE;\n\t\t\t}\n\t\t}\n\t}\n\tfileEntry.compressionMethod = compressionMethod;\n\tconst headerArray = fileEntry.headerArray = new Uint8Array(26);\n\tconst headerView = getDataView(headerArray);\n\tsetUint16(headerView, 0, fileEntry.version);\n\tsetUint16(headerView, 2, bitFlag);\n\tsetUint16(headerView, 4, compressionMethod);\n\tconst dateArray = new Uint32Array(1);\n\tconst dateView = getDataView(dateArray);\n\tlet lastModDate;\n\tif (options.lastModDate < MIN_DATE) {\n\t\tlastModDate = MIN_DATE;\n\t} else if (options.lastModDate > MAX_DATE) {\n\t\tlastModDate = MAX_DATE;\n\t} else {\n\t\tlastModDate = options.lastModDate;\n\t}\n\tsetUint16(dateView, 0, (((lastModDate.getHours() << 6) | lastModDate.getMinutes()) << 5) | lastModDate.getSeconds() / 2);\n\tsetUint16(dateView, 2, ((((lastModDate.getFullYear() - 1980) << 4) | (lastModDate.getMonth() + 1)) << 5) | lastModDate.getDate());\n\tconst rawLastModDate = dateArray[0];\n\tsetUint32(headerView, 6, rawLastModDate);\n\tsetUint16(headerView, 22, rawFilename.length);\n\tconst extraFieldLength = rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length + fileEntry.rawExtraField.length;\n\tsetUint16(headerView, 24, extraFieldLength);\n\tconst localHeaderArray = new Uint8Array(30 + rawFilename.length + extraFieldLength);\n\tconst localHeaderView = getDataView(localHeaderArray);\n\tsetUint32(localHeaderView, 0, LOCAL_FILE_HEADER_SIGNATURE);\n\tarraySet(localHeaderArray, headerArray, 4);\n\tarraySet(localHeaderArray, rawFilename, 30);\n\tarraySet(localHeaderArray, rawExtraFieldAES, 30 + rawFilename.length);\n\tarraySet(localHeaderArray, rawExtraFieldExtendedTimestamp, 30 + rawFilename.length + rawExtraFieldAES.length);\n\tarraySet(localHeaderArray, rawExtraFieldNTFS, 30 + rawFilename.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length);\n\tarraySet(localHeaderArray, fileEntry.rawExtraField, 30 + rawFilename.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length);\n\tlet result;\n\tlet compressedSize = 0;\n\tif (reader) {\n\t\tuncompressedSize = fileEntry.uncompressedSize = reader.size;\n\t\tconst codec = await createCodec(config.Deflate, {\n\t\t\tcodecType: CODEC_DEFLATE,\n\t\t\tlevel,\n\t\t\tpassword,\n\t\t\tencryptionStrength,\n\t\t\tzipCrypto: encrypted && zipCrypto,\n\t\t\tpasswordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & 0xFF,\n\t\t\tsigned: true,\n\t\t\tcompressed,\n\t\t\tencrypted,\n\t\t\tuseWebWorkers\n\t\t}, config);\n\t\tawait writer.writeUint8Array(localHeaderArray);\n\t\tfileEntry.dataWritten = true;\n\t\tresult = await processData(codec, reader, writer, 0, uncompressedSize, config, { onprogress, signal });\n\t\tcompressedSize = result.length;\n\t} else {\n\t\tawait writer.writeUint8Array(localHeaderArray);\n\t\tfileEntry.dataWritten = true;\n\t}\n\tlet dataDescriptorArray = new Uint8Array(0);\n\tlet dataDescriptorView, dataDescriptorOffset = 0;\n\tif (dataDescriptor) {\n\t\tdataDescriptorArray = new Uint8Array(zip64 ? (dataDescriptorSignature ? 24 : 20) : (dataDescriptorSignature ? 16 : 12));\n\t\tdataDescriptorView = getDataView(dataDescriptorArray);\n\t\tif (dataDescriptorSignature) {\n\t\t\tdataDescriptorOffset = 4;\n\t\t\tsetUint32(dataDescriptorView, 0, DATA_DESCRIPTOR_RECORD_SIGNATURE);\n\t\t}\n\t}\n\tif (reader) {\n\t\tconst signature = result.signature;\n\t\tif ((!encrypted || zipCrypto) && signature !== undefined) {\n\t\t\tsetUint32(headerView, 10, signature);\n\t\t\tfileEntry.signature = signature;\n\t\t\tif (dataDescriptor) {\n\t\t\t\tsetUint32(dataDescriptorView, dataDescriptorOffset, signature);\n\t\t\t}\n\t\t}\n\t\tif (zip64) {\n\t\t\tconst rawExtraFieldZip64View = getDataView(fileEntry.rawExtraFieldZip64);\n\t\t\tsetUint16(rawExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);\n\t\t\tsetUint16(rawExtraFieldZip64View, 2, EXTRAFIELD_LENGTH_ZIP64);\n\t\t\tsetUint32(headerView, 14, MAX_32_BITS);\n\t\t\tsetBigUint64(rawExtraFieldZip64View, 12, BigInt(compressedSize));\n\t\t\tsetUint32(headerView, 18, MAX_32_BITS);\n\t\t\tsetBigUint64(rawExtraFieldZip64View, 4, BigInt(uncompressedSize));\n\t\t\tif (dataDescriptor) {\n\t\t\t\tsetBigUint64(dataDescriptorView, dataDescriptorOffset + 4, BigInt(compressedSize));\n\t\t\t\tsetBigUint64(dataDescriptorView, dataDescriptorOffset + 12, BigInt(uncompressedSize));\n\t\t\t}\n\t\t} else {\n\t\t\tsetUint32(headerView, 14, compressedSize);\n\t\t\tsetUint32(headerView, 18, uncompressedSize);\n\t\t\tif (dataDescriptor) {\n\t\t\t\tsetUint32(dataDescriptorView, dataDescriptorOffset + 4, compressedSize);\n\t\t\t\tsetUint32(dataDescriptorView, dataDescriptorOffset + 8, uncompressedSize);\n\t\t\t}\n\t\t}\n\t}\n\tif (dataDescriptor) {\n\t\tawait writer.writeUint8Array(dataDescriptorArray);\n\t}\n\tconst length = localHeaderArray.length + compressedSize + dataDescriptorArray.length;\n\tObject.assign(fileEntry, { compressedSize, lastModDate, rawLastModDate, creationDate, lastAccessDate, encrypted, length });\n\treturn fileEntry;\n}\n\nasync function closeFile(zipWriter, comment, options) {\n\tconst writer = zipWriter.writer;\n\tconst files = zipWriter.files;\n\tlet offset = 0;\n\tlet directoryDataLength = 0;\n\tlet directoryOffset = zipWriter.offset;\n\tlet filesLength = files.size;\n\tfor (const [, fileEntry] of files) {\n\t\tdirectoryDataLength += 46 +\n\t\t\tfileEntry.rawFilename.length +\n\t\t\tfileEntry.rawComment.length +\n\t\t\tfileEntry.rawExtraFieldZip64.length +\n\t\t\tfileEntry.rawExtraFieldAES.length +\n\t\t\tfileEntry.rawExtraFieldExtendedTimestamp.length +\n\t\t\tfileEntry.rawExtraFieldNTFS.length +\n\t\t\tfileEntry.rawExtraField.length;\n\t}\n\tlet zip64 = options.zip64 || zipWriter.options.zip64 || false;\n\tif (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS) {\n\t\tif (options.zip64 === false || zipWriter.options.zip64 === false) {\n\t\t\tthrow new Error(ERR_UNSUPPORTED_FORMAT);\n\t\t} else {\n\t\t\tzip64 = true;\n\t\t}\n\t}\n\tconst directoryArray = new Uint8Array(directoryDataLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH));\n\tconst directoryView = getDataView(directoryArray);\n\tif (comment && comment.length) {\n\t\tif (comment.length <= MAX_16_BITS) {\n\t\t\tsetUint16(directoryView, offset + 20, comment.length);\n\t\t} else {\n\t\t\tthrow new Error(ERR_INVALID_COMMENT);\n\t\t}\n\t}\n\tfor (const [indexFileEntry, fileEntry] of Array.from(files.values()).entries()) {\n\t\tconst {\n\t\t\trawFilename,\n\t\t\trawExtraFieldZip64,\n\t\t\trawExtraFieldAES,\n\t\t\trawExtraField,\n\t\t\trawComment,\n\t\t\tversionMadeBy,\n\t\t\theaderArray,\n\t\t\tdirectory,\n\t\t\tzip64,\n\t\t\tmsDosCompatible,\n\t\t\tinternalFileAttribute,\n\t\t\texternalFileAttribute\n\t\t} = fileEntry;\n\t\tlet rawExtraFieldExtendedTimestamp;\n\t\tlet rawExtraFieldNTFS;\n\t\tif (fileEntry.extendedTimestamp) {\n\t\t\trawExtraFieldNTFS = fileEntry.rawExtraFieldNTFS;\n\t\t\trawExtraFieldExtendedTimestamp = new Uint8Array(9);\n\t\t\tconst extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);\n\t\t\tsetUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);\n\t\t\tsetUint16(extraFieldExtendedTimestampView, 2, rawExtraFieldExtendedTimestamp.length - 4);\n\t\t\tsetUint8(extraFieldExtendedTimestampView, 4, 0x1);\n\t\t\tsetUint32(extraFieldExtendedTimestampView, 5, Math.floor(fileEntry.lastModDate.getTime() / 1000));\n\t\t} else {\n\t\t\trawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array(0);\n\t\t}\n\t\tconst extraFieldLength = rawExtraFieldZip64.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length + rawExtraField.length;\n\t\tsetUint32(directoryView, offset, CENTRAL_FILE_HEADER_SIGNATURE);\n\t\tsetUint16(directoryView, offset + 4, versionMadeBy);\n\t\tarraySet(directoryArray, headerArray, offset + 6);\n\t\tsetUint16(directoryView, offset + 30, extraFieldLength);\n\t\tsetUint16(directoryView, offset + 32, rawComment.length);\n\t\tsetUint32(directoryView, offset + 34, internalFileAttribute);\n\t\tif (externalFileAttribute) {\n\t\t\tsetUint32(directoryView, offset + 38, externalFileAttribute);\n\t\t} else if (directory && msDosCompatible) {\n\t\t\tsetUint8(directoryView, offset + 38, FILE_ATTR_MSDOS_DIR_MASK);\n\t\t}\n\t\tif (zip64) {\n\t\t\tsetUint32(directoryView, offset + 42, MAX_32_BITS);\n\t\t} else {\n\t\t\tsetUint32(directoryView, offset + 42, fileEntry.offset);\n\t\t}\n\t\tarraySet(directoryArray, rawFilename, offset + 46);\n\t\tarraySet(directoryArray, rawExtraFieldZip64, offset + 46 + rawFilename.length);\n\t\tarraySet(directoryArray, rawExtraFieldAES, offset + 46 + rawFilename.length + rawExtraFieldZip64.length);\n\t\tarraySet(directoryArray, rawExtraFieldExtendedTimestamp, offset + 46 + rawFilename.length + rawExtraFieldZip64.length + rawExtraFieldAES.length);\n\t\tarraySet(directoryArray, rawExtraFieldNTFS, offset + 46 + rawFilename.length + rawExtraFieldZip64.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length);\n\t\tarraySet(directoryArray, rawExtraField, offset + 46 + rawFilename.length + rawExtraFieldZip64.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length);\n\t\tarraySet(directoryArray, rawComment, offset + 46 + rawFilename.length + extraFieldLength);\n\t\toffset += 46 + rawFilename.length + extraFieldLength + rawComment.length;\n\t\tif (options.onprogress) {\n\t\t\ttry {\n\t\t\t\toptions.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));\n\t\t\t} catch (error) {\n\t\t\t\t// ignored\n\t\t\t}\n\t\t}\n\t}\n\tif (zip64) {\n\t\tsetUint32(directoryView, offset, ZIP64_END_OF_CENTRAL_DIR_SIGNATURE);\n\t\tsetBigUint64(directoryView, offset + 4, BigInt(44));\n\t\tsetUint16(directoryView, offset + 12, 45);\n\t\tsetUint16(directoryView, offset + 14, 45);\n\t\tsetBigUint64(directoryView, offset + 24, BigInt(filesLength));\n\t\tsetBigUint64(directoryView, offset + 32, BigInt(filesLength));\n\t\tsetBigUint64(directoryView, offset + 40, BigInt(directoryDataLength));\n\t\tsetBigUint64(directoryView, offset + 48, BigInt(directoryOffset));\n\t\tsetUint32(directoryView, offset + 56, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE);\n\t\tsetBigUint64(directoryView, offset + 64, BigInt(directoryOffset) + BigInt(directoryDataLength));\n\t\tsetUint32(directoryView, offset + 72, ZIP64_TOTAL_NUMBER_OF_DISKS);\n\t\tfilesLength = MAX_16_BITS;\n\t\tdirectoryOffset = MAX_32_BITS;\n\t\tdirectoryDataLength = MAX_32_BITS;\n\t\toffset += 76;\n\t}\n\tsetUint32(directoryView, offset, END_OF_CENTRAL_DIR_SIGNATURE);\n\tsetUint16(directoryView, offset + 8, filesLength);\n\tsetUint16(directoryView, offset + 10, filesLength);\n\tsetUint32(directoryView, offset + 12, directoryDataLength);\n\tsetUint32(directoryView, offset + 16, directoryOffset);\n\tawait writer.writeUint8Array(directoryArray);\n\tif (comment && comment.length) {\n\t\tawait writer.writeUint8Array(comment);\n\t}\n}\n\nfunction sliceAsArrayBuffer(blob, start, end) {\n\tif (blob.arrayBuffer) {\n\t\tif (start || end) {\n\t\t\treturn blob.slice(start, end).arrayBuffer();\n\t\t} else {\n\t\t\treturn blob.arrayBuffer();\n\t\t}\n\t} else {\n\t\tconst fileReader = new FileReader();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tfileReader.onload = event => resolve(event.target.result);\n\t\t\tfileReader.onerror = () => reject(fileReader.error);\n\t\t\tfileReader.readAsArrayBuffer(start || end ? blob.slice(start, end) : blob);\n\t\t});\n\t}\n}\n\nasync function writeBlob(writer, blob, start = 0) {\n\tconst blockSize = 512 * 1024 * 1024;\n\tawait writeSlice();\n\n\tasync function writeSlice() {\n\t\tif (start < blob.size) {\n\t\t\tconst arrayBuffer = await sliceAsArrayBuffer(blob, start, start + blockSize);\n\t\t\tawait writer.writeUint8Array(new Uint8Array(arrayBuffer));\n\t\t\tstart += blockSize;\n\t\t\tawait writeSlice();\n\t\t}\n\t}\n}\n\nfunction getTimeNTFS(date) {\n\tif (date) {\n\t\treturn ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));\n\t}\n}\n\nfunction getOptionValue(zipWriter, options, name) {\n\treturn options[name] === undefined ? zipWriter.options[name] : options[name];\n}\n\nfunction getMaximumCompressedSize(uncompressedSize) {\n\treturn uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 1));\n}\n\nfunction setUint8(view, offset, value) {\n\tview.setUint8(offset, value);\n}\n\nfunction setUint16(view, offset, value) {\n\tview.setUint16(offset, value, true);\n}\n\nfunction setUint32(view, offset, value) {\n\tview.setUint32(offset, value, true);\n}\n\nfunction setBigUint64(view, offset, value) {\n\tview.setBigUint64(offset, value, true);\n}\n\nfunction arraySet(array, typedArray, offset) {\n\tarray.set(typedArray, offset);\n}\n\nfunction getDataView(array) {\n\treturn new DataView(array.buffer);\n}","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nimport { configure } from \"./core/configuration.js\";\nimport configureWebWorker from \"./z-worker-inline.js\";\nimport getMimeType from \"./core/util/default-mime-type.js\";\nimport initShimAsyncCodec from \"./core/util/stream-codec-shim.js\";\nimport { terminateWorkers } from \"./core/codecs/codec-pool.js\";\n\nlet baseURL;\ntry {\n\tbaseURL = import.meta.url;\n} catch (error) {\n\t// ignored\n}\nconfigure({ baseURL });\nconfigureWebWorker(configure);\n\nexport * from \"./core/io.js\";\nexport * from \"./core/zip-reader.js\";\nexport * from \"./core/zip-writer.js\";\nexport * from \"./core/zip-fs-core.js\";\nexport {\n\tconfigure,\n\tgetMimeType,\n\tinitShimAsyncCodec,\n\tterminateWorkers\n};","export default t=>{if(\"function\"==typeof URL.createObjectURL){const e='\\n\\t\\t\\t\\n\\nconst t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n;}class e{constructor(t){this.crc=t||-1;}append(e){let n=0|this.crc;for(let i=0,a=0|e.length;i>>8^t[255&(n^e[i])];this.crc=n;}get(){return ~this.crc}}const n={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const i=t[t.length-1],a=n.getPartial(i);return 32===a?t.concat(e):n._shiftRight(e,a,0|i,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const i=t[e-1];return 32*(e-1)+n.getPartial(i)},clamp(t,e){if(32*t.length0&&e&&(t[i-1]=n.partial(e,t[i-1]&2147483648>>e-1,1)),t},partial:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,getPartial:t=>Math.round(t/1099511627776)||32,_shiftRight(t,e,i,a){for(void 0===a&&(a=[]);e>=32;e-=32)a.push(i),i=0;if(0===e)return a.concat(t);for(let n=0;n>>e),i=t[n]<<32-e;const r=t.length?t[t.length-1]:0,s=n.getPartial(r);return a.push(n.partial(e+s&31,e+s>32?i:a.pop(),1)),a}},i={bytes:{fromBits(t){const e=n.bitLength(t)/8,i=new Uint8Array(e);let a;for(let n=0;n>>24,a<<=8;return i},toBits(t){const e=[];let i,a=0;for(i=0;i9007199254740991)throw new Error(\"Cannot hash more than 2^53 - 1 bits\");const o=new Uint32Array(a);let l=0;for(let t=e.blockSize+r-(e.blockSize+r&e.blockSize-1);t<=s;t+=e.blockSize)e._block(o.subarray(16*l,16*(l+1))),l+=1;return a.splice(0,16*l),e},finalize:function(){const t=this;let e=t._buffer;const i=t._h;e=n.concat(e,[n.partial(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(Math.floor(t._length/4294967296)),e.push(0|t._length);e.length;)t._block(e.splice(0,16));return t.reset(),i},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(t,e,n,i){return t<=19?e&n|~e&i:t<=39?e^n^i:t<=59?e&n|e&i|n&i:t<=79?e^n^i:void 0},_S:function(t,e){return e<>>32-t},_block:function(t){const e=this,n=e._h,i=Array(80);for(let e=0;e<16;e++)i[e]=t[e];let a=n[0],r=n[1],s=n[2],o=n[3],l=n[4];for(let t=0;t<=79;t++){t>=16&&(i[t]=e._S(1,i[t-3]^i[t-8]^i[t-14]^i[t-16]));const n=e._S(5,a)+e._f(t,r,s,o)+l+i[t]+e._key[Math.floor(t/20)]|0;l=o,o=s,s=e._S(30,r),r=a,a=n;}n[0]=n[0]+a|0,n[1]=n[1]+r|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+l|0;}};const r={aes:class{constructor(t){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const n=e._tables[0][4],i=e._tables[1],a=t.length;let r,s,o,l=1;if(4!==a&&6!==a&&8!==a)throw new Error(\"invalid aes key size\");for(e._key=[s=t.slice(0),o=[]],r=a;r<4*a+28;r++){let t=s[r-1];(r%a==0||8===a&&r%a==4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],r%a==0&&(t=t<<8^t>>>24^l<<24,l=l<<1^283*(l>>7))),s[r]=s[r-a]^t;}for(let t=0;r;t++,r--){const e=s[3&t?r:r-4];o[t]=r<=4||t<4?e:i[0][n[e>>>24]]^i[1][n[e>>16&255]]^i[2][n[e>>8&255]]^i[3][n[255&e]];}}encrypt(t){return this._crypt(t,0)}decrypt(t){return this._crypt(t,1)}_precompute(){const t=this._tables[0],e=this._tables[1],n=t[4],i=e[4],a=[],r=[];let s,o,l,_;for(let t=0;t<256;t++)r[(a[t]=t<<1^283*(t>>7))^t]=t;for(let d=s=0;!n[d];d^=o||1,s=r[s]||1){let r=s^s<<1^s<<2^s<<3^s<<4;r=r>>8^255&r^99,n[d]=r,i[r]=d,_=a[l=a[o=a[d]]];let c=16843009*_^65537*l^257*o^16843008*d,f=257*a[r]^16843008*r;for(let n=0;n<4;n++)t[n][d]=f=f<<24^f>>>8,e[n][r]=c=c<<24^c>>>8;}for(let n=0;n<5;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0);}_crypt(t,e){if(4!==t.length)throw new Error(\"invalid aes block size\");const n=this._key[e],i=n.length/4-2,a=[0,0,0,0],r=this._tables[e],s=r[0],o=r[1],l=r[2],_=r[3],d=r[4];let c,f,u,h=t[0]^n[0],b=t[e?3:1]^n[1],w=t[2]^n[2],p=t[e?1:3]^n[3],x=4;for(let t=0;t>>24]^o[b>>16&255]^l[w>>8&255]^_[255&p]^n[x],f=s[b>>>24]^o[w>>16&255]^l[p>>8&255]^_[255&h]^n[x+1],u=s[w>>>24]^o[p>>16&255]^l[h>>8&255]^_[255&b]^n[x+2],p=s[p>>>24]^o[h>>16&255]^l[b>>8&255]^_[255&w]^n[x+3],x+=4,h=c,b=f,w=u;for(let t=0;t<4;t++)a[e?3&-t:t]=d[h>>>24]<<24^d[b>>16&255]<<16^d[w>>8&255]<<8^d[255&p]^n[x++],c=h,h=b,b=w,w=p,p=c;return a}}},s={ctrGladman:class{constructor(t,e){this._prf=t,this._initIv=e,this._iv=e;}reset(){this._iv=this._initIv;}update(t){return this.calculate(this._prf,t,this._iv)}incWord(t){if(255==(t>>24&255)){let e=t>>16&255,n=t>>8&255,i=255&t;255===e?(e=0,255===n?(n=0,255===i?i=0:++i):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=i;}else t+=1<<24;return t}incCounter(t){0===(t[0]=this.incWord(t[0]))&&(t[1]=this.incWord(t[1]));}calculate(t,e,i){let a;if(!(a=e.length))return [];const r=n.bitLength(e);for(let n=0;nr&&(t=n.hash(t));for(let e=0;et.length){const n=t;(t=new Uint8Array(e)).set(n,0);}return t}(n,s-s%16)),o=0;o<=s-16;o+=16){const a=b.toBits(A(e,o,o+16));r&&t.hmac.update(a);const s=t.aesCtrGladman.update(a);r||t.hmac.update(s),n.set(b.fromBits(s),o+i);}return t.pendingInput=A(e,o),n}async function k(t,e,n){const i=function(t){if(\"undefined\"==typeof TextEncoder){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let n=0;n>>24]),t.keys[2]=~t.crcKey2.get();}function M(t){const e=2|t.keys[2];return B(Math.imul(e,1^e)>>>8)}function B(t){return 255&t}function H(t){return 4294967295&t}class V{constructor(t,{signature:n,password:i,signed:a,compressed:r,zipCrypto:s,passwordVerification:o,encryptionStrength:l},{chunkSize:_}){const d=Boolean(i);Object.assign(this,{signature:n,encrypted:d,signed:a,compressed:r,inflate:r&&new t({chunkSize:_}),crc32:a&&new e,zipCrypto:s,decrypt:d&&s?new U(i,o):new g(i,a,l)});}async append(t){const e=this;return e.encrypted&&t.length&&(t=await e.decrypt.append(t)),e.compressed&&t.length&&(t=await e.inflate.append(t)),(!e.encrypted||e.zipCrypto)&&e.signed&&t.length&&e.crc32.append(t),t}async flush(){const t=this;let e,n=new Uint8Array(0);if(t.encrypted){const e=t.decrypt.flush();if(!e.valid)throw new Error(\"Invalid signature\");n=e.data;}if((!t.encrypted||t.zipCrypto)&&t.signed){const n=new DataView(new Uint8Array(4).buffer);if(e=t.crc32.get(),n.setUint32(0,e),t.signature!=n.getUint32(0,!1))throw new Error(\"Invalid signature\")}return t.compressed&&(n=await t.inflate.append(n)||new Uint8Array(0),await t.inflate.flush()),{data:n,signature:e}}}class D{constructor(t,{encrypted:n,signed:i,compressed:a,level:r,zipCrypto:s,password:o,passwordVerification:l,encryptionStrength:_},{chunkSize:d}){Object.assign(this,{encrypted:n,signed:i,compressed:a,deflate:a&&new t({level:r||5,chunkSize:d}),crc32:i&&new e,zipCrypto:s,encrypt:n&&s?new S(o,l):new y(o,_)});}async append(t){const e=this;let n=t;return e.compressed&&t.length&&(n=await e.deflate.append(t)),e.encrypted&&n.length&&(n=await e.encrypt.append(n)),(!e.encrypted||e.zipCrypto)&&e.signed&&t.length&&e.crc32.append(t),n}async flush(){const t=this;let e,n=new Uint8Array(0);if(t.compressed&&(n=await t.deflate.flush()||new Uint8Array(0)),t.encrypted){n=await t.encrypt.append(n);const i=t.encrypt.flush();e=i.signature;const a=new Uint8Array(n.length+i.data.length);a.set(n,0),a.set(i.data,n.length),n=a;}return t.encrypted&&!t.zipCrypto||!t.signed||(e=t.crc32.get()),{data:n,signature:e}}}const j={init(t){t.scripts&&t.scripts.length&&importScripts.apply(void 0,t.scripts);const e=t.options;let n;self.initCodec&&self.initCodec(),e.codecType.startsWith(\"deflate\")?n=self.Deflate:e.codecType.startsWith(\"inflate\")&&(n=self.Inflate),O=function(t,e,n){return e.codecType.startsWith(\"deflate\")?new D(t,e,n):e.codecType.startsWith(\"inflate\")?new V(t,e,n):void 0}(n,e,t.config);},append:async t=>({data:await O.append(t.data)}),flush:()=>O.flush()};let O;addEventListener(\"message\",(async t=>{const e=t.data,n=e.type,i=j[n];if(i)try{e.data&&(e.data=new Uint8Array(e.data));const t=await i(e)||{};if(t.type=n,t.data)try{t.data=t.data.buffer,postMessage(t,[t.data]);}catch(e){postMessage(t);}else postMessage(t);}catch(t){postMessage({type:n,error:{message:t.message,stack:t.stack}});}}));function P(t){return K(t.map((([t,e])=>new Array(t).fill(e,0,t))))}function K(t){return t.reduce(((t,e)=>t.concat(Array.isArray(e)?K(e):e)),[])}const G=[0,1,2,3].concat(...P([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function W(){const t=this;function e(t,e){let n=0;do{n|=1&t,t>>>=1,n<<=1;}while(--e>0);return n>>>1}t.build_tree=function(n){const i=t.dyn_tree,a=t.stat_desc.static_tree,r=t.stat_desc.elems;let s,o,l,_=-1;for(n.heap_len=0,n.heap_max=573,s=0;s=1;s--)n.pqdownheap(i,s);l=r;do{s=n.heap[1],n.heap[1]=n.heap[n.heap_len--],n.pqdownheap(i,1),o=n.heap[1],n.heap[--n.heap_max]=s,n.heap[--n.heap_max]=o,i[2*l]=i[2*s]+i[2*o],n.depth[l]=Math.max(n.depth[s],n.depth[o])+1,i[2*s+1]=i[2*o+1]=l,n.heap[1]=l++,n.pqdownheap(i,1);}while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],function(e){const n=t.dyn_tree,i=t.stat_desc.static_tree,a=t.stat_desc.extra_bits,r=t.stat_desc.extra_base,s=t.stat_desc.max_length;let o,l,_,d,c,f,u=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(n[2*e.heap[e.heap_max]+1]=0,o=e.heap_max+1;o<573;o++)l=e.heap[o],d=n[2*n[2*l+1]+1]+1,d>s&&(d=s,u++),n[2*l+1]=d,l>t.max_code||(e.bl_count[d]++,c=0,l>=r&&(c=a[l-r]),f=n[2*l],e.opt_len+=f*(d+c),i&&(e.static_len+=f*(i[2*l+1]+c)));if(0!==u){do{for(d=s-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[s]--,u-=2;}while(u>0);for(d=s;0!==d;d--)for(l=e.bl_count[d];0!==l;)_=e.heap[--o],_>t.max_code||(n[2*_+1]!=d&&(e.opt_len+=(d-n[2*_+1])*n[2*_],n[2*_+1]=d),l--);}}(n),function(t,n,i){const a=[];let r,s,o,l=0;for(r=1;r<=15;r++)a[r]=l=l+i[r-1]<<1;for(s=0;s<=n;s++)o=t[2*s+1],0!==o&&(t[2*s]=e(a[o]++,o));}(i,t.max_code,n.bl_count);};}function T(t,e,n,i,a){const r=this;r.static_tree=t,r.extra_bits=e,r.extra_base=n,r.elems=i,r.max_length=a;}W._length_code=[0,1,2,3,4,5,6,7].concat(...P([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),W.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],W.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],W.d_code=function(t){return t<256?G[t]:G[256+(t>>>7)]},W.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],W.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],W.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],W.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],T.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],T.static_l_desc=new T(T.static_ltree,W.extra_lbits,257,286,15),T.static_d_desc=new T(T.static_dtree,W.extra_dbits,0,30,15),T.static_bl_desc=new T(null,W.extra_blbits,0,19,7);function L(t,e,n,i,a){const r=this;r.good_length=t,r.max_lazy=e,r.nice_length=n,r.max_chain=i,r.func=a;}const R=[new L(0,0,0,0,0),new L(4,4,8,4,1),new L(4,5,16,8,1),new L(4,6,32,32,1),new L(4,4,16,16,2),new L(8,16,32,32,2),new L(8,16,128,128,2),new L(8,32,128,256,2),new L(32,128,258,1024,2),new L(32,258,258,4096,2)],q=[\"need dictionary\",\"stream end\",\"\",\"\",\"stream error\",\"data error\",\"\",\"buffer error\",\"\",\"\"];function F(t,e,n,i){const a=t[2*e],r=t[2*n];return a>>8&255);}function tt(t,e){let n;const i=e;Q>16-i?(n=t,N|=n<>>16-Q,Q+=i-16):(N|=t<=8&&(Z(255&N),N>>>=8,Q-=8);}function at(e,n){let i,a,r;if(t.pending_buf[G+2*K]=e>>>8&255,t.pending_buf[G+2*K+1]=255&e,t.pending_buf[O+K]=255&n,K++,0===e?M[2*n]++:(L++,e--,M[2*(W._length_code[n]+256+1)]++,B[2*W.d_code(e)]++),0==(8191&K)&&z>2){for(i=8*K,a=m-p,r=0;r<30;r++)i+=B[2*r]*(5+W.extra_dbits[r]);if(i>>>=3,L8?$(N):Q>0&&Z(255&N),N=0,Q=0;}function ot(e,n,i){tt(0+(i?1:0),3),function(e,n,i){st(),J=8,i&&($(n),$(~n)),t.pending_buf.set(l.subarray(e,e+n),t.pending),t.pending+=n;}(e,n,!0);}function lt(e,n,i){let a,r,s=0;z>0?(V.build_tree(t),D.build_tree(t),s=function(){let e;for(Y(M,V.max_code),Y(B,D.max_code),j.build_tree(t),e=18;e>=3&&0===H[2*W.bl_order[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(),a=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=a&&(a=r)):a=r=n+5,n+4<=a&&-1!=e?ot(e,n,i):r==a?(tt(2+(i?1:0),3),rt(T.static_ltree,T.static_dtree)):(tt(4+(i?1:0),3),function(t,e,n){let i;for(tt(t-257,5),tt(e-1,5),tt(n-4,4),i=0;i=0?p:-1,m-p,t),p=m,e.flush_pending();}function dt(){let t,n,i,a;do{if(a=_-v-m,0===a&&0===m&&0===v)a=r;else if(-1==a)a--;else if(m>=r+r-262){l.set(l.subarray(r,r+r),0),k-=r,m-=r,p-=r,t=u,i=t;do{n=65535&c[--i],c[i]=n>=r?n-r:0;}while(0!=--t);t=r,i=t;do{n=65535&d[--i],d[i]=n>=r?n-r:0;}while(0!=--t);a+=r;}if(0===e.avail_in)return;t=e.read_buf(l,m+v,a),v+=t,v>=3&&(f=255&l[m],f=(f<r-262?m-(r-262):0;let c=C;const f=o,u=m+258;let h=l[a+s-1],b=l[a+s];A>=E&&(i>>=2),c>v&&(c=v);do{if(e=t,l[e+s]==b&&l[e+s-1]==h&&l[e]==l[a]&&l[++e]==l[a+1]){a+=2,e++;do{}while(l[++a]==l[++e]&&l[++a]==l[++e]&&l[++a]==l[++e]&&l[++a]==l[++e]&&l[++a]==l[++e]&&l[++a]==l[++e]&&l[++a]==l[++e]&&l[++a]==l[++e]&&as){if(k=t,s=n,n>=c)break;h=l[a+s-1],b=l[a+s];}}}while((t=65535&d[t&f])>_&&0!=--i);return s<=v?s:v}function ft(e){return e.total_in=e.total_out=0,e.msg=null,t.pending=0,t.pending_out=0,n=113,a=0,V.dyn_tree=M,V.stat_desc=T.static_l_desc,D.dyn_tree=B,D.stat_desc=T.static_d_desc,j.dyn_tree=H,j.stat_desc=T.static_bl_desc,N=0,Q=0,J=8,X(),function(){_=2*r,c[u-1]=0;for(let t=0;t9||8!=_||a<9||a>15||n<0||n>9||p<0||p>2?-2:(e.dstate=t,s=a,r=1<9||n<0||n>2?-2:(R[z].func!=R[e].func&&0!==t.total_in&&(i=t.deflate(1)),z!=e&&(z=e,S=R[z].max_lazy,E=R[z].good_length,C=R[z].nice_length,U=R[z].max_chain),I=n,i)},t.deflateSetDictionary=function(t,e,i){let a,s=i,_=0;if(!e||42!=n)return -2;if(s<3)return 0;for(s>r-262&&(s=r-262,_=i-s),l.set(e.subarray(_,_+s),0),m=s,p=s,f=255&l[0],f=(f<4||h<0)return -2;if(!_.next_out||!_.next_in&&0!==_.avail_in||666==n&&4!=h)return _.msg=q[4],-2;if(0===_.avail_out)return _.msg=q[7],-5;var H;if(e=_,M=a,a=h,42==n&&(E=8+(s-8<<4)<<8,C=(z-1&255)>>1,C>3&&(C=3),E|=C<<6,0!==m&&(E|=32),E+=31-E%31,n=113,Z((H=E)>>8&255),Z(255&H)),0!==t.pending){if(e.flush_pending(),0===e.avail_out)return a=-1,0}else if(0===e.avail_in&&h<=M&&4!=h)return e.msg=q[7],-5;if(666==n&&0!==e.avail_in)return _.msg=q[7],-5;if(0!==e.avail_in||0!==v||0!=h&&666!=n){switch(B=-1,R[z].func){case 0:B=function(t){let n,a=65535;for(a>i-5&&(a=i-5);;){if(v<=1){if(dt(),0===v&&0==t)return 0;if(0===v)break}if(m+=v,v=0,n=p+a,(0===m||m>=n)&&(v=m-n,m=n,_t(!1),0===e.avail_out))return 0;if(m-p>=r-262&&(_t(!1),0===e.avail_out))return 0}return _t(4==t),0===e.avail_out?4==t?2:0:4==t?3:1}(h);break;case 1:B=function(t){let n,i=0;for(;;){if(v<262){if(dt(),v<262&&0==t)return 0;if(0===v)break}if(v>=3&&(f=(f<=3)if(n=at(m-k,x-3),v-=x,x<=S&&v>=3){x--;do{m++,f=(f<=3&&(f=(f<4096)&&(x=2)),A>=3&&x<=A){i=m+v-3,n=at(m-1-g,A-3),v-=A-1,A-=2;do{++m<=i&&(f=(f<0&&e.next_in_index!=o&&(i(e.next_in_index),o=e.next_in_index);}while(e.avail_in>0||0===e.avail_out);return d.length>1?(s=new Uint8Array(_),d.forEach((function(t){s.set(t,l),l+=t.length;}))):s=d[0]||new Uint8Array(0),s}},this.flush=function(){let t,i,r=0,s=0;const o=[];do{if(e.next_out_index=0,e.avail_out=n,t=e.deflate(4),1!=t&&0!=t)throw new Error(\"deflating: \"+e.msg);n-e.avail_out>0&&o.push(a.slice(0,e.next_out_index)),s+=e.next_out_index;}while(e.avail_in>0||0===e.avail_out);return e.deflateEnd(),i=new Uint8Array(s),o.forEach((function(t){i.set(t,r),r+=t.length;})),i};}N.prototype={deflateInit:function(t,e){const n=this;return n.dstate=new J,e||(e=15),n.dstate.deflateInit(n,t,e)},deflate:function(t){const e=this;return e.dstate?e.dstate.deflate(e,t):-2},deflateEnd:function(){const t=this;if(!t.dstate)return -2;const e=t.dstate.deflateEnd();return t.dstate=null,e},deflateParams:function(t,e){const n=this;return n.dstate?n.dstate.deflateParams(n,t,e):-2},deflateSetDictionary:function(t,e){const n=this;return n.dstate?n.dstate.deflateSetDictionary(n,t,e):-2},read_buf:function(t,e,n){const i=this;let a=i.avail_in;return a>n&&(a=n),0===a?0:(i.avail_in-=a,t.set(i.next_in.subarray(i.next_in_index,i.next_in_index+a),e),i.next_in_index+=a,i.total_in+=a,a)},flush_pending:function(){const t=this;let e=t.dstate.pending;e>t.avail_out&&(e=t.avail_out),0!==e&&(t.next_out.set(t.dstate.pending_buf.subarray(t.dstate.pending_out,t.dstate.pending_out+e),t.next_out_index),t.next_out_index+=e,t.dstate.pending_out+=e,t.total_out+=e,t.avail_out-=e,t.dstate.pending-=e,0===t.dstate.pending&&(t.dstate.pending_out=0));}};const X=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],Y=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],Z=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],$=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],tt=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],et=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],nt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function it(){let t,e,n,i,a,r;function s(t,e,s,o,l,_,d,c,f,u,h){let b,w,p,x,g,y,m,k,v,A,U,S,z,I,E;A=0,g=s;do{n[t[e+A]]++,A++,g--;}while(0!==g);if(n[0]==s)return d[0]=-1,c[0]=0,0;for(k=c[0],y=1;y<=15&&0===n[y];y++);for(m=y,kg&&(k=g),c[0]=k,I=1<S+k;){if(x++,S+=k,E=p-S,E=E>k?k:E,(w=1<<(y=m-S))>b+1&&(w-=b+1,z=m,y1440)return -3;a[x]=U=u[0],u[0]+=E,0!==x?(r[x]=g,i[0]=y,i[1]=k,y=g>>>S-k,i[2]=U-a[x-1]-y,f.set(i,3*(a[x-1]+y))):d[0]=U;}for(i[1]=m-S,A>=s?i[0]=192:h[A]>>S;y>>=1)g^=y;for(g^=y,v=(1<257?(-3==u?f.msg=\"oversubscribed distance tree\":-5==u?(f.msg=\"incomplete distance tree\",u=-3):-4!=u&&(f.msg=\"empty distance tree with lengths\",u=-3),u):0)};}it.inflate_trees_fixed=function(t,e,n,i){return t[0]=9,e[0]=5,n[0]=Y,i[0]=Z,0};function at(){const t=this;let e,n,i,a,r=0,s=0,o=0,l=0,_=0,d=0,c=0,f=0,u=0,h=0;function b(t,e,n,i,a,r,s,o){let l,_,d,c,f,u,h,b,w,p,x,g,y,m,k,v;h=o.next_in_index,b=o.avail_in,f=s.bitb,u=s.bitk,w=s.write,p=w>=_[v+1],u-=_[v+1],0!=(16&c)){for(c&=15,y=_[v+2]+(f&X[c]),f>>=c,u-=c;u<15;)b--,f|=(255&o.read_byte(h++))<>=_[v+1],u-=_[v+1],0!=(16&c)){for(c&=15;u>=c,u-=c,p-=y,w>=m)k=w-m,w-k>0&&2>w-k?(s.window[w++]=s.window[k++],s.window[w++]=s.window[k++],y-=2):(s.window.set(s.window.subarray(k,k+2),w),w+=2,k+=2,y-=2);else {k=w-m;do{k+=s.end;}while(k<0);if(c=s.end-k,y>c){if(y-=c,w-k>0&&c>w-k)do{s.window[w++]=s.window[k++];}while(0!=--c);else s.window.set(s.window.subarray(k,k+c),w),w+=c,k+=c,c=0;k=0;}}if(w-k>0&&y>w-k)do{s.window[w++]=s.window[k++];}while(0!=--y);else s.window.set(s.window.subarray(k,k+y),w),w+=y,k+=y,y=0;break}if(0!=(64&c))return o.msg=\"invalid distance code\",y=o.avail_in-b,y=u>>3>3:y,b+=y,h-=y,u-=y<<3,s.bitb=f,s.bitk=u,o.avail_in=b,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=w,-3;l+=_[v+2],l+=f&X[c],v=3*(d+l),c=_[v];}break}if(0!=(64&c))return 0!=(32&c)?(y=o.avail_in-b,y=u>>3>3:y,b+=y,h-=y,u-=y<<3,s.bitb=f,s.bitk=u,o.avail_in=b,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=w,1):(o.msg=\"invalid literal/length code\",y=o.avail_in-b,y=u>>3>3:y,b+=y,h-=y,u-=y<<3,s.bitb=f,s.bitk=u,o.avail_in=b,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=w,-3);if(l+=_[v+2],l+=f&X[c],v=3*(d+l),0===(c=_[v])){f>>=_[v+1],u-=_[v+1],s.window[w++]=_[v+2],p--;break}}else f>>=_[v+1],u-=_[v+1],s.window[w++]=_[v+2],p--;}while(p>=258&&b>=10);return y=o.avail_in-b,y=u>>3>3:y,b+=y,h-=y,u-=y<<3,s.bitb=f,s.bitk=u,o.avail_in=b,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=w,0}t.init=function(t,r,s,o,l,_){e=0,c=t,f=r,i=s,u=o,a=l,h=_,n=null;},t.proc=function(t,w,p){let x,g,y,m,k,v,A,U=0,S=0,z=0;for(z=w.next_in_index,m=w.avail_in,U=t.bitb,S=t.bitk,k=t.write,v=k=258&&m>=10&&(t.bitb=U,t.bitk=S,w.avail_in=m,w.total_in+=z-w.next_in_index,w.next_in_index=z,t.write=k,p=b(c,f,i,u,a,h,t,w),z=w.next_in_index,m=w.avail_in,U=t.bitb,S=t.bitk,k=t.write,v=k>>=n[g+1],S-=n[g+1],y=n[g],0===y){l=n[g+2],e=6;break}if(0!=(16&y)){_=15&y,r=n[g+2],e=2;break}if(0==(64&y)){o=y,s=g/3+n[g+2];break}if(0!=(32&y)){e=7;break}return e=9,w.msg=\"invalid literal/length code\",p=-3,t.bitb=U,t.bitk=S,w.avail_in=m,w.total_in+=z-w.next_in_index,w.next_in_index=z,t.write=k,t.inflate_flush(w,p);case 2:for(x=_;S>=x,S-=x,o=f,n=a,s=h,e=3;case 3:for(x=o;S>=n[g+1],S-=n[g+1],y=n[g],0!=(16&y)){_=15&y,d=n[g+2],e=4;break}if(0==(64&y)){o=y,s=g/3+n[g+2];break}return e=9,w.msg=\"invalid distance code\",p=-3,t.bitb=U,t.bitk=S,w.avail_in=m,w.total_in+=z-w.next_in_index,w.next_in_index=z,t.write=k,t.inflate_flush(w,p);case 4:for(x=_;S>=x,S-=x,e=5;case 5:for(A=k-d;A<0;)A+=t.end;for(;0!==r;){if(0===v&&(k==t.end&&0!==t.read&&(k=0,v=k7&&(S-=8,m++,z--),t.write=k,p=t.inflate_flush(w,p),k=t.write,v=kt.avail_out&&(i=t.avail_out),0!==i&&-5==e&&(e=0),t.avail_out-=i,t.total_out+=i,t.next_out.set(n.window.subarray(r,r+i),a),a+=i,r+=i,r==n.end&&(r=0,n.write==n.end&&(n.write=0),i=n.write-r,i>t.avail_out&&(i=t.avail_out),0!==i&&-5==e&&(e=0),t.avail_out-=i,t.total_out+=i,t.next_out.set(n.window.subarray(r,r+i),a),a+=i,r+=i),t.next_out_index=a,n.read=r,e},n.proc=function(t,e){let h,b,w,p,x,g,y,m;for(p=t.next_in_index,x=t.avail_in,b=n.bitb,w=n.bitk,g=n.write,y=g>>1){case 0:b>>>=3,w-=3,h=7&w,b>>>=h,w-=h,a=1;break;case 1:k=[],v=[],A=[[]],U=[[]],it.inflate_trees_fixed(k,v,A,U),d.init(k[0],v[0],A[0],0,U[0],0),b>>>=3,w-=3,a=6;break;case 2:b>>>=3,w-=3,a=3;break;case 3:return b>>>=3,w-=3,a=9,t.msg=\"invalid block type\",e=-3,n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e)}break;case 1:for(;w<32;){if(0===x)return n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);e=0,x--,b|=(255&t.read_byte(p++))<>>16&65535)!=(65535&b))return a=9,t.msg=\"invalid stored block lengths\",e=-3,n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);r=65535&b,b=w=0,a=0!==r?2:0!==c?7:0;break;case 2:if(0===x)return n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);if(0===y&&(g==n.end&&0!==n.read&&(g=0,y=gx&&(h=x),h>y&&(h=y),n.window.set(t.read_buf(p,h),g),p+=h,x-=h,g+=h,y-=h,0!=(r-=h))break;a=0!==c?7:0;break;case 3:for(;w<14;){if(0===x)return n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);e=0,x--,b|=(255&t.read_byte(p++))<29||(h>>5&31)>29)return a=9,t.msg=\"too many length or distance symbols\",e=-3,n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);if(h=258+(31&h)+(h>>5&31),!i||i.length>>=14,w-=14,o=0,a=4;case 4:for(;o<4+(s>>>10);){for(;w<3;){if(0===x)return n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);e=0,x--,b|=(255&t.read_byte(p++))<>>=3,w-=3;}for(;o<19;)i[rt[o++]]=0;if(l[0]=7,h=u.inflate_trees_bits(i,l,_,f,t),0!=h)return -3==(e=h)&&(i=null,a=9),n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);o=0,a=5;case 5:for(;h=s,!(o>=258+(31&h)+(h>>5&31));){let r,d;for(h=l[0];w>>=h,w-=h,i[o++]=d;else {for(m=18==d?7:d-14,r=18==d?11:3;w>>=h,w-=h,r+=b&X[m],b>>>=m,w-=m,m=o,h=s,m+r>258+(31&h)+(h>>5&31)||16==d&&m<1)return i=null,a=9,t.msg=\"invalid bit length repeat\",e=-3,n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);d=16==d?i[m-1]:0;do{i[m++]=d;}while(0!=--r);o=m;}}if(_[0]=-1,S=[],z=[],I=[],E=[],S[0]=9,z[0]=6,h=s,h=u.inflate_trees_dynamic(257+(31&h),1+(h>>5&31),i,S,z,I,E,f,t),0!=h)return -3==h&&(i=null,a=9),e=h,n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,n.inflate_flush(t,e);d.init(S[0],z[0],f,I[0],f,E[0]),a=6;case 6:if(n.bitb=b,n.bitk=w,t.avail_in=x,t.total_in+=p-t.next_in_index,t.next_in_index=p,n.write=g,1!=(e=d.proc(n,t,e)))return n.inflate_flush(t,e);if(e=0,d.free(t),p=t.next_in_index,x=t.avail_in,b=n.bitb,w=n.bitk,g=n.write,y=g15?(t.inflateEnd(n),-2):(t.wbits=i,n.istate.blocks=new st(n,1<>4)>a.wbits){a.mode=13,t.msg=\"invalid window size\",a.marker=5;break}a.mode=1;case 1:if(0===t.avail_in)return n;if(n=e,t.avail_in--,t.total_in++,i=255&t.read_byte(t.next_in_index++),((a.method<<8)+i)%31!=0){a.mode=13,t.msg=\"incorrect header check\",a.marker=5;break}if(0==(32&i)){a.mode=7;break}a.mode=2;case 2:if(0===t.avail_in)return n;n=e,t.avail_in--,t.total_in++,a.need=(255&t.read_byte(t.next_in_index++))<<24&4278190080,a.mode=3;case 3:if(0===t.avail_in)return n;n=e,t.avail_in--,t.total_in++,a.need+=(255&t.read_byte(t.next_in_index++))<<16&16711680,a.mode=4;case 4:if(0===t.avail_in)return n;n=e,t.avail_in--,t.total_in++,a.need+=(255&t.read_byte(t.next_in_index++))<<8&65280,a.mode=5;case 5:return 0===t.avail_in?n:(n=e,t.avail_in--,t.total_in++,a.need+=255&t.read_byte(t.next_in_index++),a.mode=6,2);case 6:return a.mode=13,t.msg=\"need dictionary\",a.marker=0,-2;case 7:if(n=a.blocks.proc(t,n),-3==n){a.mode=13,a.marker=0;break}if(0==n&&(n=e),1!=n)return n;n=e,a.blocks.reset(t,a.was),a.mode=12;case 12:return 1;case 13:return -3;default:return -2}},t.inflateSetDictionary=function(t,e,n){let i=0,a=n;if(!t||!t.istate||6!=t.istate.mode)return -2;const r=t.istate;return a>=1<0&&e.next_in_index!=_&&(r(e.next_in_index),_=e.next_in_index);}while(e.avail_in>0||0===e.avail_out);return s.length>1?(l=new Uint8Array(c),s.forEach((function(t){l.set(t,d),d+=t.length;}))):l=s[0]||new Uint8Array(0),l}},this.flush=function(){e.inflateEnd();};}_t.prototype={inflateInit:function(t){const e=this;return e.istate=new lt,t||(t=15),e.istate.inflateInit(e,t)},inflate:function(t){const e=this;return e.istate?e.istate.inflate(e,t):-2},inflateEnd:function(){const t=this;if(!t.istate)return -2;const e=t.istate.inflateEnd(t);return t.istate=null,e},inflateSync:function(){const t=this;return t.istate?t.istate.inflateSync(t):-2},inflateSetDictionary:function(t,e){const n=this;return n.istate?n.istate.inflateSetDictionary(n,t,e):-2},read_byte:function(t){return this.next_in[t]},read_buf:function(t,e){return this.next_in.subarray(t,t+e)}},self.initCodec=()=>{self.Deflate=Q,self.Inflate=dt;};\\n\\n\\t\\t',n=URL.createObjectURL(new Blob([e],{type:\"text/javascript\"}));t({workerScripts:{inflate:[n],deflate:[n]}})}};\n","/*\n Copyright (c) 2022 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\"use strict\";\n\nimport Deflate from \"./lib/core/codecs/deflate.js\";\nimport Inflate from \"./lib/core/codecs/inflate.js\";\nimport { configure } from \"./lib/core/configuration.js\";\nimport getMimeType from \"./lib/core/util/mime-type.js\";\nimport { terminateWorkers } from \"./lib/core/codecs/codec-pool.js\";\n\nconfigure({ Deflate, Inflate });\n\nexport {\n\tfs,\n\tconfigure,\n\tinitShimAsyncCodec,\n\tZipReader,\n\tZipWriter,\n\tReader,\n\tWriter,\n\tTextReader,\n\tTextWriter,\n\tData64URIReader,\n\tData64URIWriter,\n\tBlobReader,\n\tBlobWriter,\n\tHttpReader,\n\tHttpRangeReader,\n\tUint8ArrayWriter,\n\tUint8ArrayReader,\n\tERR_HTTP_RANGE,\n\tERR_BAD_FORMAT,\n\tERR_EOCDR_NOT_FOUND,\n\tERR_EOCDR_ZIP64_NOT_FOUND,\n\tERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,\n\tERR_CENTRAL_DIRECTORY_NOT_FOUND,\n\tERR_LOCAL_FILE_HEADER_NOT_FOUND,\n\tERR_EXTRAFIELD_ZIP64_NOT_FOUND,\n\tERR_ENCRYPTED,\n\tERR_UNSUPPORTED_ENCRYPTION,\n\tERR_UNSUPPORTED_COMPRESSION,\n\tERR_INVALID_SIGNATURE,\n\tERR_INVALID_PASSWORD,\n\tERR_DUPLICATED_NAME,\n\tERR_INVALID_COMMENT,\n\tERR_INVALID_ENTRY_NAME,\n\tERR_INVALID_ENTRY_COMMENT,\n\tERR_INVALID_VERSION,\n\tERR_INVALID_EXTRAFIELD_TYPE,\n\tERR_INVALID_EXTRAFIELD_DATA,\n\tERR_INVALID_ENCRYPTION_STRENGTH,\n\tERR_UNSUPPORTED_FORMAT,\n\tERR_ABORT\n} from \"./lib/zip-fs.js\";\nexport { getMimeType, terminateWorkers };","// src/utils/ArrayUtils.ts\r\nvar ArrayUtils = class {\r\n /**returns the last element of an Array where the condition is true. If no\r\n * elements match, null is returned\r\n */\r\n static lastWhere(items, condition, thisObj) {\r\n if (!items) {\r\n return null;\r\n }\r\n if (thisObj) {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (condition.call(thisObj, items[i])) {\r\n return items[i];\r\n }\r\n }\r\n } else {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (condition(items[i])) {\r\n return items[i];\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n /**returns the index of the last element of an Array where the condition is\r\n * true. If no elements match, -1 is returned\r\n */\r\n static lastIndexWhere(items, condition, thisObj) {\r\n if (!items) {\r\n return null;\r\n }\r\n if (thisObj) {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (condition.call(thisObj, items[i])) {\r\n return i;\r\n }\r\n }\r\n } else {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (condition(items[i])) {\r\n return i;\r\n }\r\n }\r\n }\r\n return -1;\r\n }\r\n static removeWhere(items, condition, thisObj) {\r\n if (!items) {\r\n return;\r\n }\r\n if (thisObj) {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (condition.call(thisObj, items[i])) {\r\n items.splice(i, 1);\r\n }\r\n }\r\n } else {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (condition(items[i])) {\r\n items.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n /**removes the first occurance of @item from the @array .\r\n * @returns true if an item was removed.\r\n */\r\n static remove(item, array) {\r\n let idx = array.indexOf(item);\r\n if (idx !== -1) {\r\n array.splice(idx, 1);\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n};\r\n\r\n// src/utils/BrowserUtils.ts\r\nvar BrowserUtils = class {\r\n static isSafari() {\r\n let uagent = window.navigator.userAgent.toLowerCase();\r\n return uagent.indexOf(\"safari\") !== -1 && uagent.indexOf(\"chrome\") === -1 && uagent.indexOf(\"android\") === -1;\r\n }\r\n static isMobile() {\r\n let u = window.navigator.userAgent.toLowerCase();\r\n return u.includes(\"android\") || u.includes(\"webos\") || u.includes(\"iphone\") || u.includes(\"ipad\") || u.includes(\"ipod\") || u.includes(\"blackberry\") || u.includes(\"windows phone\");\r\n }\r\n static isiOS() {\r\n let u = window.navigator.userAgent.toLowerCase();\r\n return u.includes(\"iphone\") || u.includes(\"ipad\") || u.includes(\"ipod\");\r\n }\r\n static isAndroid() {\r\n let u = window.navigator.userAgent.toLowerCase();\r\n return u.includes(\"android\");\r\n }\r\n /**returns the query parameters in the URL - use .get() to retrieve a value\r\n * by name*/\r\n static getQueryParams() {\r\n return new URLSearchParams(location.search);\r\n }\r\n /**returns the string value of the query parameter matching the passed in \r\n * name. if url is left null, window.location is used.*/\r\n static getQueryParam(paramName, url) {\r\n if (url) {\r\n let idx = url.indexOf(\"?\");\r\n if (idx === -1) {\r\n return null;\r\n }\r\n return new URLSearchParams(url.slice(idx)).get(paramName);\r\n } else {\r\n return new URLSearchParams(location.search).get(paramName);\r\n }\r\n }\r\n /**returns the number value of an integer value from the query string. If \r\n * the value doesn't exist or fails to convert as an number, null is returned.\r\n * If you don't specify params, [Uri.base.queryParameters] is used.*/\r\n static getQueryParamInt(paramName, params = null) {\r\n if (params == null)\r\n params = new URLSearchParams(location.search);\r\n let param = params.get(paramName);\r\n if (param == null)\r\n return null;\r\n try {\r\n return Number.parseInt(param);\r\n } catch (err) {\r\n return null;\r\n }\r\n }\r\n /**constructs and returns a new query string after removing and adding\r\n * the requested parameters. This does not update the browser URL (use\r\n * something like window.history.replaceState({\"page\":\"pageName\"}, \"\", \r\n * \"./qstring\") to achieve this). If there are no query parameters (or\r\n * all are removed), \"\" is returned. Note, this will remove any duplicate\r\n * parameters from the qstring. If you add a value that's already in\r\n * the query string, it will be updated instead of added.*/\r\n static getUpdatedQueryString(paramsToRemove, paramsToAdd) {\r\n let qstring;\r\n if (paramsToAdd != null) {\r\n for (let key of paramsToAdd.keys()) {\r\n if (qstring == null) {\r\n qstring = `?${key}=${paramsToAdd.get(key)}`;\r\n } else {\r\n qstring += `&${key}=${paramsToAdd.get(key)}`;\r\n }\r\n }\r\n }\r\n let params = new URLSearchParams(location.search);\r\n for (let key of params.keys()) {\r\n if ((paramsToRemove == null || paramsToRemove.indexOf(key) === -1) && (paramsToAdd == null || !paramsToAdd.has(key))) {\r\n if (qstring == null) {\r\n qstring = `?${key}=${params.get(key)}`;\r\n } else {\r\n qstring += `&${key}=${params.get(key)}`;\r\n }\r\n }\r\n }\r\n return qstring ?? \"\";\r\n }\r\n /**constructs and returns a new query string. If there are no query \r\n * parameters, \"\" is returned. If a key in the params is mapped to a null\r\n * value, that key/value pair is omitted.*/\r\n static buildQueryString(params) {\r\n let qstring;\r\n if (params != null) {\r\n for (let key of params.keys()) {\r\n if (params.get(key) == null) {\r\n continue;\r\n }\r\n if (qstring == null) {\r\n qstring = `?${key}=${params.get(key)}`;\r\n } else {\r\n qstring += `&${key}=${params.get(key)}`;\r\n }\r\n }\r\n }\r\n return qstring ?? \"\";\r\n }\r\n /**returns the folder path portion of a url that points to a file. If\r\n * the path includes no slashes, a single \"/\" is returned.*/\r\n static getFolderPathToFile(fileUrl) {\r\n let i = fileUrl.lastIndexOf(\"/\");\r\n if (i < 0)\r\n i = fileUrl.lastIndexOf(\"\\\\\");\r\n if (i >= 0)\r\n return fileUrl.substring(0, i + 1);\r\n return \"/\";\r\n }\r\n};\r\n\r\n// src/utils/CompressionUtils.ts\r\nimport {\r\n BlobReader,\r\n BlobWriter,\r\n TextReader,\r\n TextWriter,\r\n Uint8ArrayReader,\r\n ZipReader,\r\n ZipWriter\r\n} from \"@zip.js/zip.js\";\r\n\r\n// src/utils/ConversionUtils.ts\r\nvar ConversionUtils = class _ConversionUtils {\r\n static getUint8ArrayFromArrayBuffer(buffer) {\r\n return new Uint8Array(buffer);\r\n }\r\n static getBlobFromArrayBuffer(buffer, type = null) {\r\n let array = _ConversionUtils.getUint8ArrayFromArrayBuffer(buffer);\r\n return type == null ? new Blob([array]) : new Blob([array], { type });\r\n }\r\n static async getUint8ArrayFromBlob(blob) {\r\n return new Promise((resolve, reject) => {\r\n _ConversionUtils.getArrayBufferFromBinaryBlob(blob).then((buffer) => {\r\n let array = _ConversionUtils.getUint8ArrayFromArrayBuffer(\r\n buffer\r\n );\r\n resolve(array);\r\n }).catch((err) => {\r\n reject(err);\r\n });\r\n });\r\n }\r\n static getNumberArrayFromUint8Array(uint8Array) {\r\n return Array.from(uint8Array);\r\n }\r\n /**returns a string decoded from a decompressed Uint8Array. */\r\n static getStringFromUint8Array(array) {\r\n return new TextDecoder().decode(array);\r\n }\r\n static getUint8ArrayFromString(text) {\r\n return new TextEncoder().encode(text);\r\n }\r\n /**returns a string read from a Blob (File extends Blob and also works) */\r\n static getStringFromTextBlob(blob, encoding = \"UTF-8\") {\r\n return new Promise((resolve, reject) => {\r\n let reader = new FileReader();\r\n reader.onload = (_) => {\r\n resolve(reader.result);\r\n };\r\n reader.onerror = (ev) => {\r\n reject(ev.toString());\r\n };\r\n reader.readAsText(blob, encoding);\r\n });\r\n }\r\n /**returns an ArrayBuffer read from a Blob (File extends Blob and also\r\n * works) */\r\n static getArrayBufferFromBinaryBlob(blob) {\r\n return new Promise((resolve, reject) => {\r\n let reader = new FileReader();\r\n reader.onload = (_) => {\r\n resolve(reader.result);\r\n };\r\n reader.onerror = (ev) => {\r\n reject(ev.toString());\r\n };\r\n reader.readAsArrayBuffer(blob);\r\n });\r\n }\r\n};\r\n\r\n// src/utils/CompressionUtils.ts\r\nvar CompressionUtils = {\r\n // https://gildas-lormeau.github.io/zip.js/core-api.html\r\n /**\r\n * \r\n * @param files A Map of filename/blob pairs\r\n * @param compression A value from 0 (no compression) to 9. 5 is default\r\n * @returns A Zip blob\r\n */\r\n async zipBlobs(files, compression = 5) {\r\n try {\r\n let blobWriter = new BlobWriter(\"application/zip\");\r\n let zipWriter = new ZipWriter(blobWriter);\r\n for (let fileName of files.keys()) {\r\n let textReader = new BlobReader(files.get(fileName));\r\n await zipWriter.add(fileName, textReader, {\r\n level: compression\r\n });\r\n }\r\n await zipWriter.close();\r\n let blob = blobWriter.getData();\r\n return blob;\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n },\r\n /**\r\n * Decompresses a zip file to a collection of Entry objects\r\n * @param file a Blob, ArrayBuffer or Uint8Array of a compressed zip file\r\n * @returns an array of Entry objects\r\n */\r\n async unzip(file) {\r\n try {\r\n let reader;\r\n if (file instanceof Blob) {\r\n reader = new BlobReader(file);\r\n } else if (file instanceof ArrayBuffer) {\r\n let array = ConversionUtils.getUint8ArrayFromArrayBuffer(file);\r\n reader = new Uint8ArrayReader(array);\r\n } else if (file instanceof Uint8Array) {\r\n reader = new Uint8ArrayReader(file);\r\n }\r\n let zipReader = new ZipReader(reader);\r\n let entries = await zipReader.getEntries();\r\n await zipReader.close();\r\n return entries;\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n },\r\n async unzipToUint8Array(compressed) {\r\n try {\r\n let reader = new Uint8ArrayReader(compressed);\r\n await reader.init();\r\n let decompressed = await reader.readUint8Array(\r\n 0,\r\n compressed.length\r\n );\r\n return decompressed;\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n },\r\n async getStringFromEntry(entry) {\r\n try {\r\n let writer = new TextWriter();\r\n let text = await entry.getData(writer);\r\n return text;\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n },\r\n async getBlobFromEntry(entry) {\r\n try {\r\n let writer = new BlobWriter();\r\n let blob = await entry.getData(writer);\r\n return blob;\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n },\r\n /**\r\n *creates a [Blob] object of a text string after compressing it with\r\n *ZIP compression.\r\n */\r\n async createZipFileFromString(text, uncompressedName = \"file.txt\") {\r\n try {\r\n let blobWriter = new BlobWriter(\"application/zip\");\r\n let zipWriter = new ZipWriter(blobWriter);\r\n let textReader = new TextReader(text);\r\n await zipWriter.add(uncompressedName, textReader);\r\n await zipWriter.close();\r\n let blob = blobWriter.getData();\r\n return blob;\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n },\r\n /**converts a [html.Blob] object that was zip compressed into its string\r\n * contents. This is the counterpart to [createZipFileFromString].*/\r\n async getStringFromZipBlob(zipBlob) {\r\n let entries = await CompressionUtils.unzip(zipBlob);\r\n if (entries != null) {\r\n let text = await CompressionUtils.getStringFromEntry(entries[0]);\r\n return text;\r\n }\r\n }\r\n};\r\n\r\n// src/utils/JsonUtils.ts\r\nvar JsonUtils = class {\r\n static decode(source) {\r\n try {\r\n return JSON.parse(source);\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n }\r\n static decodeAsList(source) {\r\n try {\r\n return JSON.parse(source);\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n }\r\n static decodeAsMapOfStringKeys(source) {\r\n try {\r\n return JSON.parse(source);\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n }\r\n static encode(value) {\r\n try {\r\n return JSON.stringify(value);\r\n } catch (err) {\r\n console.log(err);\r\n return null;\r\n }\r\n }\r\n static jsArrayToArray(array) {\r\n let list = [];\r\n for (let el of array) {\r\n list.push(el);\r\n }\r\n return list;\r\n }\r\n};\r\n\r\n// src/utils/StringUtils.ts\r\nvar StringUtils = class {\r\n static isString(obj) {\r\n return typeof obj === \"string\" || obj instanceof String;\r\n }\r\n static generateRandomString(length) {\r\n var result = \"\";\r\n var characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n let numCharacters = characters.length;\r\n for (let i = 0; i < length; i++) {\r\n let idx = Math.trunc(Math.random() * numCharacters);\r\n result += characters[idx];\r\n }\r\n return result;\r\n }\r\n /**returns true if @str IS null or undefined but NOT empty */\r\n static isNull(str) {\r\n return str == null;\r\n }\r\n /**returns true if @str is NOT null but IS empty */\r\n static isEmpty(str) {\r\n return str != null && str.length === 0;\r\n }\r\n /**returns true if @str is null, undefined or empty */\r\n static isNullOrEmpty(str) {\r\n return !str || str.length === 0;\r\n }\r\n /**returns true if @str is not null or undefined (but may be empty) */\r\n static isNotNull(str) {\r\n return str != null;\r\n }\r\n /**returns true if @str is not null, undefined or empty. If false, it is\r\n * empty or null/undefined. */\r\n static isNotEmpty(str) {\r\n return str != null && str.length > 0;\r\n }\r\n};\r\n\r\n// src/utils/dtos.ts\r\nvar IDTO = class {\r\n};\r\nvar RdtoMessage = class {\r\n};\r\nRdtoMessage.ALREADY_EXISTS = \"already exists\";\r\nRdtoMessage.NOT_FOUND = \"not found\";\r\nRdtoMessage.SERVER_ERROR = \"server error\";\r\nRdtoMessage.UNAUTHORIZED = \"unauthorized\";\r\nvar RDTO = class {\r\n constructor(json, generator) {\r\n /**set to true if the response JSON was properly formatted */\r\n this.success = false;\r\n /**/\r\n //////////do not use these for public API//////////////*/\r\n // ignore: unused_field\r\n this._jsonParsed = false;\r\n this._generator = generator;\r\n if (json != null) {\r\n let isString = StringUtils.isString(json);\r\n let jsonMap = isString ? JsonUtils.decode(json) : json;\r\n this._parse(jsonMap);\r\n }\r\n }\r\n _parse(json) {\r\n if (json == null || !(\"success\" in json)) {\r\n return;\r\n }\r\n this._jsonParsed = true;\r\n this.success = json[\"success\"];\r\n this.message = json[\"message\"];\r\n if (this.success && \"data\" in json) {\r\n let dataValue = json[\"data\"];\r\n if (StringUtils.isString(dataValue)) {\r\n dataValue = JsonUtils.decode(dataValue);\r\n if (dataValue == null) {\r\n console.log(`invalid json object?: ${dataValue}`);\r\n return;\r\n }\r\n }\r\n if (dataValue instanceof Array) {\r\n this.dataList = [];\r\n for (let d of dataValue) {\r\n let dto = this._generator();\r\n dto.parse(d);\r\n this.dataList.push(dto);\r\n }\r\n } else {\r\n this.data = this._generator();\r\n this.data.parse(dataValue);\r\n }\r\n }\r\n }\r\n};\r\nvar MarkerRDTO = class extends RDTO {\r\n constructor(json, generator) {\r\n super(json, generator);\r\n }\r\n _parse(json) {\r\n super._parse(json);\r\n if (json != null) {\r\n this.marker = json[\"marker\"];\r\n }\r\n }\r\n};\r\nvar EmptyDTO = class extends IDTO {\r\n parse(json) {\r\n }\r\n};\r\n\r\n// src/utils/geometry.ts\r\nvar Point = class {\r\n constructor(x, y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n};\r\n\r\n// src/utils/HtmlUtils.ts\r\nvar HtmlUtils = class {\r\n /**removes all Option elements from a Select element */\r\n static removeOptionsFromSelect(el) {\r\n for (let i = el.options.length - 1; i >= 0; i--) {\r\n el.options[i].remove();\r\n }\r\n }\r\n};\r\n\r\n// src/utils/HttpUtils.ts\r\nvar HttpUtils = class _HttpUtils {\r\n static get(url, {\r\n userToken = null,\r\n responseType = \"text\"\r\n }) {\r\n return new Promise((resolve, reject) => {\r\n let request = new XMLHttpRequest();\r\n request.open(\"GET\", url);\r\n if (userToken) {\r\n request.setRequestHeader(\r\n \"Authorization\",\r\n `Bearer ${userToken}`\r\n );\r\n }\r\n request.responseType = responseType;\r\n request.onload = (e) => {\r\n request.onload = null;\r\n request.onerror = null;\r\n resolve(request);\r\n };\r\n request.onerror = (e) => {\r\n request.onload = null;\r\n request.onerror = null;\r\n reject(request);\r\n };\r\n request.send();\r\n });\r\n }\r\n /**Shortcut method for retrieving string content from GET call. If the\r\n * request fails, null is returned*/\r\n static async getString(url, userToken = null) {\r\n try {\r\n let request = await _HttpUtils.get(url, {\r\n userToken,\r\n responseType: \"text\"\r\n });\r\n return request.responseText;\r\n } catch (err) {\r\n return null;\r\n }\r\n }\r\n /**Shortcut method for retrieving binary content from GET call. If the\r\n * request fails, null is returned*/\r\n static async getArrayBuffer(url, userToken = null) {\r\n try {\r\n let request = await _HttpUtils.get(url, {\r\n userToken,\r\n responseType: \"arraybuffer\"\r\n });\r\n return request.response;\r\n } catch (err) {\r\n return null;\r\n }\r\n }\r\n /**Performs a post operation as multipart/form-data if [formData] is\r\n * specified or as application/json content if either a JSON encoded string \r\n * or [dynamic] object is specified for the [json] parameter. The \r\n * [userToken] can be used to set a JWT token for authorization. The\r\n * [responseType] should be one of the following:\r\n * 'text' (default), 'arraybuffer', 'blob', 'document', 'json'.\r\n * [method] should be either \"POST\" (default), \"PUT\" or \"PATCH\". Any other\r\n * value will throw an error.\r\n * returns a [Promise] that resolves to the [XMLHttpRequest] upon \r\n * completion.*/\r\n static post(url, {\r\n formData = null,\r\n json = null,\r\n userToken = null,\r\n responseType = \"text\",\r\n method = \"POST\"\r\n }) {\r\n if (method !== \"POST\" && method != \"PUT\" && method != \"PATCH\") {\r\n throw 'method must be \"POST\", \"PATCH\" or \"PUT\"';\r\n }\r\n return new Promise((resolve, reject) => {\r\n let encodedJson;\r\n if (json != null) {\r\n encodedJson = StringUtils.isString(json) ? json : JsonUtils.encode(json);\r\n }\r\n let request = new XMLHttpRequest();\r\n request.open(method, url);\r\n if (userToken) {\r\n request.setRequestHeader(\r\n \"Authorization\",\r\n `Bearer ${userToken}`\r\n );\r\n }\r\n if (encodedJson) {\r\n request.setRequestHeader(\r\n \"Content-Type\",\r\n \"application/json; charset=UTF-8\"\r\n );\r\n }\r\n request.responseType = responseType;\r\n request.onload = (e) => {\r\n request.onload = null;\r\n request.onerror = null;\r\n resolve(request);\r\n };\r\n request.onerror = (e) => {\r\n request.onload = null;\r\n request.onerror = null;\r\n reject(request);\r\n };\r\n request.send(formData ?? encodedJson);\r\n });\r\n }\r\n static delete(url, {\r\n userToken = null,\r\n responseType = \"text\"\r\n }) {\r\n return new Promise((resolve, reject) => {\r\n let request = new XMLHttpRequest();\r\n request.open(\"DELETE\", url);\r\n if (userToken) {\r\n request.setRequestHeader(\r\n \"Authorization\",\r\n `Bearer ${userToken}`\r\n );\r\n }\r\n request.responseType = responseType;\r\n request.onload = (e) => {\r\n request.onload = null;\r\n request.onerror = null;\r\n resolve(request);\r\n };\r\n request.onerror = (e) => {\r\n request.onload = null;\r\n request.onerror = null;\r\n reject(request);\r\n };\r\n request.send();\r\n });\r\n }\r\n static parseQueryString(queryString = window.location.search) {\r\n const searchParams = new URLSearchParams(queryString);\r\n const params = {};\r\n for (const [key, value] of searchParams.entries()) {\r\n if (params.hasOwnProperty(key)) {\r\n if (Array.isArray(params[key])) {\r\n params[key].push(value);\r\n } else {\r\n params[key] = [params[key], value];\r\n }\r\n } else {\r\n params[key] = value;\r\n }\r\n }\r\n return params;\r\n }\r\n};\r\n\r\n// src/utils/IdxDbManager.ts\r\nvar IdxDbManager = class _IdxDbManager {\r\n /**example of [_config]\r\n * ```\r\n * {\r\n * \t//a unique db name within this domain (could have multiple)\r\n * \t\"dbName\": \"odogyDb\", \r\n * \t//increment when creating/changing objectstores\r\n * \t\"version\": 1, \r\n * \t//will remove/recreate stores on version increment\r\n * \t\"deleteOldVersionStores\": false,\r\n * \t//similar to tables\r\n * \t\"objectStores\": [ \r\n * \t\t{\r\n * \t\t\t//unique name for this store\r\n * \t\t\t\"name\": \"soundfonts\",\r\n * \t\t\t//primary key name - used in operations\r\n * \t\t\t\"keypath\": \"id\",\r\n * \t\t\t//optionally automatically generate/increment that prim key\r\n * \t\t\t\"autoIncrement\": false\r\n * \t\t\t//similar to additional table columns\r\n * \t\t\t\"indexes\": [\r\n * \t\t\t\t{\r\n * \t\t\t\t\t\"name\" : \"version\",\r\n * \t\t\t\t\t\"keypath\" : \"version\",\r\n * \t\t\t\t\t\"unique\" : false\r\n * \t\t\t\t},\r\n * \t\t\t\t{\r\n * \t\t\t\t\t\"name\" : \"blob\",\r\n * \t\t\t\t\t\"keypath\" : \"blob\",\r\n * \t\t\t\t\t\"unique\" : false\r\n * \t\t\t\t},\r\n * \t\t\t\t//additional columns\r\n * \t\t\t]\r\n * \t\t},\r\n * \t\t//additional object stores\r\n * \t]\r\n * };\r\n * ```*/\r\n constructor(config) {\r\n this._dbState = 1 /* closed */;\r\n this._initializeDatabase = (e) => {\r\n let request = e.target;\r\n let db = request.result;\r\n let deleteOld = this._config[\"deleteOldVersionStores\"];\r\n for (let os of this._config[\"objectStores\"]) {\r\n if (db.objectStoreNames.contains(os[\"name\"])) {\r\n if (deleteOld) {\r\n db.deleteObjectStore(os[\"name\"]);\r\n } else {\r\n continue;\r\n }\r\n }\r\n let autoIncrement = os[\"autoIncrement\"] === true;\r\n let store = db.createObjectStore(os[\"name\"], {\r\n keyPath: os[\"keypath\"],\r\n autoIncrement\r\n });\r\n for (let idx of os[\"indexes\"]) {\r\n store.createIndex(idx[\"name\"], idx[\"keypath\"], {\r\n unique: idx[\"unique\"]\r\n });\r\n }\r\n }\r\n };\r\n this._config = config;\r\n if (!window.indexedDB) {\r\n window.indexedDB = window.webkitIndexedDB || window.mozIndexedDB;\r\n }\r\n if (!window.IDBTransaction) {\r\n window.IDBTransaction = //@ts-ignore\r\n window.webkitIDBTransaction || window.msIDBTransaction;\r\n }\r\n if (!window.IDBKeyRange) {\r\n window.IDBKeyRange = //@ts-ignore\r\n window.webkitIDBKeyRange || window.msIDBKeyRange;\r\n }\r\n }\r\n /**Opens a database for operations. This must be called before using\r\n * other methods in the [IdxDbManager].*/\r\n open() {\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n if (!_IdxDbManager.isSupported) {\r\n response.success = false;\r\n response.error = \"IndexedDb not supported.\";\r\n resolve(response);\r\n }\r\n let openRequest = window.indexedDB.open(\r\n this._config[\"dbName\"],\r\n this._config[\"version\"]\r\n );\r\n openRequest.onerror = (e) => {\r\n openRequest.onerror = null;\r\n openRequest.onsuccess = null;\r\n response.error = openRequest.error;\r\n response.success = false;\r\n resolve(response);\r\n };\r\n openRequest.onsuccess = (e) => {\r\n openRequest.onerror = null;\r\n openRequest.onsuccess = null;\r\n this._db = openRequest.result;\r\n this._dbState = 0 /* open */;\r\n this._loadFromDb();\r\n response.success = true;\r\n resolve(response);\r\n };\r\n openRequest.addEventListener(\r\n \"upgradeneeded\",\r\n this._initializeDatabase\r\n );\r\n });\r\n }\r\n /**Adds a new record to an object store. For example, to an object store\r\n * called 'soundfonts' (the [objectStoreName]) we might add this [record]:\r\n * ```\r\n * \t{ \r\n * \t\t\"id\": \"gUserGsOgg\", \r\n * \t\t\"filename\": \"gUserGsMS1442_ogg.zip\",\r\n * \t\t\"version\": _soundfontVersion,\r\n * \t\t\"blob\": blob\r\n * \t}\r\n * ```*/\r\n addRecord(objectStoreName, record) {\r\n if (this._dbState !== 0 /* open */)\r\n throw \"Call IdxDbManager.open() before using methods to add or manipulate records\";\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n try {\r\n let transaction = this._db.transaction(\r\n objectStoreName,\r\n \"readwrite\"\r\n );\r\n let objectStore = transaction.objectStore(objectStoreName);\r\n let request = objectStore.add(record);\r\n this._awaitTransactionResult(transaction, request).then((_) => {\r\n response.addedKey = request.result;\r\n response.record = record;\r\n response.success = true;\r\n resolve(response);\r\n }).catch((err) => {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n });\r\n } catch (err) {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n }\r\n });\r\n }\r\n /**Updates the contents of a record in an object store. If the record does\r\n * not exist, it is added. */\r\n updateRecord(objectStoreName, record) {\r\n if (this._dbState !== 0 /* open */)\r\n throw \"Call IdxDbManager.open() before using methods to add or manipulate records\";\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n try {\r\n let transaction = this._db.transaction(\r\n objectStoreName,\r\n \"readwrite\"\r\n );\r\n let objectStore = transaction.objectStore(objectStoreName);\r\n let request = objectStore.put(record);\r\n this._awaitTransactionResult(transaction, request).then((_) => {\r\n response.addedKey = request.result;\r\n response.record = record;\r\n response.success = true;\r\n resolve(response);\r\n }).catch((err) => {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n });\r\n } catch (err) {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n }\r\n });\r\n }\r\n /**Removes a record from an object store.*/\r\n deleteRecord(objectStoreName, key) {\r\n if (this._dbState !== 0 /* open */)\r\n throw \"Call IdxDbManager.open() before using methods to add or manipulate records\";\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n try {\r\n let transaction = this._db.transaction(\r\n objectStoreName,\r\n \"readwrite\"\r\n );\r\n let objectStore = transaction.objectStore(objectStoreName);\r\n let request = objectStore.delete(key);\r\n this._awaitTransactionResult(transaction, request).then((_) => {\r\n response.success = true;\r\n resolve(response);\r\n }).catch((err) => {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n });\r\n } catch (err) {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n }\r\n });\r\n }\r\n /**Removes all records from an object store*/\r\n deleteAllRecords(objectStoreName) {\r\n if (this._dbState !== 0 /* open */)\r\n throw \"Call IdxDbManager.open() before using methods to add or manipulate records\";\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n try {\r\n let transaction = this._db.transaction(\r\n objectStoreName,\r\n \"readwrite\"\r\n );\r\n let objectStore = transaction.objectStore(objectStoreName);\r\n let request = objectStore.clear();\r\n this._awaitTransactionResult(transaction, request).then((_) => {\r\n response.success = true;\r\n resolve(response);\r\n }).catch((err) => {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n });\r\n } catch (err) {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n }\r\n });\r\n }\r\n /**Retrieves a record from a store. Get the record from the\r\n * [IdxDbManagerResponse.record] property.*/\r\n getRecord(objectStoreName, key) {\r\n if (this._dbState !== 0 /* open */)\r\n throw \"Call IdxDbManager.open() before using methods to add or manipulate records\";\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n try {\r\n let transaction = this._db.transaction(\r\n objectStoreName,\r\n \"readonly\"\r\n );\r\n let objectStore = transaction.objectStore(objectStoreName);\r\n let request = objectStore.get(key);\r\n this._awaitTransactionResult(transaction, request).then((_) => {\r\n response.record = request.result;\r\n response.success = true;\r\n resolve(response);\r\n }).catch((err) => {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n });\r\n } catch (err) {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n }\r\n });\r\n }\r\n /**Returns an [IdxDbManagerResponse] with the records property holding a\r\n * [List] record objects.*/\r\n getAllRecords(objectStoreName) {\r\n if (this._dbState !== 0 /* open */)\r\n throw \"Call IdxDbManager.open() before using methods to add or manipulate records\";\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n try {\r\n let transaction = this._db.transaction(\r\n objectStoreName,\r\n \"readonly\"\r\n );\r\n let objectStore = transaction.objectStore(objectStoreName);\r\n let request = objectStore.getAll();\r\n this._awaitTransactionResult(transaction, request).then((_) => {\r\n response.records = request.result;\r\n response.success = true;\r\n resolve(response);\r\n }).catch((err) => {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n });\r\n } catch (err) {\r\n response.success = false;\r\n response.error = err;\r\n resolve(response);\r\n }\r\n });\r\n }\r\n closeDatabase() {\r\n if (this._dbState === 0 /* open */) {\r\n this._db.close();\r\n this._dbState = 1 /* closed */;\r\n }\r\n }\r\n /**attempts to remove database. This may not work properly, so consider\r\n * just updating to a new version of the database instead.*/\r\n deleteDatabase(dbName) {\r\n return new Promise((resolve, reject) => {\r\n let response = new IdxDbManagerResponse();\r\n let finish = (success, error) => {\r\n response.success = success;\r\n response.error = error;\r\n resolve(response);\r\n };\r\n try {\r\n if (this._db && this._dbState === 0 /* open */) {\r\n this.closeDatabase();\r\n }\r\n let request = window.indexedDB.deleteDatabase(dbName);\r\n request.onblocked = (e) => {\r\n finish(false, \"database deletion blocked\");\r\n };\r\n request.onerror = (e) => {\r\n finish(false, request.error);\r\n };\r\n request.onsuccess = (e) => {\r\n finish(true);\r\n };\r\n } catch (err) {\r\n finish(false, err);\r\n }\r\n });\r\n }\r\n _loadFromDb() {\r\n }\r\n _awaitTransactionResult(transaction, request) {\r\n return new Promise((resolve, reject) => {\r\n let transactionComplete = false;\r\n let addSuccessful = false;\r\n let checkFinished = () => {\r\n if (transactionComplete && addSuccessful) {\r\n resolve();\r\n }\r\n };\r\n transaction.oncomplete = (e) => {\r\n transactionComplete = true;\r\n checkFinished();\r\n };\r\n transaction.onerror = (e) => {\r\n reject(transaction.error);\r\n };\r\n request.onsuccess = (e) => {\r\n addSuccessful = true;\r\n checkFinished();\r\n };\r\n request.onerror = (e) => {\r\n reject(request.error);\r\n };\r\n });\r\n }\r\n /**returns true if indexedDb is supported in the current browser*/\r\n static get isSupported() {\r\n return !!(window.indexedDB || //@ts-ignore\r\n window.webkitIndexedDB || window.mozIndexedDB);\r\n }\r\n};\r\nvar IdxDbManagerResponse = class {\r\n};\r\n\r\n// src/utils/ts-typed-events.ts\r\nvar BaseEvent = class {\r\n /**\r\n * Marked as protected to discourage creation outside of\r\n * createEventEmitter().\r\n */\r\n constructor() {\r\n /** All the current listeners for this event. */\r\n this.listeners = [];\r\n }\r\n /**\r\n * Attaches a callback to trigger on all emits for this event.\r\n *\r\n * @param callback - The callback to invoke on all emits.\r\n */\r\n on(callback) {\r\n this.listeners.push({\r\n once: false,\r\n callback\r\n });\r\n }\r\n /**\r\n * Attaches a callback to trigger on only the first emit for this event.\r\n *\r\n * This version either takes a callback or returns a promise.\r\n *\r\n * @param callback - Optional callback, if specified invokes the callback\r\n * only once when the event is triggered, then removes it.\r\n * Otherwise returns a promise that resolves with the value the next time\r\n * this event is triggered.\r\n * @returns Nothing if a callback is passed, otherwise a Promise that\r\n * should resolve once this Event emits.\r\n */\r\n once(callback) {\r\n if (!callback) {\r\n const promise = new Promise((resolve) => {\r\n this.once(resolve);\r\n });\r\n this.listeners[this.listeners.length - 1].promise = promise;\r\n return promise;\r\n }\r\n this.listeners.push({\r\n once: true,\r\n callback\r\n });\r\n }\r\n /**\r\n * Removes a callback from this event (regardless of once vs on).\r\n *\r\n * Returns true if a callback was removed, false otherwise.\r\n *\r\n * @param listener - The callback to remove.\r\n * @returns True if a callback was removed, false otherwise.\r\n */\r\n off(listener) {\r\n const originalLength = this.listeners.length;\r\n this.listeners = this.listeners.filter((l) => {\r\n return listener !== l.callback && (!l.promise || listener !== l.promise);\r\n });\r\n if (this.listeners.length < originalLength - 1) {\r\n console.log(\"extra callback registered: \" + listener.toString());\r\n }\r\n return this.listeners.length !== originalLength;\r\n }\r\n /**\r\n * Removes ALL callbacks from this event, regardless of once vs on.\r\n *\r\n * Returns the number of listeners removed.\r\n *\r\n * @returns The number of listeners removed.\r\n */\r\n offAll() {\r\n const originalLength = this.listeners.length;\r\n this.listeners.length = 0;\r\n return originalLength;\r\n }\r\n};\r\nvar SealedEvent = class extends BaseEvent {\r\n // functionally identical to BaseEvent, just a different name to better\r\n // signify its difference from the old `Event`.\r\n};\r\nfunction createEmitterWithBaseEvent(event) {\r\n const publicListenersEvent = event;\r\n function emit(emitting) {\r\n const { listeners } = publicListenersEvent;\r\n const hadListeners = listeners.length > 0;\r\n for (const listener of listeners) {\r\n listener.callback(emitting);\r\n }\r\n publicListenersEvent.listeners = listeners.filter(({ once }) => !once);\r\n return hadListeners;\r\n }\r\n const func = emit;\r\n func.event = event;\r\n func.emit = emit;\r\n const emitter = func;\r\n return emitter;\r\n}\r\nfunction createEmitter() {\r\n const EventClass = SealedEvent;\r\n return createEmitterWithBaseEvent(new EventClass());\r\n}\r\nvar Event = class extends BaseEvent {\r\n /**\r\n * Creates a new Event, with its emit accessible as a member function.\r\n */\r\n constructor() {\r\n super();\r\n /**\r\n * Emits a value to all the listeners, triggering their callbacks.\r\n * Returns true if the event had listeners emitted to,\r\n * false otherwise.\r\n * Because this exists on the event, any code with access to this event\r\n * can trigger the callback for all listeners.\r\n *\r\n * @param emitting - If the Event has a type, this is the data of that type\r\n * to emit to all listeners. If no type (undefined) this argument should\r\n * be omitted.\r\n * @returns True if the event had listeners emitted to, false otherwise.\r\n */\r\n this.emit = createEmitterWithBaseEvent(this);\r\n }\r\n};\r\nfunction createEventEmitter() {\r\n return createEmitterWithBaseEvent(new Event());\r\n}\r\n\r\n// src/utils/ValidationUtils.ts\r\nvar ValidationUtils = class {\r\n static helloWorld() {\r\n console.log(\"hello\");\r\n }\r\n static isValidEmail(email) {\r\n let p2 = String.raw``;\r\n let p = String.raw`^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]` + String.raw`+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.` + String.raw`[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$`;\r\n let regExp = new RegExp(p);\r\n return regExp.test(email);\r\n }\r\n /**Returns true if a string contains only letters, numbers, and these\r\n * characters: ,._-**/\r\n static isValidDisplayName(name) {\r\n let p = /^[a-zA-Z]+[a-zA-Z0-9\\.\\-_' ]+$/;\r\n return p.test(name);\r\n }\r\n /**Returns true if a string starts with a letter and contains only letters\r\n * and numbers.*/\r\n static isValidUsername(name) {\r\n let p = /^[a-zA-Z]+[a-zA-Z0-9]+$/;\r\n return p.test(name);\r\n }\r\n static validatePassword(password, minLength = 8, requireUpperAndLower = true, requireNumbers = true, requireNonAlphas = false) {\r\n let result = new PasswordValidationResult();\r\n result.pass = true;\r\n if (password.length < minLength) {\r\n result.pass = false;\r\n result.message = `Password must be at least ${minLength} characters.`;\r\n }\r\n if (result.pass && requireUpperAndLower) {\r\n let l = /[a-z]+/;\r\n let u = /[A-Z]+/;\r\n if (!l.test(password) || !u.test(password)) {\r\n result.pass = false;\r\n result.message = \"Password must contain upper and lower case letters\";\r\n }\r\n }\r\n if (result.pass && requireNumbers) {\r\n let p = /\\d+/;\r\n if (!p.test(password)) {\r\n result.pass = false;\r\n result.message = \"Password must contain at least one number.\";\r\n }\r\n }\r\n if (result.pass && requireNonAlphas) {\r\n let p = /\\W+/;\r\n if (!p.test(password)) {\r\n result.pass = false;\r\n result.message = \"Password must contain at least one character that isn't a number or letter.\";\r\n }\r\n }\r\n return result;\r\n }\r\n static removeAllHtmlTags(htmlText) {\r\n let p = /<[^>]*>/mg;\r\n return htmlText.replace(p, \"\");\r\n }\r\n};\r\nvar PasswordValidationResult = class {\r\n};\r\nexport {\r\n ArrayUtils,\r\n BaseEvent,\r\n BrowserUtils,\r\n CompressionUtils,\r\n ConversionUtils,\r\n EmptyDTO,\r\n Event,\r\n HtmlUtils,\r\n HttpUtils,\r\n IDTO,\r\n IdxDbManager,\r\n IdxDbManagerResponse,\r\n JsonUtils,\r\n MarkerRDTO,\r\n PasswordValidationResult,\r\n Point,\r\n RDTO,\r\n RdtoMessage,\r\n SealedEvent,\r\n StringUtils,\r\n ValidationUtils,\r\n createEmitter,\r\n createEventEmitter\r\n};\r\n","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BaseEvent = void 0;\n/**\n * Base class for events.\n * Handles attaching and detaching listeners\n */\nvar BaseEvent = /** @class */ (function () {\n function BaseEvent() {\n }\n /**\n * Attach implementation\n */\n BaseEvent.prototype.attach = function (a, b) {\n return this._attach(a, b, false);\n };\n /**\n * Once implementation\n */\n BaseEvent.prototype.once = function (a, b) {\n return this._attach(a, b, true);\n };\n /**\n * Attach / once implementation\n * @param a\n * @param b\n * @param once\n * @returns function you can use for detaching from the event, instead of calling detach()\n */\n BaseEvent.prototype._attach = function (a, b, once) {\n var _this = this;\n var boundTo;\n var handler;\n var event;\n var result;\n if (typeof a === 'function') {\n handler = a;\n result = function () { return _this.detach(handler); };\n }\n else if (!b && typeof a.post === 'function') {\n event = a;\n result = function () { return _this.detach(event); };\n }\n else {\n if (typeof a !== 'object' || a === undefined) {\n throw new Error('Expect a function or object as first argument');\n }\n if (typeof b !== 'function') {\n throw new Error('Expect a function as second argument');\n }\n boundTo = a;\n handler = b;\n result = function () { return _this.detach(boundTo, handler); };\n }\n if (!this._listeners) {\n this._listeners = [];\n }\n else {\n // make a copy of the array so events that are underway have a stable local copy\n // of the listeners array at the time of post()\n this._listeners = this._listeners.slice();\n }\n this._listeners.push({\n deleted: false,\n boundTo: boundTo,\n handler: handler,\n event: event,\n once: once\n });\n return result;\n };\n /**\n * Detach implementation. See the overloads for description.\n */\n BaseEvent.prototype.detach = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n this._detach.apply(this, args);\n };\n /**\n * Detach implementation\n * @param args\n */\n BaseEvent.prototype._detach = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!this._listeners || this._listeners.length === 0) {\n return;\n }\n var boundTo;\n var handler;\n var event;\n if (args.length >= 1) {\n if (typeof (args[0]) === 'function') {\n handler = args[0];\n }\n else if (args.length === 1 && typeof args[0].post === 'function') {\n event = args[0];\n }\n else {\n boundTo = args[0];\n }\n }\n if (args.length >= 2) {\n handler = args[1];\n }\n // remove listeners AND mark them as deleted so subclasses don't send any more events to them\n this._listeners = this._listeners.filter(function (listener) {\n if ((typeof handler === 'undefined' || listener.handler === handler)\n && (typeof event === 'undefined' || listener.event === event)\n && (typeof boundTo === 'undefined' || listener.boundTo === boundTo)) {\n listener.deleted = true;\n return false;\n }\n return true;\n });\n if (this._listeners.length === 0) {\n delete this._listeners;\n }\n };\n /**\n * Abstract post() method to be able to connect any type of event to any other directly\n * @abstract\n */\n BaseEvent.prototype.post = function (data) {\n throw new Error('abstract');\n };\n /**\n * The number of attached listeners\n */\n BaseEvent.prototype.listenerCount = function () {\n return (this._listeners ? this._listeners.length : 0);\n };\n /**\n * Call the given listener, if it is not marked as 'deleted'\n * @param listener The listener to call\n * @param args The arguments to the handler\n */\n BaseEvent.prototype._call = function (listener, args) {\n if (!this._listeners) {\n return;\n }\n if (!listener.deleted) {\n if (listener.once) {\n // remove listeners AND mark as deleted so subclasses don't send any more events to them\n listener.deleted = true;\n this._listeners = this._listeners.filter(function (l) { return l !== listener; });\n if (this._listeners.length === 0) {\n delete this._listeners;\n }\n }\n if (listener.event) {\n listener.event.post.apply(listener.event, args);\n }\n else if (listener.handler) {\n listener.handler.apply((typeof listener.boundTo === 'object' ? listener.boundTo : this), args);\n }\n }\n };\n return BaseEvent;\n}());\nexports.BaseEvent = BaseEvent;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS1ldmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvYmFzZS1ldmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2REFBNkQ7QUFDN0QsZUFBZTtBQUVmLFlBQVksQ0FBQzs7O0FBa0NiOzs7R0FHRztBQUNIO0lBQUE7SUF1TkEsQ0FBQztJQTNMRzs7T0FFRztJQUNJLDBCQUFNLEdBQWIsVUFBYyxDQUE2QyxFQUFFLENBQXFCO1FBQzlFLE9BQU8sSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ3JDLEN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mlyc3QgYXJndW1lbnQnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlb2YgYiAhPT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRXhwZWN0IGEgZnVuY3Rpb24gYXMgc2Vjb25kIGFyZ3VtZW50Jyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBib3VuZFRvID0gYTtcbiAgICAgICAgICAgIGhhbmRsZXIgPSBiO1xuICAgICAgICAgICAgcmVzdWx0ID0gKCkgPT4gdGhpcy5kZXRhY2goYm91bmRUbyEsIGhhbmRsZXIhKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXRoaXMuX2xpc3RlbmVycykge1xuICAgICAgICAgICAgdGhpcy5fbGlzdGVuZXJzID0gW107XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBtYWtlIGEgY29weSBvZiB0aGUgYXJyYXkgc28gZXZlbnRzIHRoYXQgYXJlIHVuZGVyd2F5IGhhdmUgYSBzdGFibGUgbG9jYWwgY29weVxuICAgICAgICAgICAgLy8gb2YgdGhlIGxpc3RlbmVycyBhcnJheSBhdCB0aGUgdGltZSBvZiBwb3N0KClcbiAgICAgICAgICAgIHRoaXMuX2xpc3RlbmVycyA9IHRoaXMuX2xpc3RlbmVycy5zbGljZSgpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2xpc3RlbmVycy5wdXNoKHtcbiAgICAgICAgICAgIGRlbGV0ZWQ6IGZhbHNlLFxuICAgICAgICAgICAgYm91bmRUbyxcbiAgICAgICAgICAgIGhhbmRsZXIsXG4gICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgIG9uY2VcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRGV0YWNoIGFsbCBsaXN0ZW5lcnMgd2l0aCB0aGUgZ2l2ZW4gaGFuZGxlciBmdW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6IGFueVtdKTogdm9pZCB7XG4gICAgICAgIGlmICghdGhpcy5fbGlzdGVuZXJzIHx8IHRoaXMuX2xpc3RlbmVycy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBsZXQgYm91bmRUbzogT2JqZWN0O1xuICAgICAgICBsZXQgaGFuZGxlcjogKGRhdGE6IFQpID0+IHZvaWQ7XG4gICAgICAgIGxldCBldmVudDogUG9zdGFibGU8VD47XG4gICAgICAgIGlmIChhcmdzLmxlbmd0aCA+PSAxKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIChhcmdzWzBdKSA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgICAgICAgIGhhbmRsZXIgPSBhcmdzWzBdO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChhcmdzLmxlbmd0aCA9PT0gMSAmJiB0eXBlb2YgYXJnc1swXS5wb3N0ID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgZXZlbnQgPSBhcmdzWzBdO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBib3VuZFRvID0gYXJnc1swXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoYXJncy5sZW5ndGggPj0gMikge1xuICAgICAgICAgICAgaGFuZGxlciA9IGFyZ3NbMV07XG4gICAgICAgIH1cblxuICAgICAgICAvLyByZW1vdmUgbGlzdGVuZXJzIEFORCBtYXJrIHRoZW0gYXMgZGVsZXRlZCBzbyBzdWJjbGFzc2VzIGRvbid0IHNlbmQgYW55IG1vcmUgZXZlbnRzIHRvIHRoZW1cbiAgICAgICAgdGhpcy5fbGlzdGVuZXJzID0gdGhpcy5fbGlzdGVuZXJzLmZpbHRlcigobGlzdGVuZXI6IExpc3RlbmVyPFQ+KTogYm9vbGVhbiA9PiB7XG4gICAgICAgICAgICBpZiAoKHR5cGVvZiBoYW5kbGVyID09PSAndW5kZWZpbmVkJyB8fCBsaXN0ZW5lci5oYW5kbGVyID09PSBoYW5kbGVyKVxuICAgICAgICAgICAgICAgICYmICh0eXBlb2YgZXZlbnQgPT09ICd1bmRlZmluZWQnIHx8IGxpc3RlbmVyLmV2ZW50ID09PSBldmVudClcbiAgICAgICAgICAgICAgICAmJiAodHlwZW9mIGJvdW5kVG8gPT09ICd1bmRlZmluZWQnIHx8IGxpc3RlbmVyLmJvdW5kVG8gPT09IGJvdW5kVG8pKSB7XG4gICAgICAgICAgICAgICAgbGlzdGVuZXIuZGVsZXRlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmICh0aGlzLl9saXN0ZW5lcnMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBkZWxldGUgdGhpcy5fbGlzdGVuZXJzO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQWJzdHJhY3QgcG9zdCgpIG1ldGhvZCB0byBiZSBhYmxlIHRvIGNvbm5lY3QgYW55IHR5cGUgb2YgZXZlbnQgdG8gYW55IG90aGVyIGRpcmVjdGx5XG4gICAgICogQGFic3RyYWN0XG4gICAgICovXG4gICAgcHVibGljIHBvc3QoZGF0YTogVCk6IHZvaWQge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ2Fic3RyYWN0Jyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIG51bWJlciBvZiBhdHRhY2hlZCBsaXN0ZW5lcnNcbiAgICAgKi9cbiAgICBwdWJsaWMgbGlzdGVuZXJDb3VudCgpOiBudW1iZXIge1xuICAgICAgICByZXR1cm4gKHRoaXMuX2xpc3RlbmVycyA/IHRoaXMuX2xpc3RlbmVycy5sZW5ndGggOiAwKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDYWxsIHRoZSBnaX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tcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobGlzdGVuZXIuaGFuZGxlcikge1xuICAgICAgICAgICAgICAgIGxpc3RlbmVyLmhhbmRsZXIuYXBwbHkoKHR5cGVvZiBsaXN0ZW5lci5ib3VuZFRvID09PSAnb2JqZWN0JyA/IGxpc3RlbmVyLmJvdW5kVG8gOiB0aGlzKSwgYXJncyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbn1cbiJdfQ==","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nvar __extends = (this && this.__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 (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorSyncEvent = exports.VoidSyncEvent = exports.SyncEvent = void 0;\nvar base_event_1 = require(\"./base-event\");\n/**\n * This is a true EventEmitter replacement: the handlers are called synchronously when\n * you post the event.\n * - Allows better error handling by aggregating any errors thrown by handlers.\n * - Prevents livelock by throwing an error when recursion depth is above a maximum.\n * - Handlers are called only for events posted after they were attached.\n * - Handlers are not called anymore when they are detached, even if a post() is in progress\n */\nvar SyncEvent = /** @class */ (function (_super) {\n __extends(SyncEvent, _super);\n function SyncEvent() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Recursive post() invocations\n */\n _this._recursion = 0;\n return _this;\n }\n Object.defineProperty(SyncEvent.prototype, \"evtListenersChanged\", {\n /**\n * Sent when someone attaches or detaches\n */\n get: function () {\n if (!this._listenersChanged) {\n // need to delay-load to avoid stack overflow in constructor\n this._listenersChanged = new VoidSyncEvent();\n }\n return this._listenersChanged;\n },\n enumerable: false,\n configurable: true\n });\n SyncEvent.prototype.post = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!this._listeners || this._listeners.length === 0) {\n return;\n }\n this._recursion++;\n if (typeof SyncEvent.MAX_RECURSION_DEPTH === 'number'\n && Number.isInteger(SyncEvent.MAX_RECURSION_DEPTH)\n && SyncEvent.MAX_RECURSION_DEPTH > 0\n && this._recursion > SyncEvent.MAX_RECURSION_DEPTH) {\n throw new Error('event fired recursively');\n }\n // copy a reference to the array because this._listeners might be replaced during\n // the handler calls\n var listeners = this._listeners;\n for (var i = 0; i < listeners.length; ++i) {\n var listener = listeners[i];\n this._call(listener, args);\n }\n this._recursion--;\n };\n /** @inheritdoc */\n SyncEvent.prototype._attach = function (a, b, once) {\n var _a, _b, _c, _d;\n var count = (_b = (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n var result = _super.prototype._attach.call(this, a, b, once);\n if (this.evtListenersChanged && count !== ((_d = (_c = this._listeners) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)) {\n this.evtListenersChanged.post();\n }\n return result;\n };\n /** @inheritdoc */\n SyncEvent.prototype._detach = function () {\n var _a, _b, _c, _d;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var count = (_b = (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n var result = _super.prototype._detach.apply(this, args);\n if (this.evtListenersChanged && count !== ((_d = (_c = this._listeners) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)) {\n this.evtListenersChanged.post();\n }\n return result;\n };\n /**\n * Maximum number of times that an event handler may cause the same event\n * recursively.\n */\n SyncEvent.MAX_RECURSION_DEPTH = 10;\n return SyncEvent;\n}(base_event_1.BaseEvent));\nexports.SyncEvent = SyncEvent;\n/**\n * Convenience class for events without data\n */\nvar VoidSyncEvent = /** @class */ (function (_super) {\n __extends(VoidSyncEvent, _super);\n function VoidSyncEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Send the event.\n */\n VoidSyncEvent.prototype.post = function () {\n _super.prototype.post.call(this, undefined);\n };\n return VoidSyncEvent;\n}(SyncEvent));\nexports.VoidSyncEvent = VoidSyncEvent;\n/**\n * Similar to 'error' event on EventEmitter: throws when a post() occurs while no handlers set.\n */\nvar ErrorSyncEvent = /** @class */ (function (_super) {\n __extends(ErrorSyncEvent, _super);\n function ErrorSyncEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ErrorSyncEvent.prototype.post = function (data) {\n if (this.listenerCount() === 0) {\n throw new Error(\"error event posted while no listeners attached. Error: \" + data.message);\n }\n _super.prototype.post.call(this, data);\n };\n return ErrorSyncEvent;\n}(SyncEvent));\nexports.ErrorSyncEvent = ErrorSyncEvent;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luYy1ldmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvc3luYy1ldmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2REFBNkQ7QUFDN0QsZUFBZTtBQUVmLFlBQVksQ0FBQzs7Ozs7Ozs7Ozs7Ozs7OztBQUViLDJDQUFpRDtBQUVqRDs7Ozs7OztHQU9HO0FBQ0g7SUFBa0MsNkJBQVk7SUFBOUM7UUFBQSxxRUE0RUM7UUFyREc7O1dBRUc7UUFDSyxnQkFBVSxHQUFXLENBQUMsQ0FBQzs7SUFrRG5DLENBQUM7SUF4RUcsc0JBQVcsMENBQW1CO1FBSDlCOztXQUVHO2FBQ0g7WUFDSSxJQUFJLENBQUMsSUFBSSxDQUFDLGlCQUFpQixFQUFFO2dCQUN6Qiw0REFBNEQ7Z0JBQzVELElBQUksQ0FBQyxpQkFBaUIsR0FB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1YmxpYyBwb3N0KCk6IHZvaWQge1xuICAgICAgICBzdXBlci5wb3N0KHVuZGVmaW5lZCk7XG4gICAgfVxufVxuXG4vKipcbiAqIFNpbWlsYXIgdG8gJ2Vycm9yJyBldmVudCBvbiBFdmVudEVtaXR0ZXI6IHRocm93cyB3aGVuIGEgcG9zdCgpIG9jY3VycyB3aGlsZSBubyBoYW5kbGVycyBzZXQuXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvclN5bmNFdmVudCBleHRlbmRzIFN5bmNFdmVudDxFcnJvcj4ge1xuXG4gICAgcHVibGljIHBvc3QoZGF0YTogRXJyb3IpOiB2b2lkIHtcbiAgICAgICAgaWYgKHRoaXMubGlzdGVuZXJDb3VudCgpID09PSAwKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYGVycm9yIGV2ZW50IHBvc3RlZCB3aGlsZSBubyBsaXN0ZW5lcnMgYXR0YWNoZWQuIEVycm9yOiAke2RhdGEubWVzc2FnZX1gKTtcbiAgICAgICAgfVxuICAgICAgICBzdXBlci5wb3N0KGRhdGEpO1xuICAgIH1cbn1cbiJdfQ==","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar sync_event_1 = require(\"./sync-event\");\n/**\n * Simple synchronous event queue that needs to be drained manually.\n */\nvar EventQueue = /** @class */ (function () {\n function EventQueue() {\n /**\n * SyncEvent triggered after an event is added outside of a flush operation.\n * @param queue The event queue itself\n */\n this.evtFilled = new sync_event_1.SyncEvent();\n /**\n * SyncEvent triggered after the queue is flushed empty\n * @param queue The event queue itself\n */\n this.evtDrained = new sync_event_1.SyncEvent();\n /**\n * Queued elements\n */\n this._queue = [];\n /**\n * True while flush() or flushOnce() is running\n */\n this._flushing = false;\n }\n /**\n * The module-global event queue\n */\n EventQueue.global = function () {\n if (!EventQueue._instance) {\n EventQueue.resetGlobal();\n }\n return EventQueue._instance;\n };\n /**\n * Testing purposes\n */\n EventQueue.resetGlobal = function () {\n EventQueue._instance = new EventQueue();\n };\n /**\n * Returns true iff the queue is empty\n */\n EventQueue.prototype.empty = function () {\n return this._queue.length === 0;\n };\n /**\n * Add an element to the queue. The handler is called when one of the flush\n * methods is called.\n */\n EventQueue.prototype.add = function (handler) {\n this._queue.push(handler);\n if (this._queue.length === 1 && !this._flushing) {\n this.evtFilled.post(this);\n }\n };\n /**\n * Calls all handlers currently in the queue. Does not call any handlers added\n * as a result of the flush\n */\n EventQueue.prototype.flushOnce = function () {\n var empty = (this._queue.length === 0);\n var flushing = this._flushing;\n this._flushing = true;\n try {\n var queue = this._queue;\n this._queue = [];\n for (var i = 0; i < queue.length; ++i) {\n queue[i]();\n }\n }\n finally {\n this._flushing = flushing;\n if (!empty && !flushing && this._queue.length === 0) {\n this.evtDrained.post(this);\n }\n }\n };\n /**\n * Flushes the QueuedEvents, calling all events currently in the queue and those\n * put into the queue as a result of the flush.\n * @param maxRounds Optional, default 10. Number of iterations after which to throw an error because\n * the queue keeps filling up. Set to null to disable this.\n */\n EventQueue.prototype.flush = function (maxRounds) {\n if (maxRounds === void 0) { maxRounds = 10; }\n var empty = (this._queue.length === 0);\n var flushing = this._flushing;\n this._flushing = true;\n try {\n var i = 0;\n while (this._queue.length > 0) {\n if (typeof maxRounds === 'number' && i >= maxRounds) {\n this._queue = [];\n throw new Error('unable to flush the queue due to recursively added event. Clearing queue now');\n }\n this.flushOnce();\n ++i;\n }\n }\n finally {\n this._flushing = flushing;\n if (!empty && !flushing && this._queue.length === 0) {\n this.evtDrained.post(this);\n }\n }\n };\n return EventQueue;\n}());\nexports.default = EventQueue;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZlbnRRdWV1ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvRXZlbnRRdWV1ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2REFB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c7XG4gICAgICAgICAgICBpZiAoIWVtcHR5ICYmICFmbHVzaGluZyAmJiB0aGlzLl9xdWV1ZS5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICB0aGlzLmV2dERyYWluZWQucG9zdCh0aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgRXZlbnRRdWV1ZTtcbiJdfQ==","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nvar __extends = (this && this.__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 (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorQueuedEvent = exports.VoidQueuedEvent = exports.QueuedEvent = void 0;\nvar base_event_1 = require(\"./base-event\");\nvar EventQueue_1 = require(\"./EventQueue\");\nvar sync_event_1 = require(\"./sync-event\");\n/**\n * Event that stays in a queue until you process the queue. Allows fine-grained\n * control over when events happen.\n * - Optionally condenses multiple post() calls into one.\n * - Handlers are called only for events posted after they were attached.\n * - Handlers are not called anymore when they are detached, even if a post() is in progress\n */\nvar QueuedEvent = /** @class */ (function (_super) {\n __extends(QueuedEvent, _super);\n /**\n * Constructor\n * @param opts Optional, an object with the following members:\n * - condensed: a Boolean indicating whether to condense multiple calls to post() into one (default false)\n * - queue: a specific event queue to use. The global EventQueue instance is used if not given.\n */\n function QueuedEvent(opts) {\n if (opts === void 0) { opts = {}; }\n var _this = _super.call(this) || this;\n _this._queued = false;\n _this.options = opts;\n if (typeof opts.condensed === 'boolean') {\n _this._condensed = opts.condensed;\n }\n else {\n _this._condensed = false;\n }\n if (typeof opts.queue === 'object' && opts.queue !== null) {\n _this._queue = opts.queue;\n }\n return _this;\n }\n Object.defineProperty(QueuedEvent.prototype, \"evtListenersChanged\", {\n /**\n * Sent when someone attaches or detaches\n */\n get: function () {\n if (!this._listenersChanged) {\n // need to delay-load to avoid stack overflow in constructor\n this._listenersChanged = new sync_event_1.VoidSyncEvent();\n }\n return this._listenersChanged;\n },\n enumerable: false,\n configurable: true\n });\n QueuedEvent.prototype.post = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!this._listeners || this._listeners.length === 0) {\n return;\n }\n var queue = (this._queue ? this._queue : EventQueue_1.default.global());\n if (this._condensed) {\n this._queuedData = args;\n this._queuedListeners = this._listeners;\n if (this._queued) {\n return;\n }\n else {\n this._queued = true;\n queue.add(function () {\n // immediately mark non-queued to allow new AsyncEvent to happen as result\n // of calling handlers\n _this._queued = false;\n // cache listeners and data because they might change while calling event handlers\n var data = _this._queuedData;\n var listeners = _this._queuedListeners;\n for (var i = 0; i < listeners.length; ++i) {\n var listener = listeners[i];\n _this._call(listener, data);\n }\n });\n }\n }\n else { // not condensed\n var listeners_1 = this._listeners;\n queue.add(function () {\n for (var i = 0; i < listeners_1.length; ++i) {\n var listener = listeners_1[i];\n _this._call(listener, args);\n }\n });\n }\n };\n /** @inheritdoc */\n QueuedEvent.prototype._attach = function (a, b, once) {\n var _a, _b, _c, _d;\n var count = (_b = (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n var result = _super.prototype._attach.call(this, a, b, once);\n if (this.evtListenersChanged && count !== ((_d = (_c = this._listeners) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)) {\n this.evtListenersChanged.post();\n }\n return result;\n };\n /** @inheritdoc */\n QueuedEvent.prototype._detach = function () {\n var _a, _b, _c, _d;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var count = (_b = (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n var result = _super.prototype._detach.apply(this, args);\n if (this.evtListenersChanged && count !== ((_d = (_c = this._listeners) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)) {\n this.evtListenersChanged.post();\n }\n return result;\n };\n return QueuedEvent;\n}(base_event_1.BaseEvent));\nexports.QueuedEvent = QueuedEvent;\n/**\n * Convenience class for events without data\n */\nvar VoidQueuedEvent = /** @class */ (function (_super) {\n __extends(VoidQueuedEvent, _super);\n function VoidQueuedEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Send the event.\n */\n VoidQueuedEvent.prototype.post = function () {\n _super.prototype.post.call(this, undefined);\n };\n return VoidQueuedEvent;\n}(QueuedEvent));\nexports.VoidQueuedEvent = VoidQueuedEvent;\n/**\n * Similar to 'error' event on EventEmitter: throws when a post() occurs while no handlers set.\n */\nvar ErrorQueuedEvent = /** @class */ (function (_super) {\n __extends(ErrorQueuedEvent, _super);\n function ErrorQueuedEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ErrorQueuedEvent.prototype.post = function (data) {\n if (!this._listeners || this._listeners.length === 0) {\n throw new Error(\"error event posted while no listeners attached. Error: \" + data.message);\n }\n _super.prototype.post.call(this, data);\n };\n return ErrorQueuedEvent;\n}(QueuedEvent));\nexports.ErrorQueuedEvent = ErrorQueuedEvent;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVldWVkLWV2ZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9xdWV1ZWQtZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNkRBQTZEO0FBQzdELGVBQWU7QUFFZixZQUFZLENBQUM7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFYiwyQ0F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XMuX3F1ZXVlZCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy5fcXVldWVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBxdWV1ZS5hZGQoKCk6IHZvaWQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAvLyBpbW1lZGlhdGVseSBtYXJrIG5vbi1xdWV1ZWQgdG8gYWxsb3cgbmV3IEFzeW5jRXZlbnQgdG8gaGFwcGVuIGFzIHJlc3VsdFxuICAgICAgICAgICAgICAgICAgICAvLyBvZiBjYWxsaW5nIGhhbmRsZXJzXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3F1ZXVlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAvLyBjYWNoZSBsaXN0ZW5lcnMgYW5kIGRhdGEgYmVjYXVzZSB0aGV5IG1pZ2h0IGNoYW5nZSB3aGlsZSBjYWxsaW5nIGV2ZW50IGhhbmRsZXJzXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGRhdGEgPSB0aGlzLl9xdWV1ZWREYXRhO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0ZW5lcnMgPSB0aGlzLl9xdWV1ZWRMaXN0ZW5lcnM7XG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdGVuZXJzLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0ZW5lciA9IGxpc3RlbmVyc1tpXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2NhbGwobGlzdGVuZXIsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7IC8vIG5vdCBjb25kZW5zZWRcbiAgICAgICAgICAgIGNvbnN0IGxpc3RlbmVycyA9IHRoaXMu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ogJHtkYXRhLm1lc3NhZ2V9YCk7XG4gICAgICAgIH1cbiAgICAgICAgc3VwZXIucG9zdChkYXRhKTtcbiAgICB9XG59XG4iXX0=","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nvar __extends = (this && this.__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 (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorAsyncEvent = exports.VoidAsyncEvent = exports.AsyncEvent = void 0;\nvar base_event_1 = require(\"./base-event\");\nvar sync_event_1 = require(\"./sync-event\");\n/**\n * A-synchronous event. Handlers are called in the next Node.JS cycle.\n * - Optionally condenses multiple post() calls into one (the last post() gets through)\n * - Handlers are called only for events posted after they were attached.\n * - Handlers are not called anymore when they are detached, even if a post() is in progress\n */\nvar AsyncEvent = /** @class */ (function (_super) {\n __extends(AsyncEvent, _super);\n /**\n * Constructor\n * @param opts Optional. Various settings:\n * - condensed: a Boolean indicating whether to condense multiple post() calls within the same cycle.\n */\n function AsyncEvent(opts) {\n if (opts === void 0) { opts = {}; }\n var _this = _super.call(this) || this;\n _this._queued = false;\n _this.options = opts;\n if (typeof opts.condensed === 'boolean') {\n _this._condensed = opts.condensed;\n }\n else {\n _this._condensed = false;\n }\n return _this;\n }\n Object.defineProperty(AsyncEvent.prototype, \"evtListenersChanged\", {\n /**\n * Sent when someone attaches or detaches\n */\n get: function () {\n if (!this._listenersChanged) {\n // need to delay-load to avoid stack overflow in constructor\n this._listenersChanged = new sync_event_1.VoidSyncEvent();\n }\n return this._listenersChanged;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * The default scheduler uses setImmediate() or setTimeout(..., 0) if setImmediate is not available.\n */\n AsyncEvent.defaultScheduler = function (callback) {\n /* istanbul ignore else */\n if (typeof window !== 'undefined') {\n // browsers don't always support setImmediate()\n setTimeout(callback, 0);\n }\n else {\n // node.js\n setImmediate(callback);\n }\n };\n /**\n * By default, AsyncEvent uses setImmediate() to schedule event handler invocation.\n * You can change this for e.g. setTimeout(..., 0) by calling this static method once.\n * @param scheduler A function that takes a callback and executes it in the next Node.JS cycle.\n */\n AsyncEvent.setScheduler = function (scheduler) {\n AsyncEvent._scheduler = scheduler;\n };\n AsyncEvent.prototype.post = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!this._listeners || this._listeners.length === 0) {\n return;\n }\n if (this._condensed) {\n this._queuedData = args;\n this._queuedListeners = this._listeners;\n if (this._queued) {\n return;\n }\n else {\n this._queued = true;\n AsyncEvent._scheduler(function () {\n // immediately mark non-queued to allow new AsyncEvent to happen as result\n // of calling handlers\n _this._queued = false;\n // cache listeners and data because they might change while calling event handlers\n var data = _this._queuedData;\n var listeners = _this._queuedListeners;\n for (var i = 0; i < listeners.length; ++i) {\n var listener = listeners[i];\n _this._call(listener, data);\n }\n });\n }\n }\n else { // not condensed\n var listeners_1 = this._listeners;\n AsyncEvent._scheduler(function () {\n for (var i = 0; i < listeners_1.length; ++i) {\n var listener = listeners_1[i];\n _this._call(listener, args);\n }\n });\n }\n };\n // inherited\n AsyncEvent.prototype._call = function (listener, args) {\n // performance optimization: don't use consecutive nodejs cycles\n // for asyncevents attached to asyncevents\n if (listener.event && listener.event instanceof AsyncEvent) {\n listener.event._postDirect(args);\n }\n else {\n _super.prototype._call.call(this, listener, args);\n }\n };\n /**\n * Performance optimization: if this async signal is attached to another\n * async signal, we're already a the next cycle and we can call listeners\n * directly\n */\n AsyncEvent.prototype._postDirect = function (args) {\n if (!this._listeners || this._listeners.length === 0) {\n return;\n }\n // copy a reference to the array because this._listeners might be replaced during\n // the handler calls\n var listeners = this._listeners;\n for (var i = 0; i < listeners.length; ++i) {\n var listener = listeners[i];\n this._call(listener, args);\n }\n };\n /** @inheritdoc */\n AsyncEvent.prototype._attach = function (a, b, once) {\n var _a, _b, _c, _d;\n var count = (_b = (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n var result = _super.prototype._attach.call(this, a, b, once);\n if (this.evtListenersChanged && count !== ((_d = (_c = this._listeners) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)) {\n this.evtListenersChanged.post();\n }\n return result;\n };\n /** @inheritdoc */\n AsyncEvent.prototype._detach = function () {\n var _a, _b, _c, _d;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var count = (_b = (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n var result = _super.prototype._detach.apply(this, args);\n if (this.evtListenersChanged && count !== ((_d = (_c = this._listeners) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)) {\n this.evtListenersChanged.post();\n }\n return result;\n };\n /**\n * The current scheduler\n */\n AsyncEvent._scheduler = AsyncEvent.defaultScheduler;\n return AsyncEvent;\n}(base_event_1.BaseEvent));\nexports.AsyncEvent = AsyncEvent;\n/**\n * Convenience class for AsyncEvents without data\n */\nvar VoidAsyncEvent = /** @class */ (function (_super) {\n __extends(VoidAsyncEvent, _super);\n function VoidAsyncEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Send the AsyncEvent.\n */\n VoidAsyncEvent.prototype.post = function () {\n _super.prototype.post.call(this, undefined);\n };\n return VoidAsyncEvent;\n}(AsyncEvent));\nexports.VoidAsyncEvent = VoidAsyncEvent;\n/**\n * Similar to 'error' event on EventEmitter: throws when a post() occurs while no handlers set.\n */\nvar ErrorAsyncEvent = /** @class */ (function (_super) {\n __extends(ErrorAsyncEvent, _super);\n function ErrorAsyncEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ErrorAsyncEvent.prototype.post = function (data) {\n if (this.listenerCount() === 0) {\n throw new Error(\"error event posted while no listeners attached. Error: \" + data.message);\n }\n _super.prototype.post.call(this, data);\n };\n return ErrorAsyncEvent;\n}(AsyncEvent));\nexports.ErrorAsyncEvent = ErrorAsyncEvent;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN5bmMtZXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2FzeW5jLWV2ZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZEQUE2RDtBQUM3RCxlQUFlO0FBRWYsWUFBWSxDQUFDOzs7Ozs7Ozs7Ozs7Ozs7O0FBRWIsMkNBQTJEO0FBQzNELDJDQUEyQztBQWEzQzs7Ozs7R0FLRztBQUNIO0lBQW1DLDhCQUFZO0lBdUQzQzs7OztPQUlHO0lBQ0gsb0JBQVksSUFBeUI7UUFBekIscUJBQUEsRUFBQSxTQUF5QjtRQUFyQyxZQUNJLGlCQUFPLFNBT1Y7UUE3Q08sYUFBTyxHQUFZLEtBQUssQ0FBQztRQXVDN0IsS0FBSSxDQUFDLE9BQU8sR0FBRyxJQUFJLENBQUM7UUFDcEIsSUFBSSxPQUFPLElBQUksQ0FBQyxTQUFTLEtBQUssU0FBUyxFQUFFO1lBQ3JDLEtBQUksQ0FBQyxVQUFVLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQztTQUNwQzthQUFNO1lBQ0gsS0FBSSxDQUFDLFVBQVUsR0FBRyxLQUFLLENBQUM7U0FDM0I7O0lBQ0wsQ0FBQztJQWhFRCxzQkFBVywyQ0FBbUI7UUFIOUI7O1dBRUc7YUFDSDtZQUNJLElBQUksQ0FBQyxJQUFJLENBQUMsaUJBQWlCLEVBQUU7Z0JBQ3pCLDREQUE0RDtnQk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Bub24tcXVldWVkIHRvIGFsbG93IG5ldyBBc3luY0V2ZW50IHRvIGhhcHBlbiBhcyByZXN1bHRcbiAgICAgICAgICAgICAgICAgICAgLy8gb2YgY2FsbGluZyBoYW5kbGVyc1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9xdWV1ZWQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgLy8gY2FjaGUgbGlzdGVuZXJzIGFuZCBkYXRhIGJlY2F1c2UgdGhleSBtaWdodCBjaGFuZ2Ugd2hpbGUgY2FsbGluZyBldmVudCBoYW5kbGVyc1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBkYXRhID0gdGhpcy5fcXVldWVkRGF0YTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGlzdGVuZXJzID0gdGhpcy5fcXVldWVkTGlzdGVuZXJzO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3RlbmVycy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbGlzdGVuZXIgPSBsaXN0ZW5lcnNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9jYWxsKGxpc3RlbmVyLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgeyAvLyBub3QgY29uZGVuc2VkXG4gICAgICAgICAgICBjb25zdCBsaXN0ZW5lcnMgPSB0aGlzLl9saXN0ZW5lcnM7XG4gICAgICAgICAgICBBc3luY0V2ZW50Ll9zY2hlZHVsZXIoKCk6IHZvaWQgPT4ge1xuICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdGVuZXJzLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGxpc3RlbmVyID0gbGlzdGVuZXJzW2ldO1xuICAgICAgICAgICAgICAgICAgICB0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Vycm9yKGBlcnJvciBldmVudCBwb3N0ZWQgd2hpbGUgbm8gbGlzdGVuZXJzIGF0dGFjaGVkLiBFcnJvcjogJHtkYXRhLm1lc3NhZ2V9YCk7XG4gICAgICAgIH1cbiAgICAgICAgc3VwZXIucG9zdChkYXRhKTtcbiAgICB9XG59XG4iXX0=","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.shallowEquals = void 0;\nfunction shallowEquals(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n switch (typeof a) {\n case 'boolean':\n case 'number':\n case 'string':\n case 'function':\n case 'symbol':\n case 'undefined':\n // already did === compare\n return false;\n case 'object':\n if (a === null || b === null) {\n return false; // already compared ===\n }\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (var i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n var namesA = [];\n var namesB = [];\n for (var name_1 in a) {\n if (a.hasOwnProperty(name_1)) {\n namesA.push(name_1);\n }\n }\n for (var name_2 in b) {\n if (b.hasOwnProperty(name_2)) {\n namesB.push(name_2);\n }\n }\n namesA.sort();\n namesB.sort();\n if (namesA.join(',') !== namesB.join(',')) {\n return false;\n }\n for (var i = 0; i < namesA.length; ++i) {\n if (a[namesA[i]] !== b[namesA[i]]) {\n return false;\n }\n }\n return true;\n default:\n return false;\n }\n}\nexports.shallowEquals = shallowEquals;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2JqZWN0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvb2JqZWN0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2REFBNkQ7QUFDN0QsZUFBZTtBQUVmLFlBQ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ID09PVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoYSkgfHwgQXJyYXkuaXNBcnJheShiKSkge1xuICAgICAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShhKSB8fCAhQXJyYXkuaXNBcnJheShiKSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChhLmxlbmd0aCAhPT0gYi5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGEubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFbaV0gIT09IGJbaV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IG5hbWVzQTogc3RyaW5nW10gPSBbXTtcbiAgICAgICAgICAgIGNvbnN0IG5hbWVzQjogc3RyaW5nW10gPSBbXTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbmFtZSBpbiBhKSB7XG4gICAgICAgICAgICAgICAgaWYgKGEuaGFzT3duUHJvcGVydHkobmFtZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgbmFtZXNBLnB1c2gobmFtZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm9yIChjb25zdCBuYW1lIGluIGIpIHtcbiAgICAgICAgICAgICAgICBpZiAoYi5oYXNPd25Qcm9wZXJ0eShuYW1lKSkge1xuICAgICAgICAgICAgICAgICAgICBuYW1lc0IucHVzaChuYW1lKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBuYW1lc0Euc29ydCgpO1xuICAgICAgICAgICAgbmFtZXNCLnNvcnQoKTtcbiAgICAgICAgICAgIGlmIChuYW1lc0Euam9pbignLCcpICE9PSBuYW1lc0Iuam9pbignLCcpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBuYW1lc0EubGVuZ3RoOyArK2kpIHtcbiAgICAgICAgICAgICAgICBpZiAoYVtuYW1lc0FbaV1dICE9PSBiW25hbWVzQVtpXV0pIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbn1cbiJdfQ==","// Copyright © 2015 Rogier Schouten\n// License: ISC\n'use strict';\nvar __extends = (this && this.__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 (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorAnyEvent = exports.VoidAnyEvent = exports.AnyEvent = exports.EventType = void 0;\nvar objects_1 = require(\"./objects\");\nvar sync_event_1 = require(\"./sync-event\");\nvar async_event_1 = require(\"./async-event\");\nvar queued_event_1 = require(\"./queued-event\");\nvar EventType;\n(function (EventType) {\n EventType[EventType[\"Sync\"] = 0] = \"Sync\";\n EventType[EventType[\"Async\"] = 1] = \"Async\";\n EventType[EventType[\"Queued\"] = 2] = \"Queued\";\n})(EventType = exports.EventType || (exports.EventType = {}));\n/**\n * An event that behaves like a Sync/Async/Queued event depending on how\n * you subscribe.\n */\nvar AnyEvent = /** @class */ (function () {\n function AnyEvent(opts) {\n /**\n * Underlying event implementations; one for every attach type + opts combination\n */\n this._events = [];\n if (opts && opts.monitorAttach) {\n this.evtFirstAttached = new VoidAnyEvent();\n this.evtLastDetached = new VoidAnyEvent();\n }\n }\n Object.defineProperty(AnyEvent.prototype, \"evtListenersChanged\", {\n /**\n * Sent when someone attaches or detaches\n */\n get: function () {\n if (!this._listenersChanged) {\n // need to delay-load to avoid stack overflow in constructor\n this._listenersChanged = new sync_event_1.VoidSyncEvent();\n }\n return this._listenersChanged;\n },\n enumerable: false,\n configurable: true\n });\n AnyEvent.prototype.attach = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var mode = EventType.Sync;\n if (args.length > 0 && typeof args[0] === 'number') {\n mode = args.shift();\n }\n var boundTo = this; // add ourselves as default 'boundTo' argument\n var handler;\n var opts;\n var postable;\n if (typeof args[0] === 'function' || (args[0] && typeof args[0] === 'object' && typeof args[0].post === 'function')) {\n if (typeof args[0] === 'function') {\n handler = args[0];\n }\n else {\n postable = args[0];\n }\n opts = args[1];\n }\n else {\n boundTo = args[0];\n handler = args[1];\n opts = args[2];\n }\n return this._attach(mode, boundTo, handler, postable, opts, false);\n };\n AnyEvent.prototype.once = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var mode = EventType.Sync;\n if (args.length > 0 && typeof args[0] === 'number') {\n mode = args.shift();\n }\n var boundTo = this; // add ourselves as default 'boundTo' argument\n var handler;\n var opts;\n var postable;\n if (typeof args[0] === 'function' || (args[0] && typeof args[0] === 'object' && typeof args[0].post === 'function')) {\n if (typeof args[0] === 'function') {\n handler = args[0];\n }\n else {\n postable = args[0];\n }\n opts = args[1];\n }\n else {\n boundTo = args[0];\n handler = args[1];\n opts = args[2];\n }\n return this._attach(mode, boundTo, handler, postable, opts, true);\n };\n AnyEvent.prototype._attach = function (mode, boundTo, handler, postable, opts, once) {\n var _this = this;\n var prevCount = (!!this.evtFirstAttached ? this.listenerCount() : 0);\n var event;\n switch (mode) {\n case EventType.Sync:\n {\n for (var _i = 0, _a = this._events; _i < _a.length; _i++) {\n var evt = _a[_i];\n if (evt instanceof sync_event_1.SyncEvent) {\n event = evt;\n }\n }\n if (!event) {\n event = new sync_event_1.SyncEvent();\n this._events.push(event);\n }\n }\n break;\n case EventType.Async:\n {\n for (var _b = 0, _c = this._events; _b < _c.length; _b++) {\n var evt = _c[_b];\n if (evt instanceof async_event_1.AsyncEvent && objects_1.shallowEquals(evt.options, opts)) {\n event = evt;\n }\n }\n if (!event) {\n event = new async_event_1.AsyncEvent(opts);\n this._events.push(event);\n }\n }\n break;\n case EventType.Queued:\n {\n for (var _d = 0, _e = this._events; _d < _e.length; _d++) {\n var evt = _e[_d];\n if (evt instanceof queued_event_1.QueuedEvent && objects_1.shallowEquals(evt.options, opts)) {\n event = evt;\n }\n }\n if (!event) {\n event = new queued_event_1.QueuedEvent(opts);\n this._events.push(event);\n }\n }\n break;\n default:\n throw new Error('unknown EventType');\n }\n var detacher;\n if (once) {\n if (postable) {\n detacher = event.once(postable);\n }\n else {\n detacher = event.once(boundTo, handler);\n }\n }\n else {\n if (postable) {\n detacher = event.attach(postable);\n }\n else {\n detacher = event.attach(boundTo, handler);\n }\n }\n if (this.evtFirstAttached && prevCount === 0) {\n this.evtFirstAttached.post();\n }\n if (this.evtListenersChanged && prevCount !== this.listenerCount()) {\n this.evtListenersChanged.post();\n }\n return function () {\n var prevCount = (!!_this.evtLastDetached ? _this.listenerCount() : 0);\n detacher();\n if (!!_this.evtLastDetached && prevCount > 0 && _this.listenerCount() === 0) {\n _this.evtLastDetached.post();\n }\n if (_this.evtListenersChanged && prevCount !== _this.listenerCount()) {\n _this.evtListenersChanged.post();\n }\n };\n };\n AnyEvent.prototype.attachSync = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args.unshift(EventType.Sync);\n return this.attach.apply(this, args);\n };\n AnyEvent.prototype.onceSync = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args.unshift(EventType.Sync);\n return this.once.apply(this, args);\n };\n AnyEvent.prototype.attachAsync = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args.unshift(EventType.Async);\n return this.attach.apply(this, args);\n };\n AnyEvent.prototype.onceAsync = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args.unshift(EventType.Async);\n return this.once.apply(this, args);\n };\n AnyEvent.prototype.attachQueued = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args.unshift(EventType.Queued);\n return this.attach.apply(this, args);\n };\n AnyEvent.prototype.onceQueued = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args.unshift(EventType.Queued);\n return this.once.apply(this, args);\n };\n /**\n * Detach event handlers regardless of type\n */\n AnyEvent.prototype.detach = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var prevCount = this.listenerCount();\n for (var i = 0; i < this._events.length; ++i) {\n this._events[i].detach.apply(this._events[i], args);\n }\n if (this.evtListenersChanged && prevCount !== this.listenerCount()) {\n this.evtListenersChanged.post();\n }\n if (!!this.evtLastDetached && prevCount > 0 && this.listenerCount() === 0) {\n this.evtLastDetached.post();\n }\n };\n /**\n * Post an event to all current listeners\n */\n AnyEvent.prototype.post = function (data) {\n // make a copy of the array first to cover the case where event handlers\n // are attached during the post\n var events = [];\n for (var i = 0; i < this._events.length; ++i) {\n events.push(this._events[i]);\n }\n for (var i = 0; i < events.length; ++i) {\n events[i].post(data);\n }\n };\n /**\n * The number of attached listeners\n */\n AnyEvent.prototype.listenerCount = function () {\n var result = 0;\n for (var i = 0; i < this._events.length; ++i) {\n result += this._events[i].listenerCount();\n }\n return result;\n };\n return AnyEvent;\n}());\nexports.AnyEvent = AnyEvent;\n/**\n * Convenience class for AnyEvents without data\n */\nvar VoidAnyEvent = /** @class */ (function (_super) {\n __extends(VoidAnyEvent, _super);\n function VoidAnyEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Send the AsyncEvent.\n */\n VoidAnyEvent.prototype.post = function () {\n _super.prototype.post.call(this, undefined);\n };\n return VoidAnyEvent;\n}(AnyEvent));\nexports.VoidAnyEvent = VoidAnyEvent;\n/**\n * Similar to 'error' event on EventEmitter: throws when a post() occurs while no handlers set.\n */\nvar ErrorAnyEvent = /** @class */ (function (_super) {\n __extends(ErrorAnyEvent, _super);\n function ErrorAnyEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ErrorAnyEvent.prototype.post = function (data) {\n if (this.listenerCount() === 0) {\n throw new Error(\"error event posted while no listeners attached. Error: \" + data.message);\n }\n _super.prototype.post.call(this, data);\n };\n return ErrorAnyEvent;\n}(AnyEvent));\nexports.ErrorAnyEvent = ErrorAnyEvent;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW55LWV2ZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9hbnktZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNkRBQTZEO0FBQzdELGVBQWU7QUFFZixZQUFZLENBQUM7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFYixxQ0FBd0M7QUFHeEMsMkNBQXNEO0FBQ3RELDZDQUF5RDtBQUN6RCwrQ0FBNEQ7QUFFNUQsSUFBWSxTQUlYO0FBSkQsV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AgICAgbW9kZTogRXZlbnRUeXBlLFxuICAgICAgICBib3VuZFRvOiBPYmplY3QgfCB1bmRlZmluZWQsXG4gICAgICAgIGhhbmRsZXI6ICgoZGF0YTogVCkgPT4gdm9pZCkgfCB1bmRlZmluZWQsXG4gICAgICAgIHBvc3RhYmxlOiBQb3N0YWJsZTxUPiB8IHVuZGVmaW5lZCxcbiAgICAgICAgb3B0czogQXN5bmNFdmVudE9wdHMgfCBRdWV1ZWRFdmVudE9wdHMgfCB1bmRlZmluZWQsXG4gICAgICAgIG9uY2U6IGJvb2xlYW5cbiAgICApOiAoKSA9PiB2b2lkIHtcbiAgICAgICAgY29uc3QgcHJldkNvdW50ID0gKCEhdGhpcy5ldnRGaXJzdEF0dGFjaGVkID8gdGhpcy5saXN0ZW5lckNvdW50KCkgOiAwKTtcbiAgICAgICAgbGV0IGV2ZW50OiBCYXNlRXZlbnQ8VD4gfCB1bmRlZmluZWQ7XG4gICAgICAgIHN3aXRjaCAobW9kZSkge1xuICAgICAgICAgICAgY2FzZSBFdmVudFR5cGUuU3luYzoge1xuICAgICAgICAgICAgICAgIGZvciAoY29uc3QgZXZ0IG9mIHRoaXMuX2V2ZW50cykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXZ0IGluc3RhbmNlb2YgU3luY0V2ZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudCA9IGV2dDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIWV2ZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50ID0gbmV3IFN5bmNFdmVudDxUPigpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9ldmVudHMucHVzaChldmVudCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBicmVhaztcbiAgICAgICAgICAgIGNhc2UgRXZlbnRUeXBlLkFzeW5jOiB7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBldnQgb2YgdGhpcy5fZXZlbnRzKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChldnQgaW5zdGFuY2VvZiBBc3luY0V2ZW50ICYmIHNoYWxsb3dFcXVhbHMoKDxBc3luY0V2ZW50PFQ+PmV2dCkub3B0aW9ucywgb3B0cykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZXZ0O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICghZXZlbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgQXN5bmNFdmVudDxUPihvcHRzKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fZXZlbnRzLnB1c2goZXZlbnQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEV2ZW50VHlwZS5RdWV1ZWQ6IHtcbiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGV2dCBvZiB0aGlzLl9ldmVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2dCBpbnN0YW5jZW9mIFF1ZXVlZEV2ZW50ICYmIHNoYWxsb3dFcXVhbHMoKDxRdWV1ZWRFdmVudDxUPj5ldnQpLm9wdGlvbnMsIG9wdHMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudCA9IGV2dDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIWV2ZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50ID0gbmV3IFF1ZXVlZEV2ZW50PFQ+KG9wdHMpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9ldmVudHMucHVzaChldmVudCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIEV2ZW50VHlwZScpO1xuICAgICAgICB9XG4gICAgICAgIGxldCBkZXRhY2hlcjogKCkgPT4gdm9pZDtcbiAgICAgICAgaWYgKG9uY2UpIHtcbiAgICAgICAgICAgIGlmIChwb3N0YWJsZSkge1xuICAgICAgICAgICAgICAgIGRldGFjaGVyID0gZXZlbnQub25jZShwb3N0YWJsZSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRldGFjaGVyID0gZXZlbnQub25jZShib3VuZFRvISwgaGFuZGxlciEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKHBvc3RhYmxlKSB7XG4gICAgICAgICAgICAgICAgZGV0YWNoZXIgPSBldmVudC5hdHRhY2gocG9zdGFibGUpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBkZXRhY2hlciA9IGV2ZW50LmF0dGFjaChib3VuZFRvISwgaGFuZGxlciEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLmV2dEZpcnN0QXR0YWNoZWQgJiYgcHJldkNvdW50ID09PSAwKSB7XG4gICAgICAgICAgICB0aGlzLmV2dEZpcnN0QXR0YWNoZWQucG9zdCgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLmV2dExpc3RlbmVyc0NoYW5nZWQgJiYgcHJldkNvdW50ICE9PSB0aGlzLmxpc3RlbmVyQ291bnQoKSkge1xuICAgICAgICAgICAgdGhpcy5ldnRMaXN0ZW5lcnNDaGFuZ2VkLnBvc3QoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gKCk6IHZvaWQgPT4ge1xuICAgICAgICAgICAgY29uc3QgcHJldkNvdW50ID0gKCEhdGhpcy5ldnRMYXN0RGV0YWNoZWQgPyB0aGlzLmxpc3RlbmVyQ291bnQoKSA6IDApO1xuICAgIC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ZXZ0TGlzdGVuZXJzQ2hhbmdlZCAmJiBwcmV2Q291bnQgIT09IHRoaXMubGlzdGVuZXJDb3VudCgpKSB7XG4gICAgICAgICAgICB0aGlzLmV2dExpc3RlbmVyc0NoYW5nZWQucG9zdCgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghIXRoaXMuZXZ0TGFzdERldGFjaGVkICYmIHByZXZDb3VudCA+IDAgJiYgdGhpcy5saXN0ZW5lckNvdW50KCkgPT09IDApIHtcbiAgICAgICAgICAgIHRoaXMuZXZ0TGFzdERldGFjaGVkLnBvc3QoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFBvc3QgYW4gZXZlbnQgdG8gYWxsIGN1cnJlbnQgbGlzdGVuZXJzXG4gICAgICovXG4gICAgcHVibGljIHBvc3QoZGF0YTogVCk6IHZvaWQge1xuICAgICAgICAvLyBtYWtlIGEgY29weSBvZiB0aGUgYXJyYXkgZmlyc3QgdG8gY292ZXIgdGhlIGNhc2Ugd2hlcmUgZXZlbnQgaGFuZGxlcnNcbiAgICAgICAgLy8gYXJlIGF0dGFjaGVkIGR1cmluZyB0aGUgcG9zdFxuICAgICAgICBjb25zdCBldmVudHM6IEJhc2VFdmVudDxUPltdID0gW107XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgdGhpcy5fZXZlbnRzLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICBldmVudHMucHVzaCh0aGlzLl9ldmVudHNbaV0pO1xuICAgICAgICB9XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZXZlbnRzLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICBldmVudHNbaV0ucG9zdChkYXRhKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBudW1iZXIgb2YgYXR0YWNoZWQgbGlzdGVuZXJzXG4gICAgICovXG4gICAgcHVibGljIGxpc3RlbmVyQ291bnQoKTogbnVtYmVyIHtcb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ogier Schouten\n// License: ISC\n'use strict';\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.flush = exports.flushOnce = exports.queue = void 0;\n__exportStar(require(\"./base-event\"), exports);\n__exportStar(require(\"./sync-event\"), exports);\n__exportStar(require(\"./queued-event\"), exports);\n__exportStar(require(\"./async-event\"), exports);\n__exportStar(require(\"./any-event\"), exports);\nvar EventQueue_1 = require(\"./EventQueue\");\nvar EventQueue_2 = require(\"./EventQueue\");\nObject.defineProperty(exports, \"EventQueue\", { enumerable: true, get: function () { return EventQueue_2.default; } });\n/**\n * The global event queue for QueuedEvents\n */\nfunction queue() {\n return EventQueue_1.default.global();\n}\nexports.queue = queue;\n/**\n * Convenience function, same as EventQueue.global().flushOnce().\n * Flushes the QueuedEvents, calling all events currently in the queue but not\n * any events put into the queue as a result of the flush.\n */\nfunction flushOnce() {\n EventQueue_1.default.global().flushOnce();\n}\nexports.flushOnce = flushOnce;\n/**\n * Convenience function, same as EventQueue.global().flush().\n * Flushes the QueuedEvents, calling all handlers currently in the queue and those\n * put into the queue as a result of the flush.\n * @param maxRounds Optional, default 10. Number of iterations after which to throw an error because\n * the queue keeps filling up. Set to undefined or null to disable this.\n */\nfunction flush(maxRounds) {\n if (maxRounds === void 0) { maxRounds = 10; }\n EventQueue_1.default.global().flush(maxRounds);\n}\nexports.flush = flush;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcm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VsdCAxMC4gTnVtYmVyIG9mIGl0ZXJhdGlvbnMgYWZ0ZXIgd2hpY2ggdG8gdGhyb3cgYW4gZXJyb3IgYmVjYXVzZVxuICogICAgICAgICAgICAgICAgICB0aGUgcXVldWUga2VlcHMgZmlsbGluZyB1cC4gU2V0IHRvIHVuZGVmaW5lZCBvciBudWxsIHRvIGRpc2FibGUgdGhpcy5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGZsdXNoKG1heFJvdW5kczogbnVtYmVyIHwgbnVsbCA9IDEwKTogdm9pZCB7XG4gICAgRXZlbnRRdWV1ZS5nbG9iYWwoKS5mbHVzaChtYXhSb3VuZHMpO1xufVxuIl19","(function (name, definition) {\r\n if (typeof define === 'function' && define.amd) { // RequireJS / AMD\r\n define(definition);\r\n } else if (typeof module !== 'undefined' && module.exports) { // CommonJS / Node.js\r\n module.exports = definition();\r\n } else { // Direct include\r\n window.ysFixWebmDuration = definition();\r\n }\r\n})('fix-webm-duration', function () {\r\n /*\r\n * This is the list of possible WEBM file sections by their IDs.\r\n * Possible types: Container, Binary, Uint, Int, String, Float, Date\r\n */\r\n var sections = {\r\n 0xa45dfa3: { name: 'EBML', type: 'Container' },\r\n 0x286: { name: 'EBMLVersion', type: 'Uint' },\r\n 0x2f7: { name: 'EBMLReadVersion', type: 'Uint' },\r\n 0x2f2: { name: 'EBMLMaxIDLength', type: 'Uint' },\r\n 0x2f3: { name: 'EBMLMaxSizeLength', type: 'Uint' },\r\n 0x282: { name: 'DocType', type: 'String' },\r\n 0x287: { name: 'DocTypeVersion', type: 'Uint' },\r\n 0x285: { name: 'DocTypeReadVersion', type: 'Uint' },\r\n 0x6c: { name: 'Void', type: 'Binary' },\r\n 0x3f: { name: 'CRC-32', type: 'Binary' },\r\n 0xb538667: { name: 'SignatureSlot', type: 'Container' },\r\n 0x3e8a: { name: 'SignatureAlgo', type: 'Uint' },\r\n 0x3e9a: { name: 'SignatureHash', type: 'Uint' },\r\n 0x3ea5: { name: 'SignaturePublicKey', type: 'Binary' },\r\n 0x3eb5: { name: 'Signature', type: 'Binary' },\r\n 0x3e5b: { name: 'SignatureElements', type: 'Container' },\r\n 0x3e7b: { name: 'SignatureElementList', type: 'Container' },\r\n 0x2532: { name: 'SignedElement', type: 'Binary' },\r\n 0x8538067: { name: 'Segment', type: 'Container' },\r\n 0x14d9b74: { name: 'SeekHead', type: 'Container' },\r\n 0xdbb: { name: 'Seek', type: 'Container' },\r\n 0x13ab: { name: 'SeekID', type: 'Binary' },\r\n 0x13ac: { name: 'SeekPosition', type: 'Uint' },\r\n 0x549a966: { name: 'Info', type: 'Container' },\r\n 0x33a4: { name: 'SegmentUID', type: 'Binary' },\r\n 0x3384: { name: 'SegmentFilename', type: 'String' },\r\n 0x1cb923: { name: 'PrevUID', type: 'Binary' },\r\n 0x1c83ab: { name: 'PrevFilename', type: 'String' },\r\n 0x1eb923: { name: 'NextUID', type: 'Binary' },\r\n 0x1e83bb: { name: 'NextFilename', type: 'String' },\r\n 0x444: { name: 'SegmentFamily', type: 'Binary' },\r\n 0x2924: { name: 'ChapterTranslate', type: 'Container' },\r\n 0x29fc: { name: 'ChapterTranslateEditionUID', type: 'Uint' },\r\n 0x29bf: { name: 'ChapterTranslateCodec', type: 'Uint' },\r\n 0x29a5: { name: 'ChapterTranslateID', type: 'Binary' },\r\n 0xad7b1: { name: 'TimecodeScale', type: 'Uint' },\r\n 0x489: { name: 'Duration', type: 'Float' },\r\n 0x461: { name: 'DateUTC', type: 'Date' },\r\n 0x3ba9: { name: 'Title', type: 'String' },\r\n 0xd80: { name: 'MuxingApp', type: 'String' },\r\n 0x1741: { name: 'WritingApp', type: 'String' },\r\n // 0xf43b675: { name: 'Cluster', type: 'Container' },\r\n 0x67: { name: 'Timecode', type: 'Uint' },\r\n 0x1854: { name: 'SilentTracks', type: 'Container' },\r\n 0x18d7: { name: 'SilentTrackNumber', type: 'Uint' },\r\n 0x27: { name: 'Position', type: 'Uint' },\r\n 0x2b: { name: 'PrevSize', type: 'Uint' },\r\n 0x23: { name: 'SimpleBlock', type: 'Binary' },\r\n 0x20: { name: 'BlockGroup', type: 'Container' },\r\n 0x21: { name: 'Block', type: 'Binary' },\r\n 0x22: { name: 'BlockVirtual', type: 'Binary' },\r\n 0x35a1: { name: 'BlockAdditions', type: 'Container' },\r\n 0x26: { name: 'BlockMore', type: 'Container' },\r\n 0x6e: { name: 'BlockAddID', type: 'Uint' },\r\n 0x25: { name: 'BlockAdditional', type: 'Binary' },\r\n 0x1b: { name: 'BlockDuration', type: 'Uint' },\r\n 0x7a: { name: 'ReferencePriority', type: 'Uint' },\r\n 0x7b: { name: 'ReferenceBlock', type: 'Int' },\r\n 0x7d: { name: 'ReferenceVirtual', type: 'Int' },\r\n 0x24: { name: 'CodecState', type: 'Binary' },\r\n 0x35a2: { name: 'DiscardPadding', type: 'Int' },\r\n 0xe: { name: 'Slices', type: 'Container' },\r\n 0x68: { name: 'TimeSlice', type: 'Container' },\r\n 0x4c: { name: 'LaceNumber', type: 'Uint' },\r\n 0x4d: { name: 'FrameNumber', type: 'Uint' },\r\n 0x4b: { name: 'BlockAdditionID', type: 'Uint' },\r\n 0x4e: { name: 'Delay', type: 'Uint' },\r\n 0x4f: { name: 'SliceDuration', type: 'Uint' },\r\n 0x48: { name: 'ReferenceFrame', type: 'Container' },\r\n 0x49: { name: 'ReferenceOffset', type: 'Uint' },\r\n 0x4a: { name: 'ReferenceTimeCode', type: 'Uint' },\r\n 0x2f: { name: 'EncryptedBlock', type: 'Binary' },\r\n 0x654ae6b: { name: 'Tracks', type: 'Container' },\r\n 0x2e: { name: 'TrackEntry', type: 'Container' },\r\n 0x57: { name: 'TrackNumber', type: 'Uint' },\r\n 0x33c5: { name: 'TrackUID', type: 'Uint' },\r\n 0x3: { name: 'TrackType', type: 'Uint' },\r\n 0x39: { name: 'FlagEnabled', type: 'Uint' },\r\n 0x8: { name: 'FlagDefault', type: 'Uint' },\r\n 0x15aa: { name: 'FlagForced', type: 'Uint' },\r\n 0x1c: { name: 'FlagLacing', type: 'Uint' },\r\n 0x2de7: { name: 'MinCache', type: 'Uint' },\r\n 0x2df8: { name: 'MaxCache', type: 'Uint' },\r\n 0x3e383: { name: 'DefaultDuration', type: 'Uint' },\r\n 0x34e7a: { name: 'DefaultDecodedFieldDuration', type: 'Uint' },\r\n 0x3314f: { name: 'TrackTimecodeScale', type: 'Float' },\r\n 0x137f: { name: 'TrackOffset', type: 'Int' },\r\n 0x15ee: { name: 'MaxBlockAdditionID', type: 'Uint' },\r\n 0x136e: { name: 'Name', type: 'String' },\r\n 0x2b59c: { name: 'Language', type: 'String' },\r\n 0x6: { name: 'CodecID', type: 'String' },\r\n 0x23a2: { name: 'CodecPrivate', type: 'Binary' },\r\n 0x58688: { name: 'CodecName', type: 'String' },\r\n 0x3446: { name: 'AttachmentLink', type: 'Uint' },\r\n 0x1a9697: { name: 'CodecSettings', type: 'String' },\r\n 0x1b4040: { name: 'CodecInfoURL', type: 'String' },\r\n 0x6b240: { name: 'CodecDownloadURL', type: 'String' },\r\n 0x2a: { name: 'CodecDecodeAll', type: 'Uint' },\r\n 0x2fab: { name: 'TrackOverlay', type: 'Uint' },\r\n 0x16aa: { name: 'CodecDelay', type: 'Uint' },\r\n 0x16bb: { name: 'SeekPreRoll', type: 'Uint' },\r\n 0x2624: { name: 'TrackTranslate', type: 'Container' },\r\n 0x26fc: { name: 'TrackTranslateEditionUID', type: 'Uint' },\r\n 0x26bf: { name: 'TrackTranslateCodec', type: 'Uint' },\r\n 0x26a5: { name: 'TrackTranslateTrackID', type: 'Binary' },\r\n 0x60: { name: 'Video', type: 'Container' },\r\n 0x1a: { name: 'FlagInterlaced', type: 'Uint' },\r\n 0x13b8: { name: 'StereoMode', type: 'Uint' },\r\n 0x13c0: { name: 'AlphaMode', type: 'Uint' },\r\n 0x13b9: { name: 'OldStereoMode', type: 'Uint' },\r\n 0x30: { name: 'PixelWidth', type: 'Uint' },\r\n 0x3a: { name: 'PixelHeight', type: 'Uint' },\r\n 0x14aa: { name: 'PixelCropBottom', type: 'Uint' },\r\n 0x14bb: { name: 'PixelCropTop', type: 'Uint' },\r\n 0x14cc: { name: 'PixelCropLeft', type: 'Uint' },\r\n 0x14dd: { name: 'PixelCropRight', type: 'Uint' },\r\n 0x14b0: { name: 'DisplayWidth', type: 'Uint' },\r\n 0x14ba: { name: 'DisplayHeight', type: 'Uint' },\r\n 0x14b2: { name: 'DisplayUnit', type: 'Uint' },\r\n 0x14b3: { name: 'AspectRatioType', type: 'Uint' },\r\n 0xeb524: { name: 'ColourSpace', type: 'Binary' },\r\n 0xfb523: { name: 'GammaValue', type: 'Float' },\r\n 0x383e3: { name: 'FrameRate', type: 'Float' },\r\n 0x61: { name: 'Audio', type: 'Container' },\r\n 0x35: { name: 'SamplingFrequency', type: 'Float' },\r\n 0x38b5: { name: 'OutputSamplingFrequency', type: 'Float' },\r\n 0x1f: { name: 'Channels', type: 'Uint' },\r\n 0x3d7b: { name: 'ChannelPositions', type: 'Binary' },\r\n 0x2264: { name: 'BitDepth', type: 'Uint' },\r\n 0x62: { name: 'TrackOperation', type: 'Container' },\r\n 0x63: { name: 'TrackCombinePlanes', type: 'Container' },\r\n 0x64: { name: 'TrackPlane', type: 'Container' },\r\n 0x65: { name: 'TrackPlaneUID', type: 'Uint' },\r\n 0x66: { name: 'TrackPlaneType', type: 'Uint' },\r\n 0x69: { name: 'TrackJoinBlocks', type: 'Container' },\r\n 0x6d: { name: 'TrackJoinUID', type: 'Uint' },\r\n 0x40: { name: 'TrickTrackUID', type: 'Uint' },\r\n 0x41: { name: 'TrickTrackSegmentUID', type: 'Binary' },\r\n 0x46: { name: 'TrickTrackFlag', type: 'Uint' },\r\n 0x47: { name: 'TrickMasterTrackUID', type: 'Uint' },\r\n 0x44: { name: 'TrickMasterTrackSegmentUID', type: 'Binary' },\r\n 0x2d80: { name: 'ContentEncodings', type: 'Container' },\r\n 0x2240: { name: 'ContentEncoding', type: 'Container' },\r\n 0x1031: { name: 'ContentEncodingOrder', type: 'Uint' },\r\n 0x1032: { name: 'ContentEncodingScope', type: 'Uint' },\r\n 0x1033: { name: 'ContentEncodingType', type: 'Uint' },\r\n 0x1034: { name: 'ContentCompression', type: 'Container' },\r\n 0x254: { name: 'ContentCompAlgo', type: 'Uint' },\r\n 0x255: { name: 'ContentCompSettings', type: 'Binary' },\r\n 0x1035: { name: 'ContentEncryption', type: 'Container' },\r\n 0x7e1: { name: 'ContentEncAlgo', type: 'Uint' },\r\n 0x7e2: { name: 'ContentEncKeyID', type: 'Binary' },\r\n 0x7e3: { name: 'ContentSignature', type: 'Binary' },\r\n 0x7e4: { name: 'ContentSigKeyID', type: 'Binary' },\r\n 0x7e5: { name: 'ContentSigAlgo', type: 'Uint' },\r\n 0x7e6: { name: 'ContentSigHashAlgo', type: 'Uint' },\r\n 0xc53bb6b: { name: 'Cues', type: 'Container' },\r\n 0x3b: { name: 'CuePoint', type: 'Container' },\r\n 0x33: { name: 'CueTime', type: 'Uint' },\r\n 0x37: { name: 'CueTrackPositions', type: 'Container' },\r\n 0x77: { name: 'CueTrack', type: 'Uint' },\r\n 0x71: { name: 'CueClusterPosition', type: 'Uint' },\r\n 0x70: { name: 'CueRelativePosition', type: 'Uint' },\r\n 0x32: { name: 'CueDuration', type: 'Uint' },\r\n 0x1378: { name: 'CueBlockNumber', type: 'Uint' },\r\n 0x6a: { name: 'CueCodecState', type: 'Uint' },\r\n 0x5b: { name: 'CueReference', type: 'Container' },\r\n 0x16: { name: 'CueRefTime', type: 'Uint' },\r\n 0x17: { name: 'CueRefCluster', type: 'Uint' },\r\n 0x135f: { name: 'CueRefNumber', type: 'Uint' },\r\n 0x6b: { name: 'CueRefCodecState', type: 'Uint' },\r\n 0x941a469: { name: 'Attachments', type: 'Container' },\r\n 0x21a7: { name: 'AttachedFile', type: 'Container' },\r\n 0x67e: { name: 'FileDescription', type: 'String' },\r\n 0x66e: { name: 'FileName', type: 'String' },\r\n 0x660: { name: 'FileMimeType', type: 'String' },\r\n 0x65c: { name: 'FileData', type: 'Binary' },\r\n 0x6ae: { name: 'FileUID', type: 'Uint' },\r\n 0x675: { name: 'FileReferral', type: 'Binary' },\r\n 0x661: { name: 'FileUsedStartTime', type: 'Uint' },\r\n 0x662: { name: 'FileUsedEndTime', type: 'Uint' },\r\n 0x43a770: { name: 'Chapters', type: 'Container' },\r\n 0x5b9: { name: 'EditionEntry', type: 'Container' },\r\n 0x5bc: { name: 'EditionUID', type: 'Uint' },\r\n 0x5bd: { name: 'EditionFlagHidden', type: 'Uint' },\r\n 0x5db: { name: 'EditionFlagDefault', type: 'Uint' },\r\n 0x5dd: { name: 'EditionFlagOrdered', type: 'Uint' },\r\n 0x36: { name: 'ChapterAtom', type: 'Container' },\r\n 0x33c4: { name: 'ChapterUID', type: 'Uint' },\r\n 0x1654: { name: 'ChapterStringUID', type: 'String' },\r\n 0x11: { name: 'ChapterTimeStart', type: 'Uint' },\r\n 0x12: { name: 'ChapterTimeEnd', type: 'Uint' },\r\n 0x18: { name: 'ChapterFlagHidden', type: 'Uint' },\r\n 0x598: { name: 'ChapterFlagEnabled', type: 'Uint' },\r\n 0x2e67: { name: 'ChapterSegmentUID', type: 'Binary' },\r\n 0x2ebc: { name: 'ChapterSegmentEditionUID', type: 'Uint' },\r\n 0x23c3: { name: 'ChapterPhysicalEquiv', type: 'Uint' },\r\n 0xf: { name: 'ChapterTrack', type: 'Container' },\r\n 0x9: { name: 'ChapterTrackNumber', type: 'Uint' },\r\n 0x0: { name: 'ChapterDisplay', type: 'Container' },\r\n 0x5: { name: 'ChapString', type: 'String' },\r\n 0x37c: { name: 'ChapLanguage', type: 'String' },\r\n 0x37e: { name: 'ChapCountry', type: 'String' },\r\n 0x2944: { name: 'ChapProcess', type: 'Container' },\r\n 0x2955: { name: 'ChapProcessCodecID', type: 'Uint' },\r\n 0x50d: { name: 'ChapProcessPrivate', type: 'Binary' },\r\n 0x2911: { name: 'ChapProcessCommand', type: 'Container' },\r\n 0x2922: { name: 'ChapProcessTime', type: 'Uint' },\r\n 0x2933: { name: 'ChapProcessData', type: 'Binary' },\r\n 0x254c367: { name: 'Tags', type: 'Container' },\r\n 0x3373: { name: 'Tag', type: 'Container' },\r\n 0x23c0: { name: 'Targets', type: 'Container' },\r\n 0x28ca: { name: 'TargetTypeValue', type: 'Uint' },\r\n 0x23ca: { name: 'TargetType', type: 'String' },\r\n 0x23c5: { name: 'TagTrackUID', type: 'Uint' },\r\n 0x23c9: { name: 'TagEditionUID', type: 'Uint' },\r\n 0x23c4: { name: 'TagChapterUID', type: 'Uint' },\r\n 0x23c6: { name: 'TagAttachmentUID', type: 'Uint' },\r\n 0x27c8: { name: 'SimpleTag', type: 'Container' },\r\n 0x5a3: { name: 'TagName', type: 'String' },\r\n 0x47a: { name: 'TagLanguage', type: 'String' },\r\n 0x484: { name: 'TagDefault', type: 'Uint' },\r\n 0x487: { name: 'TagString', type: 'String' },\r\n 0x485: { name: 'TagBinary', type: 'Binary' }\r\n };\r\n\r\n function doInherit(newClass, baseClass) {\r\n newClass.prototype = Object.create(baseClass.prototype);\r\n newClass.prototype.constructor = newClass;\r\n }\r\n\r\n function WebmBase(name, type) {\r\n this.name = name || 'Unknown';\r\n this.type = type || 'Unknown';\r\n }\r\n WebmBase.prototype.updateBySource = function() { };\r\n WebmBase.prototype.setSource = function(source) {\r\n this.source = source;\r\n this.updateBySource();\r\n };\r\n WebmBase.prototype.updateByData = function() { };\r\n WebmBase.prototype.setData = function(data) {\r\n this.data = data;\r\n this.updateByData();\r\n };\r\n\r\n function WebmUint(name, type) {\r\n WebmBase.call(this, name, type || 'Uint');\r\n }\r\n doInherit(WebmUint, WebmBase);\r\n function padHex(hex) {\r\n return hex.length % 2 === 1 ? '0' + hex : hex;\r\n }\r\n WebmUint.prototype.updateBySource = function() {\r\n // use hex representation of a number instead of number value\r\n this.data = '';\r\n for (var i = 0; i < this.source.length; i++) {\r\n var hex = this.source[i].toString(16);\r\n this.data += padHex(hex);\r\n }\r\n };\r\n WebmUint.prototype.updateByData = function() {\r\n var length = this.data.length / 2;\r\n this.source = new Uint8Array(length);\r\n for (var i = 0; i < length; i++) {\r\n var hex = this.data.substr(i * 2, 2);\r\n this.source[i] = parseInt(hex, 16);\r\n }\r\n };\r\n WebmUint.prototype.getValue = function() {\r\n return parseInt(this.data, 16);\r\n };\r\n WebmUint.prototype.setValue = function(value) {\r\n this.setData(padHex(value.toString(16)));\r\n };\r\n\r\n function WebmFloat(name, type) {\r\n WebmBase.call(this, name, type || 'Float');\r\n }\r\n doInherit(WebmFloat, WebmBase);\r\n WebmFloat.prototype.getFloatArrayType = function() {\r\n return this.source && this.source.length === 4 ? Float32Array : Float64Array;\r\n };\r\n WebmFloat.prototype.updateBySource = function() {\r\n var byteArray = this.source.reverse();\r\n var floatArrayType = this.getFloatArrayType();\r\n var floatArray = new floatArrayType(byteArray.buffer);\r\n this.data = floatArray[0];\r\n };\r\n WebmFloat.prototype.updateByData = function() {\r\n var floatArrayType = this.getFloatArrayType();\r\n var floatArray = new floatArrayType([ this.data ]);\r\n var byteArray = new Uint8Array(floatArray.buffer);\r\n this.source = byteArray.reverse();\r\n };\r\n WebmFloat.prototype.getValue = function() {\r\n return this.data;\r\n };\r\n WebmFloat.prototype.setValue = function(value) {\r\n this.setData(value);\r\n };\r\n\r\n function WebmContainer(name, type) {\r\n WebmBase.call(this, name, type || 'Container');\r\n }\r\n doInherit(WebmContainer, WebmBase);\r\n WebmContainer.prototype.readByte = function() {\r\n return this.source[this.offset++];\r\n };\r\n WebmContainer.prototype.readUint = function() {\r\n var firstByte = this.readByte();\r\n var bytes = 8 - firstByte.toString(2).length;\r\n var value = firstByte - (1 << (7 - bytes));\r\n for (var i = 0; i < bytes; i++) {\r\n // don't use bit operators to support x86\r\n value *= 256;\r\n value += this.readByte();\r\n }\r\n return value;\r\n };\r\n WebmContainer.prototype.updateBySource = function() {\r\n this.data = [];\r\n for (this.offset = 0; this.offset < this.source.length; this.offset = end) {\r\n var id = this.readUint();\r\n var len = this.readUint();\r\n var end = Math.min(this.offset + len, this.source.length);\r\n var data = this.source.slice(this.offset, end);\r\n\r\n var info = sections[id] || { name: 'Unknown', type: 'Unknown' };\r\n var ctr = WebmBase;\r\n switch (info.type) {\r\n case 'Container':\r\n ctr = WebmContainer;\r\n break;\r\n case 'Uint':\r\n ctr = WebmUint;\r\n break;\r\n case 'Float':\r\n ctr = WebmFloat;\r\n break;\r\n }\r\n var section = new ctr(info.name, info.type);\r\n section.setSource(data);\r\n this.data.push({\r\n id: id,\r\n idHex: id.toString(16),\r\n data: section\r\n });\r\n }\r\n };\r\n WebmContainer.prototype.writeUint = function(x, draft) {\r\n for (var bytes = 1, flag = 0x80; x >= flag && bytes < 8; bytes++, flag *= 0x80) { }\r\n\r\n if (!draft) {\r\n var value = flag + x;\r\n for (var i = bytes - 1; i >= 0; i--) {\r\n // don't use bit operators to support x86\r\n var c = value % 256;\r\n this.source[this.offset + i] = c;\r\n value = (value - c) / 256;\r\n }\r\n }\r\n\r\n this.offset += bytes;\r\n };\r\n WebmContainer.prototype.writeSections = function(draft) {\r\n this.offset = 0;\r\n for (var i = 0; i < this.data.length; i++) {\r\n var section = this.data[i],\r\n content = section.data.source,\r\n contentLength = content.length;\r\n this.writeUint(section.id, draft);\r\n this.writeUint(contentLength, draft);\r\n if (!draft) {\r\n this.source.set(content, this.offset);\r\n }\r\n this.offset += contentLength;\r\n }\r\n return this.offset;\r\n };\r\n WebmContainer.prototype.updateByData = function() {\r\n // run without accessing this.source to determine total length - need to know it to create Uint8Array\r\n var length = this.writeSections('draft');\r\n this.source = new Uint8Array(length);\r\n // now really write data\r\n this.writeSections();\r\n };\r\n WebmContainer.prototype.getSectionById = function(id) {\r\n for (var i = 0; i < this.data.length; i++) {\r\n var section = this.data[i];\r\n if (section.id === id) {\r\n return section.data;\r\n }\r\n }\r\n return null;\r\n };\r\n\r\n function WebmFile(source) {\r\n WebmContainer.call(this, 'File', 'File');\r\n this.setSource(source);\r\n }\r\n doInherit(WebmFile, WebmContainer);\r\n WebmFile.prototype.fixDuration = function(duration, options) {\r\n var logger = options && options.logger;\r\n if (logger === undefined) {\r\n logger = function(message) {\r\n console.log(message);\r\n };\r\n } else if (!logger) {\r\n logger = function() { };\r\n }\r\n\r\n var segmentSection = this.getSectionById(0x8538067);\r\n if (!segmentSection) {\r\n logger('[fix-webm-duration] Segment section is missing');\r\n return false;\r\n }\r\n\r\n var infoSection = segmentSection.getSectionById(0x549a966);\r\n if (!infoSection) {\r\n logger('[fix-webm-duration] Info section is missing');\r\n return false;\r\n }\r\n\r\n var timeScaleSection = infoSection.getSectionById(0xad7b1);\r\n if (!timeScaleSection) {\r\n logger('[fix-webm-duration] TimecodeScale section is missing');\r\n return false;\r\n }\r\n\r\n var durationSection = infoSection.getSectionById(0x489);\r\n if (durationSection) {\r\n if (durationSection.getValue() <= 0) {\r\n logger('[fix-webm-duration] Duration section is present, but the value is empty');\r\n durationSection.setValue(duration);\r\n } else {\r\n logger('[fix-webm-duration] Duration section is present');\r\n return false;\r\n }\r\n } else {\r\n logger('[fix-webm-duration] Duration section is missing');\r\n // append Duration section\r\n durationSection = new WebmFloat('Duration', 'Float');\r\n durationSection.setValue(duration);\r\n infoSection.data.push({\r\n id: 0x489,\r\n data: durationSection\r\n });\r\n }\r\n\r\n // set default time scale to 1 millisecond (1000000 nanoseconds)\r\n timeScaleSection.setValue(1000000);\r\n infoSection.updateByData();\r\n segmentSection.updateByData();\r\n this.updateByData();\r\n\r\n return true;\r\n };\r\n WebmFile.prototype.toBlob = function(mimeType) {\r\n return new Blob([ this.source.buffer ], { type: mimeType || 'video/webm' });\r\n };\r\n\r\n function fixWebmDuration(blob, duration, callback, options) {\r\n // The callback may be omitted - then the third argument is options\r\n if (typeof callback === \"object\") {\r\n options = callback;\r\n callback = undefined;\r\n }\r\n\r\n if (!callback) {\r\n return new Promise(function(resolve) {\r\n fixWebmDuration(blob, duration, resolve, options);\r\n });\r\n }\r\n\r\n try {\r\n var reader = new FileReader();\r\n reader.onloadend = function() {\r\n try {\r\n var file = new WebmFile(new Uint8Array(reader.result));\r\n if (file.fixDuration(duration, options)) {\r\n blob = file.toBlob(blob.type);\r\n }\r\n } catch (ex) {\r\n // ignore\r\n }\r\n callback(blob);\r\n };\r\n reader.readAsArrayBuffer(blob);\r\n } catch (ex) {\r\n callback(blob);\r\n }\r\n }\r\n\r\n // Support AMD import default\r\n fixWebmDuration.default = fixWebmDuration;\r\n\r\n return fixWebmDuration;\r\n});\r\n","// src/audio_components/AudioComponent.ts\nvar AudioComponent = class {\n constructor() {\n this._connectedComponents = [];\n }\n /**Connects the [outputNode] of this [AudioComponent] to the [inputNode] of \n * the passed in [component]*/\n connect(component) {\n this.outputNode.connect(component.inputNode);\n this._connectedComponents.push(component);\n }\n /**Disconnects the [outputNode] of this [AudioComponent] from the \n * [inputNode] of the passed in [component]*/\n disconnect(component) {\n let idx = this._connectedComponents.indexOf(component);\n if (idx !== -1) {\n this.outputNode.disconnect(component.inputNode);\n this._connectedComponents.splice(idx);\n }\n }\n /**Disconnects the [outputNode] of this [AudioComponent] from all previously\n * connected [AudioComponent] [inputNode]s.*/\n disconnectAll() {\n for (let component of this._connectedComponents) {\n this.disconnect(component);\n }\n }\n /**the [inputNode] is the target node that other [AudioComponent]\n * instances connect their [outputNode] to. If an [AudioComponent] subclass \n * can not receive input from another [AudioComponent], this should remain \n * unaltered in the subclass to generate an error if it is used.*/\n get inputNode() {\n throw \"no inputNode getter has been defined\";\n }\n /**the outputNode is the source node that connects to other[AudioComponent] \n * instances' [inputNode]. If an [AudioComponent] subclass can not attach to\n * another [AudioComponent], this should remain unaltered in the subclass to\n * generate an error if it is used.*/\n get outputNode() {\n throw \"no outputNode getter has been defined\";\n }\n};\n\n// src/audio_components/AudioNodeComponent.ts\nvar AudioNodeComponent = class extends AudioComponent {\n get audioNode() {\n return this._audioNode;\n }\n constructor(audioNode) {\n super();\n this._audioNode = audioNode;\n }\n /**the [inputNode] is the target node that other [AudioComponent]\n * instances connect their [outputNode] to. */\n get inputNode() {\n return this._audioNode;\n }\n /**the outputNode is the source node that connects to other[AudioComponent] \n * instances' [inputNode].*/\n get outputNode() {\n return this._audioNode;\n }\n};\n\n// src/audio_components/DestinationAudioComponent.ts\nvar DestinationAudioComponent = class extends AudioComponent {\n constructor(context) {\n super();\n this._context = context;\n }\n get inputNode() {\n return this._context.destination;\n }\n};\n\n// src/audio_components/MixdownAudioComponent.ts\nimport { SyncEvent } from \"ts-events\";\nimport ysFixWebmDuration from \"fix-webm-duration\";\nvar MixdownAudioComponent = class extends AudioComponent {\n constructor(context, mimeCodecSettings) {\n super();\n this._isRecording = false;\n this._mixdownEvent = new SyncEvent();\n this._onDataAvailable = (e) => {\n this._recordingBlobs.push(e.data);\n };\n this._onRecordStop = (e) => {\n if (!this._isRecording) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder.removeEventListener(\"stop\", this._onRecordStop);\n this._mediaRecorder = null;\n let type = this._canvasSettings != null ? this._mcSettings.videoMimeType : this._mcSettings.audioMimeType;\n let blob = new Blob(this._recordingBlobs, { type });\n this._recordingBlobs = null;\n if (type.includes(\"webm\")) {\n let duration = Math.ceil((this._context.currentTime - this._startTime) * 1e3);\n ysFixWebmDuration(blob, duration, (fixedBlob) => {\n let event = new MixdownEvent();\n event.type = 0 /* recordingReady */;\n event.recording = fixedBlob;\n this._mixdownEvent.post(event);\n }, { logger: false });\n } else {\n let event = new MixdownEvent();\n event.type = 0 /* recordingReady */;\n event.recording = blob;\n this._mixdownEvent.post(event);\n }\n }\n };\n this._onFadeInTimer = () => {\n if (this._fadeInIntervalId == null) {\n return;\n }\n let delta = this._context.currentTime - this._fadeInStartTime;\n if (delta >= this._fadeInTime) {\n this._fadeInIntervalId = null;\n } else {\n let ratio = delta / this._fadeInTime;\n this._drawOverlay(1 - ratio);\n let ms = Math.floor(1e3 / this._canvasSettings.fps);\n this._fadeInIntervalId = window.setTimeout(this._onFadeInTimer, ms);\n }\n };\n this._onFadeOutTimer = () => {\n if (this._fadeOutIntervalId == null) {\n return;\n }\n let canvas = this._canvasSettings.canvas;\n let delta = this._context.currentTime - this._fadeOutStartTime;\n if (delta >= this._fadeOutTime) {\n this._fadeOutIntervalId = null;\n this._drawOverlay(1);\n this._stopRecording();\n } else {\n let ratio = delta / this._fadeOutTime;\n this._drawOverlay(ratio * ratio * ratio * ratio);\n let ms = Math.floor(1e3 / this._canvasSettings.fps);\n this._fadeOutIntervalId = window.setTimeout(\n this._onFadeOutTimer,\n ms\n );\n }\n };\n this._context = context;\n this._mcSettings = mimeCodecSettings;\n this._init();\n }\n get mixdownEvent() {\n return this._mixdownEvent;\n }\n setCanvas(canvas, fps) {\n if (canvas == null) {\n this._canvasSettings = null;\n return;\n }\n this._canvasSettings = new _CanvasMixdownSettings();\n this._canvasSettings.canvas = canvas;\n this._canvasSettings.fps = fps;\n this._context2d = this._canvasSettings.canvas.getContext(\"2d\");\n }\n record(fadeInTime = 0) {\n this._clearFades();\n this._initFadeIn(fadeInTime);\n if (this._mediaRecorder != null) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder.removeEventListener(\"stop\", this._onRecordStop);\n }\n this._mediaRecorder = this._getMediaRecorder();\n this._mediaRecorder.addEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder.addEventListener(\"stop\", this._onRecordStop);\n this._isRecording = true;\n this._recordingBlobs = [];\n this._startTime = this._context.currentTime;\n this._mediaRecorder.start(1e3);\n }\n stop(fadeOutTime = 0) {\n this._clearFades();\n this._initFadeOut(fadeOutTime);\n }\n _init() {\n this._prepareRecorder();\n }\n _prepareRecorder() {\n this._mediaDestination = this._context.createMediaStreamDestination();\n this._fadeNode = this._context.createGain();\n this._fadeNode.connect(this._mediaDestination);\n }\n _getMediaRecorder() {\n let mediaRecorder;\n if (this._canvasSettings != null) {\n let options = {\n \"mimeType\": this._mcSettings.videoMimeCodecsString,\n \"videoBitsPerSecond\": 5e6\n };\n let canvasMediaStream = this._canvasSettings.canvas.captureStream(\n this._canvasSettings.fps\n );\n let audioTracks = this._mediaDestination.stream.getAudioTracks();\n audioTracks.forEach((track) => {\n canvasMediaStream.addTrack(track);\n });\n mediaRecorder = new MediaRecorder(canvasMediaStream, options);\n } else {\n let options = {\n \"mimeType\": this._mcSettings.audioMimeCodecsString\n };\n mediaRecorder = new MediaRecorder(\n this._mediaDestination.stream,\n options\n );\n }\n return mediaRecorder;\n }\n _stopRecording() {\n this._isRecording = false;\n if (this._mediaRecorder.state === \"recording\") {\n this._mediaRecorder.stop();\n }\n }\n _initFadeIn(fadeInTime) {\n this._fadeInTime = fadeInTime;\n if (fadeInTime > 0) {\n let ctime = this._context.currentTime;\n this._fadeInStartTime = ctime;\n this._fadeNode.gain.setValueAtTime(0, ctime);\n this._fadeNode.gain.linearRampToValueAtTime(\n 1,\n ctime + this._fadeInTime\n );\n this._drawOverlay(1);\n let ms = Math.floor(1e3 / this._canvasSettings.fps);\n this._fadeInIntervalId = window.setTimeout(this._onFadeInTimer, ms);\n } else {\n this._fadeNode.gain.setValueAtTime(1, this._context.currentTime);\n }\n }\n _drawOverlay(opacity) {\n let canvas = this._canvasSettings.canvas;\n this._context2d.fillStyle = `rgba(0,0,0,${opacity})`;\n this._context2d.fillRect(0, 0, canvas.width, canvas.height);\n }\n _initFadeOut(fadeOutTime) {\n this._fadeOutTime = fadeOutTime;\n if (fadeOutTime > 0) {\n let ctime = this._context.currentTime;\n this._fadeOutStartTime = ctime;\n this._fadeNode.gain.setValueAtTime(1, ctime);\n this._fadeNode.gain.linearRampToValueAtTime(\n 0,\n ctime + this._fadeOutTime\n );\n let ms = Math.floor(1e3 / this._canvasSettings.fps);\n this._fadeOutIntervalId = window.setTimeout(\n this._onFadeOutTimer,\n ms\n );\n } else {\n this._stopRecording();\n }\n }\n _clearFades() {\n if (this._fadeInIntervalId != null) {\n window.clearTimeout(this._fadeInIntervalId);\n this._fadeInIntervalId = null;\n }\n if (this._fadeOutIntervalId != null) {\n window.clearTimeout(this._fadeOutIntervalId);\n this._fadeOutIntervalId = null;\n }\n }\n get isRecording() {\n return this._isRecording;\n }\n static get isSupported() {\n return !!MediaRecorder;\n }\n get inputNode() {\n return this._fadeNode;\n }\n};\nvar MixdownEvent = class {\n};\nvar MixdownEventType = /* @__PURE__ */ ((MixdownEventType2) => {\n MixdownEventType2[MixdownEventType2[\"recordingReady\"] = 0] = \"recordingReady\";\n return MixdownEventType2;\n})(MixdownEventType || {});\nvar _CanvasMixdownSettings = class {\n};\nvar MixdownCodecSettings = class {\n constructor() {\n this.videoMimeCodecsString = \"video/webm;codecs=vp8,opus\";\n this.videoMimeType = \"video/webm\";\n this.audioMimeCodecsString = \"audio/webm; codecs=opus\";\n this.audioMimeType = \"audio/webm\";\n }\n};\n\n// src/audio_components/ReverbAudioComponent.ts\nvar ReverbAudioComponent = class extends AudioComponent {\n constructor(context) {\n super();\n this._context = context;\n this._init();\n }\n setReverbImpulse(buffer) {\n if (buffer == null) {\n this._convolver.buffer = null;\n } else {\n this._convolver.buffer = buffer;\n }\n }\n _init() {\n this._setupAudioGraph();\n this.setReverbImpulse(null);\n }\n _setupAudioGraph() {\n this._preVerbMix = this._context.createGain();\n this._convolver = this._context.createConvolver();\n this._dryMix = this._context.createGain();\n this._wetMix = this._context.createGain();\n this._masterMix = this._context.createGain();\n this._preVerbMix.connect(this._dryMix);\n this._dryMix.connect(this._masterMix);\n this._preVerbMix.connect(this._convolver);\n this._convolver.connect(this._wetMix);\n this._wetMix.connect(this._masterMix);\n this._masterMix.gain.value = 0.8;\n this.wetToDryRatio = 0.3;\n }\n get masterVolume() {\n return this._masterMix.gain.value;\n }\n set masterVolume(value) {\n if (value < 0) {\n value = 0;\n } else if (value > 1)\n value = 1;\n this._masterMix.gain.setValueAtTime(value, 0);\n }\n /**a value from 0 to 1, with 0 meaning no wet signal. The ratio may not\n * exactly match the value provided but may instead be based on it.*/\n get wetToDryRatio() {\n return this._wetMix.gain.value;\n }\n set wetToDryRatio(value) {\n if (value < 0) {\n value = 0;\n } else if (value > 1)\n value = 1;\n this._dryMix.gain.setValueAtTime(1 - value * 0.5, 0);\n this._wetMix.gain.setValueAtTime(value, 0);\n }\n get inputNode() {\n return this._preVerbMix;\n }\n get outputNode() {\n return this._masterMix;\n }\n};\nexport {\n AudioComponent,\n AudioNodeComponent,\n DestinationAudioComponent,\n MixdownAudioComponent,\n MixdownCodecSettings,\n MixdownEvent,\n MixdownEventType,\n ReverbAudioComponent\n};\n","// src/utils/AudioContextManager.ts\nvar AudioContextManager = class _AudioContextManager {\n /**initiates the AudioContext if it hasn't already been constructed.\n * @return a [bool] indicating true if AudioContext.supported*/\n static initContext() {\n if (this._context != null)\n return true;\n else if (AudioContext) {\n _AudioContextManager._context = new AudioContext();\n return _AudioContextManager._context != null;\n }\n return false;\n }\n static get context() {\n return _AudioContextManager._context;\n }\n};\n\n// src/utils/AudioProcessor.ts\nvar AudioProcessor = class _AudioProcessor {\n static generateReverbImpulse(context, seconds = 3, decay = 2, reverse = false) {\n let rate = context.sampleRate;\n let length = rate * seconds;\n let impulse = context.createBuffer(2, length, rate);\n let impulseL = impulse.getChannelData(0);\n let impulseR = impulse.getChannelData(1);\n let i;\n let n;\n for (i = 0; i < length; i++) {\n n = reverse ? length - i : i;\n impulseL[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, decay);\n impulseR[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, decay);\n }\n return impulse;\n }\n // see https://github.com/jaz303/audio-buffer-utils/blob/master/index.js\n /** trim a stereo AudioBuffer*/\n static trimBuffer(buffer, seconds, context) {\n let leftChannel = buffer.getChannelData(0);\n let rightChannel = buffer.getChannelData(1);\n let startTrimSample = Math.floor(context.sampleRate * seconds);\n let newLength = buffer.length - startTrimSample;\n let newLeftChannel = new Float32Array(newLength);\n let newRightChannel = new Float32Array(newLength);\n let j = 0;\n for (let i = startTrimSample; i < leftChannel.length; i++) {\n newLeftChannel[j] = leftChannel[i];\n j++;\n }\n j = 0;\n for (let i = startTrimSample; i < rightChannel.length; i++) {\n newRightChannel[j] = rightChannel[i];\n j++;\n }\n let returnBuffer = context.createBuffer(\n 2,\n newLength,\n context.sampleRate\n );\n returnBuffer.copyToChannel(newLeftChannel, 0);\n returnBuffer.copyToChannel(newRightChannel, 1);\n return returnBuffer;\n }\n static async normalizeWithBreaks(audioBuffer, maxSamplesBetweenBreaks = 441e3, convertToMono = true, normalizationValue = 0.8, minThreshold = 0.1, fadeOutTime = 0) {\n let fadeSamples = fadeOutTime * audioBuffer.sampleRate;\n if (audioBuffer.numberOfChannels == 1) {\n await _AudioProcessor._normalizeMonoBuffer(\n audioBuffer,\n maxSamplesBetweenBreaks,\n normalizationValue,\n minThreshold,\n fadeSamples\n );\n } else {\n audioBuffer = await _AudioProcessor._normalizeMultiChannelBuffer(\n audioBuffer,\n maxSamplesBetweenBreaks,\n convertToMono,\n normalizationValue,\n minThreshold,\n fadeSamples\n );\n }\n return audioBuffer;\n }\n static async _normalizeMonoBuffer(audioBuffer, maxSamplesBetweenBreaks, normalizationValue, minThreshold, fadeSamples) {\n let samples = audioBuffer.getChannelData(0);\n let peak = await _AudioProcessor._getPeak(\n samples,\n maxSamplesBetweenBreaks\n );\n if (peak < minThreshold) {\n return;\n }\n let factor = normalizationValue / peak;\n await _AudioProcessor._multiplyValues(\n samples,\n factor,\n maxSamplesBetweenBreaks,\n fadeSamples\n );\n }\n static async _normalizeMultiChannelBuffer(audioBuffer, maxSamplesBetweenBreaks, convertToMono, normalizationValue, minThreshold, fadeSamples) {\n let peaks = [];\n let highestPeak = 0;\n let nonZeroSampleSets = [];\n for (let i = 0; i < audioBuffer.numberOfChannels; i++) {\n let samples = audioBuffer.getChannelData(i);\n let peak = await _AudioProcessor._getPeak(\n samples,\n maxSamplesBetweenBreaks\n );\n peaks.push(peak);\n if (peak > 0) {\n nonZeroSampleSets.push(samples);\n if (peak > highestPeak) {\n highestPeak = peak;\n }\n }\n }\n if (highestPeak === 0) {\n if (convertToMono) {\n return AudioContextManager.context.createBuffer(\n 1,\n audioBuffer.length,\n audioBuffer.sampleRate\n );\n } else {\n return audioBuffer;\n }\n }\n if (!convertToMono) {\n if (highestPeak < minThreshold) {\n return audioBuffer;\n }\n let factor = normalizationValue / highestPeak;\n for (let i = 0; i < audioBuffer.numberOfChannels; i++) {\n let samples = audioBuffer.getChannelData(i);\n await _AudioProcessor._multiplyValues(\n samples,\n factor,\n maxSamplesBetweenBreaks,\n fadeSamples\n );\n }\n return audioBuffer;\n } else {\n let newBuffer = AudioContextManager.context.createBuffer(\n 1,\n audioBuffer.length,\n audioBuffer.sampleRate\n );\n let targetSamples = newBuffer.getChannelData(0);\n let factor = highestPeak >= minThreshold ? normalizationValue / highestPeak / nonZeroSampleSets.length : 1;\n await _AudioProcessor._mergeToMono(\n nonZeroSampleSets,\n targetSamples,\n factor,\n maxSamplesBetweenBreaks,\n fadeSamples\n );\n return newBuffer;\n }\n }\n static async _getPeak(samples, maxSamplesBetweenBreaks) {\n let peak = 0;\n let i = 0;\n let limit = Math.min(i + maxSamplesBetweenBreaks, samples.length);\n let sample;\n while (i < samples.length) {\n for (i; i < limit; i++) {\n sample = samples[i];\n if (sample > peak) {\n peak = sample;\n } else if (sample * -1 > peak) {\n peak = sample * -1;\n }\n }\n await _AudioProcessor._waitForNextFrame();\n limit = Math.min(i + maxSamplesBetweenBreaks, samples.length);\n }\n return peak;\n }\n static async _multiplyValues(samples, factor, maxSamplesBetweenBreaks, fadeSamples) {\n let i = 0;\n let numSamples = samples.length;\n let limit = Math.min(i + maxSamplesBetweenBreaks, numSamples);\n while (i < numSamples) {\n for (i; i < limit; i++) {\n if (numSamples - i < fadeSamples) {\n samples[i] *= factor * ((numSamples - i) / fadeSamples);\n } else {\n samples[i] *= factor;\n }\n }\n await _AudioProcessor._waitForNextFrame();\n limit = Math.min(i + maxSamplesBetweenBreaks, samples.length);\n }\n }\n static async _mergeToMono(sampleSets, targetSet, factor, maxSamplesBetweenBreaks, fadeSamples) {\n maxSamplesBetweenBreaks = Math.floor(maxSamplesBetweenBreaks / sampleSets.length);\n let i = 0;\n let numSamples = targetSet.length;\n let limit = Math.min(i + maxSamplesBetweenBreaks, numSamples);\n while (i < numSamples) {\n for (i; i < limit; i++) {\n for (let j = 0; j < sampleSets.length; j++) {\n targetSet[i] += sampleSets[j][i];\n }\n if (numSamples - i < fadeSamples) {\n targetSet[i] *= factor * ((numSamples - i) / fadeSamples);\n } else {\n targetSet[i] *= factor;\n }\n }\n await _AudioProcessor._waitForNextFrame();\n limit = Math.min(i + maxSamplesBetweenBreaks, targetSet.length);\n }\n }\n static _waitForNextFrame() {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, 0);\n });\n }\n};\n\n// src/utils/MultiSoundLoader.ts\nimport { createEmitter } from \"ts_utils\";\nvar MultiSoundLoader = class {\n constructor(context) {\n this._loadCount = 0;\n this._loadProgressEmitter = createEmitter();\n this._onBufferLoaded = (e) => {\n var request = e.target;\n this._loadProgressEmitter.emit(`${request.responseURL} downloaded... extracting...`);\n this._context.decodeAudioData(request.response).then((buffer) => {\n this._filesMap.set(request, buffer);\n this._loadCount++;\n if (this._loadCount === this._filesMap.size) {\n this._loadProgressEmitter.emit(\"audio ready\");\n this._loadCompleter(Array.from(this._filesMap.values()));\n this._cleanup();\n }\n }).catch((err) => {\n console.log(err);\n });\n };\n this._onBufferLoadError = (e) => {\n this._cleanup();\n this._loadCanceler(\"Problem downloading one or more files: \" + e.toString());\n };\n this._context = context;\n if (this._context == null)\n throw \"AudioContext not set\";\n }\n get loadProgress() {\n return this._loadProgressEmitter.event;\n }\n load(urlList) {\n this._filesMap = /* @__PURE__ */ new Map();\n this._loadProgressEmitter.emit(\"downloading audio...\");\n return new Promise((resolve, reject) => {\n this._loadCompleter = resolve;\n this._loadCanceler = reject;\n for (let i = 0; i < urlList.length; i++) {\n var request = this._loadBuffer(urlList[i]);\n this._filesMap.set(request, null);\n }\n });\n }\n _loadBuffer(url) {\n let request = new XMLHttpRequest();\n request.responseType = \"arraybuffer\";\n request.onload = this._onBufferLoaded;\n request.onerror = this._onBufferLoadError;\n request.open(\"GET\", url);\n request.send();\n return request;\n }\n _cleanup() {\n for (let request of this._filesMap.keys()) {\n request.onload = null;\n request.onerror = null;\n }\n this._filesMap = null;\n }\n};\n\n// src/utils/phaze/PhazeManager.ts\nvar PhazeManager = class {\n constructor() {\n }\n async renderAudio(workletUrl, audioBuffer, pitch = 1) {\n try {\n let oac = new OfflineAudioContext({\n length: audioBuffer.length,\n sampleRate: audioBuffer.sampleRate,\n numberOfChannels: audioBuffer.numberOfChannels\n });\n await oac.audioWorklet.addModule(workletUrl);\n let bsn = oac.createBufferSource();\n bsn.buffer = audioBuffer;\n let phazeNode = this.createAudioNode(oac);\n let pitchParam = phazeNode.parameters.get(\"pitchFactor\");\n pitchParam.value = pitch;\n bsn.connect(phazeNode);\n phazeNode.connect(oac.destination);\n bsn.start(0);\n let rendered = await oac.startRendering();\n for (let i = 0; i < rendered.numberOfChannels; i++) {\n let ch = rendered.getChannelData(i);\n for (let j = 0; j < ch.length; j++) {\n if (isNaN(ch[j])) {\n ch[j] = 0;\n }\n }\n }\n return rendered;\n } catch (err) {\n console.log(err);\n return null;\n }\n }\n createAudioNode(context) {\n let node = new AudioWorkletNode(context, \"phase-vocoder-processor\");\n return node;\n }\n};\n\n// src/utils/signalsmith_stretch/SignalSmithManager.ts\nvar _queue = [];\nvar _isProcessing = false;\nvar _SSMJob = class {\n};\nvar _SignalSmithManager = class _SignalSmithManager {\n /**set the SignalSmithManager.iframeUrl first to use iframe for memory\n * management */\n static renderAudio(workletUrl, audioBuffer, semitones = 0, rate = 1) {\n let job = new _SSMJob();\n job.workletUrl = workletUrl;\n job.sourceBuffer = audioBuffer;\n job.semitones = semitones;\n job.rate = rate;\n let promise = new Promise((resolve, reject) => {\n job.resolve = resolve;\n job.reject = reject;\n });\n _queue.push(job);\n if (_SignalSmithManager.iframeUrl != null) {\n _SignalSmithManager._processWithIframe();\n } else {\n _SignalSmithManager._process();\n }\n return promise;\n }\n static _processWithIframe() {\n if (_queue.length < 1) {\n return;\n }\n let job = _queue.shift();\n _isProcessing = true;\n let iframe = document.createElement(\"iframe\");\n iframe.onload = async (e) => {\n iframe.onload = null;\n await iframe.contentWindow.processJob(job);\n };\n iframe.src = _SignalSmithManager.iframeUrl;\n iframe.style.display = \"none\";\n job.iframeFinishedCallback = () => {\n iframe.remove();\n iframe.src = \"\";\n };\n document.body.append(iframe);\n }\n static async _process() {\n if (_isProcessing || _queue.length < 1) {\n return;\n }\n let job = _queue.shift();\n _isProcessing = true;\n try {\n let sampleRate = job.sourceBuffer.sampleRate;\n job.numLatencySamples = Math.ceil(sampleRate * 0.12);\n job.adjustedSourceBuffer = new AudioBuffer({\n length: job.sourceBuffer.length + job.numLatencySamples,\n sampleRate,\n numberOfChannels: job.sourceBuffer.numberOfChannels\n });\n for (let i = 0; i < job.sourceBuffer.numberOfChannels; i++) {\n let ch = job.sourceBuffer.getChannelData(i);\n job.adjustedSourceBuffer.copyToChannel(ch, i, 0);\n }\n let stretchedLength = Math.ceil(job.adjustedSourceBuffer.length / job.rate);\n let oac = new OfflineAudioContext({\n length: stretchedLength,\n sampleRate,\n numberOfChannels: job.adjustedSourceBuffer.numberOfChannels\n });\n await oac.audioWorklet.addModule(job.workletUrl);\n let semitoneShift = 12 * Math.log2(job.rate);\n let settings = {\n \"rate\": 1,\n \"semitones\": job.semitones - semitoneShift,\n \"tonality\": 8e3,\n \"block\": 120,\n \"overlap\": 4\n };\n let stretch = await SignalsmithStretch(oac);\n let callback = (e) => {\n if (e.data === \"config received\") {\n stretch.port.removeEventListener(\"message\", callback);\n _SignalSmithManager._processAudio(job, stretch, oac);\n }\n };\n stretch.port.addEventListener(\"message\", callback);\n stretch.port.postMessage({ controls: settings });\n } catch (err) {\n console.log(err);\n job.reject(err);\n }\n _isProcessing = false;\n _SignalSmithManager._process();\n }\n static async _processAudio(job, stretch, oac) {\n let bsn = oac.createBufferSource();\n bsn.buffer = job.adjustedSourceBuffer;\n bsn.connect(stretch);\n stretch.connect(oac.destination);\n if (job.rate != 1) {\n bsn.playbackRate.value = job.rate;\n }\n bsn.start(0);\n let rendered = await oac.startRendering();\n bsn.disconnect(stretch);\n stretch.disconnect(oac.destination);\n let truncated = new AudioBuffer({\n length: rendered.length - job.numLatencySamples,\n sampleRate: rendered.sampleRate,\n numberOfChannels: rendered.numberOfChannels\n });\n for (let i = 0; i < rendered.numberOfChannels; i++) {\n let ch = rendered.getChannelData(i);\n ch = ch.slice(job.numLatencySamples);\n truncated.copyToChannel(ch, i);\n }\n job.resolve(truncated);\n }\n /**only intended for testing */\n static async renderAudioLive(workletUrl, audioBuffer, semitones = 0, rate = 1) {\n try {\n let oac = AudioContextManager.context;\n await oac.audioWorklet.addModule(workletUrl);\n let bsn = oac.createBufferSource();\n bsn.buffer = audioBuffer;\n let settings = {\n \"rate\": 1,\n \"semitones\": semitones,\n \"tonality\": 8e3,\n \"block\": 120,\n \"overlap\": 4\n };\n let stretch = await SignalsmithStretch(oac);\n stretch.port.postMessage({ controls: settings });\n if (rate != 1) {\n bsn.playbackRate.value = rate;\n }\n bsn.connect(stretch);\n stretch.connect(oac.destination);\n bsn.start(0);\n bsn.connect(oac.destination);\n return null;\n } catch (err) {\n console.log(err);\n return null;\n }\n }\n};\n/**if set, an iframe will be used so that memory cleanup is possible. Note\n * that the SignalsmightStretch.js file must be in the same folder and\n * level as the iframe html page. Not used if null.*/\n_SignalSmithManager.iframeUrl = null;\nvar SignalSmithManager = _SignalSmithManager;\n\n// src/utils/SoundLoader.ts\nimport { createEmitter as createEmitter2 } from \"ts_utils\";\nvar _SoundLoader = class _SoundLoader {\n /**listen for progress in downloading (not parsing) the SoundFont file.\n * Use (loaded / total) properties to calculate download ratio.*/\n static get downloadProgress() {\n return _SoundLoader._downloadProgressEmitter.event;\n }\n // static StreamController _downloadProgressController = \n // \tnew StreamController.broadcast();\n constructor() {\n }\n /**loads an audio file and returns an AudioBuffer object\n * @fileInputId - the id from the html input element\n * @context - an AudioContext object*/\n static async getAudioBufferFromFileInput(fileInputId, context) {\n let input = document.getElementById(fileInputId);\n if (input == null) {\n console.log(\"invalid FileInput element ID\");\n return null;\n }\n if (input.files.length !== 1) {\n console.log(\"one audio file must be selected.\");\n return null;\n }\n let file = input.files[0];\n let audioBuffer = await _SoundLoader.getAudioBufferFromBlob(\n file,\n context\n );\n return audioBuffer;\n }\n /**converts an audioBlob (typically from getOggAudioBlob()) into an\n * AudioBuffer object that can be used with an AudioBufferSourceNode.\n * After making a recording (or reloading one from a server), use\n * getOggAudioBlob() to get the recording as an html.Blob object. Then\n * pass that to this getAudioBuffer() method and wait for the result\n * of the future, which will be the AudioBuffer object. To play it, use\n * something like:\n * let playbackNode = context.createBufferSource();\n * _playbackNode.buffer = audioBuffer;\n * _playbackNode.connectNode(context.destination);\n * _playbackNode.start(0);*/\n static getAudioBufferFromBlob(audioBlob, context) {\n if (context == null)\n throw \"AudioContext not set\";\n return new Promise((resolve, reject) => {\n let reader = new FileReader();\n reader.addEventListener(\"loadend\", async (e) => {\n try {\n let ab = await context.decodeAudioData(\n reader.result\n );\n resolve(ab);\n } catch (err) {\n console.log(\"problem decoding file - unsupported type?\");\n resolve(null);\n }\n });\n reader.readAsArrayBuffer(audioBlob);\n });\n }\n /**loads an audio file from a URL and converts it to an\n * AudioBuffer object that can be used with an AudioBufferSourceNode.\n * To play it, use something like:\n * let playbackNode = context.createBufferSource();\n * _playbackNode.buffer = audioBuffer;\n * _playbackNode.connectNode(context.destination);\n * _playbackNode.start(0);*/\n static getAudioBufferFromUrl(url, context) {\n if (context == null)\n throw \"AudioContext not set\";\n return new Promise((resolve, reject) => {\n _SoundLoader.getArrayBufferFromUrl(url).then((byteBuffer) => {\n context.decodeAudioData(byteBuffer).then((ab) => {\n resolve(ab);\n }).catch((err) => {\n console.log(err.toString());\n reject(err);\n });\n });\n });\n }\n /**loads a url as binary content, returning a ByteBuffer (Dart equivalent\n * of ArrayBuffer)*/\n static getArrayBufferFromUrl(url) {\n return new Promise((resolve, reject) => {\n let request = new XMLHttpRequest();\n request.responseType = \"arraybuffer\";\n request.onprogress = (e) => {\n _SoundLoader._downloadProgressEmitter.emit(e);\n };\n request.onload = (e) => {\n resolve(request.response);\n };\n request.onerror = (e) => {\n console.log(e.toString());\n reject(e.toString());\n };\n request.open(\"GET\", url);\n request.send();\n });\n }\n static getDownloadLinkForArrayBuffer(data, fileName) {\n let a = document.createElement(\"a\");\n a.style.display = \"none\";\n let blob = new Blob(data, { type: \"octet/stream\" });\n let url = URL.createObjectURL(blob);\n a.href = url;\n a.download = fileName;\n a.click();\n URL.revokeObjectURL(url);\n return a;\n }\n /**listen for progress in downloading (not parsing) the SoundFont file.\n * Use (loaded / total) properties to calculate download ratio.*/\n // static Stream get onDownloadProgress => \n // \t_downloadProgressController.stream;\n};\n/**used for listening to file download progress events*/\n_SoundLoader._downloadProgressEmitter = createEmitter2();\nvar SoundLoader = _SoundLoader;\n\n// src/utils/soundTouch/SoundTouchManager.ts\nvar SoundTouchManager = class {\n constructor() {\n this._onMessage = (e) => {\n let msgType = e.data[0];\n switch (msgType) {\n case \"ready\": {\n if (this._workerLoadedResolver) {\n this._workerLoadedResolver();\n this._workerLoadedResolver = null;\n }\n break;\n }\n case \"render_complete\": {\n this._handleFinishedRender(e.data[1]);\n break;\n }\n }\n };\n }\n /** Loads a SoundTouch module script\n * @param url the url of a SoundTouch module script matching the public\n * exports of the version packed with this application. */\n loadSoundTouchWorker(url) {\n return new Promise((resolve, reject) => {\n this._workerLoadedResolver = resolve;\n if (this._worker != null) {\n this._worker.removeEventListener(\"message\", this._onMessage);\n }\n this._worker = new Worker(url);\n this._worker.addEventListener(\"message\", this._onMessage);\n });\n }\n renderAudio(audioBuffer, { pitch = 1, tempo = 1 }) {\n if (this._currentAudioBuffer != null) {\n throw \"You must wait for the previous render to finish\";\n }\n this._currentAudioBuffer = audioBuffer;\n return new Promise((resolve, reject) => {\n this._renderFinishedResolver = resolve;\n let left = audioBuffer.getChannelData(0);\n let right = audioBuffer.numberOfChannels > 1 ? audioBuffer.getChannelData(1) : audioBuffer.getChannelData(0);\n this._worker.postMessage([\n \"render\",\n left,\n right,\n audioBuffer.sampleRate,\n audioBuffer.numberOfChannels,\n pitch,\n tempo\n ]);\n });\n }\n _handleFinishedRender(samples) {\n let ab = new AudioBuffer({\n length: samples[0].length,\n sampleRate: this._currentAudioBuffer.sampleRate,\n numberOfChannels: samples.length\n });\n ab.copyToChannel(samples[0], 0);\n if (samples.length > 1) {\n ab.copyToChannel(samples[1], 1);\n }\n this._currentAudioBuffer = null;\n this._renderFinishedResolver(ab);\n this._renderFinishedResolver = null;\n }\n};\n\n// src/utils/soundTouch/SoundTouchAudioNode.ts\nvar SoundTouchAudioNode = class extends AudioWorkletNode {\n constructor(context, workletName = \"soundtouch-worklet\", audioBuffer) {\n super(\n context,\n workletName,\n {\n outputChannelCount: [audioBuffer.numberOfChannels]\n }\n );\n this._ready = false;\n this._onMessage = (e) => {\n let message = e.data.message;\n switch (message) {\n case \"PROCESSOR_CONSTRUCTOR\": {\n this._initializeProcessor();\n break;\n }\n case \"PROCESSOR_READY\": {\n this._ready = true;\n if (this._readyResolver) {\n this._readyResolver();\n this._readyResolver = null;\n }\n break;\n }\n }\n };\n this._onMessageError = (e) => {\n console.log(e);\n };\n this._audioBuffer = audioBuffer;\n this._init();\n }\n ready() {\n return new Promise((resolve, reject) => {\n if (this._ready) {\n resolve();\n } else {\n this._readyResolver = resolve;\n }\n });\n }\n setPitch(pitch = 1) {\n this._updateProperty(\"pitch\", pitch);\n }\n setTempo(tempo = 1) {\n this._updateProperty(\"tempo\", tempo);\n }\n _init() {\n this.port.onmessage = this._onMessage;\n this.port.onmessageerror = this._onMessageError;\n }\n _initializeProcessor() {\n let ab = this._audioBuffer;\n let settings = {\n sampleRate: ab.sampleRate,\n duration: ab.duration,\n bufferLength: ab.length,\n numberOfChannels: ab.numberOfChannels\n };\n let details = [\n settings,\n ab.getChannelData(0),\n ab.numberOfChannels > 1 ? ab.getChannelData(1) : ab.getChannelData(0)\n ];\n this.port.postMessage({\n message: \"INITIALIZE_PROCESSOR\",\n detail: details\n });\n this._audioBuffer = null;\n }\n _updateProperty(name, value) {\n this.port.postMessage({\n message: \"SET_PIPE_PROP\",\n detail: { name, value }\n });\n }\n};\n\n// src/utils/soundTouch/SoundTouchManager2.ts\nvar SoundTouchManager2 = class {\n constructor() {\n }\n /**at this time, only pitch is supported */\n async renderAudio(workletUrl, audioBuffer, { pitch = 1, tempo = 1, fadeOut = false }) {\n try {\n let oac = new OfflineAudioContext({\n length: audioBuffer.length,\n sampleRate: audioBuffer.sampleRate,\n numberOfChannels: audioBuffer.numberOfChannels\n });\n await oac.audioWorklet.addModule(workletUrl);\n let bsn = oac.createBufferSource();\n bsn.buffer = audioBuffer;\n let stNode = await this.createSoundTouchAudioNode(oac, audioBuffer);\n stNode.setPitch(pitch);\n bsn.connect(stNode);\n stNode.connect(oac.destination);\n bsn.start(0);\n let rendered = await oac.startRendering();\n for (let i = 0; i < rendered.numberOfChannels; i++) {\n let ch = rendered.getChannelData(i);\n let numSamples = ch.length;\n for (let j = 0; j < numSamples; j++) {\n if (isNaN(ch[j])) {\n ch[j] = 0;\n }\n }\n if (fadeOut) {\n let fadeSamples = 0.1 * rendered.sampleRate;\n let endIdx = -1;\n for (let j = numSamples - 1; j >= 0; j--) {\n if (endIdx === -1 && ch[j] !== 0) {\n endIdx = j;\n }\n if (endIdx !== -1) {\n ch[j] *= (endIdx - j) / fadeSamples;\n if (endIdx - j >= fadeSamples) {\n break;\n }\n }\n }\n }\n }\n return rendered;\n } catch (err) {\n console.log(err);\n return null;\n }\n }\n /** Loads an audio worklet processor on the provided context. This is only\n * necessary if you are playing the audio in real time, as opposed to using\n * the renderAudio method.\n * @param workletUrl the url of the audio worklet for processing */\n async loadSoundTouchAudioWorklet(workletUrl, audioContext) {\n await audioContext.audioWorklet.addModule(workletUrl);\n }\n /**This feature does not work correctly. Audio doesn't play full length. */\n async createSoundTouchAudioNode(context, audioBuffer) {\n let node = new SoundTouchAudioNode(\n context,\n \"soundtouch-worklet\",\n audioBuffer\n );\n await node.ready();\n return node;\n }\n};\n\n// src/utils/WaveWriter.ts\nvar WaveWriter = class _WaveWriter {\n getWaveData(audioBuffer) {\n let leftChannel = audioBuffer.getChannelData(0);\n let rightChannel = audioBuffer.numberOfChannels > 1 ? audioBuffer.getChannelData(1) : audioBuffer.getChannelData(0);\n let interleaved = this.interleave(leftChannel, rightChannel);\n let uint8Array = new Uint8Array(44 + interleaved.length * 2);\n let view = new DataView(uint8Array.buffer);\n this.writeUTFBytes(view, 0, \"RIFF\");\n view.setUint32(4, 44 + interleaved.length * 2, true);\n this.writeUTFBytes(view, 8, \"WAVE\");\n this.writeUTFBytes(view, 12, \"fmt \");\n view.setUint32(16, 16, true);\n view.setUint16(20, 1, true);\n view.setUint16(22, 2, true);\n view.setUint32(24, audioBuffer.sampleRate, true);\n view.setUint32(28, audioBuffer.sampleRate * 4, true);\n view.setUint16(32, 4, true);\n view.setUint16(34, 16, true);\n this.writeUTFBytes(view, 36, \"data\");\n view.setUint32(40, interleaved.length * 2, true);\n let lng = interleaved.length;\n let index = 44;\n for (let i = 0; i < lng; i++) {\n view.setInt16(index, Math.trunc(interleaved[i] * 32767), true);\n index += 2;\n }\n return view.buffer;\n }\n writeUTFBytes(view, offset, string) {\n let lng = string.length;\n for (let i = 0; i < lng; i++) {\n view.setUint8(offset + i, string.charCodeAt(i));\n }\n }\n interleave(leftChannel, rightChannel) {\n let length = leftChannel.length + rightChannel.length;\n let result = new Float32Array(length);\n let inputIndex = 0;\n for (let index = 0; index < length; ) {\n result[index++] = leftChannel[inputIndex];\n result[index++] = rightChannel[inputIndex];\n inputIndex++;\n }\n return result;\n }\n /**helper method to generate a wave file from an AudioBuffer and pop a\n * file save dialog.\n * @param audioBuffer the audio to convert to a wave file\n * @param name the name of the file\n */\n static saveWaveFile(audioBuffer, name) {\n let waveWriter = new _WaveWriter();\n let waveAB = waveWriter.getWaveData(audioBuffer);\n let blob = new Blob([waveAB], { type: \"audio/wav\" });\n let link = document.createElement(\"a\");\n let objectURL = URL.createObjectURL(blob);\n link.href = objectURL;\n link.href = URL.createObjectURL(blob);\n link.download = name.endsWith(\".wav\") ? name : `${name}.wav`;\n link.click();\n }\n};\nexport {\n AudioContextManager,\n AudioProcessor,\n MultiSoundLoader,\n PhazeManager,\n SignalSmithManager,\n SoundLoader,\n SoundTouchManager,\n SoundTouchManager2,\n WaveWriter\n};\n","\"use strict\";\nvar ExtensionType = /* @__PURE__ */ ((ExtensionType2) => {\n ExtensionType2[\"Application\"] = \"application\";\n ExtensionType2[\"WebGLPipes\"] = \"webgl-pipes\";\n ExtensionType2[\"WebGLPipesAdaptor\"] = \"webgl-pipes-adaptor\";\n ExtensionType2[\"WebGLSystem\"] = \"webgl-system\";\n ExtensionType2[\"WebGPUPipes\"] = \"webgpu-pipes\";\n ExtensionType2[\"WebGPUPipesAdaptor\"] = \"webgpu-pipes-adaptor\";\n ExtensionType2[\"WebGPUSystem\"] = \"webgpu-system\";\n ExtensionType2[\"CanvasSystem\"] = \"canvas-system\";\n ExtensionType2[\"CanvasPipesAdaptor\"] = \"canvas-pipes-adaptor\";\n ExtensionType2[\"CanvasPipes\"] = \"canvas-pipes\";\n ExtensionType2[\"Asset\"] = \"asset\";\n ExtensionType2[\"LoadParser\"] = \"load-parser\";\n ExtensionType2[\"ResolveParser\"] = \"resolve-parser\";\n ExtensionType2[\"CacheParser\"] = \"cache-parser\";\n ExtensionType2[\"DetectionParser\"] = \"detection-parser\";\n ExtensionType2[\"MaskEffect\"] = \"mask-effect\";\n ExtensionType2[\"BlendMode\"] = \"blend-mode\";\n ExtensionType2[\"TextureSource\"] = \"texture-source\";\n ExtensionType2[\"Environment\"] = \"environment\";\n ExtensionType2[\"ShapeBuilder\"] = \"shape-builder\";\n return ExtensionType2;\n})(ExtensionType || {});\nconst normalizeExtension = (ext) => {\n if (typeof ext === \"function\" || typeof ext === \"object\" && ext.extension) {\n if (!ext.extension) {\n throw new Error(\"Extension class must have an extension object\");\n }\n const metadata = typeof ext.extension !== \"object\" ? { type: ext.extension } : ext.extension;\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === \"object\") {\n ext = { ...ext };\n } else {\n throw new Error(\"Invalid extension type\");\n }\n if (typeof ext.type === \"string\") {\n ext.type = [ext.type];\n }\n return ext;\n};\nconst normalizeExtensionPriority = (ext, defaultPriority) => normalizeExtension(ext).priority ?? defaultPriority;\nconst extensions = {\n /** @ignore */\n _addHandlers: {},\n /** @ignore */\n _removeHandlers: {},\n /** @ignore */\n _queue: {},\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {extensions} For chaining.\n */\n remove(...extensions2) {\n extensions2.map(normalizeExtension).forEach((ext) => {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n return this;\n },\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {extensions} For chaining.\n */\n add(...extensions2) {\n extensions2.map(normalizeExtension).forEach((ext) => {\n ext.type.forEach((type) => {\n const handlers = this._addHandlers;\n const queue = this._queue;\n if (!handlers[type]) {\n queue[type] = queue[type] || [];\n queue[type]?.push(ext);\n } else {\n handlers[type]?.(ext);\n }\n });\n });\n return this;\n },\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function handler when extensions are added/registered {@link StrictExtensionFormat}.\n * @param onRemove - Function handler when extensions are removed/unregistered {@link StrictExtensionFormat}.\n * @returns {extensions} For chaining.\n */\n handle(type, onAdd, onRemove) {\n const addHandlers = this._addHandlers;\n const removeHandlers = this._removeHandlers;\n if (addHandlers[type] || removeHandlers[type]) {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n const queue = this._queue;\n if (queue[type]) {\n queue[type]?.forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n return this;\n },\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {extensions} For chaining.\n */\n handleByMap(type, map) {\n return this.handle(\n type,\n (extension) => {\n if (extension.name) {\n map[extension.name] = extension.ref;\n }\n },\n (extension) => {\n if (extension.name) {\n delete map[extension.name];\n }\n }\n );\n },\n /**\n * Handle a type, but using a list of extensions with a `name` property.\n * @param type - Type of extension to handle.\n * @param map - The array of named extensions.\n * @param defaultPriority - Fallback priority if none is defined.\n * @returns {extensions} For chaining.\n */\n handleByNamedList(type, map, defaultPriority = -1) {\n return this.handle(\n type,\n (extension) => {\n const index = map.findIndex((item) => item.name === extension.name);\n if (index >= 0)\n return;\n map.push({ name: extension.name, value: extension.ref });\n map.sort((a, b) => normalizeExtensionPriority(b.value, defaultPriority) - normalizeExtensionPriority(a.value, defaultPriority));\n },\n (extension) => {\n const index = map.findIndex((item) => item.name === extension.name);\n if (index !== -1) {\n map.splice(index, 1);\n }\n }\n );\n },\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @param defaultPriority - The default priority to use if none is specified.\n * @returns {extensions} For chaining.\n */\n handleByList(type, list, defaultPriority = -1) {\n return this.handle(\n type,\n (extension) => {\n if (list.includes(extension.ref)) {\n return;\n }\n list.push(extension.ref);\n list.sort((a, b) => normalizeExtensionPriority(b, defaultPriority) - normalizeExtensionPriority(a, defaultPriority));\n },\n (extension) => {\n const index = list.indexOf(extension.ref);\n if (index !== -1) {\n list.splice(index, 1);\n }\n }\n );\n }\n};\n\nexport { ExtensionType, extensions, normalizeExtensionPriority };\n//# sourceMappingURL=Extensions.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\n\n\"use strict\";\nconst browserExt = {\n extension: {\n type: ExtensionType.Environment,\n name: \"browser\",\n priority: -1\n },\n test: () => true,\n load: async () => {\n await import('./browserAll.mjs');\n }\n};\n\nexport { browserExt };\n//# sourceMappingURL=browserExt.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\n\n\"use strict\";\nconst webworkerExt = {\n extension: {\n type: ExtensionType.Environment,\n name: \"webworker\",\n priority: 0\n },\n test: () => typeof self !== \"undefined\" && self.WorkerGlobalScope !== void 0,\n load: async () => {\n await import('./webworkerAll.mjs');\n }\n};\n\nexport { webworkerExt };\n//# sourceMappingURL=webworkerExt.mjs.map\n","\"use strict\";\nclass ObservablePoint {\n /**\n * Creates a new `ObservablePoint`\n * @param observer - Observer to pass to listen for change events.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(observer, x, y) {\n this._x = x || 0;\n this._y = y || 0;\n this._observer = observer;\n }\n /**\n * Creates a clone of this point.\n * @param observer - Optional observer to pass to the new observable point.\n * @returns a copy of this observable point\n */\n clone(observer) {\n return new ObservablePoint(observer ?? this._observer, this._x, this._y);\n }\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x) {\n if (this._x !== x || this._y !== y) {\n this._x = x;\n this._y = y;\n this._observer._onUpdate(this);\n }\n return this;\n }\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `PointData`\n * @returns The observable point instance itself\n */\n copyFrom(p) {\n if (this._x !== p.x || this._y !== p.y) {\n this._x = p.x;\n this._y = p.y;\n this._observer._onUpdate(this);\n }\n return this;\n }\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `PointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p) {\n p.set(this._x, this._y);\n return p;\n }\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p) {\n return p.x === this._x && p.y === this._y;\n }\n toString() {\n return `[pixi.js/math:ObservablePoint x=${0} y=${0} scope=${this._observer}]`;\n }\n /** Position of the observable point on the x axis. */\n get x() {\n return this._x;\n }\n set x(value) {\n if (this._x !== value) {\n this._x = value;\n this._observer._onUpdate(this);\n }\n }\n /** Position of the observable point on the y axis. */\n get y() {\n return this._y;\n }\n set y(value) {\n if (this._y !== value) {\n this._y = value;\n this._observer._onUpdate(this);\n }\n }\n}\n\nexport { ObservablePoint };\n//# sourceMappingURL=ObservablePoint.mjs.map\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","\"use strict\";\nconst PI_2 = Math.PI * 2;\nconst RAD_TO_DEG = 180 / Math.PI;\nconst DEG_TO_RAD = Math.PI / 180;\n\nexport { DEG_TO_RAD, PI_2, RAD_TO_DEG };\n//# sourceMappingURL=const.mjs.map\n","\"use strict\";\nclass Point {\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0) {\n /** Position of the point on the x axis */\n this.x = 0;\n /** Position of the point on the y axis */\n this.y = 0;\n this.x = x;\n this.y = y;\n }\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone() {\n return new Point(this.x, this.y);\n }\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p) {\n this.set(p.x, p.y);\n return this;\n }\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `PointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p) {\n p.set(this.x, this.y);\n return p;\n }\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p) {\n return p.x === this.x && p.y === this.y;\n }\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x) {\n this.x = x;\n this.y = y;\n return this;\n }\n toString() {\n return `[pixi.js/math:Point x=${this.x} y=${this.y}]`;\n }\n /**\n * A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.\n * @readonly\n */\n static get shared() {\n tempPoint.x = 0;\n tempPoint.y = 0;\n return tempPoint;\n }\n}\nconst tempPoint = new Point();\n\nexport { Point };\n//# sourceMappingURL=Point.mjs.map\n","import { PI_2 } from '../misc/const.mjs';\nimport { Point } from '../point/Point.mjs';\n\n\"use strict\";\nclass Matrix {\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {\n /** An array of the current matrix. Only populated when `toArray` is called */\n this.array = null;\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array) {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a, b, c, d, tx, ty) {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n return this;\n }\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose, out) {\n if (!this.array) {\n this.array = new Float32Array(9);\n }\n const array = out || this.array;\n if (transpose) {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n } else {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n return array;\n }\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {Point} The new point, transformed through this matrix\n */\n apply(pos, newPos) {\n newPos = newPos || new Point();\n const x = pos.x;\n const y = pos.y;\n newPos.x = this.a * x + this.c * y + this.tx;\n newPos.y = this.b * x + this.d * y + this.ty;\n return newPos;\n }\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {Point} The new point, inverse-transformed through this matrix\n */\n applyInverse(pos, newPos) {\n newPos = newPos || new Point();\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const tx = this.tx;\n const ty = this.ty;\n const id = 1 / (a * d + c * -b);\n const x = pos.x;\n const y = pos.y;\n newPos.x = d * id * x + -c * id * y + (ty * c - tx * d) * id;\n newPos.y = a * id * y + -b * id * x + (-ty * a + tx * b) * id;\n return newPos;\n }\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x, y) {\n this.tx += x;\n this.ty += y;\n return this;\n }\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x, y) {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n return this;\n }\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n this.a = a1 * cos - this.b * sin;\n this.b = a1 * sin + this.b * cos;\n this.c = c1 * cos - this.d * sin;\n this.d = c1 * sin + this.d * cos;\n this.tx = tx1 * cos - this.ty * sin;\n this.ty = tx1 * sin + this.ty * cos;\n return this;\n }\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix) {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n this.a = matrix.a * a1 + matrix.b * c1;\n this.b = matrix.a * b1 + matrix.b * d1;\n this.c = matrix.c * a1 + matrix.d * c1;\n this.d = matrix.c * b1 + matrix.d * d1;\n this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx;\n this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty;\n return this;\n }\n /**\n * Appends two matrix's and sets the result to this matrix. AB = A * B\n * @param a - The matrix to append.\n * @param b - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n appendFrom(a, b) {\n const a1 = a.a;\n const b1 = a.b;\n const c1 = a.c;\n const d1 = a.d;\n const tx = a.tx;\n const ty = a.ty;\n const a2 = b.a;\n const b2 = b.b;\n const c2 = b.c;\n const d2 = b.d;\n this.a = a1 * a2 + b1 * c2;\n this.b = a1 * b2 + b1 * d2;\n this.c = c1 * a2 + d1 * c2;\n this.d = c1 * b2 + d1 * d2;\n this.tx = tx * a2 + ty * c2 + b.tx;\n this.ty = tx * b2 + ty * d2 + b.ty;\n return this;\n }\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n this.tx = x - (pivotX * this.a + pivotY * this.c);\n this.ty = y - (pivotX * this.b + pivotY * this.d);\n return this;\n }\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix) {\n const tx1 = this.tx;\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) {\n const a1 = this.a;\n const c1 = this.c;\n this.a = a1 * matrix.a + this.b * matrix.c;\n this.b = a1 * matrix.b + this.b * matrix.d;\n this.c = c1 * matrix.a + this.d * matrix.c;\n this.d = c1 * matrix.b + this.d * matrix.d;\n }\n this.tx = tx1 * matrix.a + this.ty * matrix.c + matrix.tx;\n this.ty = tx1 * matrix.b + this.ty * matrix.d + matrix.ty;\n return this;\n }\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform) {\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n const delta = Math.abs(skewX + skewY);\n if (delta < 1e-5 || Math.abs(PI_2 - delta) < 1e-5) {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n } else {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n transform.scale.x = Math.sqrt(a * a + b * b);\n transform.scale.y = Math.sqrt(c * c + d * d);\n transform.position.x = this.tx + (pivot.x * a + pivot.y * c);\n transform.position.y = this.ty + (pivot.x * b + pivot.y * d);\n return transform;\n }\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert() {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = a1 * d1 - b1 * c1;\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = (c1 * this.ty - d1 * tx1) / n;\n this.ty = -(a1 * this.ty - b1 * tx1) / n;\n return this;\n }\n /** Checks if this matrix is an identity matrix */\n isIdentity() {\n return this.a === 1 && this.b === 0 && this.c === 0 && this.d === 1 && this.tx === 0 && this.ty === 0;\n }\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity() {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n return this;\n }\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone() {\n const matrix = new Matrix();\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n }\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix) {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n }\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param matrix - The matrix to copy from.\n * @returns this\n */\n copyFrom(matrix) {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n return this;\n }\n /**\n * check to see if two matrices are the same\n * @param matrix - The matrix to compare to.\n */\n equals(matrix) {\n return matrix.a === this.a && matrix.b === this.b && matrix.c === this.c && matrix.d === this.d && matrix.tx === this.tx && matrix.ty === this.ty;\n }\n toString() {\n return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n /**\n * A default (identity) matrix.\n *\n * This is a shared object, if you want to modify it consider creating a new `Matrix`\n * @readonly\n */\n static get IDENTITY() {\n return identityMatrix.identity();\n }\n /**\n * A static Matrix that can be used to avoid creating new objects.\n * Will always ensure the matrix is reset to identity when requested.\n * Use this object for fast but temporary calculations, as it may be mutated later on.\n * This is a different object to the `IDENTITY` object and so can be modified without changing `IDENTITY`.\n * @readonly\n */\n static get shared() {\n return tempMatrix.identity();\n }\n}\nconst tempMatrix = new Matrix();\nconst identityMatrix = new Matrix();\n\nexport { Matrix };\n//# sourceMappingURL=Matrix.mjs.map\n","import { Matrix } from './Matrix.mjs';\n\n\"use strict\";\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\nconst rotationCayley = [];\nconst rotationMatrices = [];\nconst signum = Math.sign;\nfunction init() {\n for (let i = 0; i < 16; i++) {\n const row = [];\n rotationCayley.push(row);\n for (let j = 0; j < 16; j++) {\n const _ux = signum(ux[i] * ux[j] + vx[i] * uy[j]);\n const _uy = signum(uy[i] * ux[j] + vy[i] * uy[j]);\n const _vx = signum(ux[i] * vx[j] + vx[i] * vy[j]);\n const _vy = signum(uy[i] * vx[j] + vy[i] * vy[j]);\n for (let k = 0; k < 16; k++) {\n if (ux[k] === _ux && uy[k] === _uy && vx[k] === _vx && vy[k] === _vy) {\n row.push(k);\n break;\n }\n }\n }\n }\n for (let i = 0; i < 16; i++) {\n const mat = new Matrix();\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\ninit();\nconst groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n E: 0,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n SE: 1,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n S: 2,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n SW: 3,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n W: 4,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n NW: 5,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n N: 6,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n NE: 7,\n /**\n * Reflection about Y-axis.\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n /**\n * Reflection about the main diagonal.\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n /**\n * Reflection about X-axis.\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n /**\n * Reflection about reverse diagonal.\n * @memberof maths.groupD8\n * @constant {GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n /**\n * @memberof maths.groupD8\n * @param {GD8Symmetry} ind - sprite rotation angle.\n * @returns {GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind) => ux[ind],\n /**\n * @memberof maths.groupD8\n * @param {GD8Symmetry} ind - sprite rotation angle.\n * @returns {GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind) => uy[ind],\n /**\n * @memberof maths.groupD8\n * @param {GD8Symmetry} ind - sprite rotation angle.\n * @returns {GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind) => vx[ind],\n /**\n * @memberof maths.groupD8\n * @param {GD8Symmetry} ind - sprite rotation angle.\n * @returns {GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind) => vy[ind],\n /**\n * @memberof maths.groupD8\n * @param {GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation) => {\n if (rotation & 8) {\n return rotation & 15;\n }\n return -rotation & 7;\n },\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof maths.groupD8\n * @param {GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {GD8Symmetry} Composed operation\n */\n add: (rotationSecond, rotationFirst) => rotationCayley[rotationSecond][rotationFirst],\n /**\n * Reverse of `add`.\n * @memberof maths.groupD8\n * @param {GD8Symmetry} rotationSecond - Second operation\n * @param {GD8Symmetry} rotationFirst - First operation\n * @returns {GD8Symmetry} Result\n */\n sub: (rotationSecond, rotationFirst) => rotationCayley[rotationSecond][groupD8.inv(rotationFirst)],\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof maths.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation) => rotation ^ 4,\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof maths.groupD8\n * @param {GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation) => (rotation & 3) === 2,\n // rotation % 4 === 2\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof maths.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx, dy) => {\n if (Math.abs(dx) * 2 <= Math.abs(dy)) {\n if (dy >= 0) {\n return groupD8.S;\n }\n return groupD8.N;\n } else if (Math.abs(dy) * 2 <= Math.abs(dx)) {\n if (dx > 0) {\n return groupD8.E;\n }\n return groupD8.W;\n } else if (dy > 0) {\n if (dx > 0) {\n return groupD8.SE;\n }\n return groupD8.SW;\n } else if (dx > 0) {\n return groupD8.NE;\n }\n return groupD8.NW;\n },\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof maths.groupD8\n * @param {Matrix} matrix - sprite world matrix\n * @param {GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix, rotation, tx = 0, ty = 0) => {\n const mat = rotationMatrices[groupD8.inv(rotation)];\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n }\n};\n\nexport { groupD8 };\n//# sourceMappingURL=groupD8.mjs.map\n","import { Point } from '../point/Point.mjs';\n\n\"use strict\";\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nclass Rectangle {\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x = 0, y = 0, width = 0, height = 0) {\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default 'rectangle'\n */\n this.type = \"rectangle\";\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n }\n /** Returns the left edge of the rectangle. */\n get left() {\n return this.x;\n }\n /** Returns the right edge of the rectangle. */\n get right() {\n return this.x + this.width;\n }\n /** Returns the top edge of the rectangle. */\n get top() {\n return this.y;\n }\n /** Returns the bottom edge of the rectangle. */\n get bottom() {\n return this.y + this.height;\n }\n /** Determines whether the Rectangle is empty. */\n isEmpty() {\n return this.left === this.right || this.top === this.bottom;\n }\n /** A constant empty rectangle. This is a new object every time the property is accessed */\n static get EMPTY() {\n return new Rectangle(0, 0, 0, 0);\n }\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone() {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n /**\n * Converts a Bounds object to a Rectangle object.\n * @param bounds - The bounds to copy and convert to a rectangle.\n * @returns Returns itself.\n */\n copyFromBounds(bounds) {\n this.x = bounds.minX;\n this.y = bounds.minY;\n this.width = bounds.maxX - bounds.minX;\n this.height = bounds.maxY - bounds.minY;\n return this;\n }\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle) {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n return this;\n }\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle) {\n rectangle.copyFrom(this);\n return rectangle;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x < this.x + this.width) {\n if (y >= this.y && y < this.y + this.height) {\n return true;\n }\n }\n return false;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this rectangle including the stroke.\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @param strokeWidth - The width of the line to check\n * @returns Whether the x/y coordinates are within this rectangle\n */\n strokeContains(x, y, strokeWidth) {\n const { width, height } = this;\n if (width <= 0 || height <= 0)\n return false;\n const _x = this.x;\n const _y = this.y;\n const outerLeft = _x - strokeWidth / 2;\n const outerRight = _x + width + strokeWidth / 2;\n const outerTop = _y - strokeWidth / 2;\n const outerBottom = _y + height + strokeWidth / 2;\n const innerLeft = _x + strokeWidth / 2;\n const innerRight = _x + width - strokeWidth / 2;\n const innerTop = _y + strokeWidth / 2;\n const innerBottom = _y + height - strokeWidth / 2;\n return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);\n }\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other, transform) {\n if (!transform) {\n const x02 = this.x < other.x ? other.x : this.x;\n const x12 = this.right > other.right ? other.right : this.right;\n if (x12 <= x02) {\n return false;\n }\n const y02 = this.y < other.y ? other.y : this.y;\n const y12 = this.bottom > other.bottom ? other.bottom : this.bottom;\n return y12 > y02;\n }\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n if (x1 <= x0 || y1 <= y0) {\n return false;\n }\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n if (rt.x <= lt.x || lb.y <= lt.y) {\n return false;\n }\n const s = Math.sign(transform.a * transform.d - transform.b * transform.c);\n if (s === 0) {\n return false;\n }\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0 || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1 || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0 || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {\n return false;\n }\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = nx * x0 + ny * y0;\n const n10 = nx * x1 + ny * y0;\n const n01 = nx * x0 + ny * y1;\n const n11 = nx * x1 + ny * y1;\n if (Math.max(n00, n10, n01, n11) <= nx * lt.x + ny * lt.y || Math.min(n00, n10, n01, n11) >= nx * rb.x + ny * rb.y) {\n return false;\n }\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = mx * x0 + my * y0;\n const m10 = mx * x1 + my * y0;\n const m01 = mx * x0 + my * y1;\n const m11 = mx * x1 + my * y1;\n if (Math.max(m00, m10, m01, m11) <= mx * lt.x + my * lt.y || Math.min(m00, m10, m01, m11) >= mx * rb.x + my * rb.y) {\n return false;\n }\n return true;\n }\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX) {\n this.x -= paddingX;\n this.y -= paddingY;\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n return this;\n }\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle) {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n return this;\n }\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 1e-3) {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n return this;\n }\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle) {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n return this;\n }\n /**\n * Returns the framing rectangle of the rectangle as a Rectangle object\n * @param out - optional rectangle to store the result\n * @returns The framing rectangle\n */\n getBounds(out) {\n out = out || new Rectangle();\n out.copyFrom(this);\n return out;\n }\n toString() {\n return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n}\n\nexport { Rectangle };\n//# sourceMappingURL=Rectangle.mjs.map\n","\"use strict\";\nconst uidCache = {\n default: -1\n};\nfunction uid(name = \"default\") {\n if (uidCache[name] === void 0) {\n uidCache[name] = -1;\n }\n return ++uidCache[name];\n}\nfunction resetUids() {\n for (const key in uidCache) {\n delete uidCache[key];\n }\n}\n\nexport { resetUids, uid };\n//# sourceMappingURL=uid.mjs.map\n","\"use strict\";\nconst warnings = {};\nconst v8_0_0 = \"8.0.0\";\nfunction deprecation(version, message, ignoreDepth = 3) {\n if (warnings[message]) {\n return;\n }\n let stack = new Error().stack;\n if (typeof stack === \"undefined\") {\n console.warn(\"PixiJS Deprecation Warning: \", `${message}\nDeprecated since v${version}`);\n } else {\n stack = stack.split(\"\\n\").splice(ignoreDepth).join(\"\\n\");\n if (console.groupCollapsed) {\n console.groupCollapsed(\n \"%cPixiJS Deprecation Warning: %c%s\",\n \"color:#614108;background:#fffbe6\",\n \"font-weight:normal;color:#614108;background:#fffbe6\",\n `${message}\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n } else {\n console.warn(\"PixiJS Deprecation Warning: \", `${message}\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n warnings[message] = true;\n}\n\nexport { deprecation, v8_0_0 };\n//# sourceMappingURL=deprecation.mjs.map\n","\"use strict\";\nconst NOOP = () => {\n};\n\nexport { NOOP };\n//# sourceMappingURL=NOOP.mjs.map\n","\"use strict\";\nfunction nextPow2(v) {\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n}\nfunction isPow2(v) {\n return !(v & v - 1) && !!v;\n}\nfunction log2(v) {\n let r = (v > 65535 ? 1 : 0) << 4;\n v >>>= r;\n let shift = (v > 255 ? 1 : 0) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 15 ? 1 : 0) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 3 ? 1 : 0) << 1;\n v >>>= shift;\n r |= shift;\n return r | v >> 1;\n}\n\nexport { isPow2, log2, nextPow2 };\n//# sourceMappingURL=pow2.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { uid } from '../../../../utils/data/uid.mjs';\nimport { deprecation, v8_0_0 } from '../../../../utils/logging/deprecation.mjs';\n\n\"use strict\";\nconst idHash = /* @__PURE__ */ Object.create(null);\nfunction createResourceIdFromString(value) {\n const id = idHash[value];\n if (id === void 0) {\n idHash[value] = uid(\"resource\");\n }\n return id;\n}\nconst _TextureStyle = class _TextureStyle extends EventEmitter {\n /**\n * @param options - options for the style\n */\n constructor(options = {}) {\n super();\n this._resourceType = \"textureSampler\";\n this._touched = 0;\n /**\n * Specifies the maximum anisotropy value clamp used by the sampler.\n * Note: Most implementations support {@link GPUSamplerDescriptor#maxAnisotropy} values in range\n * between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor#maxAnisotropy} will\n * be clamped to the maximum value that the platform supports.\n * @internal\n * @ignore\n */\n this._maxAnisotropy = 1;\n /**\n * Has the style been destroyed?\n * @readonly\n */\n this.destroyed = false;\n options = { ..._TextureStyle.defaultOptions, ...options };\n this.addressMode = options.addressMode;\n this.addressModeU = options.addressModeU ?? this.addressModeU;\n this.addressModeV = options.addressModeV ?? this.addressModeV;\n this.addressModeW = options.addressModeW ?? this.addressModeW;\n this.scaleMode = options.scaleMode;\n this.magFilter = options.magFilter ?? this.magFilter;\n this.minFilter = options.minFilter ?? this.minFilter;\n this.mipmapFilter = options.mipmapFilter ?? this.mipmapFilter;\n this.lodMinClamp = options.lodMinClamp;\n this.lodMaxClamp = options.lodMaxClamp;\n this.compare = options.compare;\n this.maxAnisotropy = options.maxAnisotropy ?? 1;\n }\n set addressMode(value) {\n this.addressModeU = value;\n this.addressModeV = value;\n this.addressModeW = value;\n }\n /** setting this will set wrapModeU,wrapModeV and wrapModeW all at once! */\n get addressMode() {\n return this.addressModeU;\n }\n set wrapMode(value) {\n deprecation(v8_0_0, \"TextureStyle.wrapMode is now TextureStyle.addressMode\");\n this.addressMode = value;\n }\n get wrapMode() {\n return this.addressMode;\n }\n set scaleMode(value) {\n this.magFilter = value;\n this.minFilter = value;\n this.mipmapFilter = value;\n }\n /** setting this will set magFilter,minFilter and mipmapFilter all at once! */\n get scaleMode() {\n return this.magFilter;\n }\n /** Specifies the maximum anisotropy value clamp used by the sampler. */\n set maxAnisotropy(value) {\n this._maxAnisotropy = Math.min(value, 16);\n if (this._maxAnisotropy > 1) {\n this.scaleMode = \"linear\";\n }\n }\n get maxAnisotropy() {\n return this._maxAnisotropy;\n }\n // TODO - move this to WebGL?\n get _resourceId() {\n return this._sharedResourceId || this._generateResourceId();\n }\n update() {\n this.emit(\"change\", this);\n this._sharedResourceId = null;\n }\n _generateResourceId() {\n const bigKey = `${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;\n this._sharedResourceId = createResourceIdFromString(bigKey);\n return this._resourceId;\n }\n /** Destroys the style */\n destroy() {\n this.destroyed = true;\n this.emit(\"destroy\", this);\n this.emit(\"change\", this);\n this.removeAllListeners();\n }\n};\n/** default options for the style */\n_TextureStyle.defaultOptions = {\n addressMode: \"clamp-to-edge\",\n scaleMode: \"linear\"\n};\nlet TextureStyle = _TextureStyle;\n\nexport { TextureStyle };\n//# sourceMappingURL=TextureStyle.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { isPow2 } from '../../../../../maths/misc/pow2.mjs';\nimport { definedProps } from '../../../../../scene/container/utils/definedProps.mjs';\nimport { uid } from '../../../../../utils/data/uid.mjs';\nimport { TextureStyle } from '../TextureStyle.mjs';\n\n\"use strict\";\nconst _TextureSource = class _TextureSource extends EventEmitter {\n /**\n * @param options - options for creating a new TextureSource\n */\n constructor(options = {}) {\n super();\n this.options = options;\n /** unique id for this Texture source */\n this.uid = uid(\"textureSource\");\n /**\n * The resource type used by this TextureSource. This is used by the bind groups to determine\n * how to handle this resource.\n * @ignore\n * @internal\n */\n this._resourceType = \"textureSource\";\n /**\n * i unique resource id, used by the bind group systems.\n * This can change if the texture is resized or its resource changes\n */\n this._resourceId = uid(\"resource\");\n /**\n * this is how the backends know how to upload this texture to the GPU\n * It changes depending on the resource type. Classes that extend TextureSource\n * should override this property.\n * @ignore\n * @internal\n */\n this.uploadMethodId = \"unknown\";\n // dimensions\n this._resolution = 1;\n /** the pixel width of this texture source. This is the REAL pure number, not accounting resolution */\n this.pixelWidth = 1;\n /** the pixel height of this texture source. This is the REAL pure number, not accounting resolution */\n this.pixelHeight = 1;\n /**\n * the width of this texture source, accounting for resolution\n * eg pixelWidth 200, resolution 2, then width will be 100\n */\n this.width = 1;\n /**\n * the height of this texture source, accounting for resolution\n * eg pixelHeight 200, resolution 2, then height will be 100\n */\n this.height = 1;\n /**\n * The number of samples of a multisample texture. This is always 1 for non-multisample textures.\n * To enable multisample for a texture, set antialias to true\n * @internal\n * @ignore\n */\n this.sampleCount = 1;\n /** The number of mip levels to generate for this texture. this is overridden if autoGenerateMipmaps is true */\n this.mipLevelCount = 1;\n /**\n * Should we auto generate mipmaps for this texture? This will automatically generate mipmaps\n * for this texture when uploading to the GPU. Mipmapped textures take up more memory, but\n * can look better when scaled down.\n *\n * For performance reasons, it is recommended to NOT use this with RenderTextures, as they are often updated every frame.\n * If you do, make sure to call `updateMipmaps` after you update the texture.\n */\n this.autoGenerateMipmaps = false;\n /** the format that the texture data has */\n this.format = \"rgba8unorm\";\n /** how many dimensions does this texture have? currently v8 only supports 2d */\n this.dimension = \"2d\";\n /**\n * Only really affects RenderTextures.\n * Should we use antialiasing for this texture. It will look better, but may impact performance as a\n * Blit operation will be required to resolve the texture.\n */\n this.antialias = false;\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n this._touched = 0;\n /**\n * Used by the batcher to build texture batches. faster to have the variable here!\n * @protected\n */\n this._batchTick = -1;\n /**\n * A temporary batch location for the texture batching. Here for performance reasons only!\n * @protected\n */\n this._textureBindLocation = -1;\n options = { ..._TextureSource.defaultOptions, ...options };\n this.label = options.label ?? \"\";\n this.resource = options.resource;\n this.autoGarbageCollect = options.autoGarbageCollect;\n this._resolution = options.resolution;\n if (options.width) {\n this.pixelWidth = options.width * this._resolution;\n } else {\n this.pixelWidth = this.resource ? this.resourceWidth ?? 1 : 1;\n }\n if (options.height) {\n this.pixelHeight = options.height * this._resolution;\n } else {\n this.pixelHeight = this.resource ? this.resourceHeight ?? 1 : 1;\n }\n this.width = this.pixelWidth / this._resolution;\n this.height = this.pixelHeight / this._resolution;\n this.format = options.format;\n this.dimension = options.dimensions;\n this.mipLevelCount = options.mipLevelCount;\n this.autoGenerateMipmaps = options.autoGenerateMipmaps;\n this.sampleCount = options.sampleCount;\n this.antialias = options.antialias;\n this.alphaMode = options.alphaMode;\n this.style = new TextureStyle(definedProps(options));\n this.destroyed = false;\n this._refreshPOT();\n }\n /** returns itself */\n get source() {\n return this;\n }\n /** the style of the texture */\n get style() {\n return this._style;\n }\n set style(value) {\n if (this.style === value)\n return;\n this._style?.off(\"change\", this._onStyleChange, this);\n this._style = value;\n this._style?.on(\"change\", this._onStyleChange, this);\n this._onStyleChange();\n }\n /** setting this will set wrapModeU,wrapModeV and wrapModeW all at once! */\n get addressMode() {\n return this._style.addressMode;\n }\n set addressMode(value) {\n this._style.addressMode = value;\n }\n /** setting this will set wrapModeU,wrapModeV and wrapModeW all at once! */\n get repeatMode() {\n return this._style.addressMode;\n }\n set repeatMode(value) {\n this._style.addressMode = value;\n }\n /** Specifies the sampling behavior when the sample footprint is smaller than or equal to one texel. */\n get magFilter() {\n return this._style.magFilter;\n }\n set magFilter(value) {\n this._style.magFilter = value;\n }\n /** Specifies the sampling behavior when the sample footprint is larger than one texel. */\n get minFilter() {\n return this._style.minFilter;\n }\n set minFilter(value) {\n this._style.minFilter = value;\n }\n /** Specifies behavior for sampling between mipmap levels. */\n get mipmapFilter() {\n return this._style.mipmapFilter;\n }\n set mipmapFilter(value) {\n this._style.mipmapFilter = value;\n }\n /** Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture. */\n get lodMinClamp() {\n return this._style.lodMinClamp;\n }\n set lodMinClamp(value) {\n this._style.lodMinClamp = value;\n }\n /** Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture. */\n get lodMaxClamp() {\n return this._style.lodMaxClamp;\n }\n set lodMaxClamp(value) {\n this._style.lodMaxClamp = value;\n }\n _onStyleChange() {\n this.emit(\"styleChange\", this);\n }\n /** call this if you have modified the texture outside of the constructor */\n update() {\n if (this.resource) {\n const resolution = this._resolution;\n const didResize = this.resize(this.resourceWidth / resolution, this.resourceHeight / resolution);\n if (didResize)\n return;\n }\n this.emit(\"update\", this);\n }\n /** Destroys this texture source */\n destroy() {\n this.destroyed = true;\n this.emit(\"destroy\", this);\n this.emit(\"change\", this);\n if (this._style) {\n this._style.destroy();\n this._style = null;\n }\n this.uploadMethodId = null;\n this.resource = null;\n this.removeAllListeners();\n }\n /**\n * This will unload the Texture source from the GPU. This will free up the GPU memory\n * As soon as it is required fore rendering, it will be re-uploaded.\n */\n unload() {\n this._resourceId = uid(\"resource\");\n this.emit(\"change\", this);\n this.emit(\"unload\", this);\n }\n /** the width of the resource. This is the REAL pure number, not accounting resolution */\n get resourceWidth() {\n const { resource } = this;\n return resource.naturalWidth || resource.videoWidth || resource.displayWidth || resource.width;\n }\n /** the height of the resource. This is the REAL pure number, not accounting resolution */\n get resourceHeight() {\n const { resource } = this;\n return resource.naturalHeight || resource.videoHeight || resource.displayHeight || resource.height;\n }\n /**\n * the resolution of the texture. Changing this number, will not change the number of pixels in the actual texture\n * but will the size of the texture when rendered.\n *\n * changing the resolution of this texture to 2 for example will make it appear twice as small when rendered (as pixel\n * density will have increased)\n */\n get resolution() {\n return this._resolution;\n }\n set resolution(resolution) {\n if (this._resolution === resolution)\n return;\n this._resolution = resolution;\n this.width = this.pixelWidth / resolution;\n this.height = this.pixelHeight / resolution;\n }\n /**\n * Resize the texture, this is handy if you want to use the texture as a render texture\n * @param width - the new width of the texture\n * @param height - the new height of the texture\n * @param resolution - the new resolution of the texture\n * @returns - if the texture was resized\n */\n resize(width, height, resolution) {\n resolution = resolution || this._resolution;\n width = width || this.width;\n height = height || this.height;\n const newPixelWidth = Math.round(width * resolution);\n const newPixelHeight = Math.round(height * resolution);\n this.width = newPixelWidth / resolution;\n this.height = newPixelHeight / resolution;\n this._resolution = resolution;\n if (this.pixelWidth === newPixelWidth && this.pixelHeight === newPixelHeight) {\n return false;\n }\n this._refreshPOT();\n this.pixelWidth = newPixelWidth;\n this.pixelHeight = newPixelHeight;\n this.emit(\"resize\", this);\n this._resourceId = uid(\"resource\");\n this.emit(\"change\", this);\n return true;\n }\n /**\n * Lets the renderer know that this texture has been updated and its mipmaps should be re-generated.\n * This is only important for RenderTexture instances, as standard Texture instances will have their\n * mipmaps generated on upload. You should call this method after you make any change to the texture\n *\n * The reason for this is is can be quite expensive to update mipmaps for a texture. So by default,\n * We want you, the developer to specify when this action should happen.\n *\n * Generally you don't want to have mipmaps generated on Render targets that are changed every frame,\n */\n updateMipmaps() {\n if (this.autoGenerateMipmaps && this.mipLevelCount > 1) {\n this.emit(\"updateMipmaps\", this);\n }\n }\n set wrapMode(value) {\n this._style.wrapMode = value;\n }\n get wrapMode() {\n return this._style.wrapMode;\n }\n set scaleMode(value) {\n this._style.scaleMode = value;\n }\n /** setting this will set magFilter,minFilter and mipmapFilter all at once! */\n get scaleMode() {\n return this._style.scaleMode;\n }\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n _refreshPOT() {\n this.isPowerOfTwo = isPow2(this.pixelWidth) && isPow2(this.pixelHeight);\n }\n static test(_resource) {\n throw new Error(\"Unimplemented\");\n }\n};\n/** The default options used when creating a new TextureSource. override these to add your own defaults */\n_TextureSource.defaultOptions = {\n resolution: 1,\n format: \"bgra8unorm\",\n alphaMode: \"premultiply-alpha-on-upload\",\n dimensions: \"2d\",\n mipLevelCount: 1,\n autoGenerateMipmaps: false,\n sampleCount: 1,\n antialias: false,\n autoGarbageCollect: false\n};\nlet TextureSource = _TextureSource;\n\nexport { TextureSource };\n//# sourceMappingURL=TextureSource.mjs.map\n","\"use strict\";\nfunction definedProps(obj) {\n const result = {};\n for (const key in obj) {\n if (obj[key] !== void 0) {\n result[key] = obj[key];\n }\n }\n return result;\n}\n\nexport { definedProps };\n//# sourceMappingURL=definedProps.mjs.map\n","import { ExtensionType } from '../../../../../extensions/Extensions.mjs';\nimport { TextureSource } from './TextureSource.mjs';\n\n\"use strict\";\nclass BufferImageSource extends TextureSource {\n constructor(options) {\n const buffer = options.resource || new Float32Array(options.width * options.height * 4);\n let format = options.format;\n if (!format) {\n if (buffer instanceof Float32Array) {\n format = \"rgba32float\";\n } else if (buffer instanceof Int32Array) {\n format = \"rgba32uint\";\n } else if (buffer instanceof Uint32Array) {\n format = \"rgba32uint\";\n } else if (buffer instanceof Int16Array) {\n format = \"rgba16uint\";\n } else if (buffer instanceof Uint16Array) {\n format = \"rgba16uint\";\n } else if (buffer instanceof Int8Array) {\n format = \"bgra8unorm\";\n } else {\n format = \"bgra8unorm\";\n }\n }\n super({\n ...options,\n resource: buffer,\n format\n });\n this.uploadMethodId = \"buffer\";\n }\n static test(resource) {\n return resource instanceof Int8Array || resource instanceof Uint8Array || resource instanceof Uint8ClampedArray || resource instanceof Int16Array || resource instanceof Uint16Array || resource instanceof Int32Array || resource instanceof Uint32Array || resource instanceof Float32Array;\n }\n}\nBufferImageSource.extension = ExtensionType.TextureSource;\n\nexport { BufferImageSource };\n//# sourceMappingURL=BufferImageSource.mjs.map\n","import { Matrix } from '../../../../maths/matrix/Matrix.mjs';\n\n\"use strict\";\nconst tempMat = new Matrix();\nclass TextureMatrix {\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture, clampMargin) {\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n this.clampOffset = 0;\n if (typeof clampMargin === \"undefined\") {\n this.clampMargin = texture.width < 10 ? 0 : 0.5;\n } else {\n this.clampMargin = clampMargin;\n }\n this.isSimple = false;\n this.texture = texture;\n }\n /** Texture property. */\n get texture() {\n return this._texture;\n }\n set texture(value) {\n if (this.texture === value)\n return;\n this._texture?.removeListener(\"update\", this.update, this);\n this._texture = value;\n this._texture.addListener(\"update\", this.update, this);\n this.update();\n }\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs, out) {\n if (out === void 0) {\n out = uvs;\n }\n const mat = this.mapCoord;\n for (let i = 0; i < uvs.length; i += 2) {\n const x = uvs[i];\n const y = uvs[i + 1];\n out[i] = x * mat.a + y * mat.c + mat.tx;\n out[i + 1] = x * mat.b + y * mat.d + mat.ty;\n }\n return out;\n }\n /**\n * Updates matrices if texture was changed\n * @returns - whether or not it was updated\n */\n update() {\n const tex = this._texture;\n this._updateID++;\n const uvs = tex.uvs;\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n const orig = tex.orig;\n const trim = tex.trim;\n if (trim) {\n tempMat.set(\n orig.width / trim.width,\n 0,\n 0,\n orig.height / trim.height,\n -trim.x / trim.width,\n -trim.y / trim.height\n );\n this.mapCoord.append(tempMat);\n }\n const texBase = tex.source;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase._resolution;\n const offset = this.clampOffset;\n frame[0] = (tex.frame.x + margin + offset) / texBase.width;\n frame[1] = (tex.frame.y + margin + offset) / texBase.height;\n frame[2] = (tex.frame.x + tex.frame.width - margin + offset) / texBase.width;\n frame[3] = (tex.frame.y + tex.frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.pixelWidth;\n this.uClampOffset[1] = offset / texBase.pixelHeight;\n this.isSimple = tex.frame.width === texBase.width && tex.frame.height === texBase.height && tex.rotate === 0;\n return true;\n }\n}\n\nexport { TextureMatrix };\n//# sourceMappingURL=TextureMatrix.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { groupD8 } from '../../../../maths/matrix/groupD8.mjs';\nimport { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { uid } from '../../../../utils/data/uid.mjs';\nimport { deprecation, v8_0_0 } from '../../../../utils/logging/deprecation.mjs';\nimport { NOOP } from '../../../../utils/misc/NOOP.mjs';\nimport { BufferImageSource } from './sources/BufferImageSource.mjs';\nimport { TextureSource } from './sources/TextureSource.mjs';\nimport { TextureMatrix } from './TextureMatrix.mjs';\n\n\"use strict\";\nclass Texture extends EventEmitter {\n /**\n * @param {rendering.TextureOptions} options - Options for the texture\n */\n constructor({\n source,\n label,\n frame,\n orig,\n trim,\n defaultAnchor,\n defaultBorders,\n rotate,\n dynamic\n } = {}) {\n super();\n /** unique id for this texture */\n this.uid = uid(\"texture\");\n /** A uvs object based on the given frame and the texture source */\n this.uvs = { x0: 0, y0: 0, x1: 0, y1: 0, x2: 0, y2: 0, x3: 0, y3: 0 };\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n this.frame = new Rectangle();\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n * @example\n * texture.on('update', () => {});\n */\n this.noFrame = false;\n /**\n * Set to true if you plan on modifying the uvs of this texture.\n * When this is the case, sprites and other objects using the texture will\n * make sure to listen for changes to the uvs and update their vertices accordingly.\n */\n this.dynamic = false;\n /** is it a texture? yes! used for type checking */\n this.isTexture = true;\n this.label = label;\n this.source = source?.source ?? new TextureSource();\n this.noFrame = !frame;\n if (frame) {\n this.frame.copyFrom(frame);\n } else {\n const { width, height } = this._source;\n this.frame.width = width;\n this.frame.height = height;\n }\n this.orig = orig || this.frame;\n this.trim = trim;\n this.rotate = rotate ?? 0;\n this.defaultAnchor = defaultAnchor;\n this.defaultBorders = defaultBorders;\n this.destroyed = false;\n this.dynamic = dynamic || false;\n this.updateUvs();\n }\n set source(value) {\n if (this._source) {\n this._source.off(\"resize\", this.update, this);\n }\n this._source = value;\n value.on(\"resize\", this.update, this);\n this.emit(\"update\", this);\n }\n /** the underlying source of the texture (equivalent of baseTexture in v7) */\n get source() {\n return this._source;\n }\n /** returns a TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n get textureMatrix() {\n if (!this._textureMatrix) {\n this._textureMatrix = new TextureMatrix(this);\n }\n return this._textureMatrix;\n }\n /** The width of the Texture in pixels. */\n get width() {\n return this.orig.width;\n }\n /** The height of the Texture in pixels. */\n get height() {\n return this.orig.height;\n }\n /** Call this function when you have modified the frame of this texture. */\n updateUvs() {\n const { uvs, frame } = this;\n const { width, height } = this._source;\n const nX = frame.x / width;\n const nY = frame.y / height;\n const nW = frame.width / width;\n const nH = frame.height / height;\n let rotate = this.rotate;\n if (rotate) {\n const w2 = nW / 2;\n const h2 = nH / 2;\n const cX = nX + w2;\n const cY = nY + h2;\n rotate = groupD8.add(rotate, groupD8.NW);\n uvs.x0 = cX + w2 * groupD8.uX(rotate);\n uvs.y0 = cY + h2 * groupD8.uY(rotate);\n rotate = groupD8.add(rotate, 2);\n uvs.x1 = cX + w2 * groupD8.uX(rotate);\n uvs.y1 = cY + h2 * groupD8.uY(rotate);\n rotate = groupD8.add(rotate, 2);\n uvs.x2 = cX + w2 * groupD8.uX(rotate);\n uvs.y2 = cY + h2 * groupD8.uY(rotate);\n rotate = groupD8.add(rotate, 2);\n uvs.x3 = cX + w2 * groupD8.uX(rotate);\n uvs.y3 = cY + h2 * groupD8.uY(rotate);\n } else {\n uvs.x0 = nX;\n uvs.y0 = nY;\n uvs.x1 = nX + nW;\n uvs.y1 = nY;\n uvs.x2 = nX + nW;\n uvs.y2 = nY + nH;\n uvs.x3 = nX;\n uvs.y3 = nY + nH;\n }\n }\n /**\n * Destroys this texture\n * @param destroySource - Destroy the source when the texture is destroyed.\n */\n destroy(destroySource = false) {\n if (this._source) {\n if (destroySource) {\n this._source.destroy();\n this._source = null;\n }\n }\n this._textureMatrix = null;\n this.destroyed = true;\n this.emit(\"destroy\", this);\n this.removeAllListeners();\n }\n /** call this if you have modified the `texture outside` of the constructor */\n update() {\n if (this.noFrame) {\n this.frame.width = this._source.width;\n this.frame.height = this._source.height;\n }\n this.updateUvs();\n this.emit(\"update\", this);\n }\n /** @deprecated since 8.0.0 */\n get baseTexture() {\n deprecation(v8_0_0, \"Texture.baseTexture is now Texture.source\");\n return this._source;\n }\n}\nTexture.EMPTY = new Texture({\n label: \"EMPTY\",\n source: new TextureSource({\n label: \"EMPTY\"\n })\n});\nTexture.EMPTY.destroy = NOOP;\nTexture.WHITE = new Texture({\n source: new BufferImageSource({\n resource: new Uint8Array([255, 255, 255, 255]),\n width: 1,\n height: 1,\n alphaMode: \"premultiply-alpha-on-upload\",\n label: \"WHITE\"\n }),\n label: \"WHITE\"\n});\nTexture.WHITE.destroy = NOOP;\n\nexport { Texture };\n//# sourceMappingURL=Texture.mjs.map\n","\"use strict\";\nfunction updateQuadBounds(bounds, anchor, texture, padding) {\n const { width, height } = texture.orig;\n const trim = texture.trim;\n if (trim) {\n const sourceWidth = trim.width;\n const sourceHeight = trim.height;\n bounds.minX = trim.x - anchor._x * width - padding;\n bounds.maxX = bounds.minX + sourceWidth;\n bounds.minY = trim.y - anchor._y * height - padding;\n bounds.maxY = bounds.minY + sourceHeight;\n } else {\n bounds.minX = -anchor._x * width - padding;\n bounds.maxX = bounds.minX + width;\n bounds.minY = -anchor._y * height - padding;\n bounds.maxY = bounds.minY + height;\n }\n return;\n}\n\nexport { updateQuadBounds };\n//# sourceMappingURL=updateQuadBounds.mjs.map\n","var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return\"string\"==typeof r?r.length>0:\"number\"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?\"0\"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,p=/^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s+([+-]?\\d*\\.?\\d+)%\\s+([+-]?\\d*\\.?\\d+)%\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,v=/^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,m=/^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},\"hex\"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},\"rgb\"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u=\"deg\"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},\"hsl\"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},\"rgb\"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},\"hsl\"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},\"hsv\"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):\"\",\"#\"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?\"rgba(\"+t+\", \"+n+\", \"+e+\", \"+u+\")\":\"rgb(\"+t+\", \"+n+\", \"+e+\")\";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?\"hsla(\"+t+\", \"+n+\"%, \"+e+\"%, \"+u+\")\":\"hsl(\"+t+\", \"+n+\"%, \"+e+\"%)\";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return\"number\"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return\"number\"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};export{j as Colord,w as colord,k as extend,I as getFormat,E as random};\n","import { extend, colord } from '@pixi/colord';\nimport namesPlugin from '@pixi/colord/plugins/names';\n\n\"use strict\";\nextend([namesPlugin]);\nconst _Color = class _Color {\n /**\n * @param {ColorSource} value - Optional value to use, if not provided, white is used.\n */\n constructor(value = 16777215) {\n this._value = null;\n this._components = new Float32Array(4);\n this._components.fill(1);\n this._int = 16777215;\n this.value = value;\n }\n /** Get red component (0 - 1) */\n get red() {\n return this._components[0];\n }\n /** Get green component (0 - 1) */\n get green() {\n return this._components[1];\n }\n /** Get blue component (0 - 1) */\n get blue() {\n return this._components[2];\n }\n /** Get alpha component (0 - 1) */\n get alpha() {\n return this._components[3];\n }\n /**\n * Set the value, suitable for chaining\n * @param value\n * @see Color.value\n */\n setValue(value) {\n this.value = value;\n return this;\n }\n /**\n * The current color source.\n *\n * When setting:\n * - Setting to an instance of `Color` will copy its color source and components.\n * - Otherwise, `Color` will try to normalize the color source and set the components.\n * If the color source is invalid, an `Error` will be thrown and the `Color` will left unchanged.\n *\n * Note: The `null` in the setter's parameter type is added to match the TypeScript rule: return type of getter\n * must be assignable to its setter's parameter type. Setting `value` to `null` will throw an `Error`.\n *\n * When getting:\n * - A return value of `null` means the previous value was overridden (e.g., {@link Color.multiply multiply},\n * {@link Color.premultiply premultiply} or {@link Color.round round}).\n * - Otherwise, the color source used when setting is returned.\n */\n set value(value) {\n if (value instanceof _Color) {\n this._value = this._cloneSource(value._value);\n this._int = value._int;\n this._components.set(value._components);\n } else if (value === null) {\n throw new Error(\"Cannot set Color#value to null\");\n } else if (this._value === null || !this._isSourceEqual(this._value, value)) {\n this._normalize(value);\n this._value = this._cloneSource(value);\n }\n }\n get value() {\n return this._value;\n }\n /**\n * Copy a color source internally.\n * @param value - Color source\n */\n _cloneSource(value) {\n if (typeof value === \"string\" || typeof value === \"number\" || value instanceof Number || value === null) {\n return value;\n } else if (Array.isArray(value) || ArrayBuffer.isView(value)) {\n return value.slice(0);\n } else if (typeof value === \"object\" && value !== null) {\n return { ...value };\n }\n return value;\n }\n /**\n * Equality check for color sources.\n * @param value1 - First color source\n * @param value2 - Second color source\n * @returns `true` if the color sources are equal, `false` otherwise.\n */\n _isSourceEqual(value1, value2) {\n const type1 = typeof value1;\n const type2 = typeof value2;\n if (type1 !== type2) {\n return false;\n } else if (type1 === \"number\" || type1 === \"string\" || value1 instanceof Number) {\n return value1 === value2;\n } else if (Array.isArray(value1) && Array.isArray(value2) || ArrayBuffer.isView(value1) && ArrayBuffer.isView(value2)) {\n if (value1.length !== value2.length) {\n return false;\n }\n return value1.every((v, i) => v === value2[i]);\n } else if (value1 !== null && value2 !== null) {\n const keys1 = Object.keys(value1);\n const keys2 = Object.keys(value2);\n if (keys1.length !== keys2.length) {\n return false;\n }\n return keys1.every((key) => value1[key] === value2[key]);\n }\n return value1 === value2;\n }\n /**\n * Convert to a RGBA color object.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgb(); // returns { r: 1, g: 1, b: 1, a: 1 }\n */\n toRgba() {\n const [r, g, b, a] = this._components;\n return { r, g, b, a };\n }\n /**\n * Convert to a RGB color object.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgb(); // returns { r: 1, g: 1, b: 1 }\n */\n toRgb() {\n const [r, g, b] = this._components;\n return { r, g, b };\n }\n /** Convert to a CSS-style rgba string: `rgba(255,255,255,1.0)`. */\n toRgbaString() {\n const [r, g, b] = this.toUint8RgbArray();\n return `rgba(${r},${g},${b},${this.alpha})`;\n }\n toUint8RgbArray(out) {\n const [r, g, b] = this._components;\n if (!this._arrayRgb) {\n this._arrayRgb = [];\n }\n out = out || this._arrayRgb;\n out[0] = Math.round(r * 255);\n out[1] = Math.round(g * 255);\n out[2] = Math.round(b * 255);\n return out;\n }\n toArray(out) {\n if (!this._arrayRgba) {\n this._arrayRgba = [];\n }\n out = out || this._arrayRgba;\n const [r, g, b, a] = this._components;\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n return out;\n }\n toRgbArray(out) {\n if (!this._arrayRgb) {\n this._arrayRgb = [];\n }\n out = out || this._arrayRgb;\n const [r, g, b] = this._components;\n out[0] = r;\n out[1] = g;\n out[2] = b;\n return out;\n }\n /**\n * Convert to a hexadecimal number.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toNumber(); // returns 16777215\n */\n toNumber() {\n return this._int;\n }\n /**\n * Convert to a BGR number\n * @example\n * import { Color } from 'pixi.js';\n * new Color(0xffcc99).toBgrNumber(); // returns 0x99ccff\n */\n toBgrNumber() {\n const [r, g, b] = this.toUint8RgbArray();\n return (b << 16) + (g << 8) + r;\n }\n /**\n * Convert to a hexadecimal number in little endian format (e.g., BBGGRR).\n * @example\n * import { Color } from 'pixi.js';\n * new Color(0xffcc99).toLittleEndianNumber(); // returns 0x99ccff\n * @returns {number} - The color as a number in little endian format.\n */\n toLittleEndianNumber() {\n const value = this._int;\n return (value >> 16) + (value & 65280) + ((value & 255) << 16);\n }\n /**\n * Multiply with another color. This action is destructive, and will\n * override the previous `value` property to be `null`.\n * @param {ColorSource} value - The color to multiply by.\n */\n multiply(value) {\n const [r, g, b, a] = _Color._temp.setValue(value)._components;\n this._components[0] *= r;\n this._components[1] *= g;\n this._components[2] *= b;\n this._components[3] *= a;\n this._refreshInt();\n this._value = null;\n return this;\n }\n /**\n * Converts color to a premultiplied alpha format. This action is destructive, and will\n * override the previous `value` property to be `null`.\n * @param alpha - The alpha to multiply by.\n * @param {boolean} [applyToRGB=true] - Whether to premultiply RGB channels.\n * @returns {Color} - Itself.\n */\n premultiply(alpha, applyToRGB = true) {\n if (applyToRGB) {\n this._components[0] *= alpha;\n this._components[1] *= alpha;\n this._components[2] *= alpha;\n }\n this._components[3] = alpha;\n this._refreshInt();\n this._value = null;\n return this;\n }\n /**\n * Premultiplies alpha with current color.\n * @param {number} alpha - The alpha to multiply by.\n * @param {boolean} [applyToRGB=true] - Whether to premultiply RGB channels.\n * @returns {number} tint multiplied by alpha\n */\n toPremultiplied(alpha, applyToRGB = true) {\n if (alpha === 1) {\n return (255 << 24) + this._int;\n }\n if (alpha === 0) {\n return applyToRGB ? 0 : this._int;\n }\n let r = this._int >> 16 & 255;\n let g = this._int >> 8 & 255;\n let b = this._int & 255;\n if (applyToRGB) {\n r = r * alpha + 0.5 | 0;\n g = g * alpha + 0.5 | 0;\n b = b * alpha + 0.5 | 0;\n }\n return (alpha * 255 << 24) + (r << 16) + (g << 8) + b;\n }\n /**\n * Convert to a hexadecimal string.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toHex(); // returns \"#ffffff\"\n */\n toHex() {\n const hexString = this._int.toString(16);\n return `#${\"000000\".substring(0, 6 - hexString.length) + hexString}`;\n }\n /**\n * Convert to a hexadecimal string with alpha.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toHexa(); // returns \"#ffffffff\"\n */\n toHexa() {\n const alphaValue = Math.round(this._components[3] * 255);\n const alphaString = alphaValue.toString(16);\n return this.toHex() + \"00\".substring(0, 2 - alphaString.length) + alphaString;\n }\n /**\n * Set alpha, suitable for chaining.\n * @param alpha\n */\n setAlpha(alpha) {\n this._components[3] = this._clamp(alpha);\n return this;\n }\n /**\n * Normalize the input value into rgba\n * @param value - Input value\n */\n _normalize(value) {\n let r;\n let g;\n let b;\n let a;\n if ((typeof value === \"number\" || value instanceof Number) && value >= 0 && value <= 16777215) {\n const int = value;\n r = (int >> 16 & 255) / 255;\n g = (int >> 8 & 255) / 255;\n b = (int & 255) / 255;\n a = 1;\n } else if ((Array.isArray(value) || value instanceof Float32Array) && value.length >= 3 && value.length <= 4) {\n value = this._clamp(value);\n [r, g, b, a = 1] = value;\n } else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray) && value.length >= 3 && value.length <= 4) {\n value = this._clamp(value, 0, 255);\n [r, g, b, a = 255] = value;\n r /= 255;\n g /= 255;\n b /= 255;\n a /= 255;\n } else if (typeof value === \"string\" || typeof value === \"object\") {\n if (typeof value === \"string\") {\n const match = _Color.HEX_PATTERN.exec(value);\n if (match) {\n value = `#${match[2]}`;\n }\n }\n const color = colord(value);\n if (color.isValid()) {\n ({ r, g, b, a } = color.rgba);\n r /= 255;\n g /= 255;\n b /= 255;\n }\n }\n if (r !== void 0) {\n this._components[0] = r;\n this._components[1] = g;\n this._components[2] = b;\n this._components[3] = a;\n this._refreshInt();\n } else {\n throw new Error(`Unable to convert color ${value}`);\n }\n }\n /** Refresh the internal color rgb number */\n _refreshInt() {\n this._clamp(this._components);\n const [r, g, b] = this._components;\n this._int = (r * 255 << 16) + (g * 255 << 8) + (b * 255 | 0);\n }\n /**\n * Clamps values to a range. Will override original values\n * @param value - Value(s) to clamp\n * @param min - Minimum value\n * @param max - Maximum value\n */\n _clamp(value, min = 0, max = 1) {\n if (typeof value === \"number\") {\n return Math.min(Math.max(value, min), max);\n }\n value.forEach((v, i) => {\n value[i] = Math.min(Math.max(v, min), max);\n });\n return value;\n }\n /**\n * Check if the value is a color-like object\n * @param value - Value to check\n * @returns True if the value is a color-like object\n * @static\n * @example\n * import { Color } from 'pixi.js';\n * Color.isColorLike('white'); // returns true\n * Color.isColorLike(0xffffff); // returns true\n * Color.isColorLike([1, 1, 1]); // returns true\n */\n static isColorLike(value) {\n return typeof value === \"number\" || typeof value === \"string\" || value instanceof Number || value instanceof _Color || Array.isArray(value) || value instanceof Uint8Array || value instanceof Uint8ClampedArray || value instanceof Float32Array || value.r !== void 0 && value.g !== void 0 && value.b !== void 0 || value.r !== void 0 && value.g !== void 0 && value.b !== void 0 && value.a !== void 0 || value.h !== void 0 && value.s !== void 0 && value.l !== void 0 || value.h !== void 0 && value.s !== void 0 && value.l !== void 0 && value.a !== void 0 || value.h !== void 0 && value.s !== void 0 && value.v !== void 0 || value.h !== void 0 && value.s !== void 0 && value.v !== void 0 && value.a !== void 0;\n }\n};\n/**\n * Default Color object for static uses\n * @example\n * import { Color } from 'pixi.js';\n * Color.shared.setValue(0xffffff).toHex(); // '#ffffff'\n */\n_Color.shared = new _Color();\n/**\n * Temporary Color object for static uses internally.\n * As to not conflict with Color.shared.\n * @ignore\n */\n_Color._temp = new _Color();\n/** Pattern for hex strings */\n// eslint-disable-next-line @typescript-eslint/naming-convention\n_Color.HEX_PATTERN = /^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;\nlet Color = _Color;\n\nexport { Color };\n//# sourceMappingURL=Color.mjs.map\n","export default function(e,f){var a={white:\"#ffffff\",bisque:\"#ffe4c4\",blue:\"#0000ff\",cadetblue:\"#5f9ea0\",chartreuse:\"#7fff00\",chocolate:\"#d2691e\",coral:\"#ff7f50\",antiquewhite:\"#faebd7\",aqua:\"#00ffff\",azure:\"#f0ffff\",whitesmoke:\"#f5f5f5\",papayawhip:\"#ffefd5\",plum:\"#dda0dd\",blanchedalmond:\"#ffebcd\",black:\"#000000\",gold:\"#ffd700\",goldenrod:\"#daa520\",gainsboro:\"#dcdcdc\",cornsilk:\"#fff8dc\",cornflowerblue:\"#6495ed\",burlywood:\"#deb887\",aquamarine:\"#7fffd4\",beige:\"#f5f5dc\",crimson:\"#dc143c\",cyan:\"#00ffff\",darkblue:\"#00008b\",darkcyan:\"#008b8b\",darkgoldenrod:\"#b8860b\",darkkhaki:\"#bdb76b\",darkgray:\"#a9a9a9\",darkgreen:\"#006400\",darkgrey:\"#a9a9a9\",peachpuff:\"#ffdab9\",darkmagenta:\"#8b008b\",darkred:\"#8b0000\",darkorchid:\"#9932cc\",darkorange:\"#ff8c00\",darkslateblue:\"#483d8b\",gray:\"#808080\",darkslategray:\"#2f4f4f\",darkslategrey:\"#2f4f4f\",deeppink:\"#ff1493\",deepskyblue:\"#00bfff\",wheat:\"#f5deb3\",firebrick:\"#b22222\",floralwhite:\"#fffaf0\",ghostwhite:\"#f8f8ff\",darkviolet:\"#9400d3\",magenta:\"#ff00ff\",green:\"#008000\",dodgerblue:\"#1e90ff\",grey:\"#808080\",honeydew:\"#f0fff0\",hotpink:\"#ff69b4\",blueviolet:\"#8a2be2\",forestgreen:\"#228b22\",lawngreen:\"#7cfc00\",indianred:\"#cd5c5c\",indigo:\"#4b0082\",fuchsia:\"#ff00ff\",brown:\"#a52a2a\",maroon:\"#800000\",mediumblue:\"#0000cd\",lightcoral:\"#f08080\",darkturquoise:\"#00ced1\",lightcyan:\"#e0ffff\",ivory:\"#fffff0\",lightyellow:\"#ffffe0\",lightsalmon:\"#ffa07a\",lightseagreen:\"#20b2aa\",linen:\"#faf0e6\",mediumaquamarine:\"#66cdaa\",lemonchiffon:\"#fffacd\",lime:\"#00ff00\",khaki:\"#f0e68c\",mediumseagreen:\"#3cb371\",limegreen:\"#32cd32\",mediumspringgreen:\"#00fa9a\",lightskyblue:\"#87cefa\",lightblue:\"#add8e6\",midnightblue:\"#191970\",lightpink:\"#ffb6c1\",mistyrose:\"#ffe4e1\",moccasin:\"#ffe4b5\",mintcream:\"#f5fffa\",lightslategray:\"#778899\",lightslategrey:\"#778899\",navajowhite:\"#ffdead\",navy:\"#000080\",mediumvioletred:\"#c71585\",powderblue:\"#b0e0e6\",palegoldenrod:\"#eee8aa\",oldlace:\"#fdf5e6\",paleturquoise:\"#afeeee\",mediumturquoise:\"#48d1cc\",mediumorchid:\"#ba55d3\",rebeccapurple:\"#663399\",lightsteelblue:\"#b0c4de\",mediumslateblue:\"#7b68ee\",thistle:\"#d8bfd8\",tan:\"#d2b48c\",orchid:\"#da70d6\",mediumpurple:\"#9370db\",purple:\"#800080\",pink:\"#ffc0cb\",skyblue:\"#87ceeb\",springgreen:\"#00ff7f\",palegreen:\"#98fb98\",red:\"#ff0000\",yellow:\"#ffff00\",slateblue:\"#6a5acd\",lavenderblush:\"#fff0f5\",peru:\"#cd853f\",palevioletred:\"#db7093\",violet:\"#ee82ee\",teal:\"#008080\",slategray:\"#708090\",slategrey:\"#708090\",aliceblue:\"#f0f8ff\",darkseagreen:\"#8fbc8f\",darkolivegreen:\"#556b2f\",greenyellow:\"#adff2f\",seagreen:\"#2e8b57\",seashell:\"#fff5ee\",tomato:\"#ff6347\",silver:\"#c0c0c0\",sienna:\"#a0522d\",lavender:\"#e6e6fa\",lightgreen:\"#90ee90\",orange:\"#ffa500\",orangered:\"#ff4500\",steelblue:\"#4682b4\",royalblue:\"#4169e1\",turquoise:\"#40e0d0\",yellowgreen:\"#9acd32\",salmon:\"#fa8072\",saddlebrown:\"#8b4513\",sandybrown:\"#f4a460\",rosybrown:\"#bc8f8f\",darksalmon:\"#e9967a\",lightgoldenrodyellow:\"#fafad2\",snow:\"#fffafa\",lightgrey:\"#d3d3d3\",lightgray:\"#d3d3d3\",dimgray:\"#696969\",dimgrey:\"#696969\",olivedrab:\"#6b8e23\",olive:\"#808000\"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return\"transparent\";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b=\"black\";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u 0) {\n item = this._pool[--this._index];\n } else {\n item = new this._classType();\n }\n item.init?.(data);\n return item;\n }\n /**\n * Returns an item to the pool. Calls the item's `reset` method if it exists.\n * @param {T} item - The item to return to the pool.\n */\n return(item) {\n item.reset?.();\n this._pool[this._index++] = item;\n }\n /**\n * Gets the number of items in the pool.\n * @readonly\n * @member {number}\n */\n get totalSize() {\n return this._count;\n }\n /**\n * Gets the number of items in the pool that are free to use without needing to create more.\n * @readonly\n * @member {number}\n */\n get totalFree() {\n return this._index;\n }\n /**\n * Gets the number of items in the pool that are currently in use.\n * @readonly\n * @member {number}\n */\n get totalUsed() {\n return this._count - this._index;\n }\n /** clears the pool - mainly used for debugging! */\n clear() {\n this._pool.length = 0;\n this._index = 0;\n }\n}\n\nexport { Pool };\n//# sourceMappingURL=Pool.mjs.map\n","import { Pool } from './Pool.mjs';\n\n\"use strict\";\nclass PoolGroupClass {\n constructor() {\n /**\n * A map to store the pools by their class type.\n * @private\n */\n this._poolsByClass = /* @__PURE__ */ new Map();\n }\n /**\n * Prepopulates a specific pool with a given number of items.\n * @template T The type of items in the pool. Must extend PoolItem.\n * @param {PoolItemConstructor} Class - The constructor of the items in the pool.\n * @param {number} total - The number of items to add to the pool.\n */\n prepopulate(Class, total) {\n const classPool = this.getPool(Class);\n classPool.prepopulate(total);\n }\n /**\n * Gets an item from a specific pool.\n * @template T The type of items in the pool. Must extend PoolItem.\n * @param {PoolItemConstructor} Class - The constructor of the items in the pool.\n * @param {unknown} [data] - Optional data to pass to the item's constructor.\n * @returns {T} The item from the pool.\n */\n get(Class, data) {\n const pool = this.getPool(Class);\n return pool.get(data);\n }\n /**\n * Returns an item to its respective pool.\n * @param {PoolItem} item - The item to return to the pool.\n */\n return(item) {\n const pool = this.getPool(item.constructor);\n pool.return(item);\n }\n /**\n * Gets a specific pool based on the class type.\n * @template T The type of items in the pool. Must extend PoolItem.\n * @param {PoolItemConstructor} ClassType - The constructor of the items in the pool.\n * @returns {Pool} The pool of the given class type.\n */\n getPool(ClassType) {\n if (!this._poolsByClass.has(ClassType)) {\n this._poolsByClass.set(ClassType, new Pool(ClassType));\n }\n return this._poolsByClass.get(ClassType);\n }\n /** gets the usage stats of each pool in the system */\n stats() {\n const stats = {};\n this._poolsByClass.forEach((pool) => {\n const name = stats[pool._classType.name] ? pool._classType.name + pool._classType.ID : pool._classType.name;\n stats[name] = {\n free: pool.totalFree,\n used: pool.totalUsed,\n size: pool.totalSize\n };\n });\n return stats;\n }\n}\nconst BigPool = new PoolGroupClass();\n\nexport { BigPool, PoolGroupClass };\n//# sourceMappingURL=PoolGroup.mjs.map\n","\"use strict\";\nfunction removeItems(arr, startIdx, removeCount) {\n const length = arr.length;\n let i;\n if (startIdx >= length || removeCount === 0) {\n return;\n }\n removeCount = startIdx + removeCount > length ? length - startIdx : removeCount;\n const len = length - removeCount;\n for (i = startIdx; i < len; ++i) {\n arr[i] = arr[i + removeCount];\n }\n arr.length = len;\n}\n\nexport { removeItems };\n//# sourceMappingURL=removeItems.mjs.map\n","import { removeItems } from '../../../utils/data/removeItems.mjs';\nimport { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';\n\n\"use strict\";\nconst childrenHelperMixin = {\n allowChildren: true,\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n * @memberof scene.Container#\n */\n removeChildren(beginIndex = 0, endIndex) {\n const end = endIndex ?? this.children.length;\n const range = end - beginIndex;\n const removed = [];\n if (range > 0 && range <= end) {\n for (let i = end - 1; i >= beginIndex; i--) {\n const child = this.children[i];\n if (!child)\n continue;\n removed.push(child);\n child.parent = null;\n }\n removeItems(this.children, beginIndex, end);\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.removeChildren(removed);\n }\n for (let i = 0; i < removed.length; ++i) {\n this.emit(\"childRemoved\", removed[i], this, i);\n removed[i].emit(\"removed\", this);\n }\n return removed;\n } else if (range === 0 && this.children.length === 0) {\n return removed;\n }\n throw new RangeError(\"removeChildren: numeric values are outside the acceptable range.\");\n },\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n * @memberof scene.Container#\n */\n removeChildAt(index) {\n const child = this.getChildAt(index);\n return this.removeChild(child);\n },\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n * @memberof scene.Container#\n */\n getChildAt(index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n return this.children[index];\n },\n /**\n * Changes the position of an existing child in the container container\n * @param child - The child Container instance for which you want to change the index number\n * @param index - The resulting index number for the child container\n * @memberof scene.Container#\n */\n setChildIndex(child, index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n this.getChildIndex(child);\n this.addChildAt(child, index);\n },\n /**\n * Returns the index position of a child Container instance\n * @param child - The Container instance to identify\n * @returns - The index position of the child container to identify\n * @memberof scene.Container#\n */\n getChildIndex(child) {\n const index = this.children.indexOf(child);\n if (index === -1) {\n throw new Error(\"The supplied Container must be a child of the caller\");\n }\n return index;\n },\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown.\n * If the child is already in this container, it will be moved to the specified index.\n * @param {Container} child - The child to add.\n * @param {number} index - The absolute index where the child will be positioned at the end of the operation.\n * @returns {Container} The child that was added.\n * @memberof scene.Container#\n */\n addChildAt(child, index) {\n if (!this.allowChildren) {\n deprecation(v8_0_0, \"addChildAt: Only Containers will be allowed to add children in v8.0.0\");\n }\n const { children } = this;\n if (index < 0 || index > children.length) {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${children.length}`);\n }\n if (child.parent) {\n const currentIndex = child.parent.children.indexOf(child);\n if (child.parent === this && currentIndex === index) {\n return child;\n }\n if (currentIndex !== -1) {\n child.parent.children.splice(currentIndex, 1);\n }\n }\n if (index === children.length) {\n children.push(child);\n } else {\n children.splice(index, 0, child);\n }\n child.parent = this;\n child.didChange = true;\n child.didViewUpdate = false;\n child._updateFlags = 15;\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.addChild(child);\n }\n if (this.sortableChildren)\n this.sortDirty = true;\n this.emit(\"childAdded\", child, this, index);\n child.emit(\"added\", this);\n return child;\n },\n /**\n * Swaps the position of 2 Containers within this container.\n * @param child - First container to swap\n * @param child2 - Second container to swap\n */\n swapChildren(child, child2) {\n if (child === child2) {\n return;\n }\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n this.children[index1] = child2;\n this.children[index2] = child;\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.structureDidChange = true;\n }\n this._didChangeId++;\n },\n /**\n * Remove the Container from its parent Container. If the Container has no parent, do nothing.\n * @memberof scene.Container#\n */\n removeFromParent() {\n this.parent?.removeChild(this);\n },\n /**\n * Reparent the child to this container, keeping the same worldTransform.\n * @param child - The child to reparent\n * @returns The first child that was reparented.\n * @memberof scene.Container#\n */\n reparentChild(...child) {\n if (child.length === 1) {\n return this.reparentChildAt(child[0], this.children.length);\n }\n child.forEach((c) => this.reparentChildAt(c, this.children.length));\n return child[0];\n },\n /**\n * Reparent the child to this container at the specified index, keeping the same worldTransform.\n * @param child - The child to reparent\n * @param index - The index to reparent the child to\n * @memberof scene.Container#\n */\n reparentChildAt(child, index) {\n if (child.parent === this) {\n this.setChildIndex(child, index);\n return child;\n }\n const childMat = child.worldTransform.clone();\n child.removeFromParent();\n this.addChildAt(child, index);\n const newMatrix = this.worldTransform.clone();\n newMatrix.invert();\n childMat.prepend(newMatrix);\n child.setFromMatrix(childMat);\n return child;\n }\n};\n\nexport { childrenHelperMixin };\n//# sourceMappingURL=childrenHelperMixin.mjs.map\n","\"use strict\";\nclass FilterEffect {\n constructor() {\n /** the pipe that knows how to handle this effect */\n this.pipe = \"filter\";\n /** the priority of this effect */\n this.priority = 1;\n }\n destroy() {\n for (let i = 0; i < this.filters.length; i++) {\n this.filters[i].destroy();\n }\n this.filters = null;\n this.filterArea = null;\n }\n}\n\nexport { FilterEffect };\n//# sourceMappingURL=FilterEffect.mjs.map\n","import { extensions, ExtensionType } from '../../extensions/Extensions.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\n\n\"use strict\";\nclass MaskEffectManagerClass {\n constructor() {\n /**\n * @private\n */\n this._effectClasses = [];\n this._tests = [];\n this._initialized = false;\n }\n init() {\n if (this._initialized)\n return;\n this._initialized = true;\n this._effectClasses.forEach((test) => {\n this.add({\n test: test.test,\n maskClass: test\n });\n });\n }\n add(test) {\n this._tests.push(test);\n }\n getMaskEffect(item) {\n if (!this._initialized)\n this.init();\n for (let i = 0; i < this._tests.length; i++) {\n const test = this._tests[i];\n if (test.test(item)) {\n return BigPool.get(test.maskClass, item);\n }\n }\n return item;\n }\n returnMaskEffect(effect) {\n BigPool.return(effect);\n }\n}\nconst MaskEffectManager = new MaskEffectManagerClass();\nextensions.handleByList(ExtensionType.MaskEffect, MaskEffectManager._effectClasses);\n\nexport { MaskEffectManager, MaskEffectManagerClass };\n//# sourceMappingURL=MaskEffectManager.mjs.map\n","import { FilterEffect } from '../../../filters/FilterEffect.mjs';\nimport { MaskEffectManager } from '../../../rendering/mask/MaskEffectManager.mjs';\n\n\"use strict\";\nconst effectsMixin = {\n _maskEffect: null,\n _filterEffect: null,\n /**\n * @todo Needs docs.\n * @memberof scene.Container#\n * @type {Array}\n */\n effects: [],\n /**\n * @todo Needs docs.\n * @param effect - The effect to add.\n * @memberof scene.Container#\n * @ignore\n */\n addEffect(effect) {\n const index = this.effects.indexOf(effect);\n if (index !== -1)\n return;\n this.effects.push(effect);\n this.effects.sort((a, b) => a.priority - b.priority);\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.structureDidChange = true;\n }\n this._updateIsSimple();\n },\n /**\n * @todo Needs docs.\n * @param effect - The effect to remove.\n * @memberof scene.Container#\n * @ignore\n */\n removeEffect(effect) {\n const index = this.effects.indexOf(effect);\n if (index === -1)\n return;\n this.effects.splice(index, 1);\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n this._updateIsSimple();\n },\n set mask(value) {\n const effect = this._maskEffect;\n if (effect?.mask === value)\n return;\n if (effect) {\n this.removeEffect(effect);\n MaskEffectManager.returnMaskEffect(effect);\n this._maskEffect = null;\n }\n if (value === null || value === void 0)\n return;\n this._maskEffect = MaskEffectManager.getMaskEffect(value);\n this.addEffect(this._maskEffect);\n },\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link Graphics} or a {@link Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * import { Graphics, Sprite } from 'pixi.js';\n *\n * const graphics = new Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new Sprite(texture);\n * sprite.mask = graphics;\n * @memberof scene.Container#\n */\n get mask() {\n return this._maskEffect?.mask;\n },\n set filters(value) {\n if (!Array.isArray(value) && value)\n value = [value];\n const effect = this._filterEffect || (this._filterEffect = new FilterEffect());\n value = value;\n const hasFilters = value?.length > 0;\n const hadFilters = effect.filters?.length > 0;\n const didChange = hasFilters !== hadFilters;\n value = Array.isArray(value) ? value.slice(0) : value;\n effect.filters = Object.freeze(value);\n if (didChange) {\n if (hasFilters) {\n this.addEffect(effect);\n } else {\n this.removeEffect(effect);\n effect.filters = value ?? null;\n }\n }\n },\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n * @memberof scene.Container#\n */\n get filters() {\n return this._filterEffect?.filters;\n },\n set filterArea(value) {\n this._filterEffect || (this._filterEffect = new FilterEffect());\n this._filterEffect.filterArea = value;\n },\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n * @memberof scene.Container#\n */\n get filterArea() {\n return this._filterEffect?.filterArea;\n }\n};\n\nexport { effectsMixin };\n//# sourceMappingURL=effectsMixin.mjs.map\n","import { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';\n\n\"use strict\";\nconst findMixin = {\n /**\n * The instance label of the object.\n * @memberof scene.Container#\n * @member {string} label\n */\n label: null,\n /**\n * The instance name of the object.\n * @deprecated since 8.0.0\n * @see scene.Container#label\n * @member {string} name\n * @memberof scene.Container#\n */\n get name() {\n deprecation(v8_0_0, \"Container.name property has been removed, use Container.label instead\");\n return this.label;\n },\n set name(value) {\n deprecation(v8_0_0, \"Container.name property has been removed, use Container.label instead\");\n this.label = value;\n },\n /**\n * @method getChildByName\n * @deprecated since 8.0.0\n * @param {string} name - Instance name.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @returns {Container} The child with the specified name.\n * @see scene.Container#getChildByLabel\n * @memberof scene.Container#\n */\n getChildByName(name, deep = false) {\n return this.getChildByLabel(name, deep);\n },\n /**\n * Returns the first child in the container with the specified label.\n *\n * Recursive searches are done in a pre-order traversal.\n * @memberof scene.Container#\n * @param {string|RegExp} label - Instance label.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @returns {Container} The child with the specified label.\n */\n getChildByLabel(label, deep = false) {\n const children = this.children;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child.label === label || label instanceof RegExp && label.test(child.label))\n return child;\n }\n if (deep) {\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const found = child.getChildByLabel(label, true);\n if (found) {\n return found;\n }\n }\n }\n return null;\n },\n /**\n * Returns all children in the container with the specified label.\n * @memberof scene.Container#\n * @param {string|RegExp} label - Instance label.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @param {Container[]} [out=[]] - The array to store matching children in.\n * @returns {Container[]} An array of children with the specified label.\n */\n getChildrenByLabel(label, deep = false, out = []) {\n const children = this.children;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child.label === label || label instanceof RegExp && label.test(child.label)) {\n out.push(child);\n }\n }\n if (deep) {\n for (let i = 0; i < children.length; i++) {\n children[i].getChildrenByLabel(label, true, out);\n }\n }\n return out;\n }\n};\n\nexport { findMixin };\n//# sourceMappingURL=findMixin.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { Rectangle } from '../../../maths/shapes/Rectangle.mjs';\n\n\"use strict\";\nconst defaultMatrix = new Matrix();\nclass Bounds {\n constructor(minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity) {\n /** @default Infinity */\n this.minX = Infinity;\n /** @default Infinity */\n this.minY = Infinity;\n /** @default -Infinity */\n this.maxX = -Infinity;\n /** @default -Infinity */\n this.maxY = -Infinity;\n this.matrix = defaultMatrix;\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n /**\n * Checks if bounds are empty.\n * @returns - True if empty.\n */\n isEmpty() {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n /** The bounding rectangle of the bounds. */\n get rectangle() {\n if (!this._rectangle) {\n this._rectangle = new Rectangle();\n }\n const rectangle = this._rectangle;\n if (this.minX > this.maxX || this.minY > this.maxY) {\n rectangle.x = 0;\n rectangle.y = 0;\n rectangle.width = 0;\n rectangle.height = 0;\n } else {\n rectangle.copyFromBounds(this);\n }\n return rectangle;\n }\n /** Clears the bounds and resets. */\n clear() {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n this.matrix = defaultMatrix;\n return this;\n }\n /**\n * Sets the bounds.\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n set(x0, y0, x1, y1) {\n this.minX = x0;\n this.minY = y0;\n this.maxX = x1;\n this.maxY = y1;\n }\n /**\n * Adds sprite frame\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param matrix\n */\n addFrame(x0, y0, x1, y1, matrix) {\n matrix || (matrix = this.matrix);\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n let x = a * x0 + c * y0 + tx;\n let y = b * x0 + d * y0 + ty;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n if (x > maxX)\n maxX = x;\n if (y > maxY)\n maxY = y;\n x = a * x1 + c * y0 + tx;\n y = b * x1 + d * y0 + ty;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n if (x > maxX)\n maxX = x;\n if (y > maxY)\n maxY = y;\n x = a * x0 + c * y1 + tx;\n y = b * x0 + d * y1 + ty;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n if (x > maxX)\n maxX = x;\n if (y > maxY)\n maxY = y;\n x = a * x1 + c * y1 + tx;\n y = b * x1 + d * y1 + ty;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n if (x > maxX)\n maxX = x;\n if (y > maxY)\n maxY = y;\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n /**\n * Adds a rectangle to the bounds.\n * @param rect - The rectangle to be added.\n * @param matrix - The matrix to apply to the bounds.\n */\n addRect(rect, matrix) {\n this.addFrame(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, matrix);\n }\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n * @param matrix\n */\n addBounds(bounds, matrix) {\n this.addFrame(bounds.minX, bounds.minY, bounds.maxX, bounds.maxY, matrix);\n }\n /**\n * Adds other Bounds, masked with Bounds.\n * @param mask - The Bounds to be added.\n */\n addBoundsMask(mask) {\n this.minX = this.minX > mask.minX ? this.minX : mask.minX;\n this.minY = this.minY > mask.minY ? this.minY : mask.minY;\n this.maxX = this.maxX < mask.maxX ? this.maxX : mask.maxX;\n this.maxY = this.maxY < mask.maxY ? this.maxY : mask.maxY;\n }\n /**\n * Adds other Bounds, multiplied with matrix.\n * @param matrix - The matrix to apply to the bounds.\n */\n applyMatrix(matrix) {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n const { a, b, c, d, tx, ty } = matrix;\n let x = a * minX + c * minY + tx;\n let y = b * minX + d * minY + ty;\n this.minX = x;\n this.minY = y;\n this.maxX = x;\n this.maxY = y;\n x = a * maxX + c * minY + tx;\n y = b * maxX + d * minY + ty;\n this.minX = x < this.minX ? x : this.minX;\n this.minY = y < this.minY ? y : this.minY;\n this.maxX = x > this.maxX ? x : this.maxX;\n this.maxY = y > this.maxY ? y : this.maxY;\n x = a * minX + c * maxY + tx;\n y = b * minX + d * maxY + ty;\n this.minX = x < this.minX ? x : this.minX;\n this.minY = y < this.minY ? y : this.minY;\n this.maxX = x > this.maxX ? x : this.maxX;\n this.maxY = y > this.maxY ? y : this.maxY;\n x = a * maxX + c * maxY + tx;\n y = b * maxX + d * maxY + ty;\n this.minX = x < this.minX ? x : this.minX;\n this.minY = y < this.minY ? y : this.minY;\n this.maxX = x > this.maxX ? x : this.maxX;\n this.maxY = y > this.maxY ? y : this.maxY;\n }\n /**\n * Resizes the bounds object to include the given rectangle.\n * @param rect - The rectangle to be included.\n */\n fit(rect) {\n if (this.minX < rect.left)\n this.minX = rect.left;\n if (this.maxX > rect.right)\n this.maxX = rect.right;\n if (this.minY < rect.top)\n this.minY = rect.top;\n if (this.maxY > rect.bottom)\n this.maxY = rect.bottom;\n return this;\n }\n /**\n * Resizes the bounds object to include the given bounds.\n * @param left - The left value of the bounds.\n * @param right - The right value of the bounds.\n * @param top - The top value of the bounds.\n * @param bottom - The bottom value of the bounds.\n */\n fitBounds(left, right, top, bottom) {\n if (this.minX < left)\n this.minX = left;\n if (this.maxX > right)\n this.maxX = right;\n if (this.minY < top)\n this.minY = top;\n if (this.maxY > bottom)\n this.maxY = bottom;\n return this;\n }\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX, paddingY = paddingX) {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n return this;\n }\n /** Ceils the bounds. */\n ceil() {\n this.minX = Math.floor(this.minX);\n this.minY = Math.floor(this.minY);\n this.maxX = Math.ceil(this.maxX);\n this.maxY = Math.ceil(this.maxY);\n return this;\n }\n /** Clones the bounds. */\n clone() {\n return new Bounds(this.minX, this.minY, this.maxX, this.maxY);\n }\n /**\n * Scales the bounds by the given values\n * @param x - The X value to scale by.\n * @param y - The Y value to scale by.\n */\n scale(x, y = x) {\n this.minX *= x;\n this.minY *= y;\n this.maxX *= x;\n this.maxY *= y;\n return this;\n }\n /** the x value of the bounds. */\n get x() {\n return this.minX;\n }\n set x(value) {\n const width = this.maxX - this.minX;\n this.minX = value;\n this.maxX = value + width;\n }\n /** the y value of the bounds. */\n get y() {\n return this.minY;\n }\n set y(value) {\n const height = this.maxY - this.minY;\n this.minY = value;\n this.maxY = value + height;\n }\n /** the width value of the bounds. */\n get width() {\n return this.maxX - this.minX;\n }\n set width(value) {\n this.maxX = this.minX + value;\n }\n /** the height value of the bounds. */\n get height() {\n return this.maxY - this.minY;\n }\n set height(value) {\n this.maxY = this.minY + value;\n }\n /** the left value of the bounds. */\n get left() {\n return this.minX;\n }\n /** the right value of the bounds. */\n get right() {\n return this.maxX;\n }\n /** the top value of the bounds. */\n get top() {\n return this.minY;\n }\n /** the bottom value of the bounds. */\n get bottom() {\n return this.maxY;\n }\n /** Is the bounds positive. */\n get isPositive() {\n return this.maxX - this.minX > 0 && this.maxY - this.minY > 0;\n }\n get isValid() {\n return this.minX + this.minY !== Infinity;\n }\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param matrix\n */\n addVertexData(vertexData, beginOffset, endOffset, matrix) {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n matrix || (matrix = this.matrix);\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n for (let i = beginOffset; i < endOffset; i += 2) {\n const localX = vertexData[i];\n const localY = vertexData[i + 1];\n const x = a * localX + c * localY + tx;\n const y = b * localX + d * localY + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n /**\n * Checks if the point is contained within the bounds.\n * @param x - x coordinate\n * @param y - y coordinate\n */\n containsPoint(x, y) {\n if (this.minX <= x && this.minY <= y && this.maxX >= x && this.maxY >= y) {\n return true;\n }\n return false;\n }\n toString() {\n return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`;\n }\n}\n\nexport { Bounds };\n//# sourceMappingURL=Bounds.mjs.map\n","import { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { Pool } from '../../../../utils/pool/Pool.mjs';\nimport { Bounds } from '../Bounds.mjs';\n\n\"use strict\";\nconst matrixPool = new Pool(Matrix);\nconst boundsPool = new Pool(Bounds);\n\nexport { boundsPool, matrixPool };\n//# sourceMappingURL=matrixAndBoundsPool.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { matrixPool, boundsPool } from './utils/matrixAndBoundsPool.mjs';\n\n\"use strict\";\nfunction getGlobalBounds(target, skipUpdateTransform, bounds) {\n bounds.clear();\n let parentTransform;\n let pooledMatrix;\n if (target.parent) {\n if (!skipUpdateTransform) {\n pooledMatrix = matrixPool.get().identity();\n parentTransform = updateTransformBackwards(target, pooledMatrix);\n } else {\n parentTransform = target.parent.worldTransform;\n }\n } else {\n parentTransform = Matrix.IDENTITY;\n }\n _getGlobalBounds(target, bounds, parentTransform, skipUpdateTransform);\n if (pooledMatrix) {\n matrixPool.return(pooledMatrix);\n }\n if (!bounds.isValid) {\n bounds.set(0, 0, 0, 0);\n }\n return bounds;\n}\nfunction _getGlobalBounds(target, bounds, parentTransform, skipUpdateTransform) {\n if (!target.visible || !target.measurable)\n return;\n let worldTransform;\n if (!skipUpdateTransform) {\n target.updateLocalTransform();\n worldTransform = matrixPool.get();\n worldTransform.appendFrom(target.localTransform, parentTransform);\n } else {\n worldTransform = target.worldTransform;\n }\n const parentBounds = bounds;\n const preserveBounds = !!target.effects.length;\n if (preserveBounds) {\n bounds = boundsPool.get().clear();\n }\n if (target.boundsArea) {\n bounds.addRect(target.boundsArea, worldTransform);\n } else {\n if (target.addBounds) {\n bounds.matrix = worldTransform;\n target.addBounds(bounds);\n }\n for (let i = 0; i < target.children.length; i++) {\n _getGlobalBounds(target.children[i], bounds, worldTransform, skipUpdateTransform);\n }\n }\n if (preserveBounds) {\n for (let i = 0; i < target.effects.length; i++) {\n target.effects[i].addBounds?.(bounds);\n }\n parentBounds.addBounds(bounds, Matrix.IDENTITY);\n boundsPool.return(bounds);\n }\n if (!skipUpdateTransform) {\n matrixPool.return(worldTransform);\n }\n}\nfunction updateTransformBackwards(target, parentTransform) {\n const parent = target.parent;\n if (parent) {\n updateTransformBackwards(parent, parentTransform);\n parent.updateLocalTransform();\n parentTransform.append(parent.localTransform);\n }\n return parentTransform;\n}\n\nexport { _getGlobalBounds, getGlobalBounds, updateTransformBackwards };\n//# sourceMappingURL=getGlobalBounds.mjs.map\n","\"use strict\";\nlet warnCount = 0;\nconst maxWarnings = 500;\nfunction warn(...args) {\n if (warnCount === maxWarnings)\n return;\n warnCount++;\n if (warnCount === maxWarnings) {\n console.warn(\"PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS.\");\n } else {\n console.warn(\"PixiJS Warning: \", ...args);\n }\n}\n\nexport { warn };\n//# sourceMappingURL=warn.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\nimport { matrixPool, boundsPool } from './utils/matrixAndBoundsPool.mjs';\n\n\"use strict\";\nfunction getLocalBounds(target, bounds, relativeMatrix) {\n bounds.clear();\n relativeMatrix || (relativeMatrix = Matrix.IDENTITY);\n _getLocalBounds(target, bounds, relativeMatrix, target, true);\n if (!bounds.isValid) {\n bounds.set(0, 0, 0, 0);\n }\n return bounds;\n}\nfunction _getLocalBounds(target, bounds, parentTransform, rootContainer, isRoot) {\n let relativeTransform;\n if (!isRoot) {\n if (!target.visible || !target.measurable)\n return;\n target.updateLocalTransform();\n const localTransform = target.localTransform;\n relativeTransform = matrixPool.get();\n relativeTransform.appendFrom(localTransform, parentTransform);\n } else {\n relativeTransform = matrixPool.get();\n relativeTransform = parentTransform.copyTo(relativeTransform);\n }\n const parentBounds = bounds;\n const preserveBounds = !!target.effects.length;\n if (preserveBounds) {\n bounds = boundsPool.get().clear();\n }\n if (target.boundsArea) {\n bounds.addRect(target.boundsArea, relativeTransform);\n } else {\n if (target.renderPipeId) {\n bounds.matrix = relativeTransform;\n target.addBounds(bounds);\n }\n const children = target.children;\n for (let i = 0; i < children.length; i++) {\n _getLocalBounds(children[i], bounds, relativeTransform, rootContainer, false);\n }\n }\n if (preserveBounds) {\n for (let i = 0; i < target.effects.length; i++) {\n target.effects[i].addLocalBounds?.(bounds, rootContainer);\n }\n parentBounds.addBounds(bounds, Matrix.IDENTITY);\n boundsPool.return(bounds);\n }\n matrixPool.return(relativeTransform);\n}\nfunction getParent(target, root, matrix) {\n const parent = target.parent;\n if (!parent) {\n warn(\"Item is not inside the root container\");\n return;\n }\n if (parent !== root) {\n getParent(parent, root, matrix);\n parent.updateLocalTransform();\n matrix.append(parent.localTransform);\n }\n}\n\nexport { getLocalBounds, getParent };\n//# sourceMappingURL=getLocalBounds.mjs.map\n","\"use strict\";\nfunction checkChildrenDidChange(container, previousData) {\n const children = container.children;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const changeId = (child.uid & 255) << 24 | child._didChangeId & 16777215;\n if (previousData.data[previousData.index] !== changeId) {\n previousData.data[previousData.index] = changeId;\n previousData.didChange = true;\n }\n previousData.index++;\n if (child.children.length) {\n checkChildrenDidChange(child, previousData);\n }\n }\n return previousData.didChange;\n}\n\nexport { checkChildrenDidChange };\n//# sourceMappingURL=checkChildrenDidChange.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { Bounds } from '../bounds/Bounds.mjs';\nimport { getGlobalBounds } from '../bounds/getGlobalBounds.mjs';\nimport { getLocalBounds } from '../bounds/getLocalBounds.mjs';\nimport { checkChildrenDidChange } from '../utils/checkChildrenDidChange.mjs';\n\n\"use strict\";\nconst tempMatrix = new Matrix();\nconst measureMixin = {\n _localBoundsCacheId: -1,\n _localBoundsCacheData: null,\n _setWidth(value, localWidth) {\n const sign = Math.sign(this.scale.x) || 1;\n if (localWidth !== 0) {\n this.scale.x = value / localWidth * sign;\n } else {\n this.scale.x = sign;\n }\n },\n _setHeight(value, localHeight) {\n const sign = Math.sign(this.scale.y) || 1;\n if (localHeight !== 0) {\n this.scale.y = value / localHeight * sign;\n } else {\n this.scale.y = sign;\n }\n },\n /**\n * Retrieves the local bounds of the container as a Bounds object.\n * @returns - The bounding area.\n * @memberof scene.Container#\n */\n getLocalBounds() {\n if (!this._localBoundsCacheData) {\n this._localBoundsCacheData = {\n data: [],\n index: 1,\n didChange: false,\n localBounds: new Bounds()\n };\n }\n const localBoundsCacheData = this._localBoundsCacheData;\n localBoundsCacheData.index = 1;\n localBoundsCacheData.didChange = false;\n if (localBoundsCacheData.data[0] !== this._didChangeId >> 12) {\n localBoundsCacheData.didChange = true;\n localBoundsCacheData.data[0] = this._didChangeId >> 12;\n }\n checkChildrenDidChange(this, localBoundsCacheData);\n if (localBoundsCacheData.didChange) {\n getLocalBounds(this, localBoundsCacheData.localBounds, tempMatrix);\n }\n return localBoundsCacheData.localBounds;\n },\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link Rectangle}.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param bounds - Optional bounds to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n * @memberof scene.Container#\n */\n getBounds(skipUpdate, bounds) {\n return getGlobalBounds(this, skipUpdate, bounds || new Bounds());\n }\n};\n\nexport { measureMixin };\n//# sourceMappingURL=measureMixin.mjs.map\n","\"use strict\";\nconst onRenderMixin = {\n _onRender: null,\n set onRender(func) {\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (!func) {\n if (this._onRender) {\n renderGroup?.removeOnRender(this);\n }\n this._onRender = null;\n return;\n }\n if (!this._onRender) {\n renderGroup?.addOnRender(this);\n }\n this._onRender = func;\n },\n /**\n * This callback is used when the container is rendered. This is where you should add your custom\n * logic that is needed to be run every frame.\n *\n * In v7 many users used `updateTransform` for this, however the way v8 renders objects is different\n * and \"updateTransform\" is no longer called every frame\n * @example\n * const container = new Container();\n * container.onRender = () => {\n * container.rotation += 0.01;\n * };\n * @memberof scene.Container#\n */\n get onRender() {\n return this._onRender;\n }\n};\n\nexport { onRenderMixin };\n//# sourceMappingURL=onRenderMixin.mjs.map\n","\"use strict\";\nconst sortMixin = {\n _zIndex: 0,\n /**\n * Should children be sorted by zIndex at the next render call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n * @type {boolean}\n * @memberof scene.Container#\n */\n sortDirty: false,\n /**\n * If set to true, the container will sort its children by `zIndex` value\n * when the next render is called, or manually if `sortChildren()` is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as {@link https://github.com/pixijs/layers PixiJS Layers}\n *\n * Also be aware of that this may not work nicely with the `addChildAt()` function,\n * as the `zIndex` sorting may cause the child to automatically sorted to another position.\n * @type {boolean}\n * @memberof scene.Container#\n */\n sortableChildren: false,\n /**\n * The zIndex of the container.\n *\n * Setting this value, will automatically set the parent to be sortable. Children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see scene.Container#sortableChildren\n * @memberof scene.Container#\n */\n get zIndex() {\n return this._zIndex;\n },\n set zIndex(value) {\n if (this._zIndex === value)\n return;\n this._zIndex = value;\n this.depthOfChildModified();\n },\n depthOfChildModified() {\n if (this.parent) {\n this.parent.sortableChildren = true;\n this.parent.sortDirty = true;\n }\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n },\n /**\n * Sorts children by zIndex.\n * @memberof scene.Container#\n */\n sortChildren() {\n if (!this.sortDirty)\n return;\n this.sortDirty = false;\n this.children.sort(sortChildren);\n }\n};\nfunction sortChildren(a, b) {\n return a._zIndex - b._zIndex;\n}\n\nexport { sortMixin };\n//# sourceMappingURL=sortMixin.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { Point } from '../../../maths/point/Point.mjs';\nimport { updateTransformBackwards } from '../bounds/getGlobalBounds.mjs';\n\n\"use strict\";\nconst toLocalGlobalMixin = {\n /**\n * Returns the global position of the container.\n * @param point - The optional point to write the global value to.\n * @param skipUpdate - Should we skip the update transform.\n * @returns - The updated point.\n * @memberof scene.Container#\n */\n getGlobalPosition(point = new Point(), skipUpdate = false) {\n if (this.parent) {\n this.parent.toGlobal(this._position, point, skipUpdate);\n } else {\n point.x = this._position.x;\n point.y = this._position.y;\n }\n return point;\n },\n /**\n * Calculates the global position of the container.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n * @memberof scene.Container#\n */\n toGlobal(position, point, skipUpdate = false) {\n if (!skipUpdate) {\n this.updateLocalTransform();\n const globalMatrix = updateTransformBackwards(this, new Matrix());\n globalMatrix.append(this.localTransform);\n return globalMatrix.apply(position, point);\n }\n return this.worldTransform.apply(position, point);\n },\n /**\n * Calculates the local position of the container relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The Container to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n * @memberof scene.Container#\n */\n toLocal(position, from, point, skipUpdate) {\n if (from) {\n position = from.toGlobal(position, point, skipUpdate);\n }\n if (!skipUpdate) {\n this.updateLocalTransform();\n const globalMatrix = updateTransformBackwards(this, new Matrix());\n globalMatrix.append(this.localTransform);\n return globalMatrix.applyInverse(position, point);\n }\n return this.worldTransform.applyInverse(position, point);\n }\n};\n\nexport { toLocalGlobalMixin };\n//# sourceMappingURL=toLocalGlobalMixin.mjs.map\n","import { uid } from '../../../../utils/data/uid.mjs';\n\n\"use strict\";\nclass InstructionSet {\n constructor() {\n /** a unique id for this instruction set used through the renderer */\n this.uid = uid(\"instructionSet\");\n /** the array of instructions */\n this.instructions = [];\n /** the actual size of the array (any instructions passed this should be ignored) */\n this.instructionSize = 0;\n }\n /** reset the instruction set so it can be reused set size back to 0 */\n reset() {\n this.instructionSize = 0;\n }\n /**\n * Add an instruction to the set\n * @param instruction - add an instruction to the set\n */\n add(instruction) {\n this.instructions[this.instructionSize++] = instruction;\n }\n /**\n * Log the instructions to the console (for debugging)\n * @internal\n * @ignore\n */\n log() {\n this.instructions.length = this.instructionSize;\n console.table(this.instructions, [\"type\", \"action\"]);\n }\n}\n\nexport { InstructionSet };\n//# sourceMappingURL=InstructionSet.mjs.map\n","import { Matrix } from '../../maths/matrix/Matrix.mjs';\nimport { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet.mjs';\n\n\"use strict\";\nclass RenderGroup {\n constructor() {\n this.renderPipeId = \"renderGroup\";\n this.root = null;\n this.canBundle = false;\n this.renderGroupParent = null;\n this.renderGroupChildren = [];\n this.worldTransform = new Matrix();\n this.worldColorAlpha = 4294967295;\n this.worldColor = 16777215;\n this.worldAlpha = 1;\n // these updates are transform changes..\n this.childrenToUpdate = /* @__PURE__ */ Object.create(null);\n this.updateTick = 0;\n // these update are renderable changes..\n this.childrenRenderablesToUpdate = { list: [], index: 0 };\n // other\n this.structureDidChange = true;\n this.instructionSet = new InstructionSet();\n this._onRenderContainers = [];\n }\n init(root) {\n this.root = root;\n if (root._onRender)\n this.addOnRender(root);\n root.didChange = true;\n const children = root.children;\n for (let i = 0; i < children.length; i++) {\n this.addChild(children[i]);\n }\n }\n reset() {\n this.renderGroupChildren.length = 0;\n for (const i in this.childrenToUpdate) {\n const childrenAtDepth = this.childrenToUpdate[i];\n childrenAtDepth.list.fill(null);\n childrenAtDepth.index = 0;\n }\n this.childrenRenderablesToUpdate.index = 0;\n this.childrenRenderablesToUpdate.list.fill(null);\n this.root = null;\n this.updateTick = 0;\n this.structureDidChange = true;\n this._onRenderContainers.length = 0;\n this.renderGroupParent = null;\n }\n get localTransform() {\n return this.root.localTransform;\n }\n addRenderGroupChild(renderGroupChild) {\n if (renderGroupChild.renderGroupParent) {\n renderGroupChild.renderGroupParent._removeRenderGroupChild(renderGroupChild);\n }\n renderGroupChild.renderGroupParent = this;\n this.renderGroupChildren.push(renderGroupChild);\n }\n _removeRenderGroupChild(renderGroupChild) {\n const index = this.renderGroupChildren.indexOf(renderGroupChild);\n if (index > -1) {\n this.renderGroupChildren.splice(index, 1);\n }\n renderGroupChild.renderGroupParent = null;\n }\n addChild(child) {\n this.structureDidChange = true;\n child.parentRenderGroup = this;\n child.updateTick = -1;\n if (child.parent === this.root) {\n child.relativeRenderGroupDepth = 1;\n } else {\n child.relativeRenderGroupDepth = child.parent.relativeRenderGroupDepth + 1;\n }\n child.didChange = true;\n this.onChildUpdate(child);\n if (child.renderGroup) {\n this.addRenderGroupChild(child.renderGroup);\n return;\n }\n if (child._onRender)\n this.addOnRender(child);\n const children = child.children;\n for (let i = 0; i < children.length; i++) {\n this.addChild(children[i]);\n }\n }\n removeChild(child) {\n this.structureDidChange = true;\n if (child._onRender) {\n if (!child.renderGroup) {\n this.removeOnRender(child);\n }\n }\n child.parentRenderGroup = null;\n if (child.renderGroup) {\n this._removeRenderGroupChild(child.renderGroup);\n return;\n }\n const children = child.children;\n for (let i = 0; i < children.length; i++) {\n this.removeChild(children[i]);\n }\n }\n removeChildren(children) {\n for (let i = 0; i < children.length; i++) {\n this.removeChild(children[i]);\n }\n }\n onChildUpdate(child) {\n let childrenToUpdate = this.childrenToUpdate[child.relativeRenderGroupDepth];\n if (!childrenToUpdate) {\n childrenToUpdate = this.childrenToUpdate[child.relativeRenderGroupDepth] = {\n index: 0,\n list: []\n };\n }\n childrenToUpdate.list[childrenToUpdate.index++] = child;\n }\n // SHOULD THIS BE HERE?\n updateRenderable(container) {\n if (container.globalDisplayStatus < 7)\n return;\n container.didViewUpdate = false;\n this.instructionSet.renderPipes[container.renderPipeId].updateRenderable(container);\n }\n onChildViewUpdate(child) {\n this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++] = child;\n }\n get isRenderable() {\n return this.root.localDisplayStatus === 7 && this.worldAlpha > 0;\n }\n /**\n * adding a container to the onRender list will make sure the user function\n * passed in to the user defined 'onRender` callBack\n * @param container - the container to add to the onRender list\n */\n addOnRender(container) {\n this._onRenderContainers.push(container);\n }\n removeOnRender(container) {\n this._onRenderContainers.splice(this._onRenderContainers.indexOf(container), 1);\n }\n runOnRender() {\n for (let i = 0; i < this._onRenderContainers.length; i++) {\n this._onRenderContainers[i]._onRender();\n }\n }\n destroy() {\n this.renderGroupParent = null;\n this.root = null;\n this.childrenRenderablesToUpdate = null;\n this.childrenToUpdate = null;\n this.renderGroupChildren = null;\n this._onRenderContainers = null;\n this.instructionSet = null;\n }\n getChildren(out = []) {\n const children = this.root.children;\n for (let i = 0; i < children.length; i++) {\n this._getChildren(children[i], out);\n }\n return out;\n }\n _getChildren(container, out = []) {\n out.push(container);\n if (container.renderGroup)\n return out;\n const children = container.children;\n for (let i = 0; i < children.length; i++) {\n this._getChildren(children[i], out);\n }\n return out;\n }\n}\n\nexport { RenderGroup };\n//# sourceMappingURL=RenderGroup.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { Color } from '../../color/Color.mjs';\nimport { cullingMixin } from '../../culling/cullingMixin.mjs';\nimport { Matrix } from '../../maths/matrix/Matrix.mjs';\nimport { RAD_TO_DEG, DEG_TO_RAD } from '../../maths/misc/const.mjs';\nimport { ObservablePoint } from '../../maths/point/ObservablePoint.mjs';\nimport { uid } from '../../utils/data/uid.mjs';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\nimport { childrenHelperMixin } from './container-mixins/childrenHelperMixin.mjs';\nimport { effectsMixin } from './container-mixins/effectsMixin.mjs';\nimport { findMixin } from './container-mixins/findMixin.mjs';\nimport { measureMixin } from './container-mixins/measureMixin.mjs';\nimport { onRenderMixin } from './container-mixins/onRenderMixin.mjs';\nimport { sortMixin } from './container-mixins/sortMixin.mjs';\nimport { toLocalGlobalMixin } from './container-mixins/toLocalGlobalMixin.mjs';\nimport { RenderGroup } from './RenderGroup.mjs';\nimport { assignWithIgnore } from './utils/assignWithIgnore.mjs';\n\n\"use strict\";\nconst defaultSkew = new ObservablePoint(null);\nconst defaultPivot = new ObservablePoint(null);\nconst defaultScale = new ObservablePoint(null, 1, 1);\nconst UPDATE_COLOR = 1;\nconst UPDATE_BLEND = 2;\nconst UPDATE_VISIBLE = 4;\nconst UPDATE_TRANSFORM = 8;\nclass Container extends EventEmitter {\n constructor(options = {}) {\n super();\n /** unique id for this container */\n this.uid = uid(\"renderable\");\n /** @private */\n this._updateFlags = 15;\n // the render group this container owns\n /** @private */\n this.renderGroup = null;\n // the render group this container belongs to\n /** @private */\n this.parentRenderGroup = null;\n // the index of the container in the render group\n /** @private */\n this.parentRenderGroupIndex = 0;\n // set to true if the container has changed. It is reset once the changes have been applied\n // by the transform system\n // its here to stop ensure that when things change, only one update gets registers with the transform system\n /** @private */\n this.didChange = false;\n // same as above, but for the renderable\n /** @private */\n this.didViewUpdate = false;\n // how deep is the container relative to its render group..\n // unless the element is the root render group - it will be relative to its parent\n /** @private */\n this.relativeRenderGroupDepth = 0;\n /**\n * The array of children of this container.\n * @readonly\n */\n this.children = [];\n /** The display object container that contains this display object. */\n this.parent = null;\n // used internally for changing up the render order.. mainly for masks and filters\n // TODO setting this should cause a rebuild??\n /** @private */\n this.includeInBuild = true;\n /** @private */\n this.measurable = true;\n /** @private */\n this.isSimple = true;\n // / /////////////Transform related props//////////////\n // used by the transform system to check if a container needs to be updated that frame\n // if the tick matches the current transform system tick, it is not updated again\n /**\n * @internal\n * @ignore\n */\n this.updateTick = -1;\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n this.localTransform = new Matrix();\n /**\n * The relative group transform is a transform relative to the render group it belongs too. It will include all parent\n * transforms and up to the render group (think of it as kind of like a stage - but the stage can be nested).\n * If this container is is self a render group matrix will be relative to its parent render group\n * @readonly\n */\n this.relativeGroupTransform = new Matrix();\n /**\n * The group transform is a transform relative to the render group it belongs too.\n * If this container is render group then this will be an identity matrix. other wise it\n * will be the same as the relativeGroupTransform.\n * Use this value when actually rendering things to the screen\n * @readonly\n */\n this.groupTransform = this.relativeGroupTransform;\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n this.destroyed = false;\n // transform data..\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @internal\n * @ignore\n */\n this._position = new ObservablePoint(this, 0, 0);\n /**\n * The scale factor of the object.\n * @internal\n * @ignore\n */\n this._scale = defaultScale;\n /**\n * The pivot point of the container that it rotates around.\n * @internal\n * @ignore\n */\n this._pivot = defaultPivot;\n /**\n * The skew amount, on the x and y axis.\n * @internal\n * @ignore\n */\n this._skew = defaultSkew;\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n * @internal\n * @ignore\n */\n this._cx = 1;\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n * @internal\n * @ignore\n */\n this._sx = 0;\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n * @internal\n * @ignore\n */\n this._cy = 0;\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n * @internal\n * @ignore\n */\n this._sy = 1;\n /**\n * The rotation amount.\n * @internal\n * @ignore\n */\n this._rotation = 0;\n // / COLOR related props //////////////\n // color stored as ABGR\n this.localColor = 16777215;\n this.localAlpha = 1;\n this.groupAlpha = 1;\n // A\n this.groupColor = 16777215;\n // BGR\n this.groupColorAlpha = 4294967295;\n // ABGR\n // / BLEND related props //////////////\n /**\n * @internal\n * @ignore\n */\n this.localBlendMode = \"inherit\";\n /**\n * @internal\n * @ignore\n */\n this.groupBlendMode = \"normal\";\n // / VISIBILITY related props //////////////\n // visibility\n // 0b11\n // first bit is visible, second bit is renderable\n /**\n * This property holds three bits: culled, visible, renderable\n * the third bit represents culling (0 = culled, 1 = not culled) 0b100\n * the second bit represents visibility (0 = not visible, 1 = visible) 0b010\n * the first bit represents renderable (0 = not renderable, 1 = renderable) 0b001\n * @internal\n * @ignore\n */\n this.localDisplayStatus = 7;\n // 0b11 | 0b10 | 0b01 | 0b00\n /**\n * @internal\n * @ignore\n */\n this.globalDisplayStatus = 7;\n /**\n * A value that increments each time the container is modified\n * the first 12 bits represent the container changes (eg transform, alpha, visible etc)\n * the second 12 bits represent:\n * - for view changes (eg texture swap, geometry change etc)\n * - containers changes (eg children added, removed etc)\n *\n * view container\n * [000000000000][00000000000]\n * @ignore\n */\n this._didChangeId = 0;\n /**\n * property that tracks if the container transform has changed\n * @ignore\n */\n this._didLocalTransformChangeId = -1;\n assignWithIgnore(this, options, {\n children: true,\n parent: true,\n effects: true\n });\n options.children?.forEach((child) => this.addChild(child));\n this.effects = [];\n options.parent?.addChild(this);\n }\n /**\n * Mixes all enumerable properties and methods from a source object to Container.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source) {\n Object.defineProperties(Container.prototype, Object.getOwnPropertyDescriptors(source));\n }\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...Container} children - The Container(s) to add to the container\n * @returns {Container} - The first child that was added.\n */\n addChild(...children) {\n if (!this.allowChildren) {\n deprecation(v8_0_0, \"addChild: Only Containers will be allowed to add children in v8.0.0\");\n }\n if (children.length > 1) {\n for (let i = 0; i < children.length; i++) {\n this.addChild(children[i]);\n }\n return children[0];\n }\n const child = children[0];\n if (child.parent === this) {\n this.children.splice(this.children.indexOf(child), 1);\n this.children.push(child);\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n return child;\n }\n if (child.parent) {\n child.parent.removeChild(child);\n }\n this.children.push(child);\n if (this.sortableChildren)\n this.sortDirty = true;\n child.parent = this;\n child.didChange = true;\n child.didViewUpdate = false;\n child._updateFlags = 15;\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.addChild(child);\n }\n this.emit(\"childAdded\", child, this, this.children.length - 1);\n child.emit(\"added\", this);\n this._didChangeId += 1 << 12;\n if (child._zIndex !== 0) {\n child.depthOfChildModified();\n }\n return child;\n }\n /**\n * Removes one or more children from the container.\n * @param {...Container} children - The Container(s) to remove\n * @returns {Container} The first child that was removed.\n */\n removeChild(...children) {\n if (children.length > 1) {\n for (let i = 0; i < children.length; i++) {\n this.removeChild(children[i]);\n }\n return children[0];\n }\n const child = children[0];\n const index = this.children.indexOf(child);\n if (index > -1) {\n this._didChangeId += 1 << 12;\n this.children.splice(index, 1);\n if (this.renderGroup) {\n this.renderGroup.removeChild(child);\n } else if (this.parentRenderGroup) {\n this.parentRenderGroup.removeChild(child);\n }\n child.parent = null;\n this.emit(\"childRemoved\", child, this, index);\n child.emit(\"removed\", this);\n }\n return child;\n }\n /** @ignore */\n _onUpdate(point) {\n if (point) {\n if (point === this._skew) {\n this._updateSkew();\n }\n }\n this._didChangeId++;\n if (this.didChange)\n return;\n this.didChange = true;\n if (this.parentRenderGroup) {\n this.parentRenderGroup.onChildUpdate(this);\n }\n }\n set isRenderGroup(value) {\n if (!!this.renderGroup === value)\n return;\n if (value) {\n this.enableRenderGroup();\n } else {\n this.disableRenderGroup();\n }\n }\n /**\n * Returns true if this container is a render group.\n * This means that it will be rendered as a separate pass, with its own set of instructions\n */\n get isRenderGroup() {\n return !!this.renderGroup;\n }\n /**\n * Calling this enables a render group for this container.\n * This means it will be rendered as a separate set of instructions.\n * The transform of the container will also be handled on the GPU rather than the CPU.\n */\n enableRenderGroup() {\n if (this.renderGroup)\n return;\n const parentRenderGroup = this.parentRenderGroup;\n parentRenderGroup?.removeChild(this);\n this.renderGroup = BigPool.get(RenderGroup, this);\n this.groupTransform = Matrix.IDENTITY;\n parentRenderGroup?.addChild(this);\n this._updateIsSimple();\n }\n /** This will disable the render group for this container. */\n disableRenderGroup() {\n if (!this.renderGroup)\n return;\n const parentRenderGroup = this.parentRenderGroup;\n parentRenderGroup?.removeChild(this);\n BigPool.return(this.renderGroup);\n this.renderGroup = null;\n this.groupTransform = this.relativeGroupTransform;\n parentRenderGroup?.addChild(this);\n this._updateIsSimple();\n }\n /** @ignore */\n _updateIsSimple() {\n this.isSimple = !this.renderGroup && this.effects.length === 0;\n }\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform() {\n this._worldTransform || (this._worldTransform = new Matrix());\n if (this.renderGroup) {\n this._worldTransform.copyFrom(this.renderGroup.worldTransform);\n } else if (this.parentRenderGroup) {\n this._worldTransform.appendFrom(this.relativeGroupTransform, this.parentRenderGroup.worldTransform);\n }\n return this._worldTransform;\n }\n // / ////// transform related stuff\n /**\n * The position of the container on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x() {\n return this._position.x;\n }\n set x(value) {\n this._position.x = value;\n }\n /**\n * The position of the container on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y() {\n return this._position.y;\n }\n set y(value) {\n this._position.y = value;\n }\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position() {\n return this._position;\n }\n set position(value) {\n this._position.copyFrom(value);\n }\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation() {\n return this._rotation;\n }\n set rotation(value) {\n if (this._rotation !== value) {\n this._rotation = value;\n this._onUpdate(this._skew);\n }\n }\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle() {\n return this.rotation * RAD_TO_DEG;\n }\n set angle(value) {\n this.rotation = value * DEG_TO_RAD;\n }\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot() {\n if (this._pivot === defaultPivot) {\n this._pivot = new ObservablePoint(this, 0, 0);\n }\n return this._pivot;\n }\n set pivot(value) {\n if (this._pivot === defaultPivot) {\n this._pivot = new ObservablePoint(this, 0, 0);\n }\n typeof value === \"number\" ? this._pivot.set(value) : this._pivot.copyFrom(value);\n }\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew() {\n if (this._skew === defaultSkew) {\n this._skew = new ObservablePoint(this, 0, 0);\n }\n return this._skew;\n }\n set skew(value) {\n if (this._skew === defaultSkew) {\n this._skew = new ObservablePoint(this, 0, 0);\n }\n this._skew.copyFrom(value);\n }\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale() {\n if (this._scale === defaultScale) {\n this._scale = new ObservablePoint(this, 1, 1);\n }\n return this._scale;\n }\n set scale(value) {\n if (this._scale === defaultScale) {\n this._scale = new ObservablePoint(this, 0, 0);\n }\n typeof value === \"number\" ? this._scale.set(value) : this._scale.copyFrom(value);\n }\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set.\n * @memberof scene.Container#\n */\n get width() {\n return Math.abs(this.scale.x * this.getLocalBounds().width);\n }\n set width(value) {\n const localWidth = this.getLocalBounds().width;\n this._setWidth(value, localWidth);\n }\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set.\n * @memberof scene.Container#\n */\n get height() {\n return Math.abs(this.scale.y * this.getLocalBounds().height);\n }\n set height(value) {\n const localHeight = this.getLocalBounds().height;\n this._setHeight(value, localHeight);\n }\n /**\n * Retrieves the size of the container as a [Size]{@link Size} object.\n * This is faster than get the width and height separately.\n * @param out - Optional object to store the size in.\n * @returns - The size of the container.\n * @memberof scene.Container#\n */\n getSize(out) {\n if (!out) {\n out = {};\n }\n const bounds = this.getLocalBounds();\n out.width = Math.abs(this.scale.x * bounds.width);\n out.height = Math.abs(this.scale.y * bounds.height);\n return out;\n }\n /**\n * Sets the size of the container to the specified width and height.\n * This is faster than setting the width and height separately.\n * @param value - This can be either a number or a [Size]{@link Size} object.\n * @param height - The height to set. Defaults to the value of `width` if not provided.\n * @memberof scene.Container#\n */\n setSize(value, height) {\n const size = this.getLocalBounds();\n let convertedWidth;\n let convertedHeight;\n if (typeof value !== \"object\") {\n convertedWidth = value;\n convertedHeight = height ?? value;\n } else {\n convertedWidth = value.width;\n convertedHeight = value.height ?? value.width;\n }\n if (convertedWidth !== void 0) {\n this._setWidth(convertedWidth, size.width);\n }\n if (convertedHeight !== void 0) {\n this._setHeight(convertedHeight, size.height);\n }\n }\n /** Called when the skew or the rotation changes. */\n _updateSkew() {\n const rotation = this._rotation;\n const skew = this._skew;\n this._cx = Math.cos(rotation + skew._y);\n this._sx = Math.sin(rotation + skew._y);\n this._cy = -Math.sin(rotation - skew._x);\n this._sy = Math.cos(rotation - skew._x);\n }\n /**\n * Updates the transform properties of the container (accepts partial values).\n * @param {object} opts - The options for updating the transform.\n * @param {number} opts.x - The x position of the container.\n * @param {number} opts.y - The y position of the container.\n * @param {number} opts.scaleX - The scale factor on the x-axis.\n * @param {number} opts.scaleY - The scale factor on the y-axis.\n * @param {number} opts.rotation - The rotation of the container, in radians.\n * @param {number} opts.skewX - The skew factor on the x-axis.\n * @param {number} opts.skewY - The skew factor on the y-axis.\n * @param {number} opts.pivotX - The x coordinate of the pivot point.\n * @param {number} opts.pivotY - The y coordinate of the pivot point.\n */\n updateTransform(opts) {\n this.position.set(\n typeof opts.x === \"number\" ? opts.x : this.position.x,\n typeof opts.y === \"number\" ? opts.y : this.position.y\n );\n this.scale.set(\n typeof opts.scaleX === \"number\" ? opts.scaleX || 1 : this.scale.x,\n typeof opts.scaleY === \"number\" ? opts.scaleY || 1 : this.scale.y\n );\n this.rotation = typeof opts.rotation === \"number\" ? opts.rotation : this.rotation;\n this.skew.set(\n typeof opts.skewX === \"number\" ? opts.skewX : this.skew.x,\n typeof opts.skewY === \"number\" ? opts.skewY : this.skew.y\n );\n this.pivot.set(\n typeof opts.pivotX === \"number\" ? opts.pivotX : this.pivot.x,\n typeof opts.pivotY === \"number\" ? opts.pivotY : this.pivot.y\n );\n return this;\n }\n /**\n * Updates the local transform using the given matrix.\n * @param matrix - The matrix to use for updating the transform.\n */\n setFromMatrix(matrix) {\n matrix.decompose(this);\n }\n /** Updates the local transform. */\n updateLocalTransform() {\n const localTransformChangeId = this._didChangeId & 4095;\n if (this._didLocalTransformChangeId === localTransformChangeId)\n return;\n this._didLocalTransformChangeId = localTransformChangeId;\n const lt = this.localTransform;\n const scale = this._scale;\n const pivot = this._pivot;\n const position = this._position;\n const sx = scale._x;\n const sy = scale._y;\n const px = pivot._x;\n const py = pivot._y;\n lt.a = this._cx * sx;\n lt.b = this._sx * sx;\n lt.c = this._cy * sy;\n lt.d = this._sy * sy;\n lt.tx = position._x - (px * lt.a + py * lt.c);\n lt.ty = position._y - (px * lt.b + py * lt.d);\n }\n // / ///// color related stuff\n set alpha(value) {\n if (value === this.localAlpha)\n return;\n this.localAlpha = value;\n this._updateFlags |= UPDATE_COLOR;\n this._onUpdate();\n }\n /** The opacity of the object. */\n get alpha() {\n return this.localAlpha;\n }\n set tint(value) {\n const tempColor = Color.shared.setValue(value ?? 16777215);\n const bgr = tempColor.toBgrNumber();\n if (bgr === this.localColor)\n return;\n this.localColor = bgr;\n this._updateFlags |= UPDATE_COLOR;\n this._onUpdate();\n }\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint() {\n const bgr = this.localColor;\n return ((bgr & 255) << 16) + (bgr & 65280) + (bgr >> 16 & 255);\n }\n // / //////////////// blend related stuff\n set blendMode(value) {\n if (this.localBlendMode === value)\n return;\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n this._updateFlags |= UPDATE_BLEND;\n this.localBlendMode = value;\n this._onUpdate();\n }\n /**\n * The blend mode to be applied to the sprite. Apply a value of `'normal'` to reset the blend mode.\n * @default 'normal'\n */\n get blendMode() {\n return this.localBlendMode;\n }\n // / ///////// VISIBILITY / RENDERABLE /////////////////\n /** The visibility of the object. If false the object will not be drawn, and the transform will not be updated. */\n get visible() {\n return !!(this.localDisplayStatus & 2);\n }\n set visible(value) {\n const valueNumber = value ? 2 : 0;\n if ((this.localDisplayStatus & 2) === valueNumber)\n return;\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n this._updateFlags |= UPDATE_VISIBLE;\n this.localDisplayStatus ^= 2;\n this._onUpdate();\n }\n /** @ignore */\n get culled() {\n return !(this.localDisplayStatus & 4);\n }\n /** @ignore */\n set culled(value) {\n const valueNumber = value ? 0 : 4;\n if ((this.localDisplayStatus & 4) === valueNumber)\n return;\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n this._updateFlags |= UPDATE_VISIBLE;\n this.localDisplayStatus ^= 4;\n this._onUpdate();\n }\n /** Can this object be rendered, if false the object will not be drawn but the transform will still be updated. */\n get renderable() {\n return !!(this.localDisplayStatus & 1);\n }\n set renderable(value) {\n const valueNumber = value ? 1 : 0;\n if ((this.localDisplayStatus & 1) === valueNumber)\n return;\n this._updateFlags |= UPDATE_VISIBLE;\n this.localDisplayStatus ^= 1;\n if (this.parentRenderGroup) {\n this.parentRenderGroup.structureDidChange = true;\n }\n this._onUpdate();\n }\n /** Whether or not the object should be rendered. */\n get isRenderable() {\n return this.localDisplayStatus === 7 && this.groupAlpha > 0;\n }\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites. If options.children\n * is set to true it should destroy the texture of the child sprite\n * @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.\n * If options.children is set to true it should destroy the texture source of the child sprite\n * @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.\n * If options.children is set to true it should destroy the context of the child graphics\n */\n destroy(options = false) {\n if (this.destroyed)\n return;\n this.destroyed = true;\n const oldChildren = this.removeChildren(0, this.children.length);\n this.removeFromParent();\n this.parent = null;\n this._maskEffect = null;\n this._filterEffect = null;\n this.effects = null;\n this._position = null;\n this._scale = null;\n this._pivot = null;\n this._skew = null;\n this.emit(\"destroyed\", this);\n this.removeAllListeners();\n const destroyChildren = typeof options === \"boolean\" ? options : options?.children;\n if (destroyChildren) {\n for (let i = 0; i < oldChildren.length; ++i) {\n oldChildren[i].destroy(options);\n }\n }\n this.renderGroup?.destroy();\n this.renderGroup = null;\n }\n}\nContainer.mixin(childrenHelperMixin);\nContainer.mixin(toLocalGlobalMixin);\nContainer.mixin(onRenderMixin);\nContainer.mixin(measureMixin);\nContainer.mixin(effectsMixin);\nContainer.mixin(findMixin);\nContainer.mixin(sortMixin);\nContainer.mixin(cullingMixin);\n\nexport { Container, UPDATE_BLEND, UPDATE_COLOR, UPDATE_TRANSFORM, UPDATE_VISIBLE };\n//# sourceMappingURL=Container.mjs.map\n","\"use strict\";\nfunction assignWithIgnore(target, options, ignore = {}) {\n for (const key in options) {\n if (!ignore[key] && options[key] !== void 0) {\n target[key] = options[key];\n }\n }\n}\n\nexport { assignWithIgnore };\n//# sourceMappingURL=assignWithIgnore.mjs.map\n","\"use strict\";\nconst cullingMixin = {\n cullArea: null,\n cullable: false,\n cullableChildren: true\n};\n\nexport { cullingMixin };\n//# sourceMappingURL=cullingMixin.mjs.map\n","import { ObservablePoint } from '../../maths/point/ObservablePoint.mjs';\nimport { Texture } from '../../rendering/renderers/shared/texture/Texture.mjs';\nimport { updateQuadBounds } from '../../utils/data/updateQuadBounds.mjs';\nimport { Container } from '../container/Container.mjs';\n\n\"use strict\";\nclass Sprite extends Container {\n /**\n * @param options - The options for creating the sprite.\n */\n constructor(options = Texture.EMPTY) {\n if (options instanceof Texture) {\n options = { texture: options };\n }\n const { texture = Texture.EMPTY, anchor, roundPixels, width, height, ...rest } = options;\n super({\n label: \"Sprite\",\n ...rest\n });\n this.renderPipeId = \"sprite\";\n this.batched = true;\n this._didSpriteUpdate = false;\n this._bounds = { minX: 0, maxX: 1, minY: 0, maxY: 0 };\n this._sourceBounds = { minX: 0, maxX: 1, minY: 0, maxY: 0 };\n this._boundsDirty = true;\n this._sourceBoundsDirty = true;\n this._roundPixels = 0;\n this._anchor = new ObservablePoint(\n {\n _onUpdate: () => {\n this.onViewUpdate();\n }\n }\n );\n if (anchor) {\n this.anchor = anchor;\n } else if (texture.defaultAnchor) {\n this.anchor = texture.defaultAnchor;\n }\n this.texture = texture;\n this.allowChildren = false;\n this.roundPixels = roundPixels ?? false;\n if (width !== void 0)\n this.width = width;\n if (height !== void 0)\n this.height = height;\n }\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image, video, canvas element, video element, texture\n * @param source - Source to create texture from\n * @param [skipCache] - Whether to skip the cache or not\n * @returns The newly created sprite\n */\n static from(source, skipCache = false) {\n if (source instanceof Texture) {\n return new Sprite(source);\n }\n return new Sprite(Texture.from(source, skipCache));\n }\n set texture(value) {\n value || (value = Texture.EMPTY);\n const currentTexture = this._texture;\n if (currentTexture === value)\n return;\n if (currentTexture && currentTexture.dynamic)\n currentTexture.off(\"update\", this.onViewUpdate, this);\n if (value.dynamic)\n value.on(\"update\", this.onViewUpdate, this);\n this._texture = value;\n if (this._width) {\n this._setWidth(this._width, this._texture.orig.width);\n }\n if (this._height) {\n this._setHeight(this._height, this._texture.orig.height);\n }\n this.onViewUpdate();\n }\n /** The texture that the sprite is using. */\n get texture() {\n return this._texture;\n }\n /**\n * The local bounds of the sprite.\n * @type {rendering.Bounds}\n */\n get bounds() {\n if (this._boundsDirty) {\n this._updateBounds();\n this._boundsDirty = false;\n }\n return this._bounds;\n }\n /**\n * The bounds of the sprite, taking the texture's trim into account.\n * @type {rendering.Bounds}\n */\n get sourceBounds() {\n if (this._sourceBoundsDirty) {\n this._updateSourceBounds();\n this._sourceBoundsDirty = false;\n }\n return this._sourceBounds;\n }\n /**\n * Checks if the object contains the given point.\n * @param point - The point to check\n */\n containsPoint(point) {\n const bounds = this.sourceBounds;\n if (point.x >= bounds.maxX && point.x <= bounds.minX) {\n if (point.y >= bounds.maxY && point.y <= bounds.minY) {\n return true;\n }\n }\n return false;\n }\n /**\n * Adds the bounds of this object to the bounds object.\n * @param bounds - The output bounds object.\n */\n addBounds(bounds) {\n const _bounds = this._texture.trim ? this.sourceBounds : this.bounds;\n bounds.addFrame(_bounds.minX, _bounds.minY, _bounds.maxX, _bounds.maxY);\n }\n onViewUpdate() {\n this._didChangeId += 1 << 12;\n this._didSpriteUpdate = true;\n this._sourceBoundsDirty = this._boundsDirty = true;\n if (this.didViewUpdate)\n return;\n this.didViewUpdate = true;\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.onChildViewUpdate(this);\n }\n }\n _updateBounds() {\n updateQuadBounds(this._bounds, this._anchor, this._texture, 0);\n }\n _updateSourceBounds() {\n const anchor = this._anchor;\n const texture = this._texture;\n const sourceBounds = this._sourceBounds;\n const { width, height } = texture.orig;\n sourceBounds.maxX = -anchor._x * width;\n sourceBounds.minX = sourceBounds.maxX + width;\n sourceBounds.maxY = -anchor._y * height;\n sourceBounds.minY = sourceBounds.maxY + height;\n }\n /**\n * Destroys this sprite renderable and optionally its texture.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well\n * @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well\n */\n destroy(options = false) {\n super.destroy(options);\n const destroyTexture = typeof options === \"boolean\" ? options : options?.texture;\n if (destroyTexture) {\n const destroyTextureSource = typeof options === \"boolean\" ? options : options?.textureSource;\n this._texture.destroy(destroyTextureSource);\n }\n this._texture = null;\n this._bounds = null;\n this._sourceBounds = null;\n this._anchor = null;\n }\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * import { Sprite } from 'pixi.js';\n *\n * const sprite = new Sprite({texture: Texture.WHITE});\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor() {\n return this._anchor;\n }\n set anchor(value) {\n typeof value === \"number\" ? this._anchor.set(value) : this._anchor.copyFrom(value);\n }\n /**\n * Whether or not to round the x/y position of the sprite.\n * @type {boolean}\n */\n get roundPixels() {\n return !!this._roundPixels;\n }\n set roundPixels(value) {\n this._roundPixels = value ? 1 : 0;\n }\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width() {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n set width(value) {\n this._setWidth(value, this._texture.orig.width);\n this._width = value;\n }\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height() {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n set height(value) {\n this._setHeight(value, this._texture.orig.height);\n this._height = value;\n }\n /**\n * Retrieves the size of the Sprite as a [Size]{@link Size} object.\n * This is faster than get the width and height separately.\n * @param out - Optional object to store the size in.\n * @returns - The size of the Sprite.\n */\n getSize(out) {\n if (!out) {\n out = {};\n }\n out.width = Math.abs(this.scale.x) * this._texture.orig.width;\n out.height = Math.abs(this.scale.y) * this._texture.orig.height;\n return out;\n }\n /**\n * Sets the size of the Sprite to the specified width and height.\n * This is faster than setting the width and height separately.\n * @param value - This can be either a number or a [Size]{@link Size} object.\n * @param height - The height to set. Defaults to the value of `width` if not provided.\n */\n setSize(value, height) {\n let convertedWidth;\n let convertedHeight;\n if (typeof value !== \"object\") {\n convertedWidth = value;\n convertedHeight = height ?? value;\n } else {\n convertedWidth = value.width;\n convertedHeight = value.height ?? value.width;\n }\n if (convertedWidth !== void 0) {\n this._setWidth(convertedWidth, this._texture.orig.width);\n }\n if (convertedHeight !== void 0) {\n this._setHeight(convertedHeight, this._texture.orig.height);\n }\n }\n}\n\nexport { Sprite };\n//# sourceMappingURL=Sprite.mjs.map\n","import { Bounds } from '../../../scene/container/bounds/Bounds.mjs';\nimport { getGlobalBounds } from '../../../scene/container/bounds/getGlobalBounds.mjs';\n\n\"use strict\";\nconst tempBounds = new Bounds();\nfunction addMaskBounds(mask, bounds, skipUpdateTransform) {\n const boundsToMask = tempBounds;\n mask.measurable = true;\n getGlobalBounds(mask, skipUpdateTransform, boundsToMask);\n bounds.addBoundsMask(boundsToMask);\n mask.measurable = false;\n}\n\nexport { addMaskBounds };\n//# sourceMappingURL=addMaskBounds.mjs.map\n","import { getLocalBounds } from '../../../scene/container/bounds/getLocalBounds.mjs';\nimport { boundsPool, matrixPool } from '../../../scene/container/bounds/utils/matrixAndBoundsPool.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\n\n\"use strict\";\nfunction addMaskLocalBounds(mask, bounds, localRoot) {\n const boundsToMask = boundsPool.get();\n mask.measurable = true;\n const tempMatrix = matrixPool.get().identity();\n const relativeMask = getMatrixRelativeToParent(mask, localRoot, tempMatrix);\n getLocalBounds(mask, boundsToMask, relativeMask);\n mask.measurable = false;\n bounds.addBoundsMask(boundsToMask);\n matrixPool.return(tempMatrix);\n boundsPool.return(boundsToMask);\n}\nfunction getMatrixRelativeToParent(target, root, matrix) {\n if (!target) {\n warn(\"Mask bounds, renderable is not inside the root container\");\n return matrix;\n }\n if (target !== root) {\n getMatrixRelativeToParent(target.parent, root, matrix);\n target.updateLocalTransform();\n matrix.append(target.localTransform);\n }\n return matrix;\n}\n\nexport { addMaskLocalBounds, getMatrixRelativeToParent };\n//# sourceMappingURL=addMaskLocalBounds.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Sprite } from '../../../scene/sprite/Sprite.mjs';\nimport { addMaskBounds } from '../utils/addMaskBounds.mjs';\nimport { addMaskLocalBounds } from '../utils/addMaskLocalBounds.mjs';\n\n\"use strict\";\nclass AlphaMask {\n constructor(options) {\n this.priority = 0;\n this.pipe = \"alphaMask\";\n if (options?.mask) {\n this.init(options.mask);\n }\n }\n init(mask) {\n this.mask = mask;\n this.renderMaskToTexture = !(mask instanceof Sprite);\n this.mask.renderable = this.renderMaskToTexture;\n this.mask.includeInBuild = !this.renderMaskToTexture;\n this.mask.measurable = false;\n }\n reset() {\n this.mask.measurable = true;\n this.mask = null;\n }\n addBounds(bounds, skipUpdateTransform) {\n addMaskBounds(this.mask, bounds, skipUpdateTransform);\n }\n addLocalBounds(bounds, localRoot) {\n addMaskLocalBounds(this.mask, bounds, localRoot);\n }\n containsPoint(point, hitTestFn) {\n const mask = this.mask;\n return hitTestFn(mask, point);\n }\n destroy() {\n this.reset();\n }\n static test(mask) {\n return mask instanceof Sprite;\n }\n}\nAlphaMask.extension = ExtensionType.MaskEffect;\n\nexport { AlphaMask };\n//# sourceMappingURL=AlphaMask.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass ColorMask {\n constructor(options) {\n this.priority = 0;\n this.pipe = \"colorMask\";\n if (options?.mask) {\n this.init(options.mask);\n }\n }\n init(mask) {\n this.mask = mask;\n }\n destroy() {\n }\n static test(mask) {\n return typeof mask === \"number\";\n }\n}\nColorMask.extension = ExtensionType.MaskEffect;\n\nexport { ColorMask };\n//# sourceMappingURL=ColorMask.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Container } from '../../../scene/container/Container.mjs';\nimport { addMaskBounds } from '../utils/addMaskBounds.mjs';\nimport { addMaskLocalBounds } from '../utils/addMaskLocalBounds.mjs';\n\n\"use strict\";\nclass StencilMask {\n constructor(options) {\n this.priority = 0;\n this.pipe = \"stencilMask\";\n if (options?.mask) {\n this.init(options.mask);\n }\n }\n init(mask) {\n this.mask = mask;\n this.mask.includeInBuild = false;\n this.mask.measurable = false;\n }\n reset() {\n this.mask.measurable = true;\n this.mask.includeInBuild = true;\n this.mask = null;\n }\n addBounds(bounds, skipUpdateTransform) {\n addMaskBounds(this.mask, bounds, skipUpdateTransform);\n }\n addLocalBounds(bounds, localRoot) {\n addMaskLocalBounds(this.mask, bounds, localRoot);\n }\n containsPoint(point, hitTestFn) {\n const mask = this.mask;\n return hitTestFn(mask, point);\n }\n destroy() {\n this.reset();\n }\n static test(mask) {\n return mask instanceof Container;\n }\n}\nStencilMask.extension = ExtensionType.MaskEffect;\n\nexport { StencilMask };\n//# sourceMappingURL=StencilMask.mjs.map\n","import { BrowserAdapter } from '../environment-browser/BrowserAdapter.mjs';\n\n\"use strict\";\nlet currentAdapter = BrowserAdapter;\nconst DOMAdapter = {\n /**\n * Returns the current adapter.\n * @returns {environment.Adapter} The current adapter.\n */\n get() {\n return currentAdapter;\n },\n /**\n * Sets the current adapter.\n * @param adapter - The new adapter.\n */\n set(adapter) {\n currentAdapter = adapter;\n }\n};\n\nexport { DOMAdapter };\n//# sourceMappingURL=adapter.mjs.map\n","\"use strict\";\nconst BrowserAdapter = {\n createCanvas: (width, height) => {\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n return canvas;\n },\n getCanvasRenderingContext2D: () => CanvasRenderingContext2D,\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => document.baseURI ?? window.location.href,\n getFontFaceSet: () => document.fonts,\n fetch: (url, options) => fetch(url, options),\n parseXML: (xml) => {\n const parser = new DOMParser();\n return parser.parseFromString(xml, \"text/xml\");\n }\n};\n\nexport { BrowserAdapter };\n//# sourceMappingURL=BrowserAdapter.mjs.map\n","import { DOMAdapter } from '../../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../../extensions/Extensions.mjs';\nimport { TextureSource } from './TextureSource.mjs';\n\n\"use strict\";\nclass CanvasSource extends TextureSource {\n constructor(options) {\n if (!options.resource) {\n options.resource = DOMAdapter.get().createCanvas();\n }\n if (!options.width) {\n options.width = options.resource.width;\n if (!options.autoDensity) {\n options.width /= options.resolution;\n }\n }\n if (!options.height) {\n options.height = options.resource.height;\n if (!options.autoDensity) {\n options.height /= options.resolution;\n }\n }\n super(options);\n this.uploadMethodId = \"image\";\n this.autoDensity = options.autoDensity;\n const canvas = options.resource;\n if (this.pixelWidth !== canvas.width || this.pixelWidth !== canvas.height) {\n this.resizeCanvas();\n }\n this.transparent = !!options.transparent;\n }\n resizeCanvas() {\n if (this.autoDensity) {\n this.resource.style.width = `${this.width}px`;\n this.resource.style.height = `${this.height}px`;\n }\n if (this.resource.width !== this.pixelWidth || this.resource.height !== this.pixelHeight) {\n this.resource.width = this.pixelWidth;\n this.resource.height = this.pixelHeight;\n }\n }\n resize(width = this.width, height = this.height, resolution = this._resolution) {\n const didResize = super.resize(width, height, resolution);\n if (didResize) {\n this.resizeCanvas();\n }\n return didResize;\n }\n static test(resource) {\n return globalThis.HTMLCanvasElement && resource instanceof HTMLCanvasElement || globalThis.OffscreenCanvas && resource instanceof OffscreenCanvas;\n }\n}\nCanvasSource.extension = ExtensionType.TextureSource;\n\nexport { CanvasSource };\n//# sourceMappingURL=CanvasSource.mjs.map\n","import { DOMAdapter } from '../../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../../extensions/Extensions.mjs';\nimport { warn } from '../../../../../utils/logging/warn.mjs';\nimport { TextureSource } from './TextureSource.mjs';\n\n\"use strict\";\nclass ImageSource extends TextureSource {\n constructor(options) {\n if (options.resource && (globalThis.HTMLImageElement && options.resource instanceof HTMLImageElement)) {\n const canvas = DOMAdapter.get().createCanvas(options.resource.width, options.resource.height);\n const context = canvas.getContext(\"2d\");\n context.drawImage(options.resource, 0, 0, options.resource.width, options.resource.height);\n options.resource = canvas;\n warn(\"ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.\");\n }\n super(options);\n this.uploadMethodId = \"image\";\n this.autoGarbageCollect = true;\n }\n static test(resource) {\n return globalThis.HTMLImageElement && resource instanceof HTMLImageElement || typeof ImageBitmap !== \"undefined\" && resource instanceof ImageBitmap;\n }\n}\nImageSource.extension = ExtensionType.TextureSource;\n\nexport { ImageSource };\n//# sourceMappingURL=ImageSource.mjs.map\n","\"use strict\";\nvar UPDATE_PRIORITY = /* @__PURE__ */ ((UPDATE_PRIORITY2) => {\n UPDATE_PRIORITY2[UPDATE_PRIORITY2[\"INTERACTION\"] = 50] = \"INTERACTION\";\n UPDATE_PRIORITY2[UPDATE_PRIORITY2[\"HIGH\"] = 25] = \"HIGH\";\n UPDATE_PRIORITY2[UPDATE_PRIORITY2[\"NORMAL\"] = 0] = \"NORMAL\";\n UPDATE_PRIORITY2[UPDATE_PRIORITY2[\"LOW\"] = -25] = \"LOW\";\n UPDATE_PRIORITY2[UPDATE_PRIORITY2[\"UTILITY\"] = -50] = \"UTILITY\";\n return UPDATE_PRIORITY2;\n})(UPDATE_PRIORITY || {});\n\nexport { UPDATE_PRIORITY };\n//# sourceMappingURL=const.mjs.map\n","\"use strict\";\nclass TickerListener {\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn, context = null, priority = 0, once = false) {\n /** The next item in chain. */\n this.next = null;\n /** The previous item in chain. */\n this.previous = null;\n /** `true` if this listener has been destroyed already. */\n this._destroyed = false;\n this._fn = fn;\n this._context = context;\n this.priority = priority;\n this._once = once;\n }\n /**\n * Simple compare function to figure out if a function and context match.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn, context = null) {\n return this._fn === fn && this._context === context;\n }\n /**\n * Emit by calling the current function.\n * @param ticker - The ticker emitting.\n * @returns Next ticker\n */\n emit(ticker) {\n if (this._fn) {\n if (this._context) {\n this._fn.call(this._context, ticker);\n } else {\n this._fn(ticker);\n }\n }\n const redirect = this.next;\n if (this._once) {\n this.destroy(true);\n }\n if (this._destroyed) {\n this.next = null;\n }\n return redirect;\n }\n /**\n * Connect to the list.\n * @param previous - Input node, previous listener\n */\n connect(previous) {\n this.previous = previous;\n if (previous.next) {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n /**\n * Destroy and don't use after this.\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false) {\n this._destroyed = true;\n this._fn = null;\n this._context = null;\n if (this.previous) {\n this.previous.next = this.next;\n }\n if (this.next) {\n this.next.previous = this.previous;\n }\n const redirect = this.next;\n this.next = hard ? null : redirect;\n this.previous = null;\n return redirect;\n }\n}\n\nexport { TickerListener };\n//# sourceMappingURL=TickerListener.mjs.map\n","import { UPDATE_PRIORITY } from './const.mjs';\nimport { TickerListener } from './TickerListener.mjs';\n\n\"use strict\";\nconst _Ticker = class _Ticker {\n constructor() {\n /**\n * Whether or not this ticker should invoke the method\n * {@link ticker.Ticker#start|start} automatically when a listener is added.\n */\n this.autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link ticker.Ticker#minFPS|minFPS}\n * and is scaled with {@link ticker.Ticker#speed|speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n this.deltaTime = 1;\n /**\n * The last time {@link ticker.Ticker#update|update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n this.lastTime = -1;\n /**\n * Factor of current {@link ticker.Ticker#deltaTime|deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n this.speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link ticker.Ticker#start|start} has been called.\n * `false` if {@link ticker.Ticker#stop|Stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link ticker.Ticker#autoStart|autoStart} being `true`\n * and a listener is added.\n */\n this.started = false;\n /** Internal current frame request ID */\n this._requestId = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n this._maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n this._minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n this._protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n this._lastFrame = -1;\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / _Ticker.targetFPMS;\n this.elapsedMS = 1 / _Ticker.targetFPMS;\n this._tick = (time) => {\n this._requestId = null;\n if (this.started) {\n this.update(time);\n if (this.started && this._requestId === null && this._head.next) {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n _requestIfNeeded() {\n if (this._requestId === null && this._head.next) {\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n _cancelIfNeeded() {\n if (this._requestId !== null) {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n _startIfPossible() {\n if (this.started) {\n this._requestIfNeeded();\n } else if (this.autoStart) {\n this.start();\n }\n }\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn, context, priority = UPDATE_PRIORITY.NORMAL) {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn, context, priority = UPDATE_PRIORITY.NORMAL) {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n _addListener(listener) {\n let current = this._head.next;\n let previous = this._head;\n if (!current) {\n listener.connect(previous);\n } else {\n while (current) {\n if (listener.priority > current.priority) {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n if (!listener.previous) {\n listener.connect(previous);\n }\n }\n this._startIfPossible();\n return this;\n }\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn, context) {\n let listener = this._head.next;\n while (listener) {\n if (listener.match(fn, context)) {\n listener = listener.destroy();\n } else {\n listener = listener.next;\n }\n }\n if (!this._head.next) {\n this._cancelIfNeeded();\n }\n return this;\n }\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count() {\n if (!this._head) {\n return 0;\n }\n let count = 0;\n let current = this._head;\n while (current = current.next) {\n count++;\n }\n return count;\n }\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start() {\n if (!this.started) {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop() {\n if (this.started) {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy() {\n if (!this._protected) {\n this.stop();\n let listener = this._head.next;\n while (listener) {\n listener = listener.destroy(true);\n }\n this._head.destroy();\n this._head = null;\n }\n }\n /**\n * Triggers an update. An update entails setting the\n * current {@link ticker.Ticker#elapsedMS|elapsedMS},\n * the current {@link ticker.Ticker#deltaTime|deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link ticker.Ticker#lastTime|lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()) {\n let elapsedMS;\n if (currentTime > this.lastTime) {\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n if (elapsedMS > this._maxElapsedMS) {\n elapsedMS = this._maxElapsedMS;\n }\n elapsedMS *= this.speed;\n if (this._minElapsedMS) {\n const delta = currentTime - this._lastFrame | 0;\n if (delta < this._minElapsedMS) {\n return;\n }\n this._lastFrame = currentTime - delta % this._minElapsedMS;\n }\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * _Ticker.targetFPMS;\n const head = this._head;\n let listener = head.next;\n while (listener) {\n listener = listener.emit(this);\n }\n if (!head.next) {\n this._cancelIfNeeded();\n }\n } else {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n this.lastTime = currentTime;\n }\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link ticker.Ticker#speed|speed}, which is specific\n * to scaling {@link ticker.Ticker#deltaTime|deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS() {\n return 1e3 / this.elapsedMS;\n }\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link ticker.Ticker#update|update}.\n * This value is used to cap {@link ticker.Ticker#deltaTime|deltaTime},\n * but does not effect the measured value of {@link ticker.Ticker#FPS|FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `Ticker.targetFPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS() {\n return 1e3 / this._maxElapsedMS;\n }\n set minFPS(fps) {\n const minFPS = Math.min(this.maxFPS, fps);\n const minFPMS = Math.min(Math.max(0, minFPS) / 1e3, _Ticker.targetFPMS);\n this._maxElapsedMS = 1 / minFPMS;\n }\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link ticker.Ticker#update|update}.\n * This will effect the measured value of {@link ticker.Ticker#FPS|FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS() {\n if (this._minElapsedMS) {\n return Math.round(1e3 / this._minElapsedMS);\n }\n return 0;\n }\n set maxFPS(fps) {\n if (fps === 0) {\n this._minElapsedMS = 0;\n } else {\n const maxFPS = Math.max(this.minFPS, fps);\n this._minElapsedMS = 1 / (maxFPS / 1e3);\n }\n }\n /**\n * The shared ticker instance used by {@link AnimatedSprite} and by\n * {@link VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link ticker.Ticker#autoStart|autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * import { Ticker } from 'pixi.js';\n *\n * const ticker = Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the Ticker.shared instance.\n * ticker.autoStart = false;\n *\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n *\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * import { autoDetectRenderer, Container } from 'pixi.js';\n *\n * // You may use the shared ticker to render...\n * const renderer = autoDetectRenderer();\n * const stage = new Container();\n * document.body.appendChild(renderer.view);\n * ticker.add((time) => renderer.render(stage));\n *\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * const animate = (time) => {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * };\n * animate(performance.now());\n * @member {ticker.Ticker}\n * @readonly\n * @static\n */\n static get shared() {\n if (!_Ticker._shared) {\n const shared = _Ticker._shared = new _Ticker();\n shared.autoStart = true;\n shared._protected = true;\n }\n return _Ticker._shared;\n }\n /**\n * The system ticker instance used by {@link BasePrepare} for core timing\n * functionality that shouldn't usually need to be paused, unlike the `shared`\n * ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link ticker.Ticker#autoStart|autoStart} is set to `true` for this instance.\n * @member {ticker.Ticker}\n * @readonly\n * @static\n */\n static get system() {\n if (!_Ticker._system) {\n const system = _Ticker._system = new _Ticker();\n system.autoStart = true;\n system._protected = true;\n }\n return _Ticker._system;\n }\n};\n/**\n * Target frames per millisecond.\n * @static\n */\n_Ticker.targetFPMS = 0.06;\nlet Ticker = _Ticker;\n\nexport { Ticker };\n//# sourceMappingURL=Ticker.mjs.map\n","\"use strict\";\nlet promise;\nasync function detectVideoAlphaMode() {\n promise ?? (promise = (async () => {\n const canvas = document.createElement(\"canvas\");\n const gl = canvas.getContext(\"webgl\");\n if (!gl) {\n return \"premultiply-alpha-on-upload\";\n }\n const video = await new Promise((resolve) => {\n const video2 = document.createElement(\"video\");\n video2.onloadeddata = () => resolve(video2);\n video2.onerror = () => resolve(null);\n video2.autoplay = false;\n video2.crossOrigin = \"anonymous\";\n video2.preload = \"auto\";\n video2.src = \"data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=\";\n video2.load();\n });\n if (!video) {\n return \"premultiply-alpha-on-upload\";\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n const framebuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0\n );\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);\n gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);\n const pixel = new Uint8Array(4);\n gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);\n gl.deleteFramebuffer(framebuffer);\n gl.deleteTexture(texture);\n gl.getExtension(\"WEBGL_lose_context\")?.loseContext();\n return pixel[0] <= pixel[3] ? \"premultiplied-alpha\" : \"premultiply-alpha-on-upload\";\n })());\n return promise;\n}\n\nexport { detectVideoAlphaMode };\n//# sourceMappingURL=detectVideoAlphaMode.mjs.map\n","import { ExtensionType } from '../../../../../extensions/Extensions.mjs';\nimport { Ticker } from '../../../../../ticker/Ticker.mjs';\nimport { detectVideoAlphaMode } from '../../../../../utils/browser/detectVideoAlphaMode.mjs';\nimport { TextureSource } from './TextureSource.mjs';\n\n\"use strict\";\nconst _VideoSource = class _VideoSource extends TextureSource {\n constructor(options) {\n super(options);\n // Public\n /** Whether or not the video is ready to play. */\n this.isReady = false;\n /** The upload method for this texture. */\n this.uploadMethodId = \"video\";\n options = {\n ..._VideoSource.defaultOptions,\n ...options\n };\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n this.alphaMode = options.alphaMode ?? \"premultiply-alpha-on-upload\";\n this._videoFrameRequestCallback = this._videoFrameRequestCallback.bind(this);\n this._videoFrameRequestCallbackHandle = null;\n this._load = null;\n this._resolve = null;\n this._reject = null;\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onCanPlayThrough = this._onCanPlayThrough.bind(this);\n this._onError = this._onError.bind(this);\n this._onPlayStart = this._onPlayStart.bind(this);\n this._onPlayStop = this._onPlayStop.bind(this);\n this._onSeeked = this._onSeeked.bind(this);\n if (options.autoLoad !== false) {\n void this.load();\n }\n }\n /** Update the video frame if the source is not destroyed and meets certain conditions. */\n updateFrame() {\n if (this.destroyed) {\n return;\n }\n if (this._updateFPS) {\n const elapsedMS = Ticker.shared.elapsedMS * this.resource.playbackRate;\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n }\n if (!this._updateFPS || this._msToNextUpdate <= 0) {\n this._msToNextUpdate = this._updateFPS ? Math.floor(1e3 / this._updateFPS) : 0;\n }\n if (this.isValid) {\n this.update();\n }\n }\n /** Callback to update the video frame and potentially request the next frame update. */\n _videoFrameRequestCallback() {\n this.updateFrame();\n if (this.destroyed) {\n this._videoFrameRequestCallbackHandle = null;\n } else {\n this._videoFrameRequestCallbackHandle = this.resource.requestVideoFrameCallback(\n this._videoFrameRequestCallback\n );\n }\n }\n /**\n * Checks if the resource has valid dimensions.\n * @returns {boolean} True if width and height are set, otherwise false.\n */\n get isValid() {\n return !!this.resource.videoWidth && !!this.resource.videoHeight;\n }\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n async load() {\n if (this._load) {\n return this._load;\n }\n const source = this.resource;\n const options = this.options;\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) && source.width && source.height) {\n source.complete = true;\n }\n source.addEventListener(\"play\", this._onPlayStart);\n source.addEventListener(\"pause\", this._onPlayStop);\n source.addEventListener(\"seeked\", this._onSeeked);\n if (!this._isSourceReady()) {\n if (!options.preload) {\n source.addEventListener(\"canplay\", this._onCanPlay);\n }\n source.addEventListener(\"canplaythrough\", this._onCanPlayThrough);\n source.addEventListener(\"error\", this._onError, true);\n } else {\n this._mediaReady();\n }\n this.alphaMode = await detectVideoAlphaMode();\n this._load = new Promise((resolve, reject) => {\n if (this.isValid) {\n resolve(this);\n } else {\n this._resolve = resolve;\n this._reject = reject;\n if (options.preloadTimeoutMs !== void 0) {\n this._preloadTimeout = setTimeout(() => {\n this._onError(new ErrorEvent(`Preload exceeded timeout of ${options.preloadTimeoutMs}ms`));\n });\n }\n source.load();\n }\n });\n return this._load;\n }\n /**\n * Handle video error events.\n * @param event - The error event\n */\n _onError(event) {\n this.resource.removeEventListener(\"error\", this._onError, true);\n this.emit(\"error\", event);\n if (this._reject) {\n this._reject(event);\n this._reject = null;\n this._resolve = null;\n }\n }\n /**\n * Checks if the underlying source is playing.\n * @returns True if playing.\n */\n _isSourcePlaying() {\n const source = this.resource;\n return !source.paused && !source.ended;\n }\n /**\n * Checks if the underlying source is ready for playing.\n * @returns True if ready.\n */\n _isSourceReady() {\n const source = this.resource;\n return source.readyState > 2;\n }\n /** Runs the update loop when the video is ready to play. */\n _onPlayStart() {\n if (!this.isValid) {\n this._mediaReady();\n }\n this._configureAutoUpdate();\n }\n /** Stops the update loop when a pause event is triggered. */\n _onPlayStop() {\n this._configureAutoUpdate();\n }\n /** Handles behavior when the video completes seeking to the current playback position. */\n _onSeeked() {\n if (this._autoUpdate && !this._isSourcePlaying()) {\n this._msToNextUpdate = 0;\n this.updateFrame();\n this._msToNextUpdate = 0;\n }\n }\n _onCanPlay() {\n const source = this.resource;\n source.removeEventListener(\"canplay\", this._onCanPlay);\n this._mediaReady();\n }\n _onCanPlayThrough() {\n const source = this.resource;\n source.removeEventListener(\"canplaythrough\", this._onCanPlay);\n if (this._preloadTimeout) {\n clearTimeout(this._preloadTimeout);\n this._preloadTimeout = void 0;\n }\n this._mediaReady();\n }\n /** Fired when the video is loaded and ready to play. */\n _mediaReady() {\n const source = this.resource;\n if (this.isValid) {\n this.isReady = true;\n this.resize(source.videoWidth, source.videoHeight);\n }\n this._msToNextUpdate = 0;\n this.updateFrame();\n this._msToNextUpdate = 0;\n if (this._resolve) {\n this._resolve(this);\n this._resolve = null;\n this._reject = null;\n }\n if (this._isSourcePlaying()) {\n this._onPlayStart();\n } else if (this.autoPlay) {\n void this.resource.play();\n }\n }\n /** Cleans up resources and event listeners associated with this texture. */\n destroy() {\n this._configureAutoUpdate();\n const source = this.resource;\n if (source) {\n source.removeEventListener(\"play\", this._onPlayStart);\n source.removeEventListener(\"pause\", this._onPlayStop);\n source.removeEventListener(\"seeked\", this._onSeeked);\n source.removeEventListener(\"canplay\", this._onCanPlay);\n source.removeEventListener(\"canplaythrough\", this._onCanPlayThrough);\n source.removeEventListener(\"error\", this._onError, true);\n source.pause();\n source.src = \"\";\n source.load();\n }\n super.destroy();\n }\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate() {\n return this._autoUpdate;\n }\n set autoUpdate(value) {\n if (value !== this._autoUpdate) {\n this._autoUpdate = value;\n this._configureAutoUpdate();\n }\n }\n /**\n * How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS() {\n return this._updateFPS;\n }\n set updateFPS(value) {\n if (value !== this._updateFPS) {\n this._updateFPS = value;\n this._configureAutoUpdate();\n }\n }\n /**\n * Configures the updating mechanism based on the current state and settings.\n *\n * This method decides between using the browser's native video frame callback or a custom ticker\n * for updating the video frame. It ensures optimal performance and responsiveness\n * based on the video's state, playback status, and the desired frames-per-second setting.\n *\n * - If `_autoUpdate` is enabled and the video source is playing:\n * - It will prefer the native video frame callback if available and no specific FPS is set.\n * - Otherwise, it will use a custom ticker for manual updates.\n * - If `_autoUpdate` is disabled or the video isn't playing, any active update mechanisms are halted.\n */\n _configureAutoUpdate() {\n if (this._autoUpdate && this._isSourcePlaying()) {\n if (!this._updateFPS && this.resource.requestVideoFrameCallback) {\n if (this._isConnectedToTicker) {\n Ticker.shared.remove(this.updateFrame, this);\n this._isConnectedToTicker = false;\n this._msToNextUpdate = 0;\n }\n if (this._videoFrameRequestCallbackHandle === null) {\n this._videoFrameRequestCallbackHandle = this.resource.requestVideoFrameCallback(\n this._videoFrameRequestCallback\n );\n }\n } else {\n if (this._videoFrameRequestCallbackHandle !== null) {\n this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle);\n this._videoFrameRequestCallbackHandle = null;\n }\n if (!this._isConnectedToTicker) {\n Ticker.shared.add(this.updateFrame, this);\n this._isConnectedToTicker = true;\n this._msToNextUpdate = 0;\n }\n }\n } else {\n if (this._videoFrameRequestCallbackHandle !== null) {\n this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle);\n this._videoFrameRequestCallbackHandle = null;\n }\n if (this._isConnectedToTicker) {\n Ticker.shared.remove(this.updateFrame, this);\n this._isConnectedToTicker = false;\n this._msToNextUpdate = 0;\n }\n }\n }\n static test(resource) {\n return globalThis.HTMLVideoElement && resource instanceof HTMLVideoElement || globalThis.VideoFrame && resource instanceof VideoFrame;\n }\n};\n_VideoSource.extension = ExtensionType.TextureSource;\n/** The default options for video sources. */\n_VideoSource.defaultOptions = {\n ...TextureSource.defaultOptions,\n /** If true, the video will start loading immediately. */\n autoLoad: true,\n /** If true, the video will start playing as soon as it is loaded. */\n autoPlay: true,\n /** The number of times a second to update the texture from the video. Leave at 0 to update at every render. */\n updateFPS: 0,\n /** If true, the video will be loaded with the `crossorigin` attribute. */\n crossorigin: true,\n /** If true, the video will loop when it ends. */\n loop: false,\n /** If true, the video will be muted. */\n muted: true,\n /** If true, the video will play inline. */\n playsinline: true,\n /** If true, the video will be preloaded. */\n preload: false\n};\n/**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n_VideoSource.MIME_TYPES = {\n ogv: \"video/ogg\",\n mov: \"video/quicktime\",\n m4v: \"video/mp4\"\n};\nlet VideoSource = _VideoSource;\n\nexport { VideoSource };\n//# sourceMappingURL=VideoSource.mjs.map\n","\"use strict\";\nconst convertToList = (input, transform, forceTransform = false) => {\n if (!Array.isArray(input)) {\n input = [input];\n }\n if (!transform) {\n return input;\n }\n return input.map((item) => {\n if (typeof item === \"string\" || forceTransform) {\n return transform(item);\n }\n return item;\n });\n};\n\nexport { convertToList };\n//# sourceMappingURL=convertToList.mjs.map\n","import { warn } from '../../utils/logging/warn.mjs';\nimport { convertToList } from '../utils/convertToList.mjs';\n\n\"use strict\";\nclass CacheClass {\n constructor() {\n this._parsers = [];\n this._cache = /* @__PURE__ */ new Map();\n this._cacheMap = /* @__PURE__ */ new Map();\n }\n /** Clear all entries. */\n reset() {\n this._cacheMap.clear();\n this._cache.clear();\n }\n /**\n * Check if the key exists\n * @param key - The key to check\n */\n has(key) {\n return this._cache.has(key);\n }\n /**\n * Fetch entry by key\n * @param key - The key of the entry to get\n */\n get(key) {\n const result = this._cache.get(key);\n if (!result) {\n warn(`[Assets] Asset id ${key} was not found in the Cache`);\n }\n return result;\n }\n /**\n * Set a value by key or keys name\n * @param key - The key or keys to set\n * @param value - The value to store in the cache or from which cacheable assets will be derived.\n */\n set(key, value) {\n const keys = convertToList(key);\n let cacheableAssets;\n for (let i = 0; i < this.parsers.length; i++) {\n const parser = this.parsers[i];\n if (parser.test(value)) {\n cacheableAssets = parser.getCacheableAssets(keys, value);\n break;\n }\n }\n const cacheableMap = new Map(Object.entries(cacheableAssets || {}));\n if (!cacheableAssets) {\n keys.forEach((key2) => {\n cacheableMap.set(key2, value);\n });\n }\n const cacheKeys = [...cacheableMap.keys()];\n const cachedAssets = {\n cacheKeys,\n keys\n };\n keys.forEach((key2) => {\n this._cacheMap.set(key2, cachedAssets);\n });\n cacheKeys.forEach((key2) => {\n const val = cacheableAssets ? cacheableAssets[key2] : value;\n if (this._cache.has(key2) && this._cache.get(key2) !== val) {\n warn(\"[Cache] already has key:\", key2);\n }\n this._cache.set(key2, cacheableMap.get(key2));\n });\n }\n /**\n * Remove entry by key\n *\n * This function will also remove any associated alias from the cache also.\n * @param key - The key of the entry to remove\n */\n remove(key) {\n if (!this._cacheMap.has(key)) {\n warn(`[Assets] Asset id ${key} was not found in the Cache`);\n return;\n }\n const cacheMap = this._cacheMap.get(key);\n const cacheKeys = cacheMap.cacheKeys;\n cacheKeys.forEach((key2) => {\n this._cache.delete(key2);\n });\n cacheMap.keys.forEach((key2) => {\n this._cacheMap.delete(key2);\n });\n }\n /** All loader parsers registered */\n get parsers() {\n return this._parsers;\n }\n}\nconst Cache = new CacheClass();\n\nexport { Cache };\n//# sourceMappingURL=Cache.mjs.map\n","import { Cache } from '../../../../../assets/cache/Cache.mjs';\nimport { extensions, ExtensionType } from '../../../../../extensions/Extensions.mjs';\nimport { TextureSource } from '../sources/TextureSource.mjs';\nimport { Texture } from '../Texture.mjs';\n\n\"use strict\";\nconst sources = [];\nextensions.handleByList(ExtensionType.TextureSource, sources);\nfunction autoDetectSource(options = {}) {\n return textureSourceFrom(options);\n}\nfunction textureSourceFrom(options = {}) {\n const hasResource = options && options.resource;\n const res = hasResource ? options.resource : options;\n const opts = hasResource ? options : { resource: options };\n for (let i = 0; i < sources.length; i++) {\n const Source = sources[i];\n if (Source.test(res)) {\n return new Source(opts);\n }\n }\n throw new Error(`Could not find a source type for resource: ${opts.resource}`);\n}\nfunction resourceToTexture(options = {}, skipCache = false) {\n const hasResource = options && options.resource;\n const resource = hasResource ? options.resource : options;\n const opts = hasResource ? options : { resource: options };\n if (!skipCache && Cache.has(resource)) {\n return Cache.get(resource);\n }\n const texture = new Texture({ source: textureSourceFrom(opts) });\n texture.on(\"destroy\", () => {\n if (Cache.has(resource)) {\n Cache.remove(resource);\n }\n });\n if (!skipCache) {\n Cache.set(resource, texture);\n }\n return texture;\n}\nfunction textureFrom(id, skipCache = false) {\n if (typeof id === \"string\") {\n return Cache.get(id);\n } else if (id instanceof TextureSource) {\n return new Texture({ source: id });\n }\n return resourceToTexture(id, skipCache);\n}\nTexture.from = textureFrom;\nTextureSource.from = textureSourceFrom;\n\nexport { autoDetectSource, resourceToTexture, textureFrom };\n//# sourceMappingURL=textureFrom.mjs.map\n","import { extensions } from '../extensions/Extensions.mjs';\nimport { AlphaMask } from './mask/alpha/AlphaMask.mjs';\nimport { ColorMask } from './mask/color/ColorMask.mjs';\nimport { StencilMask } from './mask/stencil/StencilMask.mjs';\nimport { BufferImageSource } from './renderers/shared/texture/sources/BufferImageSource.mjs';\nimport { CanvasSource } from './renderers/shared/texture/sources/CanvasSource.mjs';\nimport { ImageSource } from './renderers/shared/texture/sources/ImageSource.mjs';\nimport { VideoSource } from './renderers/shared/texture/sources/VideoSource.mjs';\nimport './renderers/shared/texture/utils/textureFrom.mjs';\nimport './mask/MaskEffectManager.mjs';\n\n\"use strict\";\nextensions.add(AlphaMask, ColorMask, StencilMask, VideoSource, ImageSource, CanvasSource, BufferImageSource);\n//# sourceMappingURL=init.mjs.map\n","\"use strict\";\nvar LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => {\n LoaderParserPriority2[LoaderParserPriority2[\"Low\"] = 0] = \"Low\";\n LoaderParserPriority2[LoaderParserPriority2[\"Normal\"] = 1] = \"Normal\";\n LoaderParserPriority2[LoaderParserPriority2[\"High\"] = 2] = \"High\";\n return LoaderParserPriority2;\n})(LoaderParserPriority || {});\n\nexport { LoaderParserPriority };\n//# sourceMappingURL=LoaderParser.mjs.map\n","import { DOMAdapter } from '../environment/adapter.mjs';\n\n\"use strict\";\nfunction assertPath(path2) {\n if (typeof path2 !== \"string\") {\n throw new TypeError(`Path must be a string. Received ${JSON.stringify(path2)}`);\n }\n}\nfunction removeUrlParams(url) {\n const re = url.split(\"?\")[0];\n return re.split(\"#\")[0];\n}\nfunction escapeRegExp(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\nfunction replaceAll(str, find, replace) {\n return str.replace(new RegExp(escapeRegExp(find), \"g\"), replace);\n}\nfunction normalizeStringPosix(path2, allowAboveRoot) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code = -1;\n for (let i = 0; i <= path2.length; ++i) {\n if (i < path2.length) {\n code = path2.charCodeAt(i);\n } else if (code === 47) {\n break;\n } else {\n code = 47;\n }\n if (code === 47) {\n if (lastSlash === i - 1 || dots === 1) {\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0) {\n res += \"/..\";\n } else {\n res = \"..\";\n }\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path2.slice(lastSlash + 1, i)}`;\n } else {\n res = path2.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\nconst path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path2) {\n return replaceAll(path2, \"\\\\\", \"/\");\n },\n /**\n * Checks if the path is a URL e.g. http://, https://\n * @param path - The path to check\n */\n isUrl(path2) {\n return /^https?:/.test(this.toPosix(path2));\n },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path2) {\n return /^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i.test(path2);\n },\n /**\n * Checks if the path is a blob URL\n * @param path - The path to check\n */\n isBlobUrl(path2) {\n return path2.startsWith(\"blob:\");\n },\n /**\n * Checks if the path has a protocol e.g. http://, https://, file:///, data:, blob:, C:/\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path2) {\n return /^[^/:]+:/.test(this.toPosix(path2));\n },\n /**\n * Returns the protocol of the path e.g. http://, https://, file:///, data:, blob:, C:/\n * @param path - The path to get the protocol from\n */\n getProtocol(path2) {\n assertPath(path2);\n path2 = this.toPosix(path2);\n const matchFile = /^file:\\/\\/\\//.exec(path2);\n if (matchFile) {\n return matchFile[0];\n }\n const matchProtocol = /^[^/:]+:\\/{0,2}/.exec(path2);\n if (matchProtocol) {\n return matchProtocol[0];\n }\n return \"\";\n },\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url, customBaseUrl, customRootUrl) {\n assertPath(url);\n if (this.isDataUrl(url) || this.isBlobUrl(url))\n return url;\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? DOMAdapter.get().getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n url = this.toPosix(url);\n if (url.startsWith(\"/\")) {\n return path.join(rootUrl, url.slice(1));\n }\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n return absolutePath;\n },\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path2) {\n assertPath(path2);\n if (path2.length === 0)\n return \".\";\n if (this.isDataUrl(path2) || this.isBlobUrl(path2))\n return path2;\n path2 = this.toPosix(path2);\n let protocol = \"\";\n const isAbsolute = path2.startsWith(\"/\");\n if (this.hasProtocol(path2)) {\n protocol = this.rootname(path2);\n path2 = path2.slice(protocol.length);\n }\n const trailingSeparator = path2.endsWith(\"/\");\n path2 = normalizeStringPosix(path2, false);\n if (path2.length > 0 && trailingSeparator)\n path2 += \"/\";\n if (isAbsolute)\n return `/${path2}`;\n return protocol + path2;\n },\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path2) {\n assertPath(path2);\n path2 = this.toPosix(path2);\n if (this.hasProtocol(path2))\n return true;\n return path2.startsWith(\"/\");\n },\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments) {\n if (segments.length === 0) {\n return \".\";\n }\n let joined;\n for (let i = 0; i < segments.length; ++i) {\n const arg = segments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === void 0)\n joined = arg;\n else {\n const prevArg = segments[i - 1] ?? \"\";\n if (this.joinExtensions.includes(this.extname(prevArg).toLowerCase())) {\n joined += `/../${arg}`;\n } else {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === void 0) {\n return \".\";\n }\n return this.normalize(joined);\n },\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path2) {\n assertPath(path2);\n if (path2.length === 0)\n return \".\";\n path2 = this.toPosix(path2);\n let code = path2.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n const proto = this.getProtocol(path2);\n const origpath = path2;\n path2 = path2.slice(proto.length);\n for (let i = path2.length - 1; i >= 1; --i) {\n code = path2.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n matchedSlash = false;\n }\n }\n if (end === -1)\n return hasRoot ? \"/\" : this.isUrl(origpath) ? proto + path2 : proto;\n if (hasRoot && end === 1)\n return \"//\";\n return proto + path2.slice(0, end);\n },\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path2) {\n assertPath(path2);\n path2 = this.toPosix(path2);\n let root = \"\";\n if (path2.startsWith(\"/\"))\n root = \"/\";\n else {\n root = this.getProtocol(path2);\n }\n if (this.isUrl(path2)) {\n const index = path2.indexOf(\"/\", root.length);\n if (index !== -1) {\n root = path2.slice(0, index);\n } else\n root = path2;\n if (!root.endsWith(\"/\"))\n root += \"/\";\n }\n return root;\n },\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path2, ext) {\n assertPath(path2);\n if (ext)\n assertPath(ext);\n path2 = removeUrlParams(this.toPosix(path2));\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i;\n if (ext !== void 0 && ext.length > 0 && ext.length <= path2.length) {\n if (ext.length === path2.length && ext === path2)\n return \"\";\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n for (i = path2.length - 1; i >= 0; --i) {\n const code = path2.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n end = i;\n }\n } else {\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end)\n end = firstNonSlashEnd;\n else if (end === -1)\n end = path2.length;\n return path2.slice(start, end);\n }\n for (i = path2.length - 1; i >= 0; --i) {\n if (path2.charCodeAt(i) === 47) {\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1)\n return \"\";\n return path2.slice(start, end);\n },\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path2) {\n assertPath(path2);\n path2 = removeUrlParams(this.toPosix(path2));\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let preDotState = 0;\n for (let i = path2.length - 1; i >= 0; --i) {\n const code = path2.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46) {\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n preDotState = -1;\n }\n }\n if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return \"\";\n }\n return path2.slice(startDot, end);\n },\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path2) {\n assertPath(path2);\n const ret = { root: \"\", dir: \"\", base: \"\", ext: \"\", name: \"\" };\n if (path2.length === 0)\n return ret;\n path2 = removeUrlParams(this.toPosix(path2));\n let code = path2.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path2);\n let start;\n const protocol = \"\";\n ret.root = this.rootname(path2);\n if (isAbsolute || this.hasProtocol(path2)) {\n start = 1;\n } else {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path2.length - 1;\n let preDotState = 0;\n for (; i >= start; --i) {\n code = path2.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46) {\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n preDotState = -1;\n }\n }\n if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute)\n ret.base = ret.name = path2.slice(1, end);\n else\n ret.base = ret.name = path2.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path2.slice(1, startDot);\n ret.base = path2.slice(1, end);\n } else {\n ret.name = path2.slice(startPart, startDot);\n ret.base = path2.slice(startPart, end);\n }\n ret.ext = path2.slice(startDot, end);\n }\n ret.dir = this.dirname(path2);\n if (protocol)\n ret.dir = protocol + ret.dir;\n return ret;\n },\n sep: \"/\",\n delimiter: \":\",\n joinExtensions: [\".html\"]\n};\n\nexport { path };\n//# sourceMappingURL=path.mjs.map\n","\"use strict\";\nfunction processX(base, ids, depth, result, tags) {\n const id = ids[depth];\n for (let i = 0; i < id.length; i++) {\n const value = id[i];\n if (depth < ids.length - 1) {\n processX(base.replace(result[depth], value), ids, depth + 1, result, tags);\n } else {\n tags.push(base.replace(result[depth], value));\n }\n }\n}\nfunction createStringVariations(string) {\n const regex = /\\{(.*?)\\}/g;\n const result = string.match(regex);\n const tags = [];\n if (result) {\n const ids = [];\n result.forEach((vars) => {\n const split = vars.substring(1, vars.length - 1).split(\",\");\n ids.push(split);\n });\n processX(string, ids, 0, result, tags);\n } else {\n tags.push(string);\n }\n return tags;\n}\n\nexport { createStringVariations };\n//# sourceMappingURL=createStringVariations.mjs.map\n","\"use strict\";\nconst isSingleItem = (item) => !Array.isArray(item);\n\nexport { isSingleItem };\n//# sourceMappingURL=isSingleItem.mjs.map\n","import { warn } from '../../utils/logging/warn.mjs';\nimport { path } from '../../utils/path.mjs';\nimport { convertToList } from '../utils/convertToList.mjs';\nimport { createStringVariations } from '../utils/createStringVariations.mjs';\nimport { isSingleItem } from '../utils/isSingleItem.mjs';\n\n\"use strict\";\nclass Resolver {\n constructor() {\n this._defaultBundleIdentifierOptions = {\n connector: \"-\",\n createBundleAssetId: (bundleId, assetId) => `${bundleId}${this._bundleIdConnector}${assetId}`,\n extractAssetIdFromBundle: (bundleId, assetBundleId) => assetBundleId.replace(`${bundleId}${this._bundleIdConnector}`, \"\")\n };\n /** The character that is used to connect the bundleId and the assetId when generating a bundle asset id key */\n this._bundleIdConnector = this._defaultBundleIdentifierOptions.connector;\n /**\n * A function that generates a bundle asset id key from a bundleId and an assetId\n * @param bundleId - the bundleId\n * @param assetId - the assetId\n * @returns the bundle asset id key\n */\n this._createBundleAssetId = this._defaultBundleIdentifierOptions.createBundleAssetId;\n /**\n * A function that generates an assetId from a bundle asset id key. This is the reverse of generateBundleAssetId\n * @param bundleId - the bundleId\n * @param assetBundleId - the bundle asset id key\n * @returns the assetId\n */\n this._extractAssetIdFromBundle = this._defaultBundleIdentifierOptions.extractAssetIdFromBundle;\n this._assetMap = {};\n this._preferredOrder = [];\n this._parsers = [];\n this._resolverHash = {};\n this._bundles = {};\n }\n /**\n * Override how the resolver deals with generating bundle ids.\n * must be called before any bundles are added\n * @param bundleIdentifier - the bundle identifier options\n */\n setBundleIdentifier(bundleIdentifier) {\n this._bundleIdConnector = bundleIdentifier.connector ?? this._bundleIdConnector;\n this._createBundleAssetId = bundleIdentifier.createBundleAssetId ?? this._createBundleAssetId;\n this._extractAssetIdFromBundle = bundleIdentifier.extractAssetIdFromBundle ?? this._extractAssetIdFromBundle;\n if (this._extractAssetIdFromBundle(\"foo\", this._createBundleAssetId(\"foo\", \"bar\")) !== \"bar\") {\n throw new Error(\"[Resolver] GenerateBundleAssetId are not working correctly\");\n }\n }\n /**\n * Let the resolver know which assets you prefer to use when resolving assets.\n * Multiple prefer user defined rules can be added.\n * @example\n * resolver.prefer({\n * // first look for something with the correct format, and then then correct resolution\n * priority: ['format', 'resolution'],\n * params:{\n * format:'webp', // prefer webp images\n * resolution: 2, // prefer a resolution of 2\n * }\n * })\n * resolver.add('foo', ['bar@2x.webp', 'bar@2x.png', 'bar.webp', 'bar.png']);\n * resolver.resolveUrl('foo') // => 'bar@2x.webp'\n * @param preferOrders - the prefer options\n */\n prefer(...preferOrders) {\n preferOrders.forEach((prefer) => {\n this._preferredOrder.push(prefer);\n if (!prefer.priority) {\n prefer.priority = Object.keys(prefer.params);\n }\n });\n this._resolverHash = {};\n }\n /**\n * Set the base path to prepend to all urls when resolving\n * @example\n * resolver.basePath = 'https://home.com/';\n * resolver.add('foo', 'bar.ong');\n * resolver.resolveUrl('foo', 'bar.png'); // => 'https://home.com/bar.png'\n * @param basePath - the base path to use\n */\n set basePath(basePath) {\n this._basePath = basePath;\n }\n get basePath() {\n return this._basePath;\n }\n /**\n * Set the root path for root-relative URLs. By default the `basePath`'s root is used. If no `basePath` is set, then the\n * default value for browsers is `window.location.origin`\n * @example\n * // Application hosted on https://home.com/some-path/index.html\n * resolver.basePath = 'https://home.com/some-path/';\n * resolver.rootPath = 'https://home.com/';\n * resolver.add('foo', '/bar.png');\n * resolver.resolveUrl('foo', '/bar.png'); // => 'https://home.com/bar.png'\n * @param rootPath - the root path to use\n */\n set rootPath(rootPath) {\n this._rootPath = rootPath;\n }\n get rootPath() {\n return this._rootPath;\n }\n /**\n * All the active URL parsers that help the parser to extract information and create\n * an asset object-based on parsing the URL itself.\n *\n * Can be added using the extensions API\n * @example\n * resolver.add('foo', [\n * {\n * resolution: 2,\n * format: 'png',\n * src: 'image@2x.png',\n * },\n * {\n * resolution:1,\n * format:'png',\n * src: 'image.png',\n * },\n * ]);\n *\n * // With a url parser the information such as resolution and file format could extracted from the url itself:\n * extensions.add({\n * extension: ExtensionType.ResolveParser,\n * test: loadTextures.test, // test if url ends in an image\n * parse: (value: string) =>\n * ({\n * resolution: parseFloat(Resolver.RETINA_PREFIX.exec(value)?.[1] ?? '1'),\n * format: value.split('.').pop(),\n * src: value,\n * }),\n * });\n *\n * // Now resolution and format can be extracted from the url\n * resolver.add('foo', [\n * 'image@2x.png',\n * 'image.png',\n * ]);\n */\n get parsers() {\n return this._parsers;\n }\n /** Used for testing, this resets the resolver to its initial state */\n reset() {\n this.setBundleIdentifier(this._defaultBundleIdentifierOptions);\n this._assetMap = {};\n this._preferredOrder = [];\n this._resolverHash = {};\n this._rootPath = null;\n this._basePath = null;\n this._manifest = null;\n this._bundles = {};\n this._defaultSearchParams = null;\n }\n /**\n * Sets the default URL search parameters for the URL resolver. The urls can be specified as a string or an object.\n * @param searchParams - the default url parameters to append when resolving urls\n */\n setDefaultSearchParams(searchParams) {\n if (typeof searchParams === \"string\") {\n this._defaultSearchParams = searchParams;\n } else {\n const queryValues = searchParams;\n this._defaultSearchParams = Object.keys(queryValues).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(queryValues[key])}`).join(\"&\");\n }\n }\n /**\n * Returns the aliases for a given asset\n * @param asset - the asset to get the aliases for\n */\n getAlias(asset) {\n const { alias, src } = asset;\n const aliasesToUse = convertToList(\n alias || src,\n (value) => {\n if (typeof value === \"string\")\n return value;\n if (Array.isArray(value))\n return value.map((v) => v?.src ?? v);\n if (value?.src)\n return value.src;\n return value;\n },\n true\n );\n return aliasesToUse;\n }\n /**\n * Add a manifest to the asset resolver. This is a nice way to add all the asset information in one go.\n * generally a manifest would be built using a tool.\n * @param manifest - the manifest to add to the resolver\n */\n addManifest(manifest) {\n if (this._manifest) {\n warn(\"[Resolver] Manifest already exists, this will be overwritten\");\n }\n this._manifest = manifest;\n manifest.bundles.forEach((bundle) => {\n this.addBundle(bundle.name, bundle.assets);\n });\n }\n /**\n * This adds a bundle of assets in one go so that you can resolve them as a group.\n * For example you could add a bundle for each screen in you pixi app\n * @example\n * resolver.addBundle('animals', [\n * { alias: 'bunny', src: 'bunny.png' },\n * { alias: 'chicken', src: 'chicken.png' },\n * { alias: 'thumper', src: 'thumper.png' },\n * ]);\n * // or\n * resolver.addBundle('animals', {\n * bunny: 'bunny.png',\n * chicken: 'chicken.png',\n * thumper: 'thumper.png',\n * });\n *\n * const resolvedAssets = await resolver.resolveBundle('animals');\n * @param bundleId - The id of the bundle to add\n * @param assets - A record of the asset or assets that will be chosen from when loading via the specified key\n */\n addBundle(bundleId, assets) {\n const assetNames = [];\n let convertedAssets = assets;\n if (!Array.isArray(assets)) {\n convertedAssets = Object.entries(assets).map(([alias, src]) => {\n if (typeof src === \"string\" || Array.isArray(src)) {\n return { alias, src };\n }\n return { alias, ...src };\n });\n }\n convertedAssets.forEach((asset) => {\n const srcs = asset.src;\n const aliases = asset.alias;\n let ids;\n if (typeof aliases === \"string\") {\n const bundleAssetId = this._createBundleAssetId(bundleId, aliases);\n assetNames.push(bundleAssetId);\n ids = [aliases, bundleAssetId];\n } else {\n const bundleIds = aliases.map((name) => this._createBundleAssetId(bundleId, name));\n assetNames.push(...bundleIds);\n ids = [...aliases, ...bundleIds];\n }\n this.add({\n ...asset,\n ...{\n alias: ids,\n src: srcs\n }\n });\n });\n this._bundles[bundleId] = assetNames;\n }\n /**\n * Tells the resolver what keys are associated with witch asset.\n * The most important thing the resolver does\n * @example\n * // Single key, single asset:\n * resolver.add({alias: 'foo', src: 'bar.png');\n * resolver.resolveUrl('foo') // => 'bar.png'\n *\n * // Multiple keys, single asset:\n * resolver.add({alias: ['foo', 'boo'], src: 'bar.png'});\n * resolver.resolveUrl('foo') // => 'bar.png'\n * resolver.resolveUrl('boo') // => 'bar.png'\n *\n * // Multiple keys, multiple assets:\n * resolver.add({alias: ['foo', 'boo'], src: ['bar.png', 'bar.webp']});\n * resolver.resolveUrl('foo') // => 'bar.png'\n *\n * // Add custom data attached to the resolver\n * Resolver.add({\n * alias: 'bunnyBooBooSmooth',\n * src: 'bunny{png,webp}',\n * data: { scaleMode:SCALE_MODES.NEAREST }, // Base texture options\n * });\n *\n * resolver.resolve('bunnyBooBooSmooth') // => { src: 'bunny.png', data: { scaleMode: SCALE_MODES.NEAREST } }\n * @param aliases - the UnresolvedAsset or array of UnresolvedAssets to add to the resolver\n */\n add(aliases) {\n const assets = [];\n if (Array.isArray(aliases)) {\n assets.push(...aliases);\n } else {\n assets.push(aliases);\n }\n let keyCheck;\n keyCheck = (key) => {\n if (this.hasKey(key)) {\n warn(`[Resolver] already has key: ${key} overwriting`);\n }\n };\n const assetArray = convertToList(assets);\n assetArray.forEach((asset) => {\n const { src } = asset;\n let { data, format, loadParser } = asset;\n const srcsToUse = convertToList(src).map((src2) => {\n if (typeof src2 === \"string\") {\n return createStringVariations(src2);\n }\n return Array.isArray(src2) ? src2 : [src2];\n });\n const aliasesToUse = this.getAlias(asset);\n Array.isArray(aliasesToUse) ? aliasesToUse.forEach(keyCheck) : keyCheck(aliasesToUse);\n const resolvedAssets = [];\n srcsToUse.forEach((srcs) => {\n srcs.forEach((src2) => {\n let formattedAsset = {};\n if (typeof src2 !== \"object\") {\n formattedAsset.src = src2;\n for (let i = 0; i < this._parsers.length; i++) {\n const parser = this._parsers[i];\n if (parser.test(src2)) {\n formattedAsset = parser.parse(src2);\n break;\n }\n }\n } else {\n data = src2.data ?? data;\n format = src2.format ?? format;\n loadParser = src2.loadParser ?? loadParser;\n formattedAsset = {\n ...formattedAsset,\n ...src2\n };\n }\n if (!aliasesToUse) {\n throw new Error(`[Resolver] alias is undefined for this asset: ${formattedAsset.src}`);\n }\n formattedAsset = this._buildResolvedAsset(formattedAsset, {\n aliases: aliasesToUse,\n data,\n format,\n loadParser\n });\n resolvedAssets.push(formattedAsset);\n });\n });\n aliasesToUse.forEach((alias) => {\n this._assetMap[alias] = resolvedAssets;\n });\n });\n }\n // TODO: this needs an overload like load did in Assets\n /**\n * If the resolver has had a manifest set via setManifest, this will return the assets urls for\n * a given bundleId or bundleIds.\n * @example\n * // Manifest Example\n * const manifest = {\n * bundles: [\n * {\n * name: 'load-screen',\n * assets: [\n * {\n * alias: 'background',\n * src: 'sunset.png',\n * },\n * {\n * alias: 'bar',\n * src: 'load-bar.{png,webp}',\n * },\n * ],\n * },\n * {\n * name: 'game-screen',\n * assets: [\n * {\n * alias: 'character',\n * src: 'robot.png',\n * },\n * {\n * alias: 'enemy',\n * src: 'bad-guy.png',\n * },\n * ],\n * },\n * ]\n * };\n *\n * resolver.setManifest(manifest);\n * const resolved = resolver.resolveBundle('load-screen');\n * @param bundleIds - The bundle ids to resolve\n * @returns All the bundles assets or a hash of assets for each bundle specified\n */\n resolveBundle(bundleIds) {\n const singleAsset = isSingleItem(bundleIds);\n bundleIds = convertToList(bundleIds);\n const out = {};\n bundleIds.forEach((bundleId) => {\n const assetNames = this._bundles[bundleId];\n if (assetNames) {\n const results = this.resolve(assetNames);\n const assets = {};\n for (const key in results) {\n const asset = results[key];\n assets[this._extractAssetIdFromBundle(bundleId, key)] = asset;\n }\n out[bundleId] = assets;\n }\n });\n return singleAsset ? out[bundleIds[0]] : out;\n }\n /**\n * Does exactly what resolve does, but returns just the URL rather than the whole asset object\n * @param key - The key or keys to resolve\n * @returns - The URLs associated with the key(s)\n */\n resolveUrl(key) {\n const result = this.resolve(key);\n if (typeof key !== \"string\") {\n const out = {};\n for (const i in result) {\n out[i] = result[i].src;\n }\n return out;\n }\n return result.src;\n }\n resolve(keys) {\n const singleAsset = isSingleItem(keys);\n keys = convertToList(keys);\n const result = {};\n keys.forEach((key) => {\n if (!this._resolverHash[key]) {\n if (this._assetMap[key]) {\n let assets = this._assetMap[key];\n const preferredOrder = this._getPreferredOrder(assets);\n preferredOrder?.priority.forEach((priorityKey) => {\n preferredOrder.params[priorityKey].forEach((value) => {\n const filteredAssets = assets.filter((asset) => {\n if (asset[priorityKey]) {\n return asset[priorityKey] === value;\n }\n return false;\n });\n if (filteredAssets.length) {\n assets = filteredAssets;\n }\n });\n });\n this._resolverHash[key] = assets[0];\n } else {\n this._resolverHash[key] = this._buildResolvedAsset({\n alias: [key],\n src: key\n }, {});\n }\n }\n result[key] = this._resolverHash[key];\n });\n return singleAsset ? result[keys[0]] : result;\n }\n /**\n * Checks if an asset with a given key exists in the resolver\n * @param key - The key of the asset\n */\n hasKey(key) {\n return !!this._assetMap[key];\n }\n /**\n * Checks if a bundle with the given key exists in the resolver\n * @param key - The key of the bundle\n */\n hasBundle(key) {\n return !!this._bundles[key];\n }\n /**\n * Internal function for figuring out what prefer criteria an asset should use.\n * @param assets\n */\n _getPreferredOrder(assets) {\n for (let i = 0; i < assets.length; i++) {\n const asset = assets[0];\n const preferred = this._preferredOrder.find((preference) => preference.params.format.includes(asset.format));\n if (preferred) {\n return preferred;\n }\n }\n return this._preferredOrder[0];\n }\n /**\n * Appends the default url parameters to the url\n * @param url - The url to append the default parameters to\n * @returns - The url with the default parameters appended\n */\n _appendDefaultSearchParams(url) {\n if (!this._defaultSearchParams)\n return url;\n const paramConnector = /\\?/.test(url) ? \"&\" : \"?\";\n return `${url}${paramConnector}${this._defaultSearchParams}`;\n }\n _buildResolvedAsset(formattedAsset, data) {\n const { aliases, data: assetData, loadParser, format } = data;\n if (this._basePath || this._rootPath) {\n formattedAsset.src = path.toAbsolute(formattedAsset.src, this._basePath, this._rootPath);\n }\n formattedAsset.alias = aliases ?? formattedAsset.alias ?? [formattedAsset.src];\n formattedAsset.src = this._appendDefaultSearchParams(formattedAsset.src);\n formattedAsset.data = { ...assetData || {}, ...formattedAsset.data };\n formattedAsset.loadParser = loadParser ?? formattedAsset.loadParser;\n formattedAsset.format = format ?? formattedAsset.format ?? getUrlExtension(formattedAsset.src);\n return formattedAsset;\n }\n}\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nResolver.RETINA_PREFIX = /@([0-9\\.]+)x/;\nfunction getUrlExtension(url) {\n return url.split(\".\").pop().split(\"?\").shift().split(\"#\").shift();\n}\n\nexport { Resolver, getUrlExtension };\n//# sourceMappingURL=Resolver.mjs.map\n","\"use strict\";\nconst copySearchParams = (targetUrl, sourceUrl) => {\n const searchParams = sourceUrl.split(\"?\")[1];\n if (searchParams) {\n targetUrl += `?${searchParams}`;\n }\n return targetUrl;\n};\n\nexport { copySearchParams };\n//# sourceMappingURL=copySearchParams.mjs.map\n","import { Rectangle } from '../maths/shapes/Rectangle.mjs';\nimport { Texture } from '../rendering/renderers/shared/texture/Texture.mjs';\n\n\"use strict\";\nconst _Spritesheet = class _Spritesheet {\n /**\n * @param texture - Reference to the source BaseTexture object.\n * @param {object} data - Spritesheet image data.\n */\n constructor(texture, data) {\n /** For multi-packed spritesheets, this contains a reference to all the other spritesheets it depends on. */\n this.linkedSheets = [];\n this._texture = texture instanceof Texture ? texture : null;\n this.textureSource = texture.source;\n this.textures = {};\n this.animations = {};\n this.data = data;\n const metaResolution = parseFloat(data.meta.scale);\n if (metaResolution) {\n this.resolution = metaResolution;\n texture.source.resolution = this.resolution;\n } else {\n this.resolution = texture.source._resolution;\n }\n this._frames = this.data.frames;\n this._frameKeys = Object.keys(this._frames);\n this._batchIndex = 0;\n this._callback = null;\n }\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n */\n parse() {\n return new Promise((resolve) => {\n this._callback = resolve;\n this._batchIndex = 0;\n if (this._frameKeys.length <= _Spritesheet.BATCH_SIZE) {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n } else {\n this._nextBatch();\n }\n });\n }\n /**\n * Process a batch of frames\n * @param initialFrameIndex - The index of frame to start.\n */\n _processFrames(initialFrameIndex) {\n let frameIndex = initialFrameIndex;\n const maxFrames = _Spritesheet.BATCH_SIZE;\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n if (rect) {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize ? data.sourceSize : data.frame;\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n if (data.rotated) {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n } else {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n if (data.trimmed !== false && data.spriteSourceSize) {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n this.textures[i] = new Texture({\n source: this.textureSource,\n frame,\n orig,\n trim,\n rotate: data.rotated ? 2 : 0,\n defaultAnchor: data.anchor,\n defaultBorders: data.borders,\n label: i.toString()\n });\n }\n frameIndex++;\n }\n }\n /** Parse animations config. */\n _processAnimations() {\n const animations = this.data.animations || {};\n for (const animName in animations) {\n this.animations[animName] = [];\n for (let i = 0; i < animations[animName].length; i++) {\n const frameName = animations[animName][i];\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n /** The parse has completed. */\n _parseComplete() {\n const callback = this._callback;\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n /** Begin the next batch of textures. */\n _nextBatch() {\n this._processFrames(this._batchIndex * _Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() => {\n if (this._batchIndex * _Spritesheet.BATCH_SIZE < this._frameKeys.length) {\n this._nextBatch();\n } else {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n /**\n * Destroy Spritesheet and don't use after this.\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase = false) {\n for (const i in this.textures) {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase) {\n this._texture?.destroy();\n this.textureSource.destroy();\n }\n this._texture = null;\n this.textureSource = null;\n this.linkedSheets = [];\n }\n};\n/** The maximum number of Textures to build per process. */\n_Spritesheet.BATCH_SIZE = 1e3;\nlet Spritesheet = _Spritesheet;\n\nexport { Spritesheet };\n//# sourceMappingURL=Spritesheet.mjs.map\n","import { LoaderParserPriority } from '../assets/loader/parsers/LoaderParser.mjs';\nimport { Resolver } from '../assets/resolver/Resolver.mjs';\nimport { copySearchParams } from '../assets/utils/copySearchParams.mjs';\nimport { ExtensionType } from '../extensions/Extensions.mjs';\nimport { Texture } from '../rendering/renderers/shared/texture/Texture.mjs';\nimport { path } from '../utils/path.mjs';\nimport { Spritesheet } from './Spritesheet.mjs';\n\n\"use strict\";\nconst validImages = [\n \"jpg\",\n \"png\",\n \"jpeg\",\n \"avif\",\n \"webp\",\n \"basis\",\n \"etc2\",\n \"bc7\",\n \"bc6h\",\n \"bc5\",\n \"bc4\",\n \"bc3\",\n \"bc2\",\n \"bc1\",\n \"eac\",\n \"astc\"\n];\nfunction getCacheableAssets(keys, asset, ignoreMultiPack) {\n const out = {};\n keys.forEach((key) => {\n out[key] = asset;\n });\n Object.keys(asset.textures).forEach((key) => {\n out[key] = asset.textures[key];\n });\n if (!ignoreMultiPack) {\n const basePath = path.dirname(keys[0]);\n asset.linkedSheets.forEach((item, i) => {\n const out2 = getCacheableAssets([`${basePath}/${asset.data.meta.related_multi_packs[i]}`], item, true);\n Object.assign(out, out2);\n });\n }\n return out;\n}\nconst spritesheetAsset = {\n extension: ExtensionType.Asset,\n /** Handle the caching of the related Spritesheet Textures */\n cache: {\n test: (asset) => asset instanceof Spritesheet,\n getCacheableAssets: (keys, asset) => getCacheableAssets(keys, asset, false)\n },\n /** Resolve the resolution of the asset. */\n resolver: {\n extension: {\n type: ExtensionType.ResolveParser,\n name: \"resolveSpritesheet\"\n },\n test: (value) => {\n const tempURL = value.split(\"?\")[0];\n const split = tempURL.split(\".\");\n const extension = split.pop();\n const format = split.pop();\n return extension === \"json\" && validImages.includes(format);\n },\n parse: (value) => {\n const split = value.split(\".\");\n return {\n resolution: parseFloat(Resolver.RETINA_PREFIX.exec(value)?.[1] ?? \"1\"),\n format: split[split.length - 2],\n src: value\n };\n }\n },\n /**\n * Loader plugin that parses sprite sheets!\n * once the JSON has been loaded this checks to see if the JSON is spritesheet data.\n * If it is, we load the spritesheets image and parse the data into Spritesheet\n * All textures in the sprite sheet are then added to the cache\n */\n loader: {\n name: \"spritesheetLoader\",\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Normal,\n name: \"spritesheetLoader\"\n },\n async testParse(asset, options) {\n return path.extname(options.src).toLowerCase() === \".json\" && !!asset.frames;\n },\n async parse(asset, options, loader) {\n const {\n texture: imageTexture,\n // if user need to use preloaded texture\n imageFilename\n // if user need to use custom filename (not from jsonFile.meta.image)\n } = options?.data ?? {};\n let basePath = path.dirname(options.src);\n if (basePath && basePath.lastIndexOf(\"/\") !== basePath.length - 1) {\n basePath += \"/\";\n }\n let texture;\n if (imageTexture instanceof Texture) {\n texture = imageTexture;\n } else {\n const imagePath = copySearchParams(basePath + (imageFilename ?? asset.meta.image), options.src);\n const assets = await loader.load([imagePath]);\n texture = assets[imagePath];\n }\n const spritesheet = new Spritesheet(\n texture.source,\n asset\n );\n await spritesheet.parse();\n const multiPacks = asset?.meta?.related_multi_packs;\n if (Array.isArray(multiPacks)) {\n const promises = [];\n for (const item of multiPacks) {\n if (typeof item !== \"string\") {\n continue;\n }\n let itemUrl = basePath + item;\n if (options.data?.ignoreMultiPack) {\n continue;\n }\n itemUrl = copySearchParams(itemUrl, options.src);\n promises.push(loader.load({\n src: itemUrl,\n data: {\n ignoreMultiPack: true\n }\n }));\n }\n const res = await Promise.all(promises);\n spritesheet.linkedSheets = res;\n res.forEach((item) => {\n item.linkedSheets = [spritesheet].concat(spritesheet.linkedSheets.filter((sp) => sp !== item));\n });\n }\n return spritesheet;\n },\n async unload(spritesheet, _resolvedAsset, loader) {\n await loader.unload(spritesheet.textureSource._sourceOrigin);\n spritesheet.destroy(false);\n }\n }\n};\n\nexport { spritesheetAsset };\n//# sourceMappingURL=spritesheetAsset.mjs.map\n","import { extensions } from '../extensions/Extensions.mjs';\nimport { spritesheetAsset } from './spritesheetAsset.mjs';\n\n\"use strict\";\nextensions.add(spritesheetAsset);\n//# sourceMappingURL=init.mjs.map\n","import { Point } from '../maths/point/Point.mjs';\n\n\"use strict\";\nclass FederatedEvent {\n /**\n * @param manager - The event boundary which manages this event. Propagation can only occur\n * within the boundary's jurisdiction.\n */\n constructor(manager) {\n /** Flags whether this event bubbles. This will take effect only if it is set before propagation. */\n this.bubbles = true;\n /** @deprecated since 7.0.0 */\n this.cancelBubble = true;\n /**\n * Flags whether this event can be canceled using {@link FederatedEvent.preventDefault}. This is always\n * false (for now).\n */\n this.cancelable = false;\n /**\n * Flag added for compatibility with DOM {@code Event}. It is not used in the Federated Events\n * API.\n * @see https://dom.spec.whatwg.org/#dom-event-composed\n */\n this.composed = false;\n /** Flags whether the default response of the user agent was prevent through this event. */\n this.defaultPrevented = false;\n /**\n * The propagation phase.\n * @default {@link FederatedEvent.NONE}\n */\n this.eventPhase = FederatedEvent.prototype.NONE;\n /** Flags whether propagation was stopped. */\n this.propagationStopped = false;\n /** Flags whether propagation was immediately stopped. */\n this.propagationImmediatelyStopped = false;\n /** The coordinates of the event relative to the nearest DOM layer. This is a non-standard property. */\n this.layer = new Point();\n /** The coordinates of the event relative to the DOM document. This is a non-standard property. */\n this.page = new Point();\n this.NONE = 0;\n this.CAPTURING_PHASE = 1;\n this.AT_TARGET = 2;\n this.BUBBLING_PHASE = 3;\n this.manager = manager;\n }\n /** @readonly */\n get layerX() {\n return this.layer.x;\n }\n /** @readonly */\n get layerY() {\n return this.layer.y;\n }\n /** @readonly */\n get pageX() {\n return this.page.x;\n }\n /** @readonly */\n get pageY() {\n return this.page.y;\n }\n /**\n * Fallback for the deprecated @code{InteractionEvent.data}.\n * @deprecated since 7.0.0\n */\n get data() {\n return this;\n }\n /** The propagation path for this event. Alias for {@link EventBoundary.propagationPath}. */\n composedPath() {\n if (this.manager && (!this.path || this.path[this.path.length - 1] !== this.target)) {\n this.path = this.target ? this.manager.propagationPath(this.target) : [];\n }\n return this.path;\n }\n /**\n * Unimplemented method included for implementing the DOM interface {@code Event}. It will throw an {@code Error}.\n * @deprecated\n * @param _type\n * @param _bubbles\n * @param _cancelable\n */\n initEvent(_type, _bubbles, _cancelable) {\n throw new Error(\"initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.\");\n }\n /**\n * Unimplemented method included for implementing the DOM interface {@code UIEvent}. It will throw an {@code Error}.\n * @deprecated\n * @param _typeArg\n * @param _bubblesArg\n * @param _cancelableArg\n * @param _viewArg\n * @param _detailArg\n */\n initUIEvent(_typeArg, _bubblesArg, _cancelableArg, _viewArg, _detailArg) {\n throw new Error(\"initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.\");\n }\n /** Prevent default behavior of PixiJS and the user agent. */\n preventDefault() {\n if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {\n this.nativeEvent.preventDefault();\n }\n this.defaultPrevented = true;\n }\n /**\n * Stop this event from propagating to any addition listeners, including on the\n * {@link FederatedEventTarget.currentTarget currentTarget} and also the following\n * event targets on the propagation path.\n */\n stopImmediatePropagation() {\n this.propagationImmediatelyStopped = true;\n }\n /**\n * Stop this event from propagating to the next {@link FederatedEventTarget}. The rest of the listeners\n * on the {@link FederatedEventTarget.currentTarget currentTarget} will still be notified.\n */\n stopPropagation() {\n this.propagationStopped = true;\n }\n}\n\nexport { FederatedEvent };\n//# sourceMappingURL=FederatedEvent.mjs.map\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileJs from 'ismobilejs';\n\n\"use strict\";\nconst isMobileCall = isMobileJs.default ?? isMobileJs;\nconst isMobile = isMobileCall(globalThis.navigator);\n\nexport { isMobile };\n//# sourceMappingURL=isMobile.mjs.map\n","import { FederatedEvent } from '../events/FederatedEvent.mjs';\nimport { ExtensionType } from '../extensions/Extensions.mjs';\nimport { isMobile } from '../utils/browser/isMobile.mjs';\nimport { removeItems } from '../utils/data/removeItems.mjs';\n\n\"use strict\";\nconst KEY_CODE_TAB = 9;\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1e3;\nconst DIV_HOOK_POS_Y = -1e3;\nconst DIV_HOOK_ZINDEX = 2;\nclass AccessibilitySystem {\n // 2fps\n // eslint-disable-next-line jsdoc/require-param\n /**\n * @param {WebGLRenderer|WebGPURenderer} renderer - A reference to the current renderer\n */\n constructor(renderer, _mobileInfo = isMobile) {\n this._mobileInfo = _mobileInfo;\n /** Setting this to true will visually show the divs. */\n this.debug = false;\n /** Internal variable, see isActive getter. */\n this._isActive = false;\n /** Internal variable, see isMobileAccessibility getter. */\n this._isMobileAccessibility = false;\n /** A simple pool for storing divs. */\n this._pool = [];\n /** This is a tick used to check if an object is no longer being rendered. */\n this._renderId = 0;\n /** The array of currently active accessible items. */\n this._children = [];\n /** Count to throttle div updates on android devices. */\n this._androidUpdateCount = 0;\n /** The frequency to update the div elements. */\n this._androidUpdateFrequency = 500;\n this._hookDiv = null;\n if (_mobileInfo.tablet || _mobileInfo.phone) {\n this._createTouchHook();\n }\n const div = document.createElement(\"div\");\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = \"absolute\";\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n this._div = div;\n this._renderer = renderer;\n this._onKeyDown = this._onKeyDown.bind(this);\n this._onMouseMove = this._onMouseMove.bind(this);\n globalThis.addEventListener(\"keydown\", this._onKeyDown, false);\n }\n /**\n * Value of `true` if accessibility is currently active and accessibility layers are showing.\n * @member {boolean}\n * @readonly\n */\n get isActive() {\n return this._isActive;\n }\n /**\n * Value of `true` if accessibility is enabled for touch devices.\n * @member {boolean}\n * @readonly\n */\n get isMobileAccessibility() {\n return this._isMobileAccessibility;\n }\n get hookDiv() {\n return this._hookDiv;\n }\n /**\n * Creates the touch hooks.\n * @private\n */\n _createTouchHook() {\n const hookDiv = document.createElement(\"button\");\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = \"absolute\";\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = \"#FF0000\";\n hookDiv.title = \"select to enable accessibility for this content\";\n hookDiv.addEventListener(\"focus\", () => {\n this._isMobileAccessibility = true;\n this._activate();\n this._destroyTouchHook();\n });\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n }\n /**\n * Destroys the touch hooks.\n * @private\n */\n _destroyTouchHook() {\n if (!this._hookDiv) {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n }\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n * @private\n */\n _activate() {\n if (this._isActive) {\n return;\n }\n this._isActive = true;\n globalThis.document.addEventListener(\"mousemove\", this._onMouseMove, true);\n globalThis.removeEventListener(\"keydown\", this._onKeyDown, false);\n this._renderer.runners.postrender.add(this);\n this._renderer.view.canvas.parentNode?.appendChild(this._div);\n }\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n * @private\n */\n _deactivate() {\n if (!this._isActive || this._isMobileAccessibility) {\n return;\n }\n this._isActive = false;\n globalThis.document.removeEventListener(\"mousemove\", this._onMouseMove, true);\n globalThis.addEventListener(\"keydown\", this._onKeyDown, false);\n this._renderer.runners.postrender.remove(this);\n this._div.parentNode?.removeChild(this._div);\n }\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n * @private\n * @param {Container} container - The Container to check.\n */\n _updateAccessibleObjects(container) {\n if (!container.visible || !container.accessibleChildren) {\n return;\n }\n if (container.accessible && container.isInteractive()) {\n if (!container._accessibleActive) {\n this._addChild(container);\n }\n container._renderId = this._renderId;\n }\n const children = container.children;\n if (children) {\n for (let i = 0; i < children.length; i++) {\n this._updateAccessibleObjects(children[i]);\n }\n }\n }\n /**\n * Runner init called, view is available at this point.\n * @ignore\n */\n init(options) {\n this.debug = options?.debug ?? this.debug;\n this._renderer.runners.postrender.remove(this);\n }\n /**\n * Runner postrender was called, ensure that all divs are mapped correctly to their Containers.\n * Only fires while active.\n * @ignore\n */\n postrender() {\n const now = performance.now();\n if (this._mobileInfo.android.device && now < this._androidUpdateCount) {\n return;\n }\n this._androidUpdateCount = now + this._androidUpdateFrequency;\n if (!this._renderer.renderingToScreen || !this._renderer.view.canvas) {\n return;\n }\n if (this._renderer.lastObjectRendered) {\n this._updateAccessibleObjects(this._renderer.lastObjectRendered);\n }\n const { x, y, width, height } = this._renderer.view.canvas.getBoundingClientRect();\n const { width: viewWidth, height: viewHeight, resolution } = this._renderer;\n const sx = width / viewWidth * resolution;\n const sy = height / viewHeight * resolution;\n let div = this._div;\n div.style.left = `${x}px`;\n div.style.top = `${y}px`;\n div.style.width = `${viewWidth}px`;\n div.style.height = `${viewHeight}px`;\n for (let i = 0; i < this._children.length; i++) {\n const child = this._children[i];\n if (child._renderId !== this._renderId) {\n child._accessibleActive = false;\n removeItems(this._children, i, 1);\n this._div.removeChild(child._accessibleDiv);\n this._pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n i--;\n } else {\n div = child._accessibleDiv;\n let hitArea = child.hitArea;\n const wt = child.worldTransform;\n if (child.hitArea) {\n div.style.left = `${(wt.tx + hitArea.x * wt.a) * sx}px`;\n div.style.top = `${(wt.ty + hitArea.y * wt.d) * sy}px`;\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n } else {\n hitArea = child.getBounds().rectangle;\n this._capHitArea(hitArea);\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) {\n div.title = child.accessibleTitle || \"\";\n }\n if (div.getAttribute(\"aria-label\") !== child.accessibleHint && child.accessibleHint !== null) {\n div.setAttribute(\"aria-label\", child.accessibleHint || \"\");\n }\n }\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) {\n div.title = child.accessibleTitle || \"\";\n div.tabIndex = child.tabIndex;\n if (this.debug) {\n this._updateDebugHTML(div);\n }\n }\n }\n }\n this._renderId++;\n }\n /**\n * private function that will visually add the information to the\n * accessibility div\n * @param {HTMLElement} div -\n */\n _updateDebugHTML(div) {\n div.innerHTML = `type: ${div.type}
title : ${div.title}
tabIndex: ${div.tabIndex}`;\n }\n /**\n * Adjust the hit area based on the bounds of a display object\n * @param {Rectangle} hitArea - Bounds of the child\n */\n _capHitArea(hitArea) {\n if (hitArea.x < 0) {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n if (hitArea.y < 0) {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n const { width: viewWidth, height: viewHeight } = this._renderer;\n if (hitArea.x + hitArea.width > viewWidth) {\n hitArea.width = viewWidth - hitArea.x;\n }\n if (hitArea.y + hitArea.height > viewHeight) {\n hitArea.height = viewHeight - hitArea.y;\n }\n }\n /**\n * Adds a Container to the accessibility manager\n * @private\n * @param {Container} container - The child to make accessible.\n */\n _addChild(container) {\n let div = this._pool.pop();\n if (!div) {\n div = document.createElement(\"button\");\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? \"rgba(255,255,255,0.5)\" : \"transparent\";\n div.style.position = \"absolute\";\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = \"none\";\n if (navigator.userAgent.toLowerCase().includes(\"chrome\")) {\n div.setAttribute(\"aria-live\", \"off\");\n } else {\n div.setAttribute(\"aria-live\", \"polite\");\n }\n if (navigator.userAgent.match(/rv:.*Gecko\\//)) {\n div.setAttribute(\"aria-relevant\", \"additions\");\n } else {\n div.setAttribute(\"aria-relevant\", \"text\");\n }\n div.addEventListener(\"click\", this._onClick.bind(this));\n div.addEventListener(\"focus\", this._onFocus.bind(this));\n div.addEventListener(\"focusout\", this._onFocusOut.bind(this));\n }\n div.style.pointerEvents = container.accessiblePointerEvents;\n div.type = container.accessibleType;\n if (container.accessibleTitle && container.accessibleTitle !== null) {\n div.title = container.accessibleTitle;\n } else if (!container.accessibleHint || container.accessibleHint === null) {\n div.title = `container ${container.tabIndex}`;\n }\n if (container.accessibleHint && container.accessibleHint !== null) {\n div.setAttribute(\"aria-label\", container.accessibleHint);\n }\n if (this.debug) {\n this._updateDebugHTML(div);\n }\n container._accessibleActive = true;\n container._accessibleDiv = div;\n div.container = container;\n this._children.push(container);\n this._div.appendChild(container._accessibleDiv);\n container._accessibleDiv.tabIndex = container.tabIndex;\n }\n /**\n * Dispatch events with the EventSystem.\n * @param e\n * @param type\n * @private\n */\n _dispatchEvent(e, type) {\n const { container: target } = e.target;\n const boundary = this._renderer.events.rootBoundary;\n const event = Object.assign(new FederatedEvent(boundary), { target });\n boundary.rootTarget = this._renderer.lastObjectRendered;\n type.forEach((type2) => boundary.dispatchEvent(event, type2));\n }\n /**\n * Maps the div button press to pixi's EventSystem (click)\n * @private\n * @param {MouseEvent} e - The click event.\n */\n _onClick(e) {\n this._dispatchEvent(e, [\"click\", \"pointertap\", \"tap\"]);\n }\n /**\n * Maps the div focus events to pixi's EventSystem (mouseover)\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n _onFocus(e) {\n if (!e.target.getAttribute(\"aria-live\")) {\n e.target.setAttribute(\"aria-live\", \"assertive\");\n }\n this._dispatchEvent(e, [\"mouseover\"]);\n }\n /**\n * Maps the div focus events to pixi's EventSystem (mouseout)\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n _onFocusOut(e) {\n if (!e.target.getAttribute(\"aria-live\")) {\n e.target.setAttribute(\"aria-live\", \"polite\");\n }\n this._dispatchEvent(e, [\"mouseout\"]);\n }\n /**\n * Is called when a key is pressed\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n _onKeyDown(e) {\n if (e.keyCode !== KEY_CODE_TAB) {\n return;\n }\n this._activate();\n }\n /**\n * Is called when the mouse moves across the renderer element\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n _onMouseMove(e) {\n if (e.movementX === 0 && e.movementY === 0) {\n return;\n }\n this._deactivate();\n }\n /** Destroys the accessibility manager */\n destroy() {\n this._destroyTouchHook();\n this._div = null;\n globalThis.document.removeEventListener(\"mousemove\", this._onMouseMove, true);\n globalThis.removeEventListener(\"keydown\", this._onKeyDown);\n this._pool = null;\n this._children = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nAccessibilitySystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem\n ],\n name: \"accessibility\"\n};\n\nexport { AccessibilitySystem };\n//# sourceMappingURL=AccessibilitySystem.mjs.map\n","\"use strict\";\nconst accessibilityTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n * @member {boolean}\n * @memberof scene.Container#\n */\n accessible: false,\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'container [tabIndex]'\n * @member {string}\n * @memberof scene.Container#\n */\n accessibleTitle: null,\n /**\n * Sets the aria-label attribute of the shadow div\n * @member {string}\n * @memberof scene.Container#\n */\n accessibleHint: null,\n /**\n * @member {number}\n * @memberof scene.Container#\n * @todo Needs docs.\n */\n tabIndex: 0,\n /**\n * @member {boolean}\n * @memberof scene.Container#\n * @private\n */\n _accessibleActive: false,\n /**\n * @memberof scene.Container#\n * @private\n */\n _accessibleDiv: null,\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n * @member {string}\n * @memberof scene.Container#\n * @default 'button'\n */\n accessibleType: \"button\",\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n * @type {PointerEvents}\n * @memberof scene.Container#\n * @default 'auto'\n */\n accessiblePointerEvents: \"auto\",\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n * @member {boolean}\n * @memberof scene.Container#\n * @default true\n */\n accessibleChildren: true,\n /**\n * @member {number}\n * @memberof scene.Container#\n * @private\n */\n _renderId: -1\n};\n\nexport { accessibilityTarget };\n//# sourceMappingURL=accessibilityTarget.mjs.map\n","\"use strict\";\nconst idCounts = /* @__PURE__ */ Object.create(null);\nconst idHash = /* @__PURE__ */ Object.create(null);\nfunction createIdFromString(value, groupId) {\n let id = idHash[value];\n if (id === void 0) {\n if (idCounts[groupId] === void 0) {\n idCounts[groupId] = 1;\n }\n idHash[value] = id = idCounts[groupId]++;\n }\n return id;\n}\n\nexport { createIdFromString };\n//# sourceMappingURL=createIdFromString.mjs.map\n","import { DOMAdapter } from '../../../../../environment/adapter.mjs';\n\n\"use strict\";\nlet context;\nfunction getTestContext() {\n if (!context || context?.isContextLost()) {\n const canvas = DOMAdapter.get().createCanvas();\n context = canvas.getContext(\"webgl\", {});\n }\n return context;\n}\n\nexport { getTestContext };\n//# sourceMappingURL=getTestContext.mjs.map\n","import { getTestContext } from './getTestContext.mjs';\n\n\"use strict\";\nlet maxFragmentPrecision;\nfunction getMaxFragmentPrecision() {\n if (!maxFragmentPrecision) {\n maxFragmentPrecision = \"mediump\";\n const gl = getTestContext();\n if (gl) {\n if (gl.getShaderPrecisionFormat) {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n maxFragmentPrecision = shaderFragment.precision ? \"highp\" : \"mediump\";\n }\n }\n }\n return maxFragmentPrecision;\n}\n\nexport { getMaxFragmentPrecision };\n//# sourceMappingURL=getMaxFragmentPrecision.mjs.map\n","\"use strict\";\nconst fragmentNameCache = {};\nconst VertexNameCache = {};\nfunction setProgramName(src, { name = `pixi-program` }, isFragment = true) {\n name = name.replace(/\\s+/g, \"-\");\n name += isFragment ? \"-fragment\" : \"-vertex\";\n const nameCache = isFragment ? fragmentNameCache : VertexNameCache;\n if (nameCache[name]) {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n } else {\n nameCache[name] = 1;\n }\n if (src.indexOf(\"#define SHADER_NAME\") !== -1)\n return src;\n const shaderName = `#define SHADER_NAME ${name}`;\n return `${shaderName}\n${src}`;\n}\n\nexport { setProgramName };\n//# sourceMappingURL=setProgramName.mjs.map\n","import { createIdFromString } from '../../shared/utils/createIdFromString.mjs';\nimport { getMaxFragmentPrecision } from './program/getMaxFragmentPrecision.mjs';\nimport { addProgramDefines } from './program/preprocessors/addProgramDefines.mjs';\nimport { ensurePrecision } from './program/preprocessors/ensurePrecision.mjs';\nimport { insertVersion } from './program/preprocessors/insertVersion.mjs';\nimport { setProgramName } from './program/preprocessors/setProgramName.mjs';\nimport { stripVersion } from './program/preprocessors/stripVersion.mjs';\n\n\"use strict\";\nconst processes = {\n // strips any version headers..\n stripVersion,\n // adds precision string if not already present\n ensurePrecision,\n // add some defines if WebGL1 to make it more compatible with WebGL2 shaders\n addProgramDefines,\n // add the program name to the shader\n setProgramName,\n // add the version string to the shader header\n insertVersion\n};\nconst programCache = /* @__PURE__ */ Object.create(null);\nconst _GlProgram = class _GlProgram {\n /**\n * Creates a shiny new GlProgram. Used by WebGL renderer.\n * @param options - The options for the program.\n */\n constructor(options) {\n options = { ..._GlProgram.defaultOptions, ...options };\n const isES300 = options.fragment.indexOf(\"#version 300 es\") !== -1;\n const preprocessorOptions = {\n stripVersion: isES300,\n ensurePrecision: {\n requestedFragmentPrecision: options.preferredFragmentPrecision,\n requestedVertexPrecision: options.preferredVertexPrecision,\n maxSupportedVertexPrecision: \"highp\",\n maxSupportedFragmentPrecision: getMaxFragmentPrecision()\n },\n setProgramName: {\n name: options.name\n },\n addProgramDefines: isES300,\n insertVersion: isES300\n };\n let fragment = options.fragment;\n let vertex = options.vertex;\n Object.keys(processes).forEach((processKey) => {\n const processOptions = preprocessorOptions[processKey];\n fragment = processes[processKey](fragment, processOptions, true);\n vertex = processes[processKey](vertex, processOptions, false);\n });\n this.fragment = fragment;\n this.vertex = vertex;\n this._key = createIdFromString(`${this.vertex}:${this.fragment}`, \"gl-program\");\n }\n /** destroys the program */\n destroy() {\n this.fragment = null;\n this.vertex = null;\n this._attributeData = null;\n this._uniformData = null;\n this._uniformBlockData = null;\n this.transformFeedbackVaryings = null;\n }\n /**\n * Helper function that creates a program for a given source.\n * It will check the program cache if the program has already been created.\n * If it has that one will be returned, if not a new one will be created and cached.\n * @param options - The options for the program.\n * @returns A program using the same source\n */\n static from(options) {\n const key = `${options.vertex}:${options.fragment}`;\n if (!programCache[key]) {\n programCache[key] = new _GlProgram(options);\n }\n return programCache[key];\n }\n};\n/** The default options used by the program. */\n_GlProgram.defaultOptions = {\n preferredVertexPrecision: \"highp\",\n preferredFragmentPrecision: \"mediump\"\n};\nlet GlProgram = _GlProgram;\n\nexport { GlProgram };\n//# sourceMappingURL=GlProgram.mjs.map\n","\"use strict\";\nfunction stripVersion(src, isES300) {\n if (!isES300)\n return src;\n return src.replace(\"#version 300 es\", \"\");\n}\n\nexport { stripVersion };\n//# sourceMappingURL=stripVersion.mjs.map\n","\"use strict\";\nfunction ensurePrecision(src, options, isFragment) {\n const maxSupportedPrecision = isFragment ? options.maxSupportedFragmentPrecision : options.maxSupportedVertexPrecision;\n if (src.substring(0, 9) !== \"precision\") {\n let precision = isFragment ? options.requestedFragmentPrecision : options.requestedVertexPrecision;\n if (precision === \"highp\" && maxSupportedPrecision !== \"highp\") {\n precision = \"mediump\";\n }\n return `precision ${precision} float;\n${src}`;\n } else if (maxSupportedPrecision !== \"highp\" && src.substring(0, 15) === \"precision highp\") {\n return src.replace(\"precision highp\", \"precision mediump\");\n }\n return src;\n}\n\nexport { ensurePrecision };\n//# sourceMappingURL=ensurePrecision.mjs.map\n","\"use strict\";\nfunction addProgramDefines(src, isES300, isFragment) {\n if (isES300)\n return src;\n if (isFragment) {\n src = src.replace(\"out vec4 finalColor;\", \"\");\n return `\n \n #ifdef GL_ES // This checks if it is WebGL1\n #define in varying\n #define finalColor gl_FragColor\n #define texture texture2D\n #endif\n ${src}\n `;\n }\n return `\n \n #ifdef GL_ES // This checks if it is WebGL1\n #define in attribute\n #define out varying\n #endif\n ${src}\n `;\n}\n\nexport { addProgramDefines };\n//# sourceMappingURL=addProgramDefines.mjs.map\n","\"use strict\";\nfunction insertVersion(src, isES300) {\n if (!isES300)\n return src;\n return `#version 300 es\n${src}`;\n}\n\nexport { insertVersion };\n//# sourceMappingURL=insertVersion.mjs.map\n","\"use strict\";\nconst attributeFormatData = {\n uint8x2: { size: 2, stride: 2, normalised: false },\n uint8x4: { size: 4, stride: 4, normalised: false },\n sint8x2: { size: 2, stride: 2, normalised: false },\n sint8x4: { size: 4, stride: 4, normalised: false },\n unorm8x2: { size: 2, stride: 2, normalised: true },\n unorm8x4: { size: 4, stride: 4, normalised: true },\n snorm8x2: { size: 2, stride: 2, normalised: true },\n snorm8x4: { size: 4, stride: 4, normalised: true },\n uint16x2: { size: 2, stride: 4, normalised: false },\n uint16x4: { size: 4, stride: 8, normalised: false },\n sint16x2: { size: 2, stride: 4, normalised: false },\n sint16x4: { size: 4, stride: 8, normalised: false },\n unorm16x2: { size: 2, stride: 4, normalised: true },\n unorm16x4: { size: 4, stride: 8, normalised: true },\n snorm16x2: { size: 2, stride: 4, normalised: true },\n snorm16x4: { size: 4, stride: 8, normalised: true },\n float16x2: { size: 2, stride: 4, normalised: false },\n float16x4: { size: 4, stride: 8, normalised: false },\n float32: { size: 1, stride: 4, normalised: false },\n float32x2: { size: 2, stride: 8, normalised: false },\n float32x3: { size: 3, stride: 12, normalised: false },\n float32x4: { size: 4, stride: 16, normalised: false },\n uint32: { size: 1, stride: 4, normalised: false },\n uint32x2: { size: 2, stride: 8, normalised: false },\n uint32x3: { size: 3, stride: 12, normalised: false },\n uint32x4: { size: 4, stride: 16, normalised: false },\n sint32: { size: 1, stride: 4, normalised: false },\n sint32x2: { size: 2, stride: 8, normalised: false },\n sint32x3: { size: 3, stride: 12, normalised: false },\n sint32x4: { size: 4, stride: 16, normalised: false }\n};\nfunction getAttributeInfoFromFormat(format) {\n return attributeFormatData[format] ?? attributeFormatData.float32;\n}\n\nexport { getAttributeInfoFromFormat };\n//# sourceMappingURL=getAttributeInfoFromFormat.mjs.map\n","import { getAttributeInfoFromFormat } from '../../../shared/geometry/utils/getAttributeInfoFromFormat.mjs';\n\n\"use strict\";\nconst WGSL_TO_VERTEX_TYPES = {\n f32: \"float32\",\n \"vec2\": \"float32x2\",\n \"vec3\": \"float32x3\",\n \"vec4\": \"float32x4\",\n vec2f: \"float32x2\",\n vec3f: \"float32x3\",\n vec4f: \"float32x4\",\n i32: \"sint32\",\n \"vec2\": \"sint32x2\",\n \"vec3\": \"sint32x3\",\n \"vec4\": \"sint32x4\",\n u32: \"uint32\",\n \"vec2\": \"uint32x2\",\n \"vec3\": \"uint32x3\",\n \"vec4\": \"uint32x4\",\n bool: \"uint32\",\n \"vec2\": \"uint32x2\",\n \"vec3\": \"uint32x3\",\n \"vec4\": \"uint32x4\"\n};\nfunction extractAttributesFromGpuProgram({ source, entryPoint }) {\n const results = {};\n const mainVertStart = source.indexOf(`fn ${entryPoint}`);\n if (mainVertStart !== -1) {\n const arrowFunctionStart = source.indexOf(\"->\", mainVertStart);\n if (arrowFunctionStart !== -1) {\n const functionArgsSubstring = source.substring(mainVertStart, arrowFunctionStart);\n const inputsRegex = /@location\\((\\d+)\\)\\s+([a-zA-Z0-9_]+)\\s*:\\s*([a-zA-Z0-9_<>]+)(?:,|\\s|$)/g;\n let match;\n while ((match = inputsRegex.exec(functionArgsSubstring)) !== null) {\n const format = WGSL_TO_VERTEX_TYPES[match[3]] ?? \"float32\";\n results[match[2]] = {\n location: parseInt(match[1], 10),\n format,\n stride: getAttributeInfoFromFormat(format).stride,\n offset: 0,\n instance: false,\n start: 0\n };\n }\n }\n }\n return results;\n}\n\nexport { extractAttributesFromGpuProgram };\n//# sourceMappingURL=extractAttributesFromGpuProgram.mjs.map\n","\"use strict\";\nfunction extractStructAndGroups(wgsl) {\n const linePattern = /(^|[^/])@(group|binding)\\(\\d+\\)[^;]+;/g;\n const groupPattern = /@group\\((\\d+)\\)/;\n const bindingPattern = /@binding\\((\\d+)\\)/;\n const namePattern = /var(<[^>]+>)? (\\w+)/;\n const typePattern = /:\\s*(\\w+)/;\n const structPattern = /struct\\s+(\\w+)\\s*{([^}]+)}/g;\n const structMemberPattern = /(\\w+)\\s*:\\s*([\\w\\<\\>]+)/g;\n const structName = /struct\\s+(\\w+)/;\n const groups = wgsl.match(linePattern)?.map((item) => ({\n group: parseInt(item.match(groupPattern)[1], 10),\n binding: parseInt(item.match(bindingPattern)[1], 10),\n name: item.match(namePattern)[2],\n isUniform: item.match(namePattern)[1] === \"\",\n type: item.match(typePattern)[1]\n }));\n if (!groups) {\n return {\n groups: [],\n structs: []\n };\n }\n const structs = wgsl.match(structPattern)?.map((struct) => {\n const name = struct.match(structName)[1];\n const members = struct.match(structMemberPattern).reduce((acc, member) => {\n const [name2, type] = member.split(\":\");\n acc[name2.trim()] = type.trim();\n return acc;\n }, {});\n if (!members) {\n return null;\n }\n return { name, members };\n }).filter(({ name }) => groups.some((group) => group.type === name)) ?? [];\n return {\n groups,\n structs\n };\n}\n\nexport { extractStructAndGroups };\n//# sourceMappingURL=extractStructAndGroups.mjs.map\n","\"use strict\";\nvar ShaderStage = /* @__PURE__ */ ((ShaderStage2) => {\n ShaderStage2[ShaderStage2[\"VERTEX\"] = 1] = \"VERTEX\";\n ShaderStage2[ShaderStage2[\"FRAGMENT\"] = 2] = \"FRAGMENT\";\n ShaderStage2[ShaderStage2[\"COMPUTE\"] = 4] = \"COMPUTE\";\n return ShaderStage2;\n})(ShaderStage || {});\n\nexport { ShaderStage };\n//# sourceMappingURL=const.mjs.map\n","import { createIdFromString } from '../../shared/utils/createIdFromString.mjs';\nimport { extractAttributesFromGpuProgram } from './utils/extractAttributesFromGpuProgram.mjs';\nimport { extractStructAndGroups } from './utils/extractStructAndGroups.mjs';\nimport { generateGpuLayoutGroups } from './utils/generateGpuLayoutGroups.mjs';\nimport { generateLayoutHash } from './utils/generateLayoutHash.mjs';\nimport { removeStructAndGroupDuplicates } from './utils/removeStructAndGroupDuplicates.mjs';\n\n\"use strict\";\nconst programCache = /* @__PURE__ */ Object.create(null);\nclass GpuProgram {\n /**\n * Create a new GpuProgram\n * @param options - The options for the gpu program\n */\n constructor(options) {\n /**\n * @internal\n * @ignore\n */\n this._layoutKey = 0;\n const { fragment, vertex, layout, gpuLayout, name } = options;\n this.name = name;\n this.fragment = fragment;\n this.vertex = vertex;\n if (fragment.source === vertex.source) {\n const structsAndGroups = extractStructAndGroups(fragment.source);\n this.structsAndGroups = structsAndGroups;\n } else {\n const vertexStructsAndGroups = extractStructAndGroups(vertex.source);\n const fragmentStructsAndGroups = extractStructAndGroups(fragment.source);\n this.structsAndGroups = removeStructAndGroupDuplicates(vertexStructsAndGroups, fragmentStructsAndGroups);\n }\n this.layout = layout ?? generateLayoutHash(this.structsAndGroups);\n this.gpuLayout = gpuLayout ?? generateGpuLayoutGroups(this.structsAndGroups);\n this.autoAssignGlobalUniforms = !!(this.layout[0]?.globalUniforms !== void 0);\n this.autoAssignLocalUniforms = !!(this.layout[1]?.localUniforms !== void 0);\n this._generateProgramKey();\n }\n // TODO maker this pure\n _generateProgramKey() {\n const { vertex, fragment } = this;\n const bigKey = vertex.source + fragment.source + vertex.entryPoint + fragment.entryPoint;\n this._layoutKey = createIdFromString(bigKey, \"program\");\n }\n get attributeData() {\n this._attributeData ?? (this._attributeData = extractAttributesFromGpuProgram(this.vertex));\n return this._attributeData;\n }\n /** destroys the program */\n destroy() {\n this.gpuLayout = null;\n this.layout = null;\n this.structsAndGroups = null;\n this.fragment = null;\n this.vertex = null;\n }\n /**\n * Helper function that creates a program for a given source.\n * It will check the program cache if the program has already been created.\n * If it has that one will be returned, if not a new one will be created and cached.\n * @param options - The options for the program.\n * @returns A program using the same source\n */\n static from(options) {\n const key = `${options.vertex.source}:${options.fragment.source}:${options.fragment.entryPoint}:${options.vertex.entryPoint}`;\n if (!programCache[key]) {\n programCache[key] = new GpuProgram(options);\n }\n return programCache[key];\n }\n}\n\nexport { GpuProgram };\n//# sourceMappingURL=GpuProgram.mjs.map\n","\"use strict\";\nfunction removeStructAndGroupDuplicates(vertexStructsAndGroups, fragmentStructsAndGroups) {\n const structNameSet = /* @__PURE__ */ new Set();\n const dupeGroupKeySet = /* @__PURE__ */ new Set();\n const structs = [...vertexStructsAndGroups.structs, ...fragmentStructsAndGroups.structs].filter((struct) => {\n if (structNameSet.has(struct.name)) {\n return false;\n }\n structNameSet.add(struct.name);\n return true;\n });\n const groups = [...vertexStructsAndGroups.groups, ...fragmentStructsAndGroups.groups].filter((group) => {\n const key = `${group.name}-${group.binding}`;\n if (dupeGroupKeySet.has(key)) {\n return false;\n }\n dupeGroupKeySet.add(key);\n return true;\n });\n return { structs, groups };\n}\n\nexport { removeStructAndGroupDuplicates };\n//# sourceMappingURL=removeStructAndGroupDuplicates.mjs.map\n","\"use strict\";\nfunction generateLayoutHash({ groups }) {\n const layout = [];\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i];\n if (!layout[group.group]) {\n layout[group.group] = {};\n }\n layout[group.group][group.name] = group.binding;\n }\n return layout;\n}\n\nexport { generateLayoutHash };\n//# sourceMappingURL=generateLayoutHash.mjs.map\n","import { ShaderStage } from '../../../shared/shader/const.mjs';\n\n\"use strict\";\nfunction generateGpuLayoutGroups({ groups }) {\n const layout = [];\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i];\n if (!layout[group.group]) {\n layout[group.group] = [];\n }\n if (group.isUniform) {\n layout[group.group].push({\n binding: group.binding,\n visibility: ShaderStage.VERTEX | ShaderStage.FRAGMENT,\n buffer: {\n type: \"uniform\"\n }\n });\n } else if (group.type === \"sampler\") {\n layout[group.group].push({\n binding: group.binding,\n visibility: ShaderStage.FRAGMENT,\n sampler: {\n type: \"filtering\"\n }\n });\n } else if (group.type === \"texture_2d\") {\n layout[group.group].push({\n binding: group.binding,\n visibility: ShaderStage.FRAGMENT,\n texture: {\n sampleType: \"float\",\n viewDimension: \"2d\",\n multisampled: false\n }\n });\n }\n }\n return layout;\n}\n\nexport { generateGpuLayoutGroups };\n//# sourceMappingURL=generateGpuLayoutGroups.mjs.map\n","\"use strict\";\nconst UNIFORM_TYPES_VALUES = [\n \"f32\",\n \"i32\",\n \"vec2\",\n \"vec3\",\n \"vec4\",\n \"mat2x2\",\n \"mat3x3\",\n \"mat4x4\",\n \"mat3x2\",\n \"mat4x2\",\n \"mat2x3\",\n \"mat4x3\",\n \"mat2x4\",\n \"mat3x4\"\n];\nconst UNIFORM_TYPES_MAP = UNIFORM_TYPES_VALUES.reduce((acc, type) => {\n acc[type] = true;\n return acc;\n}, {});\n\nexport { UNIFORM_TYPES_MAP, UNIFORM_TYPES_VALUES };\n//# sourceMappingURL=types.mjs.map\n","\"use strict\";\nfunction getDefaultUniformValue(type, size) {\n switch (type) {\n case \"f32\":\n return 0;\n case \"vec2\":\n return new Float32Array(2 * size);\n case \"vec3\":\n return new Float32Array(3 * size);\n case \"vec4\":\n return new Float32Array(4 * size);\n case \"mat2x2\":\n return new Float32Array([\n 1,\n 0,\n 0,\n 1\n ]);\n case \"mat3x3\":\n return new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ]);\n case \"mat4x4\":\n return new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ]);\n }\n return null;\n}\n\nexport { getDefaultUniformValue };\n//# sourceMappingURL=getDefaultUniformValue.mjs.map\n","import { uid } from '../../../../utils/data/uid.mjs';\nimport { createIdFromString } from '../utils/createIdFromString.mjs';\nimport { UNIFORM_TYPES_MAP, UNIFORM_TYPES_VALUES } from './types.mjs';\nimport { getDefaultUniformValue } from './utils/getDefaultUniformValue.mjs';\n\n\"use strict\";\nconst _UniformGroup = class _UniformGroup {\n /**\n * Create a new Uniform group\n * @param uniformStructures - The structures of the uniform group\n * @param options - The optional parameters of this uniform group\n */\n constructor(uniformStructures, options) {\n /** used internally to know if a uniform group was used in the last render pass */\n this._touched = 0;\n /** a unique id for this uniform group used through the renderer */\n this.uid = uid(\"uniform\");\n /** a resource type, used to identify how to handle it when its in a bind group / shader resource */\n this._resourceType = \"uniformGroup\";\n /** the resource id used internally by the renderer to build bind group keys */\n this._resourceId = uid(\"resource\");\n /** used ito identify if this is a uniform group */\n this.isUniformGroup = true;\n /**\n * used to flag if this Uniform groups data is different from what it has stored in its buffer / on the GPU\n * @internal\n * @ignore\n */\n this._dirtyId = 0;\n // implementing the interface - UniformGroup are not destroyed\n this.destroyed = false;\n options = { ..._UniformGroup.defaultOptions, ...options };\n this.uniformStructures = uniformStructures;\n const uniforms = {};\n for (const i in uniformStructures) {\n const uniformData = uniformStructures[i];\n uniformData.name = i;\n uniformData.size = uniformData.size ?? 1;\n if (!UNIFORM_TYPES_MAP[uniformData.type]) {\n throw new Error(`Uniform type ${uniformData.type} is not supported. Supported uniform types are: ${UNIFORM_TYPES_VALUES.join(\", \")}`);\n }\n uniformData.value ?? (uniformData.value = getDefaultUniformValue(uniformData.type, uniformData.size));\n uniforms[i] = uniformData.value;\n }\n this.uniforms = uniforms;\n this._dirtyId = 1;\n this.ubo = options.ubo;\n this.isStatic = options.isStatic;\n this._signature = createIdFromString(Object.keys(uniforms).map(\n (i) => `${i}-${uniformStructures[i].type}`\n ).join(\"-\"), \"uniform-group\");\n }\n /** Call this if you want the uniform groups data to be uploaded to the GPU only useful if `isStatic` is true. */\n update() {\n this._dirtyId++;\n }\n};\n/** The default options used by the uniform group. */\n_UniformGroup.defaultOptions = {\n /** if true the UniformGroup is handled as an Uniform buffer object. */\n ubo: false,\n /** if true, then you are responsible for when the data is uploaded to the GPU by calling `update()` */\n isStatic: false\n};\nlet UniformGroup = _UniformGroup;\n\nexport { UniformGroup };\n//# sourceMappingURL=UniformGroup.mjs.map\n","\"use strict\";\nclass BindGroup {\n /**\n * Create a new instance eof the Bind Group.\n * @param resources - The resources that are bound together for use by a shader.\n */\n constructor(resources) {\n /** The resources that are bound together for use by a shader. */\n this.resources = /* @__PURE__ */ Object.create(null);\n this._dirty = true;\n let index = 0;\n for (const i in resources) {\n const resource = resources[i];\n this.setResource(resource, index++);\n }\n this._updateKey();\n }\n /**\n * Updates the key if its flagged as dirty. This is used internally to\n * match this bind group to a WebGPU BindGroup.\n * @internal\n * @ignore\n */\n _updateKey() {\n if (!this._dirty)\n return;\n this._dirty = false;\n const keyParts = [];\n let index = 0;\n for (const i in this.resources) {\n keyParts[index++] = this.resources[i]._resourceId;\n }\n this._key = keyParts.join(\"|\");\n }\n /**\n * Set a resource at a given index. this function will\n * ensure that listeners will be removed from the current resource\n * and added to the new resource.\n * @param resource - The resource to set.\n * @param index - The index to set the resource at.\n */\n setResource(resource, index) {\n const currentResource = this.resources[index];\n if (resource === currentResource)\n return;\n if (currentResource) {\n resource.off?.(\"change\", this.onResourceChange, this);\n }\n resource.on?.(\"change\", this.onResourceChange, this);\n this.resources[index] = resource;\n this._dirty = true;\n }\n /**\n * Returns the resource at the current specified index.\n * @param index - The index of the resource to get.\n * @returns - The resource at the specified index.\n */\n getResource(index) {\n return this.resources[index];\n }\n /**\n * Used internally to 'touch' each resource, to ensure that the GC\n * knows that all resources in this bind group are still being used.\n * @param tick - The current tick.\n * @internal\n * @ignore\n */\n _touch(tick) {\n const resources = this.resources;\n for (const i in resources) {\n resources[i]._touched = tick;\n }\n }\n /** Destroys this bind group and removes all listeners. */\n destroy() {\n const resources = this.resources;\n for (const i in resources) {\n const resource = resources[i];\n resource.off?.(\"change\", this.onResourceChange, this);\n }\n this.resources = null;\n }\n onResourceChange(resource) {\n this._dirty = true;\n if (resource.destroyed) {\n const resources = this.resources;\n for (const i in resources) {\n if (resources[i] === resource) {\n resources[i] = null;\n }\n }\n } else {\n this._updateKey();\n }\n }\n}\n\nexport { BindGroup };\n//# sourceMappingURL=BindGroup.mjs.map\n","\"use strict\";\nvar RendererType = /* @__PURE__ */ ((RendererType2) => {\n RendererType2[RendererType2[\"WEBGL\"] = 1] = \"WEBGL\";\n RendererType2[RendererType2[\"WEBGPU\"] = 2] = \"WEBGPU\";\n RendererType2[RendererType2[\"BOTH\"] = 3] = \"BOTH\";\n return RendererType2;\n})(RendererType || {});\n\nexport { RendererType };\n//# sourceMappingURL=types.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { GlProgram } from '../../gl/shader/GlProgram.mjs';\nimport { BindGroup } from '../../gpu/shader/BindGroup.mjs';\nimport { GpuProgram } from '../../gpu/shader/GpuProgram.mjs';\nimport { RendererType } from '../../types.mjs';\nimport { UniformGroup } from './UniformGroup.mjs';\n\n\"use strict\";\nclass Shader extends EventEmitter {\n constructor(options) {\n super();\n /**\n * A record of the uniform groups and resources used by the shader.\n * This is used by WebGL renderer to sync uniform data.\n * @internal\n * @ignore\n */\n this._uniformBindMap = /* @__PURE__ */ Object.create(null);\n this._ownedBindGroups = [];\n let {\n gpuProgram,\n glProgram,\n groups,\n resources,\n compatibleRenderers,\n groupMap\n } = options;\n this.gpuProgram = gpuProgram;\n this.glProgram = glProgram;\n if (compatibleRenderers === void 0) {\n compatibleRenderers = 0;\n if (gpuProgram)\n compatibleRenderers |= RendererType.WEBGPU;\n if (glProgram)\n compatibleRenderers |= RendererType.WEBGL;\n }\n this.compatibleRenderers = compatibleRenderers;\n const nameHash = {};\n if (!resources && !groups) {\n resources = {};\n }\n if (resources && groups) {\n throw new Error(\"[Shader] Cannot have both resources and groups\");\n } else if (!gpuProgram && groups && !groupMap) {\n throw new Error(\"[Shader] No group map or WebGPU shader provided - consider using resources instead.\");\n } else if (!gpuProgram && groups && groupMap) {\n for (const i in groupMap) {\n for (const j in groupMap[i]) {\n const uniformName = groupMap[i][j];\n nameHash[uniformName] = {\n group: i,\n binding: j,\n name: uniformName\n };\n }\n }\n } else if (gpuProgram && groups && !groupMap) {\n const groupData = gpuProgram.structsAndGroups.groups;\n groupMap = {};\n groupData.forEach((data) => {\n groupMap[data.group] = groupMap[data.group] || {};\n groupMap[data.group][data.binding] = data.name;\n nameHash[data.name] = data;\n });\n } else if (resources) {\n groups = {};\n groupMap = {};\n if (gpuProgram) {\n const groupData = gpuProgram.structsAndGroups.groups;\n groupData.forEach((data) => {\n groupMap[data.group] = groupMap[data.group] || {};\n groupMap[data.group][data.binding] = data.name;\n nameHash[data.name] = data;\n });\n }\n let bindTick = 0;\n for (const i in resources) {\n if (nameHash[i])\n continue;\n if (!groups[99]) {\n groups[99] = new BindGroup();\n this._ownedBindGroups.push(groups[99]);\n }\n nameHash[i] = { group: 99, binding: bindTick, name: i };\n groupMap[99] = groupMap[99] || {};\n groupMap[99][bindTick] = i;\n bindTick++;\n }\n for (const i in resources) {\n const name = i;\n let value = resources[i];\n if (!value.source && !value._resourceType) {\n value = new UniformGroup(value);\n }\n const data = nameHash[name];\n if (data) {\n if (!groups[data.group]) {\n groups[data.group] = new BindGroup();\n this._ownedBindGroups.push(groups[data.group]);\n }\n groups[data.group].setResource(value, data.binding);\n }\n }\n }\n this.groups = groups;\n this._uniformBindMap = groupMap;\n this.resources = this._buildResourceAccessor(groups, nameHash);\n }\n /**\n * Sometimes a resource group will be provided later (for example global uniforms)\n * In such cases, this method can be used to let the shader know about the group.\n * @param name - the name of the resource group\n * @param groupIndex - the index of the group (should match the webGPU shader group location)\n * @param bindIndex - the index of the bind point (should match the webGPU shader bind point)\n */\n addResource(name, groupIndex, bindIndex) {\n var _a, _b;\n (_a = this._uniformBindMap)[groupIndex] || (_a[groupIndex] = {});\n (_b = this._uniformBindMap[groupIndex])[bindIndex] || (_b[bindIndex] = name);\n if (!this.groups[groupIndex]) {\n this.groups[groupIndex] = new BindGroup();\n this._ownedBindGroups.push(this.groups[groupIndex]);\n }\n }\n _buildResourceAccessor(groups, nameHash) {\n const uniformsOut = {};\n for (const i in nameHash) {\n const data = nameHash[i];\n Object.defineProperty(uniformsOut, data.name, {\n get() {\n return groups[data.group].getResource(data.binding);\n },\n set(value) {\n groups[data.group].setResource(value, data.binding);\n }\n });\n }\n return uniformsOut;\n }\n /**\n * Use to destroy the shader when its not longer needed.\n * It will destroy the resources and remove listeners.\n * @param destroyPrograms - if the programs should be destroyed as well.\n * Make sure its not being used by other shaders!\n */\n destroy(destroyPrograms = false) {\n this.emit(\"destroy\", this);\n if (destroyPrograms) {\n this.gpuProgram?.destroy();\n this.glProgram?.destroy();\n }\n this.gpuProgram = null;\n this.glProgram = null;\n this.removeAllListeners();\n this._uniformBindMap = null;\n this._ownedBindGroups.forEach((bindGroup) => {\n bindGroup.destroy();\n });\n this._ownedBindGroups = null;\n this.resources = null;\n this.groups = null;\n }\n static from(options) {\n const { gpu, gl, ...rest } = options;\n let gpuProgram;\n let glProgram;\n if (gpu) {\n gpuProgram = GpuProgram.from(gpu);\n }\n if (gl) {\n glProgram = GlProgram.from(gl);\n }\n return new Shader({\n gpuProgram,\n glProgram,\n ...rest\n });\n }\n}\n\nexport { Shader };\n//# sourceMappingURL=Shader.mjs.map\n","\"use strict\";\nconst blendModeIds = {\n normal: 0,\n add: 1,\n multiply: 2,\n screen: 3,\n overlay: 4,\n erase: 5,\n \"normal-npm\": 6,\n \"add-npm\": 7,\n \"screen-npm\": 8\n};\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\nconst _State = class _State {\n constructor() {\n this.data = 0;\n this.blendMode = \"normal\";\n this.polygonOffset = 0;\n this.blend = true;\n this.depthMask = true;\n }\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend() {\n return !!(this.data & 1 << BLEND);\n }\n set blend(value) {\n if (!!(this.data & 1 << BLEND) !== value) {\n this.data ^= 1 << BLEND;\n }\n }\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets() {\n return !!(this.data & 1 << OFFSET);\n }\n set offsets(value) {\n if (!!(this.data & 1 << OFFSET) !== value) {\n this.data ^= 1 << OFFSET;\n }\n }\n /** The culling settings for this state none - No culling back - Back face culling front - Front face culling */\n set cullMode(value) {\n if (value === \"none\") {\n this.culling = false;\n return;\n }\n this.culling = true;\n this.clockwiseFrontFace = value === \"front\";\n }\n get cullMode() {\n if (!this.culling) {\n return \"none\";\n }\n return this.clockwiseFrontFace ? \"front\" : \"back\";\n }\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling() {\n return !!(this.data & 1 << CULLING);\n }\n set culling(value) {\n if (!!(this.data & 1 << CULLING) !== value) {\n this.data ^= 1 << CULLING;\n }\n }\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest() {\n return !!(this.data & 1 << DEPTH_TEST);\n }\n set depthTest(value) {\n if (!!(this.data & 1 << DEPTH_TEST) !== value) {\n this.data ^= 1 << DEPTH_TEST;\n }\n }\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask() {\n return !!(this.data & 1 << DEPTH_MASK);\n }\n set depthMask(value) {\n if (!!(this.data & 1 << DEPTH_MASK) !== value) {\n this.data ^= 1 << DEPTH_MASK;\n }\n }\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace() {\n return !!(this.data & 1 << WINDING);\n }\n set clockwiseFrontFace(value) {\n if (!!(this.data & 1 << WINDING) !== value) {\n this.data ^= 1 << WINDING;\n }\n }\n /**\n * The blend mode to be applied when this state is set. Apply a value of `normal` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default 'normal'\n */\n get blendMode() {\n return this._blendMode;\n }\n set blendMode(value) {\n this.blend = value !== \"none\";\n this._blendMode = value;\n this._blendModeId = blendModeIds[value] || 0;\n }\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset() {\n return this._polygonOffset;\n }\n set polygonOffset(value) {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n toString() {\n return `[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`;\n }\n /**\n * A quickly getting an instance of a State that is configured for 2d rendering.\n * @returns a new State with values set for 2d rendering\n */\n static for2d() {\n const state = new _State();\n state.depthTest = false;\n state.blend = true;\n return state;\n }\n};\n_State.default2d = _State.for2d();\nlet State = _State;\n\nexport { State };\n//# sourceMappingURL=State.mjs.map\n","import { GlProgram } from '../rendering/renderers/gl/shader/GlProgram.mjs';\nimport { GpuProgram } from '../rendering/renderers/gpu/shader/GpuProgram.mjs';\nimport { Shader } from '../rendering/renderers/shared/shader/Shader.mjs';\nimport { State } from '../rendering/renderers/shared/state/State.mjs';\n\n\"use strict\";\nconst _Filter = class _Filter extends Shader {\n /**\n * @param options - The optional parameters of this filter.\n */\n constructor(options) {\n options = { ..._Filter.defaultOptions, ...options };\n super(options);\n /** If enabled is true the filter is applied, if false it will not. */\n this.enabled = true;\n /**\n * The gpu state the filter requires to render.\n * @internal\n * @ignore\n */\n this._state = State.for2d();\n this.blendMode = options.blendMode;\n this.padding = options.padding;\n if (typeof options.antialias === \"boolean\") {\n this.antialias = options.antialias ? \"on\" : \"off\";\n } else {\n this.antialias = options.antialias;\n }\n this.resolution = options.resolution;\n this.blendRequired = options.blendRequired;\n this.addResource(\"uTexture\", 0, 1);\n }\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n apply(filterManager, input, output, clearMode) {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n /**\n * Get the blend mode of the filter.\n * @default \"normal\"\n */\n get blendMode() {\n return this._state.blendMode;\n }\n /** Sets the blend mode of the filter. */\n set blendMode(value) {\n this._state.blendMode = value;\n }\n /**\n * A short hand function to create a filter based of a vertex and fragment shader src.\n * @param options\n * @returns A shiny new PixiJS filter!\n */\n static from(options) {\n const { gpu, gl, ...rest } = options;\n let gpuProgram;\n let glProgram;\n if (gpu) {\n gpuProgram = GpuProgram.from(gpu);\n }\n if (gl) {\n glProgram = GlProgram.from(gl);\n }\n return new _Filter({\n gpuProgram,\n glProgram,\n ...rest\n });\n }\n};\n/**\n * The default filter settings\n * @static\n */\n_Filter.defaultOptions = {\n blendMode: \"normal\",\n resolution: 1,\n padding: 0,\n antialias: \"off\",\n blendRequired: false\n};\nlet Filter = _Filter;\n\nexport { Filter };\n//# sourceMappingURL=Filter.mjs.map\n","import { extensions, ExtensionType } from '../extensions/Extensions.mjs';\n\n\"use strict\";\nconst environments = [];\nextensions.handleByNamedList(ExtensionType.Environment, environments);\nasync function loadEnvironmentExtensions(skip) {\n if (skip)\n return;\n for (let i = 0; i < environments.length; i++) {\n const env = environments[i];\n if (env.value.test()) {\n await env.value.load();\n return;\n }\n }\n}\nasync function autoDetectEnvironment(add) {\n return loadEnvironmentExtensions(!add);\n}\n\nexport { autoDetectEnvironment, loadEnvironmentExtensions };\n//# sourceMappingURL=autoDetectEnvironment.mjs.map\n","\"use strict\";\nlet unsafeEval;\nfunction unsafeEvalSupported() {\n if (typeof unsafeEval === \"boolean\") {\n return unsafeEval;\n }\n try {\n const func = new Function(\"param1\", \"param2\", \"param3\", \"return param1[param2] === param3;\");\n unsafeEval = func({ a: \"b\" }, \"a\", \"b\") === true;\n } catch (e) {\n unsafeEval = false;\n }\n return unsafeEval;\n}\n\nexport { unsafeEvalSupported };\n//# sourceMappingURL=unsafeEvalSupported.mjs.map\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = 0;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","\"use strict\";\nvar CLEAR = /* @__PURE__ */ ((CLEAR2) => {\n CLEAR2[CLEAR2[\"NONE\"] = 0] = \"NONE\";\n CLEAR2[CLEAR2[\"COLOR\"] = 16384] = \"COLOR\";\n CLEAR2[CLEAR2[\"STENCIL\"] = 1024] = \"STENCIL\";\n CLEAR2[CLEAR2[\"DEPTH\"] = 256] = \"DEPTH\";\n CLEAR2[CLEAR2[\"COLOR_DEPTH\"] = 16640] = \"COLOR_DEPTH\";\n CLEAR2[CLEAR2[\"COLOR_STENCIL\"] = 17408] = \"COLOR_STENCIL\";\n CLEAR2[CLEAR2[\"DEPTH_STENCIL\"] = 1280] = \"DEPTH_STENCIL\";\n CLEAR2[CLEAR2[\"ALL\"] = 17664] = \"ALL\";\n return CLEAR2;\n})(CLEAR || {});\n\nexport { CLEAR };\n//# sourceMappingURL=const.mjs.map\n","\"use strict\";\nclass SystemRunner {\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name) {\n this.items = [];\n this._name = name;\n }\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n emit(a0, a1, a2, a3, a4, a5, a6, a7) {\n const { name, items } = this;\n for (let i = 0, len = items.length; i < len; i++) {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n return this;\n }\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from 'pixi.js';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n add(item) {\n if (item[this._name]) {\n this.remove(item);\n this.items.push(item);\n }\n return this;\n }\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n remove(item) {\n const index = this.items.indexOf(item);\n if (index !== -1) {\n this.items.splice(index, 1);\n }\n return this;\n }\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n contains(item) {\n return this.items.indexOf(item) !== -1;\n }\n /** Remove all listeners from the Runner */\n removeAll() {\n this.items.length = 0;\n return this;\n }\n /** Remove all references, don't use after this. */\n destroy() {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n get empty() {\n return this.items.length === 0;\n }\n /**\n * The name of the runner.\n * @readonly\n */\n get name() {\n return this._name;\n }\n}\n\nexport { SystemRunner };\n//# sourceMappingURL=SystemRunner.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { loadEnvironmentExtensions } from '../../../../environment/autoDetectEnvironment.mjs';\nimport { Container } from '../../../../scene/container/Container.mjs';\nimport { unsafeEvalSupported } from '../../../../utils/browser/unsafeEvalSupported.mjs';\nimport { deprecation, v8_0_0 } from '../../../../utils/logging/deprecation.mjs';\nimport '../../../../utils/utils.mjs';\nimport { CLEAR } from '../../gl/const.mjs';\nimport { SystemRunner } from './SystemRunner.mjs';\nimport EventEmitter from 'eventemitter3';\n\n\"use strict\";\nconst defaultRunners = [\n \"init\",\n \"destroy\",\n \"contextChange\",\n \"resolutionChange\",\n \"reset\",\n \"renderEnd\",\n \"renderStart\",\n \"render\",\n \"update\",\n \"postrender\",\n \"prerender\"\n];\nconst _AbstractRenderer = class _AbstractRenderer extends EventEmitter {\n /**\n * Set up a system with a collection of SystemClasses and runners.\n * Systems are attached dynamically to this class when added.\n * @param config - the config for the system manager\n */\n constructor(config) {\n super();\n this.runners = /* @__PURE__ */ Object.create(null);\n this.renderPipes = /* @__PURE__ */ Object.create(null);\n this._initOptions = {};\n this._systemsHash = /* @__PURE__ */ Object.create(null);\n this.type = config.type;\n this.name = config.name;\n this.config = config;\n const combinedRunners = [...defaultRunners, ...this.config.runners ?? []];\n this._addRunners(...combinedRunners);\n this._unsafeEvalCheck();\n }\n /**\n * Initialize the renderer.\n * @param options - The options to use to create the renderer.\n */\n async init(options = {}) {\n const skip = options.skipExtensionImports === true ? true : options.manageImports === false;\n await loadEnvironmentExtensions(skip);\n this._addSystems(this.config.systems);\n this._addPipes(this.config.renderPipes, this.config.renderPipeAdaptors);\n for (const systemName in this._systemsHash) {\n const system = this._systemsHash[systemName];\n const defaultSystemOptions = system.constructor.defaultOptions;\n options = { ...defaultSystemOptions, ...options };\n }\n options = { ..._AbstractRenderer.defaultOptions, ...options };\n this._roundPixels = options.roundPixels ? 1 : 0;\n for (let i = 0; i < this.runners.init.items.length; i++) {\n await this.runners.init.items[i].init(options);\n }\n this._initOptions = options;\n }\n render(args, deprecated) {\n let options = args;\n if (options instanceof Container) {\n options = { container: options };\n if (deprecated) {\n deprecation(v8_0_0, \"passing a second argument is deprecated, please use render options instead\");\n options.target = deprecated.renderTexture;\n }\n }\n options.target || (options.target = this.view.renderTarget);\n if (options.target === this.view.renderTarget) {\n this._lastObjectRendered = options.container;\n options.clearColor = this.background.colorRgba;\n }\n if (options.clearColor) {\n const isRGBAArray = Array.isArray(options.clearColor) && options.clearColor.length === 4;\n options.clearColor = isRGBAArray ? options.clearColor : Color.shared.setValue(options.clearColor).toArray();\n }\n if (!options.transform) {\n options.container.updateLocalTransform();\n options.transform = options.container.localTransform;\n }\n this.runners.prerender.emit(options);\n this.runners.renderStart.emit(options);\n this.runners.render.emit(options);\n this.runners.renderEnd.emit(options);\n this.runners.postrender.emit(options);\n }\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n * @param resolution - The resolution / device pixel ratio of the renderer.\n */\n resize(desiredScreenWidth, desiredScreenHeight, resolution) {\n this.view.resize(desiredScreenWidth, desiredScreenHeight, resolution);\n this.emit(\"resize\", this.view.screen.width, this.view.screen.height);\n }\n clear(options = {}) {\n const renderer = this;\n options.target || (options.target = renderer.renderTarget.renderTarget);\n options.clearColor || (options.clearColor = this.background.colorRgba);\n options.clear ?? (options.clear = CLEAR.ALL);\n const { clear, clearColor, target } = options;\n Color.shared.setValue(clearColor ?? this.background.colorRgba);\n renderer.renderTarget.clear(target, clear, Color.shared.toArray());\n }\n /** The resolution / device pixel ratio of the renderer. */\n get resolution() {\n return this.view.resolution;\n }\n set resolution(value) {\n this.view.resolution = value;\n this.runners.resolutionChange.emit(value);\n }\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width() {\n return this.view.texture.frame.width;\n }\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @default 600\n */\n get height() {\n return this.view.texture.frame.height;\n }\n // NOTE: this was `view` in v7\n /**\n * The canvas element that everything is drawn to.\n * @type {environment.ICanvas}\n */\n get canvas() {\n return this.view.canvas;\n }\n /**\n * the last object rendered by the renderer. Useful for other plugins like interaction managers\n * @readonly\n */\n get lastObjectRendered() {\n return this._lastObjectRendered;\n }\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n get renderingToScreen() {\n const renderer = this;\n return renderer.renderTarget.renderingToScreen;\n }\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n */\n get screen() {\n return this.view.screen;\n }\n /**\n * Create a bunch of runners based of a collection of ids\n * @param runnerIds - the runner ids to add\n */\n _addRunners(...runnerIds) {\n runnerIds.forEach((runnerId) => {\n this.runners[runnerId] = new SystemRunner(runnerId);\n });\n }\n _addSystems(systems) {\n let i;\n for (i in systems) {\n const val = systems[i];\n this._addSystem(val.value, val.name);\n }\n }\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n _addSystem(ClassRef, name) {\n const system = new ClassRef(this);\n if (this[name]) {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n this[name] = system;\n this._systemsHash[name] = system;\n for (const i in this.runners) {\n this.runners[i].add(system);\n }\n return this;\n }\n _addPipes(pipes, pipeAdaptors) {\n const adaptors = pipeAdaptors.reduce((acc, adaptor) => {\n acc[adaptor.name] = adaptor.value;\n return acc;\n }, {});\n pipes.forEach((pipe) => {\n const PipeClass = pipe.value;\n const name = pipe.name;\n const Adaptor = adaptors[name];\n this.renderPipes[name] = new PipeClass(\n this,\n Adaptor ? new Adaptor() : null\n );\n });\n }\n destroy(options = false) {\n this.runners.destroy.items.reverse();\n this.runners.destroy.emit(options);\n Object.values(this.runners).forEach((runner) => {\n runner.destroy();\n });\n this._systemsHash = null;\n this.renderPipes = null;\n }\n /**\n * Generate a texture from a container.\n * @param options - options or container target to use when generating the texture\n * @returns a texture\n */\n generateTexture(options) {\n return this.textureGenerator.generateTexture(options);\n }\n /**\n * Whether the renderer will round coordinates to whole pixels when rendering.\n * Can be overridden on a per scene item basis.\n */\n get roundPixels() {\n return !!this._roundPixels;\n }\n /**\n * Overridable function by `pixi.js/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n * @ignore\n */\n _unsafeEvalCheck() {\n if (!unsafeEvalSupported()) {\n throw new Error(\"Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.\");\n }\n }\n};\n/** The default options for the renderer. */\n_AbstractRenderer.defaultOptions = {\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @default 1\n */\n resolution: 1,\n /**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported`\n * function. If set to true, a WebGL renderer can fail to be created if the browser thinks there could be\n * performance issues when using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many\n * scenarios as possible. However, some users may have a poor experience, for example, if a user has a gpu or\n * driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the utils package) in your code before attempting to create a\n * PixiJS renderer, and show an error message to the user if the function returns false, explaining that their\n * device & browser combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @default false\n */\n failIfMajorPerformanceCaveat: false,\n /**\n * Should round pixels be forced when rendering?\n * @default false\n */\n roundPixels: false\n};\nlet AbstractRenderer = _AbstractRenderer;\n\nexport { AbstractRenderer };\n//# sourceMappingURL=AbstractRenderer.mjs.map\n","import { DOMAdapter } from '../../environment/adapter.mjs';\nimport { AbstractRenderer } from '../../rendering/renderers/shared/system/AbstractRenderer.mjs';\n\n\"use strict\";\nlet _isWebGLSupported;\nfunction isWebGLSupported(failIfMajorPerformanceCaveat) {\n if (_isWebGLSupported !== void 0)\n return _isWebGLSupported;\n _isWebGLSupported = (() => {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat ?? AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat\n };\n try {\n if (!DOMAdapter.get().getWebGLRenderingContext()) {\n return false;\n }\n const canvas = DOMAdapter.get().createCanvas();\n let gl = canvas.getContext(\"webgl\", contextOptions);\n const success = !!gl?.getContextAttributes()?.stencil;\n if (gl) {\n const loseContext = gl.getExtension(\"WEBGL_lose_context\");\n if (loseContext) {\n loseContext.loseContext();\n }\n }\n gl = null;\n return success;\n } catch (e) {\n return false;\n }\n })();\n return _isWebGLSupported;\n}\n\nexport { isWebGLSupported };\n//# sourceMappingURL=isWebGLSupported.mjs.map\n","import { DOMAdapter } from '../../environment/adapter.mjs';\n\n\"use strict\";\nlet _isWebGPUSupported;\nasync function isWebGPUSupported(options = {}) {\n if (_isWebGPUSupported !== void 0)\n return _isWebGPUSupported;\n _isWebGPUSupported = await (async () => {\n const gpu = DOMAdapter.get().getNavigator().gpu;\n if (!gpu) {\n return false;\n }\n try {\n const adapter = await navigator.gpu.requestAdapter(options);\n await adapter.requestDevice();\n return true;\n } catch (e) {\n return false;\n }\n })();\n return _isWebGPUSupported;\n}\n\nexport { isWebGPUSupported };\n//# sourceMappingURL=isWebGPUSupported.mjs.map\n","import { isWebGLSupported } from '../../utils/browser/isWebGLSupported.mjs';\nimport { isWebGPUSupported } from '../../utils/browser/isWebGPUSupported.mjs';\nimport { AbstractRenderer } from './shared/system/AbstractRenderer.mjs';\n\n\"use strict\";\nconst renderPriority = [\"webgl\", \"webgpu\", \"canvas\"];\nasync function autoDetectRenderer(options) {\n let preferredOrder = [];\n if (options.preference) {\n preferredOrder.push(options.preference);\n renderPriority.forEach((item) => {\n if (item !== options.preference) {\n preferredOrder.push(item);\n }\n });\n } else {\n preferredOrder = renderPriority.slice();\n }\n let RendererClass;\n let finalOptions = {};\n for (let i = 0; i < preferredOrder.length; i++) {\n const rendererType = preferredOrder[i];\n if (rendererType === \"webgpu\" && await isWebGPUSupported()) {\n const { WebGPURenderer } = await import('./gpu/WebGPURenderer.mjs');\n RendererClass = WebGPURenderer;\n finalOptions = { ...options, ...options.webgpu };\n break;\n } else if (rendererType === \"webgl\" && isWebGLSupported(\n options.failIfMajorPerformanceCaveat ?? AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat\n )) {\n const { WebGLRenderer } = await import('./gl/WebGLRenderer.mjs');\n RendererClass = WebGLRenderer;\n finalOptions = { ...options, ...options.webgl };\n break;\n } else if (rendererType === \"canvas\") {\n finalOptions = { ...options };\n throw new Error(\"CanvasRenderer is not yet implemented\");\n }\n }\n delete finalOptions.webgpu;\n delete finalOptions.webgl;\n if (!RendererClass) {\n throw new Error(\"No available renderer for the current environment\");\n }\n const renderer = new RendererClass();\n await renderer.init(finalOptions);\n return renderer;\n}\n\nexport { autoDetectRenderer };\n//# sourceMappingURL=autoDetectRenderer.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass ApplicationInitHook {\n static init() {\n globalThis.__PIXI_APP_INIT__?.(this);\n }\n static destroy() {\n }\n}\n/** @ignore */\nApplicationInitHook.extension = ExtensionType.Application;\nclass RendererInitHook {\n constructor(renderer) {\n this._renderer = renderer;\n }\n init() {\n globalThis.__PIXI_RENDERER_INIT__?.(this._renderer);\n }\n destroy() {\n this._renderer = null;\n }\n}\n/** @ignore */\nRendererInitHook.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem\n ],\n name: \"initHook\",\n priority: -10\n};\n\nexport { ApplicationInitHook, RendererInitHook };\n//# sourceMappingURL=globalHooks.mjs.map\n","import { extensions, ExtensionType } from '../extensions/Extensions.mjs';\nimport { autoDetectRenderer } from '../rendering/renderers/autoDetectRenderer.mjs';\nimport { Container } from '../scene/container/Container.mjs';\nimport { ApplicationInitHook } from '../utils/global/globalHooks.mjs';\nimport { deprecation, v8_0_0 } from '../utils/logging/deprecation.mjs';\n\n\"use strict\";\nconst _Application = class _Application {\n /** @ignore */\n constructor(...args) {\n /** The root display container that's rendered. */\n this.stage = new Container();\n if (args[0] !== void 0) {\n deprecation(v8_0_0, \"Application constructor options are deprecated, please use Application.init() instead.\");\n }\n }\n /**\n * @param options - The optional application and renderer parameters.\n */\n async init(options) {\n options = { ...options };\n this.renderer = await autoDetectRenderer(options);\n _Application._plugins.forEach((plugin) => {\n plugin.init.call(this, options);\n });\n }\n /** Render the current stage. */\n render() {\n this.renderer.render({ container: this.stage });\n }\n /**\n * Reference to the renderer's canvas element.\n * @readonly\n * @member {HTMLCanvasElement}\n */\n get canvas() {\n return this.renderer.canvas;\n }\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @deprecated since 8.0.0\n */\n get view() {\n deprecation(v8_0_0, \"Application.view is deprecated, please use Application.canvas instead.\");\n return this.renderer.canvas;\n }\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @readonly\n */\n get screen() {\n return this.renderer.screen;\n }\n /**\n * Destroys the application and all of its resources.\n * @param {object|boolean}[rendererDestroyOptions=false] - The options for destroying the renderer.\n * @param {boolean}[rendererDestroyOptions.removeView=false] - Removes the Canvas element from the DOM.\n * @param {object|boolean} [options=false] - The options for destroying the stage.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy method\n * called as well. `options` will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites.\n * If options.children is set to true,\n * it should destroy the texture of the child sprite.\n * @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.\n * If options.children is set to true,\n * it should destroy the texture source of the child sprite.\n * @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.\n * If options.children is set to true,\n * it should destroy the context of the child graphics.\n */\n destroy(rendererDestroyOptions = false, options = false) {\n const plugins = _Application._plugins.slice(0);\n plugins.reverse();\n plugins.forEach((plugin) => {\n plugin.destroy.call(this);\n });\n this.stage.destroy(options);\n this.stage = null;\n this.renderer.destroy(rendererDestroyOptions);\n this.renderer = null;\n }\n};\n/**\n * Collection of installed plugins.\n * @alias _plugins\n */\n_Application._plugins = [];\nlet Application = _Application;\nextensions.handleByList(ExtensionType.Application, Application._plugins);\nextensions.add(ApplicationInitHook);\n\nexport { Application };\n//# sourceMappingURL=Application.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\n\n\"use strict\";\nclass ResizePlugin {\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options) {\n Object.defineProperty(\n this,\n \"resizeTo\",\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @member {Window|HTMLElement}\n * @name resizeTo\n * @memberof app.Application#\n */\n {\n set(dom) {\n globalThis.removeEventListener(\"resize\", this.queueResize);\n this._resizeTo = dom;\n if (dom) {\n globalThis.addEventListener(\"resize\", this.queueResize);\n this.resize();\n }\n },\n get() {\n return this._resizeTo;\n }\n }\n );\n this.queueResize = () => {\n if (!this._resizeTo) {\n return;\n }\n this._cancelResize();\n this._resizeId = requestAnimationFrame(() => this.resize());\n };\n this._cancelResize = () => {\n if (this._resizeId) {\n cancelAnimationFrame(this._resizeId);\n this._resizeId = null;\n }\n };\n this.resize = () => {\n if (!this._resizeTo) {\n return;\n }\n this._cancelResize();\n let width;\n let height;\n if (this._resizeTo === globalThis.window) {\n width = globalThis.innerWidth;\n height = globalThis.innerHeight;\n } else {\n const { clientWidth, clientHeight } = this._resizeTo;\n width = clientWidth;\n height = clientHeight;\n }\n this.renderer.resize(width, height);\n this.render();\n };\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n }\n /**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\n static destroy() {\n globalThis.removeEventListener(\"resize\", this.queueResize);\n this._cancelResize();\n this._cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n }\n}\n/** @ignore */\nResizePlugin.extension = ExtensionType.Application;\n\nexport { ResizePlugin };\n//# sourceMappingURL=ResizePlugin.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\nimport { UPDATE_PRIORITY } from '../ticker/const.mjs';\nimport { Ticker } from '../ticker/Ticker.mjs';\n\n\"use strict\";\nclass TickerPlugin {\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options) {\n options = Object.assign({\n autoStart: true,\n sharedTicker: false\n }, options);\n Object.defineProperty(\n this,\n \"ticker\",\n {\n set(ticker) {\n if (this._ticker) {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker) {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get() {\n return this._ticker;\n }\n }\n );\n this.stop = () => {\n this._ticker.stop();\n };\n this.start = () => {\n this._ticker.start();\n };\n this._ticker = null;\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n if (options.autoStart) {\n this.start();\n }\n }\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy() {\n if (this._ticker) {\n const oldTicker = this._ticker;\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n/** @ignore */\nTickerPlugin.extension = ExtensionType.Application;\n\nexport { TickerPlugin };\n//# sourceMappingURL=TickerPlugin.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\n\n\"use strict\";\nclass AbstractBitmapFont extends EventEmitter {\n constructor() {\n super(...arguments);\n /** The map of characters by character code. */\n this.chars = /* @__PURE__ */ Object.create(null);\n /**\n * The line-height of the font face in pixels.\n * @type {number}\n */\n this.lineHeight = 0;\n /**\n * The name of the font face\n * @type {string}\n */\n this.fontFamily = \"\";\n /** The metrics of the font face. */\n this.fontMetrics = { fontSize: 0, ascent: 0, descent: 0 };\n /**\n * The offset of the font face from the baseline.\n * @type {number}\n */\n this.baseLineOffset = 0;\n /** The range and type of the distance field for this font. */\n this.distanceField = { type: \"none\", range: 0 };\n /** The map of base page textures (i.e., sheets of glyphs). */\n this.pages = [];\n /** should the fill for this font be applied as a tint to the text. */\n this.applyFillAsTint = true;\n /** The size of the font face in pixels. */\n this.baseMeasurementFontSize = 100;\n this.baseRenderedFontSize = 100;\n }\n /**\n * The name of the font face.\n * @deprecated since 8.0.0 Use `fontFamily` instead.\n */\n get font() {\n deprecation(v8_0_0, \"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead.\");\n return this.fontFamily;\n }\n /**\n * The map of base page textures (i.e., sheets of glyphs).\n * @deprecated since 8.0.0 Use `pages` instead.\n */\n get pageTextures() {\n deprecation(v8_0_0, \"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead.\");\n return this.pages;\n }\n /**\n * The size of the font face in pixels.\n * @deprecated since 8.0.0 Use `fontMetrics.fontSize` instead.\n */\n get size() {\n deprecation(v8_0_0, \"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead.\");\n return this.fontMetrics.fontSize;\n }\n /**\n * The kind of distance field for this font or \"none\".\n * @deprecated since 8.0.0 Use `distanceField.type` instead.\n */\n get distanceFieldRange() {\n deprecation(v8_0_0, \"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead.\");\n return this.distanceField.range;\n }\n /**\n * The range of the distance field in pixels.\n * @deprecated since 8.0.0 Use `distanceField.range` instead.\n */\n get distanceFieldType() {\n deprecation(v8_0_0, \"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead.\");\n return this.distanceField.type;\n }\n destroy(destroyTextures = false) {\n this.emit(\"destroy\", this);\n this.removeAllListeners();\n for (const i in this.chars) {\n this.chars[i].texture?.destroy();\n }\n this.chars = null;\n if (destroyTextures) {\n this.pages.forEach((page) => page.texture.destroy(true));\n this.pages = null;\n }\n }\n}\n\nexport { AbstractBitmapFont };\n//# sourceMappingURL=AbstractBitmapFont.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { ImageSource } from '../../../../rendering/renderers/shared/texture/sources/ImageSource.mjs';\nimport { Texture } from '../../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { uid } from '../../../../utils/data/uid.mjs';\n\n\"use strict\";\nconst _FillGradient = class _FillGradient {\n constructor(x0, y0, x1, y1) {\n /** unique id for this fill gradient */\n this.uid = uid(\"fillGradient\");\n this.type = \"linear\";\n this.gradientStops = [];\n this._styleKey = null;\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n }\n addColorStop(offset, color) {\n this.gradientStops.push({ offset, color: Color.shared.setValue(color).toHexa() });\n this._styleKey = null;\n return this;\n }\n // TODO move to the system!\n buildLinearGradient() {\n const defaultSize = _FillGradient.defaultTextureSize;\n const { gradientStops } = this;\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = defaultSize;\n canvas.height = defaultSize;\n const ctx = canvas.getContext(\"2d\");\n const gradient = ctx.createLinearGradient(0, 0, _FillGradient.defaultTextureSize, 1);\n for (let i = 0; i < gradientStops.length; i++) {\n const stop = gradientStops[i];\n gradient.addColorStop(stop.offset, stop.color);\n }\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, defaultSize, defaultSize);\n this.texture = new Texture({\n source: new ImageSource({\n resource: canvas,\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"repeat\"\n })\n });\n const { x0, y0, x1, y1 } = this;\n const m = new Matrix();\n const dx = x1 - x0;\n const dy = y1 - y0;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const angle = Math.atan2(dy, dx);\n m.translate(-x0, -y0);\n m.scale(1 / defaultSize, 1 / defaultSize);\n m.rotate(-angle);\n m.scale(256 / dist, 1);\n this.transform = m;\n this._styleKey = null;\n }\n get styleKey() {\n if (this._styleKey) {\n return this._styleKey;\n }\n const stops = this.gradientStops.map((stop) => `${stop.offset}-${stop.color}`).join(\"-\");\n const texture = this.texture.uid;\n const transform = this.transform.toArray().join(\"-\");\n return `fill-gradient-${this.uid}-${stops}-${texture}-${transform}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`;\n }\n};\n_FillGradient.defaultTextureSize = 256;\nlet FillGradient = _FillGradient;\n\nexport { FillGradient };\n//# sourceMappingURL=FillGradient.mjs.map\n","import { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { uid } from '../../../../utils/data/uid.mjs';\n\n\"use strict\";\nconst repetitionMap = {\n repeat: {\n addressModeU: \"repeat\",\n addressModeV: \"repeat\"\n },\n \"repeat-x\": {\n addressModeU: \"repeat\",\n addressModeV: \"clamp-to-edge\"\n },\n \"repeat-y\": {\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"repeat\"\n },\n \"no-repeat\": {\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\"\n }\n};\nclass FillPattern {\n constructor(texture, repetition) {\n /** unique id for this fill pattern */\n this.uid = uid(\"fillPattern\");\n this.transform = new Matrix();\n this._styleKey = null;\n this.texture = texture;\n this.transform.scale(\n 1 / texture.frame.width,\n 1 / texture.frame.height\n );\n if (repetition) {\n texture.source.style.addressModeU = repetitionMap[repetition].addressModeU;\n texture.source.style.addressModeV = repetitionMap[repetition].addressModeV;\n }\n }\n setTransform(transform) {\n const texture = this.texture;\n this.transform.copyFrom(transform);\n this.transform.invert();\n this.transform.scale(\n 1 / texture.frame.width,\n 1 / texture.frame.height\n );\n this._styleKey = null;\n }\n get styleKey() {\n if (this._styleKey)\n return this._styleKey;\n this._styleKey = `fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join(\"-\")}`;\n return this._styleKey;\n }\n}\n\nexport { FillPattern };\n//# sourceMappingURL=FillPattern.mjs.map\n","\nmodule.exports = parse\n\n/**\n * expected argument lengths\n * @type {Object}\n */\n\nvar length = {a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0}\n\n/**\n * segment pattern\n * @type {RegExp}\n */\n\nvar segment = /([astvzqmhlc])([^astvzqmhlc]*)/ig\n\n/**\n * parse an svg path data string. Generates an Array\n * of commands where each command is an Array of the\n * form `[command, arg1, arg2, ...]`\n *\n * @param {String} path\n * @return {Array}\n */\n\nfunction parse(path) {\n\tvar data = []\n\tpath.replace(segment, function(_, command, args){\n\t\tvar type = command.toLowerCase()\n\t\targs = parseValues(args)\n\n\t\t// overloaded moveTo\n\t\tif (type == 'm' && args.length > 2) {\n\t\t\tdata.push([command].concat(args.splice(0, 2)))\n\t\t\ttype = 'l'\n\t\t\tcommand = command == 'm' ? 'l' : 'L'\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (args.length == length[type]) {\n\t\t\t\targs.unshift(command)\n\t\t\t\treturn data.push(args)\n\t\t\t}\n\t\t\tif (args.length < length[type]) throw new Error('malformed path data')\n\t\t\tdata.push([command].concat(args.splice(0, length[type])))\n\t\t}\n\t})\n\treturn data\n}\n\nvar number = /-?[0-9]*\\.?[0-9]+(?:e[-+]?\\d+)?/ig\n\nfunction parseValues(args) {\n\tvar numbers = args.match(number)\n\treturn numbers ? numbers.map(Number) : []\n}\n","import { Rectangle } from './Rectangle.mjs';\n\n\"use strict\";\nclass Circle {\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0) {\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default 'circle'\n */\n this.type = \"circle\";\n this.x = x;\n this.y = y;\n this.radius = radius;\n }\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone() {\n return new Circle(this.x, this.y, this.radius);\n }\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x, y) {\n if (this.radius <= 0)\n return false;\n const r2 = this.radius * this.radius;\n let dx = this.x - x;\n let dy = this.y - y;\n dx *= dx;\n dy *= dy;\n return dx + dy <= r2;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this circle including the stroke.\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @param width - The width of the line to check\n * @returns Whether the x/y coordinates are within this Circle\n */\n strokeContains(x, y, width) {\n if (this.radius === 0)\n return false;\n const dx = this.x - x;\n const dy = this.y - y;\n const r = this.radius;\n const w2 = width / 2;\n const distance = Math.sqrt(dx * dx + dy * dy);\n return distance < r + w2 && distance > r - w2;\n }\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @param out\n * @returns The framing rectangle\n */\n getBounds(out) {\n out = out || new Rectangle();\n out.x = this.x - this.radius;\n out.y = this.y - this.radius;\n out.width = this.radius * 2;\n out.height = this.radius * 2;\n return out;\n }\n /**\n * Copies another circle to this one.\n * @param circle - The circle to copy from.\n * @returns Returns itself.\n */\n copyFrom(circle) {\n this.x = circle.x;\n this.y = circle.y;\n this.radius = circle.radius;\n return this;\n }\n /**\n * Copies this circle to another one.\n * @param circle - The circle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(circle) {\n circle.copyFrom(this);\n return circle;\n }\n toString() {\n return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n}\n\nexport { Circle };\n//# sourceMappingURL=Circle.mjs.map\n","import { Rectangle } from './Rectangle.mjs';\n\n\"use strict\";\nclass Ellipse {\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0) {\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default 'ellipse'\n */\n this.type = \"ellipse\";\n this.x = x;\n this.y = y;\n this.halfWidth = halfWidth;\n this.halfHeight = halfHeight;\n }\n /**\n * Creates a clone of this Ellipse instance\n * @returns {Ellipse} A copy of the ellipse\n */\n clone() {\n return new Ellipse(this.x, this.y, this.halfWidth, this.halfHeight);\n }\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x, y) {\n if (this.halfWidth <= 0 || this.halfHeight <= 0) {\n return false;\n }\n let normx = (x - this.x) / this.halfWidth;\n let normy = (y - this.y) / this.halfHeight;\n normx *= normx;\n normy *= normy;\n return normx + normy <= 1;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse including stroke\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @param width\n * @returns Whether the x/y coords are within this ellipse\n */\n strokeContains(x, y, width) {\n const { halfWidth, halfHeight } = this;\n if (halfWidth <= 0 || halfHeight <= 0) {\n return false;\n }\n const halfStrokeWidth = width / 2;\n const innerA = halfWidth - halfStrokeWidth;\n const innerB = halfHeight - halfStrokeWidth;\n const outerA = halfWidth + halfStrokeWidth;\n const outerB = halfHeight + halfStrokeWidth;\n const normalizedX = x - this.x;\n const normalizedY = y - this.y;\n const innerEllipse = normalizedX * normalizedX / (innerA * innerA) + normalizedY * normalizedY / (innerB * innerB);\n const outerEllipse = normalizedX * normalizedX / (outerA * outerA) + normalizedY * normalizedY / (outerB * outerB);\n return innerEllipse > 1 && outerEllipse <= 1;\n }\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @param out\n * @returns The framing rectangle\n */\n getBounds(out) {\n out = out || new Rectangle();\n out.x = this.x - this.halfWidth;\n out.y = this.y - this.halfHeight;\n out.width = this.halfWidth * 2;\n out.height = this.halfHeight * 2;\n return out;\n }\n /**\n * Copies another ellipse to this one.\n * @param ellipse - The ellipse to copy from.\n * @returns Returns itself.\n */\n copyFrom(ellipse) {\n this.x = ellipse.x;\n this.y = ellipse.y;\n this.halfWidth = ellipse.halfWidth;\n this.halfHeight = ellipse.halfHeight;\n return this;\n }\n /**\n * Copies this ellipse to another one.\n * @param ellipse - The ellipse to copy to.\n * @returns Returns given parameter.\n */\n copyTo(ellipse) {\n ellipse.copyFrom(this);\n return ellipse;\n }\n toString() {\n return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`;\n }\n}\n\nexport { Ellipse };\n//# sourceMappingURL=Ellipse.mjs.map\n","\"use strict\";\nfunction squaredDistanceToLineSegment(x, y, x1, y1, x2, y2) {\n const a = x - x1;\n const b = y - y1;\n const c = x2 - x1;\n const d = y2 - y1;\n const dot = a * c + b * d;\n const lenSq = c * c + d * d;\n let param = -1;\n if (lenSq !== 0) {\n param = dot / lenSq;\n }\n let xx;\n let yy;\n if (param < 0) {\n xx = x1;\n yy = y1;\n } else if (param > 1) {\n xx = x2;\n yy = y2;\n } else {\n xx = x1 + param * c;\n yy = y1 + param * d;\n }\n const dx = x - xx;\n const dy = y - yy;\n return dx * dx + dy * dy;\n}\n\nexport { squaredDistanceToLineSegment };\n//# sourceMappingURL=squaredDistanceToLineSegment.mjs.map\n","import { squaredDistanceToLineSegment } from '../misc/squaredDistanceToLineSegment.mjs';\nimport { Rectangle } from './Rectangle.mjs';\n\n\"use strict\";\nclass Polygon {\n /**\n * @param points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new Polygon(new Point(), new Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points) {\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default 'polygon'\n */\n this.type = \"polygon\";\n let flat = Array.isArray(points[0]) ? points[0] : points;\n if (typeof flat[0] !== \"number\") {\n const p = [];\n for (let i = 0, il = flat.length; i < il; i++) {\n p.push(flat[i].x, flat[i].y);\n }\n flat = p;\n }\n this.points = flat;\n this.closePath = true;\n }\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone() {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n polygon.closePath = this.closePath;\n return polygon;\n }\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x, y) {\n let inside = false;\n const length = this.points.length / 2;\n for (let i = 0, j = length - 1; i < length; j = i++) {\n const xi = this.points[i * 2];\n const yi = this.points[i * 2 + 1];\n const xj = this.points[j * 2];\n const yj = this.points[j * 2 + 1];\n const intersect = yi > y !== yj > y && x < (xj - xi) * ((y - yi) / (yj - yi)) + xi;\n if (intersect) {\n inside = !inside;\n }\n }\n return inside;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this polygon including the stroke.\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @param strokeWidth - The width of the line to check\n * @returns Whether the x/y coordinates are within this polygon\n */\n strokeContains(x, y, strokeWidth) {\n const halfStrokeWidth = strokeWidth / 2;\n const halfStrokeWidthSqrd = halfStrokeWidth * halfStrokeWidth;\n const { points } = this;\n const iterationLength = points.length - (this.closePath ? 0 : 2);\n for (let i = 0; i < iterationLength; i += 2) {\n const x1 = points[i];\n const y1 = points[i + 1];\n const x2 = points[(i + 2) % points.length];\n const y2 = points[(i + 3) % points.length];\n const distanceSqrd = squaredDistanceToLineSegment(x, y, x1, y1, x2, y2);\n if (distanceSqrd <= halfStrokeWidthSqrd) {\n return true;\n }\n }\n return false;\n }\n /**\n * Returns the framing rectangle of the polygon as a Rectangle object\n * @param out - optional rectangle to store the result\n * @returns The framing rectangle\n */\n getBounds(out) {\n out = out || new Rectangle();\n const points = this.points;\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (let i = 0, n = points.length; i < n; i += 2) {\n const x = points[i];\n const y = points[i + 1];\n minX = x < minX ? x : minX;\n maxX = x > maxX ? x : maxX;\n minY = y < minY ? y : minY;\n maxY = y > maxY ? y : maxY;\n }\n out.x = minX;\n out.width = maxX - minX;\n out.y = minY;\n out.height = maxY - minY;\n return out;\n }\n /**\n * Copies another polygon to this one.\n * @param polygon - The polygon to copy from.\n * @returns Returns itself.\n */\n copyFrom(polygon) {\n this.points = polygon.points.slice();\n this.closePath = polygon.closePath;\n return this;\n }\n /**\n * Copies this polygon to another one.\n * @param polygon - The polygon to copy to.\n * @returns Returns given parameter.\n */\n copyTo(polygon) {\n polygon.copyFrom(this);\n return polygon;\n }\n toString() {\n return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, \"\")}]`;\n }\n /**\n * Get the last X coordinate of the polygon\n * @readonly\n */\n get lastX() {\n return this.points[this.points.length - 2];\n }\n /**\n * Get the last Y coordinate of the polygon\n * @readonly\n */\n get lastY() {\n return this.points[this.points.length - 1];\n }\n /**\n * Get the first X coordinate of the polygon\n * @readonly\n */\n get x() {\n return this.points[this.points.length - 2];\n }\n /**\n * Get the first Y coordinate of the polygon\n * @readonly\n */\n get y() {\n return this.points[this.points.length - 1];\n }\n}\n\nexport { Polygon };\n//# sourceMappingURL=Polygon.mjs.map\n","import { Rectangle } from './Rectangle.mjs';\n\n\"use strict\";\nconst isCornerWithinStroke = (pX, pY, cornerX, cornerY, radius, halfStrokeWidth) => {\n const dx = pX - cornerX;\n const dy = pY - cornerY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n return distance >= radius - halfStrokeWidth && distance <= radius + halfStrokeWidth;\n};\nclass RoundedRectangle {\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20) {\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default 'roundedRectangle'\n */\n this.type = \"roundedRectangle\";\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n }\n /**\n * Returns the framing rectangle of the rounded rectangle as a Rectangle object\n * @param out - optional rectangle to store the result\n * @returns The framing rectangle\n */\n getBounds(out) {\n out = out || new Rectangle();\n out.x = this.x;\n out.y = this.y;\n out.width = this.width;\n out.height = this.height;\n return out;\n }\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone() {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle) {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n return this;\n }\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle) {\n rectangle.copyFrom(this);\n return rectangle;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width) {\n if (y >= this.y && y <= this.y + this.height) {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n if (y >= this.y + radius && y <= this.y + this.height - radius || x >= this.x + radius && x <= this.x + this.width - radius) {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n if (dx * dx + dy * dy <= radius2) {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if (dx * dx + dy * dy <= radius2) {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if (dx * dx + dy * dy <= radius2) {\n return true;\n }\n dx = x - (this.x + radius);\n if (dx * dx + dy * dy <= radius2) {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Checks whether the x and y coordinates given are contained within this rectangle including the stroke.\n * @param pX - The X coordinate of the point to test\n * @param pY - The Y coordinate of the point to test\n * @param strokeWidth - The width of the line to check\n * @returns Whether the x/y coordinates are within this rectangle\n */\n strokeContains(pX, pY, strokeWidth) {\n const { x, y, width, height, radius } = this;\n const halfStrokeWidth = strokeWidth / 2;\n const innerX = x + radius;\n const innerY = y + radius;\n const innerWidth = width - radius * 2;\n const innerHeight = height - radius * 2;\n const rightBound = x + width;\n const bottomBound = y + height;\n if ((pX >= x - halfStrokeWidth && pX <= x + halfStrokeWidth || pX >= rightBound - halfStrokeWidth && pX <= rightBound + halfStrokeWidth) && pY >= innerY && pY <= innerY + innerHeight) {\n return true;\n }\n if ((pY >= y - halfStrokeWidth && pY <= y + halfStrokeWidth || pY >= bottomBound - halfStrokeWidth && pY <= bottomBound + halfStrokeWidth) && pX >= innerX && pX <= innerX + innerWidth) {\n return true;\n }\n return (\n // Top-left\n pX < innerX && pY < innerY && isCornerWithinStroke(pX, pY, innerX, innerY, radius, halfStrokeWidth) || pX > rightBound - radius && pY < innerY && isCornerWithinStroke(pX, pY, rightBound - radius, innerY, radius, halfStrokeWidth) || pX > rightBound - radius && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, rightBound - radius, bottomBound - radius, radius, halfStrokeWidth) || pX < innerX && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, innerX, bottomBound - radius, radius, halfStrokeWidth)\n );\n }\n toString() {\n return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n}\n\nexport { RoundedRectangle };\n//# sourceMappingURL=RoundedRectangle.mjs.map\n","\"use strict\";\nconst fragTemplate = [\n \"precision mediump float;\",\n \"void main(void){\",\n \"float test = 0.1;\",\n \"%forloop%\",\n \"gl_FragColor = vec4(0.0);\",\n \"}\"\n].join(\"\\n\");\nfunction generateIfTestSrc(maxIfs) {\n let src = \"\";\n for (let i = 0; i < maxIfs; ++i) {\n if (i > 0) {\n src += \"\\nelse \";\n }\n if (i < maxIfs - 1) {\n src += `if(test == ${i}.0){}`;\n }\n }\n return src;\n}\nfunction checkMaxIfStatementsInShader(maxIfs, gl) {\n if (maxIfs === 0) {\n throw new Error(\"Invalid value of `0` passed to `checkMaxIfStatementsInShader`\");\n }\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n while (true) {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n maxIfs = maxIfs / 2 | 0;\n } else {\n break;\n }\n }\n return maxIfs;\n}\n\nexport { checkMaxIfStatementsInShader };\n//# sourceMappingURL=checkMaxIfStatementsInShader.mjs.map\n","import { getTestContext } from '../../../renderers/gl/shader/program/getTestContext.mjs';\nimport { checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader.mjs';\n\n\"use strict\";\nlet maxTexturesPerBatchCache = null;\nfunction getMaxTexturesPerBatch() {\n if (maxTexturesPerBatchCache)\n return maxTexturesPerBatchCache;\n const gl = getTestContext();\n maxTexturesPerBatchCache = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n maxTexturesPerBatchCache = checkMaxIfStatementsInShader(\n maxTexturesPerBatchCache,\n gl\n );\n return maxTexturesPerBatchCache;\n}\n\nexport { getMaxTexturesPerBatch };\n//# sourceMappingURL=maxRecommendedTextures.mjs.map\n","import { BindGroup } from '../../renderers/gpu/shader/BindGroup.mjs';\nimport { Texture } from '../../renderers/shared/texture/Texture.mjs';\nimport { getMaxTexturesPerBatch } from '../gl/utils/maxRecommendedTextures.mjs';\n\n\"use strict\";\nconst cachedGroups = {};\nfunction getTextureBatchBindGroup(textures, size) {\n let uid = 0;\n for (let i = 0; i < size; i++) {\n uid = uid * 31 + textures[i].uid >>> 0;\n }\n return cachedGroups[uid] || generateTextureBatchBindGroup(textures, size, uid);\n}\nlet maxTextures = 0;\nfunction generateTextureBatchBindGroup(textures, size, key) {\n const bindGroupResources = {};\n let bindIndex = 0;\n if (!maxTextures)\n maxTextures = getMaxTexturesPerBatch();\n for (let i = 0; i < maxTextures; i++) {\n const texture = i < size ? textures[i] : Texture.EMPTY.source;\n bindGroupResources[bindIndex++] = texture.source;\n bindGroupResources[bindIndex++] = texture.style;\n }\n const bindGroup = new BindGroup(bindGroupResources);\n cachedGroups[key] = bindGroup;\n return bindGroup;\n}\n\nexport { getTextureBatchBindGroup };\n//# sourceMappingURL=getTextureBatchBindGroup.mjs.map\n","\"use strict\";\nclass ViewableBuffer {\n constructor(sizeOrBuffer) {\n if (typeof sizeOrBuffer === \"number\") {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n } else if (sizeOrBuffer instanceof Uint8Array) {\n this.rawBinaryData = sizeOrBuffer.buffer;\n } else {\n this.rawBinaryData = sizeOrBuffer;\n }\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n this.size = this.rawBinaryData.byteLength;\n }\n /** View on the raw binary data as a `Int8Array`. */\n get int8View() {\n if (!this._int8View) {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n return this._int8View;\n }\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View() {\n if (!this._uint8View) {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n return this._uint8View;\n }\n /** View on the raw binary data as a `Int16Array`. */\n get int16View() {\n if (!this._int16View) {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n return this._int16View;\n }\n /** View on the raw binary data as a `Int32Array`. */\n get int32View() {\n if (!this._int32View) {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n return this._int32View;\n }\n /** View on the raw binary data as a `Float64Array`. */\n get float64View() {\n if (!this._float64Array) {\n this._float64Array = new Float64Array(this.rawBinaryData);\n }\n return this._float64Array;\n }\n /** View on the raw binary data as a `BigUint64Array`. */\n get bigUint64View() {\n if (!this._bigUint64Array) {\n this._bigUint64Array = new BigUint64Array(this.rawBinaryData);\n }\n return this._bigUint64Array;\n }\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type) {\n return this[`${type}View`];\n }\n /** Destroys all buffer references. Do not use after calling this. */\n destroy() {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this.uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n /**\n * Returns the size of the given type in bytes.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - size of the type in bytes\n */\n static sizeOf(type) {\n switch (type) {\n case \"int8\":\n case \"uint8\":\n return 1;\n case \"int16\":\n case \"uint16\":\n return 2;\n case \"int32\":\n case \"uint32\":\n case \"float32\":\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n\nexport { ViewableBuffer };\n//# sourceMappingURL=ViewableBuffer.mjs.map\n","\"use strict\";\nfunction fastCopy(sourceBuffer, destinationBuffer) {\n const lengthDouble = sourceBuffer.byteLength / 8 | 0;\n const sourceFloat64View = new Float64Array(sourceBuffer, 0, lengthDouble);\n const destinationFloat64View = new Float64Array(destinationBuffer, 0, lengthDouble);\n destinationFloat64View.set(sourceFloat64View);\n const remainingBytes = sourceBuffer.byteLength - lengthDouble * 8;\n if (remainingBytes > 0) {\n const sourceUint8View = new Uint8Array(sourceBuffer, lengthDouble * 8, remainingBytes);\n const destinationUint8View = new Uint8Array(destinationBuffer, lengthDouble * 8, remainingBytes);\n destinationUint8View.set(sourceUint8View);\n }\n}\n\nexport { fastCopy };\n//# sourceMappingURL=fastCopy.mjs.map\n","\"use strict\";\nconst BLEND_TO_NPM = {\n normal: \"normal-npm\",\n add: \"add-npm\",\n screen: \"screen-npm\"\n};\nvar STENCIL_MODES = /* @__PURE__ */ ((STENCIL_MODES2) => {\n STENCIL_MODES2[STENCIL_MODES2[\"DISABLED\"] = 0] = \"DISABLED\";\n STENCIL_MODES2[STENCIL_MODES2[\"RENDERING_MASK_ADD\"] = 1] = \"RENDERING_MASK_ADD\";\n STENCIL_MODES2[STENCIL_MODES2[\"MASK_ACTIVE\"] = 2] = \"MASK_ACTIVE\";\n STENCIL_MODES2[STENCIL_MODES2[\"RENDERING_MASK_REMOVE\"] = 3] = \"RENDERING_MASK_REMOVE\";\n STENCIL_MODES2[STENCIL_MODES2[\"NONE\"] = 4] = \"NONE\";\n return STENCIL_MODES2;\n})(STENCIL_MODES || {});\n\nexport { BLEND_TO_NPM, STENCIL_MODES };\n//# sourceMappingURL=const.mjs.map\n","import { BLEND_TO_NPM } from './const.mjs';\n\n\"use strict\";\nfunction getAdjustedBlendModeBlend(blendMode, textureSource) {\n if (textureSource.alphaMode === \"no-premultiply-alpha\") {\n return BLEND_TO_NPM[blendMode] || blendMode;\n }\n return blendMode;\n}\n\nexport { getAdjustedBlendModeBlend };\n//# sourceMappingURL=getAdjustedBlendModeBlend.mjs.map\n","\"use strict\";\nclass BatchTextureArray {\n constructor() {\n /** Respective locations for textures. */\n this.ids = /* @__PURE__ */ Object.create(null);\n this.textures = [];\n this.count = 0;\n }\n /** Clear the textures and their locations. */\n clear() {\n for (let i = 0; i < this.count; i++) {\n const t = this.textures[i];\n this.textures[i] = null;\n this.ids[t.uid] = null;\n }\n this.count = 0;\n }\n}\n\nexport { BatchTextureArray };\n//# sourceMappingURL=BatchTextureArray.mjs.map\n","import { uid } from '../../../utils/data/uid.mjs';\nimport { ViewableBuffer } from '../../../utils/data/ViewableBuffer.mjs';\nimport { fastCopy } from '../../renderers/shared/buffer/utils/fastCopy.mjs';\nimport { getAdjustedBlendModeBlend } from '../../renderers/shared/state/getAdjustedBlendModeBlend.mjs';\nimport { getMaxTexturesPerBatch } from '../gl/utils/maxRecommendedTextures.mjs';\nimport { BatchTextureArray } from './BatchTextureArray.mjs';\n\n\"use strict\";\nclass Batch {\n constructor() {\n this.renderPipeId = \"batch\";\n this.action = \"startBatch\";\n // TODO - eventually this could be useful for flagging batches as dirty and then only rebuilding those ones\n // public elementStart = 0;\n // public elementSize = 0;\n // for drawing..\n this.start = 0;\n this.size = 0;\n this.textures = new BatchTextureArray();\n this.blendMode = \"normal\";\n this.canBundle = true;\n }\n destroy() {\n this.textures = null;\n this.gpuBindGroup = null;\n this.bindGroup = null;\n this.batcher = null;\n }\n}\nconst batchPool = [];\nlet batchPoolIndex = 0;\nfunction getBatchFromPool() {\n return batchPoolIndex > 0 ? batchPool[--batchPoolIndex] : new Batch();\n}\nfunction returnBatchToPool(batch) {\n batchPool[batchPoolIndex++] = batch;\n}\nlet BATCH_TICK = 0;\nconst _Batcher = class _Batcher {\n constructor(options = {}) {\n /** unique id for this batcher */\n this.uid = uid(\"batcher\");\n this.dirty = true;\n this.batchIndex = 0;\n this.batches = [];\n // specifics.\n this._vertexSize = 6;\n this._elements = [];\n options = { ..._Batcher.defaultOptions, ...options };\n const { vertexSize, indexSize } = options;\n this.attributeBuffer = new ViewableBuffer(vertexSize * this._vertexSize * 4);\n this.indexBuffer = new Uint16Array(indexSize);\n this._maxTextures = getMaxTexturesPerBatch();\n }\n begin() {\n this.elementSize = 0;\n this.elementStart = 0;\n this.indexSize = 0;\n this.attributeSize = 0;\n for (let i = 0; i < this.batchIndex; i++) {\n returnBatchToPool(this.batches[i]);\n }\n this.batchIndex = 0;\n this._batchIndexStart = 0;\n this._batchIndexSize = 0;\n this.dirty = true;\n }\n add(batchableObject) {\n this._elements[this.elementSize++] = batchableObject;\n batchableObject.indexStart = this.indexSize;\n batchableObject.location = this.attributeSize;\n batchableObject.batcher = this;\n this.indexSize += batchableObject.indexSize;\n this.attributeSize += batchableObject.vertexSize * this._vertexSize;\n }\n checkAndUpdateTexture(batchableObject, texture) {\n const textureId = batchableObject.batch.textures.ids[texture._source.uid];\n if (!textureId && textureId !== 0)\n return false;\n batchableObject.textureId = textureId;\n batchableObject.texture = texture;\n return true;\n }\n updateElement(batchableObject) {\n this.dirty = true;\n batchableObject.packAttributes(\n this.attributeBuffer.float32View,\n this.attributeBuffer.uint32View,\n batchableObject.location,\n batchableObject.textureId\n );\n }\n /**\n * breaks the batcher. This happens when a batch gets too big,\n * or we need to switch to a different type of rendering (a filter for example)\n * @param instructionSet\n */\n break(instructionSet) {\n const elements = this._elements;\n if (!elements[this.elementStart])\n return;\n let batch = getBatchFromPool();\n let textureBatch = batch.textures;\n textureBatch.clear();\n const firstElement = elements[this.elementStart];\n let blendMode = getAdjustedBlendModeBlend(firstElement.blendMode, firstElement.texture._source);\n if (this.attributeSize * 4 > this.attributeBuffer.size) {\n this._resizeAttributeBuffer(this.attributeSize * 4);\n }\n if (this.indexSize > this.indexBuffer.length) {\n this._resizeIndexBuffer(this.indexSize);\n }\n const f32 = this.attributeBuffer.float32View;\n const u32 = this.attributeBuffer.uint32View;\n const iBuffer = this.indexBuffer;\n let size = this._batchIndexSize;\n let start = this._batchIndexStart;\n let action = \"startBatch\";\n const maxTextures = this._maxTextures;\n for (let i = this.elementStart; i < this.elementSize; ++i) {\n const element = elements[i];\n elements[i] = null;\n const texture = element.texture;\n const source = texture._source;\n const adjustedBlendMode = getAdjustedBlendModeBlend(element.blendMode, source);\n const blendModeChange = blendMode !== adjustedBlendMode;\n if (source._batchTick === BATCH_TICK && !blendModeChange) {\n element.textureId = source._textureBindLocation;\n size += element.indexSize;\n element.packAttributes(f32, u32, element.location, element.textureId);\n element.packIndex(iBuffer, element.indexStart, element.location / this._vertexSize);\n element.batch = batch;\n continue;\n }\n source._batchTick = BATCH_TICK;\n if (textureBatch.count >= maxTextures || blendModeChange) {\n this._finishBatch(\n batch,\n start,\n size - start,\n textureBatch,\n blendMode,\n instructionSet,\n action\n );\n action = \"renderBatch\";\n start = size;\n blendMode = adjustedBlendMode;\n batch = getBatchFromPool();\n textureBatch = batch.textures;\n textureBatch.clear();\n ++BATCH_TICK;\n }\n element.textureId = source._textureBindLocation = textureBatch.count;\n textureBatch.ids[source.uid] = textureBatch.count;\n textureBatch.textures[textureBatch.count++] = source;\n element.batch = batch;\n size += element.indexSize;\n element.packAttributes(f32, u32, element.location, element.textureId);\n element.packIndex(iBuffer, element.indexStart, element.location / this._vertexSize);\n }\n if (textureBatch.count > 0) {\n this._finishBatch(\n batch,\n start,\n size - start,\n textureBatch,\n blendMode,\n instructionSet,\n action\n );\n start = size;\n ++BATCH_TICK;\n }\n this.elementStart = this.elementSize;\n this._batchIndexStart = start;\n this._batchIndexSize = size;\n }\n _finishBatch(batch, indexStart, indexSize, textureBatch, blendMode, instructionSet, action) {\n batch.gpuBindGroup = null;\n batch.bindGroup = null;\n batch.action = action;\n batch.batcher = this;\n batch.textures = textureBatch;\n batch.blendMode = blendMode;\n batch.start = indexStart;\n batch.size = indexSize;\n ++BATCH_TICK;\n this.batches[this.batchIndex++] = batch;\n instructionSet.add(batch);\n }\n finish(instructionSet) {\n this.break(instructionSet);\n }\n /**\n * Resizes the attribute buffer to the given size (1 = 1 float32)\n * @param size - the size in vertices to ensure (not bytes!)\n */\n ensureAttributeBuffer(size) {\n if (size * 4 <= this.attributeBuffer.size)\n return;\n this._resizeAttributeBuffer(size * 4);\n }\n /**\n * Resizes the index buffer to the given size (1 = 1 float32)\n * @param size - the size in vertices to ensure (not bytes!)\n */\n ensureIndexBuffer(size) {\n if (size <= this.indexBuffer.length)\n return;\n this._resizeIndexBuffer(size);\n }\n _resizeAttributeBuffer(size) {\n const newSize = Math.max(size, this.attributeBuffer.size * 2);\n const newArrayBuffer = new ViewableBuffer(newSize);\n fastCopy(this.attributeBuffer.rawBinaryData, newArrayBuffer.rawBinaryData);\n this.attributeBuffer = newArrayBuffer;\n }\n _resizeIndexBuffer(size) {\n const indexBuffer = this.indexBuffer;\n let newSize = Math.max(size, indexBuffer.length * 1.5);\n newSize += newSize % 2;\n const newIndexBuffer = newSize > 65535 ? new Uint32Array(newSize) : new Uint16Array(newSize);\n if (newIndexBuffer.BYTES_PER_ELEMENT !== indexBuffer.BYTES_PER_ELEMENT) {\n for (let i = 0; i < indexBuffer.length; i++) {\n newIndexBuffer[i] = indexBuffer[i];\n }\n } else {\n fastCopy(indexBuffer.buffer, newIndexBuffer.buffer);\n }\n this.indexBuffer = newIndexBuffer;\n }\n destroy() {\n for (let i = 0; i < this.batches.length; i++) {\n returnBatchToPool(this.batches[i]);\n }\n this.batches = null;\n for (let i = 0; i < this._elements.length; i++) {\n this._elements[i].batch = null;\n }\n this._elements = null;\n this.indexBuffer = null;\n this.attributeBuffer.destroy();\n this.attributeBuffer = null;\n }\n};\n_Batcher.defaultOptions = {\n vertexSize: 4,\n indexSize: 6\n};\nlet Batcher = _Batcher;\n\nexport { Batch, Batcher };\n//# sourceMappingURL=Batcher.mjs.map\n","\"use strict\";\nvar BufferUsage = /* @__PURE__ */ ((BufferUsage2) => {\n BufferUsage2[BufferUsage2[\"MAP_READ\"] = 1] = \"MAP_READ\";\n BufferUsage2[BufferUsage2[\"MAP_WRITE\"] = 2] = \"MAP_WRITE\";\n BufferUsage2[BufferUsage2[\"COPY_SRC\"] = 4] = \"COPY_SRC\";\n BufferUsage2[BufferUsage2[\"COPY_DST\"] = 8] = \"COPY_DST\";\n BufferUsage2[BufferUsage2[\"INDEX\"] = 16] = \"INDEX\";\n BufferUsage2[BufferUsage2[\"VERTEX\"] = 32] = \"VERTEX\";\n BufferUsage2[BufferUsage2[\"UNIFORM\"] = 64] = \"UNIFORM\";\n BufferUsage2[BufferUsage2[\"STORAGE\"] = 128] = \"STORAGE\";\n BufferUsage2[BufferUsage2[\"INDIRECT\"] = 256] = \"INDIRECT\";\n BufferUsage2[BufferUsage2[\"QUERY_RESOLVE\"] = 512] = \"QUERY_RESOLVE\";\n BufferUsage2[BufferUsage2[\"STATIC\"] = 1024] = \"STATIC\";\n return BufferUsage2;\n})(BufferUsage || {});\n\nexport { BufferUsage };\n//# sourceMappingURL=const.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { uid } from '../../../../utils/data/uid.mjs';\nimport { BufferUsage } from './const.mjs';\n\n\"use strict\";\nclass Buffer extends EventEmitter {\n /**\n * Creates a new Buffer with the given options\n * @param options - the options for the buffer\n */\n constructor(options) {\n let { data, size } = options;\n const { usage, label, shrinkToFit } = options;\n super();\n /**\n * emits when the underlying buffer has changed shape (i.e. resized)\n * letting the renderer know that it needs to discard the old buffer on the GPU and create a new one\n * @event change\n */\n /**\n * emits when the underlying buffer data has been updated. letting the renderer know\n * that it needs to update the buffer on the GPU\n * @event update\n */\n /**\n * emits when the buffer is destroyed. letting the renderer know that it needs to destroy the buffer on the GPU\n * @event destroy\n */\n /** a unique id for this uniform group used through the renderer */\n this.uid = uid(\"buffer\");\n /**\n * a resource type, used to identify how to handle it when its in a bind group / shader resource\n * @internal\n * @ignore\n */\n this._resourceType = \"buffer\";\n /**\n * the resource id used internally by the renderer to build bind group keys\n * @internal\n * @ignore\n */\n this._resourceId = uid(\"resource\");\n /**\n * used internally to know if a uniform group was used in the last render pass\n * @internal\n * @ignore\n */\n this._touched = 0;\n /**\n * @internal\n * @ignore\n */\n this._updateID = 1;\n /**\n * should the GPU buffer be shrunk when the data becomes smaller?\n * changing this will cause the buffer to be destroyed and a new one created on the GPU\n * this can be expensive, especially if the buffer is already big enough!\n * setting this to false will prevent the buffer from being shrunk. This will yield better performance\n * if you are constantly setting data that is changing size often.\n * @default true\n */\n this.shrinkToFit = true;\n /**\n * Has the buffer been destroyed?\n * @readonly\n */\n this.destroyed = false;\n if (data instanceof Array) {\n data = new Float32Array(data);\n }\n this._data = data;\n size = size ?? data?.byteLength;\n const mappedAtCreation = !!data;\n this.descriptor = {\n size,\n usage,\n mappedAtCreation,\n label\n };\n this.shrinkToFit = shrinkToFit ?? true;\n }\n /** the data in the buffer */\n get data() {\n return this._data;\n }\n set data(value) {\n this.setDataWithSize(value, value.length, true);\n }\n /** whether the buffer is static or not */\n get static() {\n return !!(this.descriptor.usage & BufferUsage.STATIC);\n }\n set static(value) {\n if (value) {\n this.descriptor.usage |= BufferUsage.STATIC;\n } else {\n this.descriptor.usage &= ~BufferUsage.STATIC;\n }\n }\n /**\n * Sets the data in the buffer to the given value. This will immediately update the buffer on the GPU.\n * If you only want to update a subset of the buffer, you can pass in the size of the data.\n * @param value - the data to set\n * @param size - the size of the data in bytes\n * @param syncGPU - should the buffer be updated on the GPU immediately?\n */\n setDataWithSize(value, size, syncGPU) {\n this._updateID++;\n this._updateSize = size * value.BYTES_PER_ELEMENT;\n if (this._data === value) {\n if (syncGPU)\n this.emit(\"update\", this);\n return;\n }\n const oldData = this._data;\n this._data = value;\n if (oldData.length !== value.length) {\n if (!this.shrinkToFit && value.byteLength < oldData.byteLength) {\n if (syncGPU)\n this.emit(\"update\", this);\n } else {\n this.descriptor.size = value.byteLength;\n this._resourceId = uid(\"resource\");\n this.emit(\"change\", this);\n }\n return;\n }\n if (syncGPU)\n this.emit(\"update\", this);\n }\n /**\n * updates the buffer on the GPU to reflect the data in the buffer.\n * By default it will update the entire buffer. If you only want to update a subset of the buffer,\n * you can pass in the size of the buffer to update.\n * @param sizeInBytes - the new size of the buffer in bytes\n */\n update(sizeInBytes) {\n this._updateSize = sizeInBytes ?? this._updateSize;\n this._updateID++;\n this.emit(\"update\", this);\n }\n /** Destroys the buffer */\n destroy() {\n this.destroyed = true;\n this.emit(\"destroy\", this);\n this.emit(\"change\", this);\n this._data = null;\n this.descriptor = null;\n this.removeAllListeners();\n }\n}\n\nexport { Buffer };\n//# sourceMappingURL=Buffer.mjs.map\n","import { Buffer } from '../../buffer/Buffer.mjs';\nimport { BufferUsage } from '../../buffer/const.mjs';\n\n\"use strict\";\nfunction ensureIsBuffer(buffer, index) {\n if (!(buffer instanceof Buffer)) {\n let usage = index ? BufferUsage.INDEX : BufferUsage.VERTEX;\n if (buffer instanceof Array) {\n if (index) {\n buffer = new Uint32Array(buffer);\n usage = BufferUsage.INDEX | BufferUsage.COPY_DST;\n } else {\n buffer = new Float32Array(buffer);\n usage = BufferUsage.VERTEX | BufferUsage.COPY_DST;\n }\n }\n buffer = new Buffer({\n data: buffer,\n label: index ? \"index-mesh-buffer\" : \"vertex-mesh-buffer\",\n usage\n });\n }\n return buffer;\n}\n\nexport { ensureIsBuffer };\n//# sourceMappingURL=ensureIsBuffer.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { Bounds } from '../../../../scene/container/bounds/Bounds.mjs';\nimport { uid } from '../../../../utils/data/uid.mjs';\nimport { Buffer } from '../buffer/Buffer.mjs';\nimport { ensureIsBuffer } from './utils/ensureIsBuffer.mjs';\nimport { getGeometryBounds } from './utils/getGeometryBounds.mjs';\n\n\"use strict\";\nfunction ensureIsAttribute(attribute) {\n if (attribute instanceof Buffer || Array.isArray(attribute) || attribute.BYTES_PER_ELEMENT) {\n attribute = {\n buffer: attribute\n };\n }\n attribute.buffer = ensureIsBuffer(attribute.buffer, false);\n return attribute;\n}\nclass Geometry extends EventEmitter {\n /**\n * Create a new instance of a geometry\n * @param options - The options for the geometry.\n */\n constructor(options) {\n const { attributes, indexBuffer, topology } = options;\n super();\n /** The unique id of the geometry. */\n this.uid = uid(\"geometry\");\n /**\n * the layout key will be generated by WebGPU all geometries that have the same structure\n * will have the same layout key. This is used to cache the pipeline layout\n * @internal\n * @ignore\n */\n this._layoutKey = 0;\n /** the instance count of the geometry to draw */\n this.instanceCount = 1;\n this._bounds = new Bounds();\n this._boundsDirty = true;\n this.attributes = attributes;\n this.buffers = [];\n this.instanceCount = options.instanceCount || 1;\n for (const i in attributes) {\n const attribute = attributes[i] = ensureIsAttribute(attributes[i]);\n const bufferIndex = this.buffers.indexOf(attribute.buffer);\n if (bufferIndex === -1) {\n this.buffers.push(attribute.buffer);\n attribute.buffer.on(\"update\", this.onBufferUpdate, this);\n attribute.buffer.on(\"change\", this.onBufferUpdate, this);\n }\n }\n if (indexBuffer) {\n this.indexBuffer = ensureIsBuffer(indexBuffer, true);\n this.buffers.push(this.indexBuffer);\n }\n this.topology = topology || \"triangle-list\";\n }\n onBufferUpdate() {\n this._boundsDirty = true;\n this.emit(\"update\", this);\n }\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id) {\n return this.attributes[id];\n }\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex() {\n return this.indexBuffer;\n }\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id) {\n return this.getAttribute(id).buffer;\n }\n /**\n * Used to figure out how many vertices there are in this geometry\n * @returns the number of vertices in the geometry\n */\n getSize() {\n for (const i in this.attributes) {\n const attribute = this.attributes[i];\n const buffer = attribute.buffer;\n return buffer.data.length / (attribute.stride / 4 || attribute.size);\n }\n return 0;\n }\n /** Returns the bounds of the geometry. */\n get bounds() {\n if (!this._boundsDirty)\n return this._bounds;\n this._boundsDirty = false;\n return getGeometryBounds(this, \"aPosition\", this._bounds);\n }\n /**\n * destroys the geometry.\n * @param destroyBuffers - destroy the buffers associated with this geometry\n */\n destroy(destroyBuffers = false) {\n this.emit(\"destroy\", this);\n this.removeAllListeners();\n if (destroyBuffers) {\n this.buffers.forEach((buffer) => buffer.destroy());\n }\n this.attributes = null;\n this.buffers = null;\n this.indexBuffer = null;\n this._bounds = null;\n }\n}\n\nexport { Geometry };\n//# sourceMappingURL=Geometry.mjs.map\n","\"use strict\";\nfunction getGeometryBounds(geometry, attributeId, bounds) {\n const attribute = geometry.getAttribute(attributeId);\n if (!attribute) {\n bounds.minX = 0;\n bounds.minY = 0;\n bounds.maxX = 0;\n bounds.maxY = 0;\n return bounds;\n }\n const data = attribute.buffer.data;\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n const byteSize = data.BYTES_PER_ELEMENT;\n const offset = (attribute.offset || 0) / byteSize;\n const stride = (attribute.stride || 2 * 4) / byteSize;\n for (let i = offset; i < data.length; i += stride) {\n const x = data[i];\n const y = data[i + 1];\n if (x > maxX)\n maxX = x;\n if (y > maxY)\n maxY = y;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n }\n bounds.minX = minX;\n bounds.minY = minY;\n bounds.maxX = maxX;\n bounds.maxY = maxY;\n return bounds;\n}\n\nexport { getGeometryBounds };\n//# sourceMappingURL=getGeometryBounds.mjs.map\n","import { Buffer } from '../../renderers/shared/buffer/Buffer.mjs';\nimport { BufferUsage } from '../../renderers/shared/buffer/const.mjs';\nimport { Geometry } from '../../renderers/shared/geometry/Geometry.mjs';\n\n\"use strict\";\nconst placeHolderBufferData = new Float32Array(1);\nconst placeHolderIndexData = new Uint32Array(1);\nclass BatchGeometry extends Geometry {\n constructor() {\n const vertexSize = 6;\n const attributeBuffer = new Buffer({\n data: placeHolderBufferData,\n label: \"attribute-batch-buffer\",\n usage: BufferUsage.VERTEX | BufferUsage.COPY_DST,\n shrinkToFit: false\n });\n const indexBuffer = new Buffer({\n data: placeHolderIndexData,\n label: \"index-batch-buffer\",\n usage: BufferUsage.INDEX | BufferUsage.COPY_DST,\n // | BufferUsage.STATIC,\n shrinkToFit: false\n });\n const stride = vertexSize * 4;\n super({\n attributes: {\n aPosition: {\n buffer: attributeBuffer,\n format: \"float32x2\",\n stride,\n offset: 0,\n location: 1\n },\n aUV: {\n buffer: attributeBuffer,\n format: \"float32x2\",\n stride,\n offset: 2 * 4,\n location: 3\n },\n aColor: {\n buffer: attributeBuffer,\n format: \"unorm8x4\",\n stride,\n offset: 4 * 4,\n location: 0\n },\n aTextureIdAndRound: {\n buffer: attributeBuffer,\n format: \"uint16x2\",\n stride,\n offset: 5 * 4,\n location: 2\n }\n },\n indexBuffer\n });\n }\n}\n\nexport { BatchGeometry };\n//# sourceMappingURL=BatchGeometry.mjs.map\n","\"use strict\";\nfunction transformVertices(vertices, m, offset, stride, size) {\n const a = m.a;\n const b = m.b;\n const c = m.c;\n const d = m.d;\n const tx = m.tx;\n const ty = m.ty;\n offset = offset || 0;\n stride = stride || 2;\n size = size || vertices.length / stride - offset;\n let index = offset * stride;\n for (let i = 0; i < size; i++) {\n const x = vertices[index];\n const y = vertices[index + 1];\n vertices[index] = a * x + c * y + tx;\n vertices[index + 1] = b * x + d * y + ty;\n index += stride;\n }\n}\n\nexport { transformVertices };\n//# sourceMappingURL=transformVertices.mjs.map\n","import { multiplyHexColors } from '../../container/utils/multiplyHexColors.mjs';\n\n\"use strict\";\nclass BatchableGraphics {\n constructor() {\n this.batcher = null;\n this.batch = null;\n this.applyTransform = true;\n this.roundPixels = 0;\n }\n get blendMode() {\n if (this.applyTransform) {\n return this.renderable.groupBlendMode;\n }\n return \"normal\";\n }\n packIndex(indexBuffer, index, indicesOffset) {\n const indices = this.geometryData.indices;\n for (let i = 0; i < this.indexSize; i++) {\n indexBuffer[index++] = indices[i + this.indexOffset] + indicesOffset - this.vertexOffset;\n }\n }\n packAttributes(float32View, uint32View, index, textureId) {\n const geometry = this.geometryData;\n const graphics = this.renderable;\n const positions = geometry.vertices;\n const uvs = geometry.uvs;\n const offset = this.vertexOffset * 2;\n const vertSize = (this.vertexOffset + this.vertexSize) * 2;\n const rgb = this.color;\n const bgr = rgb >> 16 | rgb & 65280 | (rgb & 255) << 16;\n if (this.applyTransform) {\n const argb = multiplyHexColors(bgr, graphics.groupColor) + (this.alpha * graphics.groupAlpha * 255 << 24);\n const wt = graphics.groupTransform;\n const textureIdAndRound = textureId << 16 | this.roundPixels & 65535;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n for (let i = offset; i < vertSize; i += 2) {\n const x = positions[i];\n const y = positions[i + 1];\n float32View[index] = a * x + c * y + tx;\n float32View[index + 1] = b * x + d * y + ty;\n float32View[index + 2] = uvs[i];\n float32View[index + 3] = uvs[i + 1];\n uint32View[index + 4] = argb;\n uint32View[index + 5] = textureIdAndRound;\n index += 6;\n }\n } else {\n const argb = bgr + (this.alpha * 255 << 24);\n for (let i = offset; i < vertSize; i += 2) {\n float32View[index] = positions[i];\n float32View[index + 1] = positions[i + 1];\n float32View[index + 2] = uvs[i];\n float32View[index + 3] = uvs[i + 1];\n uint32View[index + 4] = argb;\n uint32View[index + 5] = textureId << 16;\n index += 6;\n }\n }\n }\n // TODO rename to vertexSize\n get vertSize() {\n return this.vertexSize;\n }\n copyTo(gpuBuffer) {\n gpuBuffer.indexOffset = this.indexOffset;\n gpuBuffer.indexSize = this.indexSize;\n gpuBuffer.vertexOffset = this.vertexOffset;\n gpuBuffer.vertexSize = this.vertexSize;\n gpuBuffer.color = this.color;\n gpuBuffer.alpha = this.alpha;\n gpuBuffer.texture = this.texture;\n gpuBuffer.geometryData = this.geometryData;\n }\n reset() {\n this.applyTransform = true;\n }\n}\n\nexport { BatchableGraphics };\n//# sourceMappingURL=BatchableGraphics.mjs.map\n","\"use strict\";\nfunction multiplyHexColors(color1, color2) {\n if (color1 === 16777215 || !color2)\n return color2;\n if (color2 === 16777215 || !color1)\n return color1;\n const r1 = color1 >> 16 & 255;\n const g1 = color1 >> 8 & 255;\n const b1 = color1 & 255;\n const r2 = color2 >> 16 & 255;\n const g2 = color2 >> 8 & 255;\n const b2 = color2 & 255;\n const r = r1 * r2 / 255;\n const g = g1 * g2 / 255;\n const b = b1 * b2 / 255;\n return (r << 16) + (g << 8) + b;\n}\n\nexport { multiplyHexColors };\n//# sourceMappingURL=multiplyHexColors.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nconst buildCircle = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: \"circle\"\n },\n build(shape, points) {\n let x;\n let y;\n let dx;\n let dy;\n let rx;\n let ry;\n if (shape.type === \"circle\") {\n const circle = shape;\n x = circle.x;\n y = circle.y;\n rx = ry = circle.radius;\n dx = dy = 0;\n } else if (shape.type === \"ellipse\") {\n const ellipse = shape;\n x = ellipse.x;\n y = ellipse.y;\n rx = ellipse.halfWidth;\n ry = ellipse.halfHeight;\n dx = dy = 0;\n } else {\n const roundedRect = shape;\n const halfWidth = roundedRect.width / 2;\n const halfHeight = roundedRect.height / 2;\n x = roundedRect.x + halfWidth;\n y = roundedRect.y + halfHeight;\n rx = ry = Math.max(0, Math.min(roundedRect.radius, Math.min(halfWidth, halfHeight)));\n dx = halfWidth - rx;\n dy = halfHeight - ry;\n }\n if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {\n return points;\n }\n const n = Math.ceil(2.3 * Math.sqrt(rx + ry));\n const m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);\n if (m === 0) {\n return points;\n }\n if (n === 0) {\n points[0] = points[6] = x + dx;\n points[1] = points[3] = y + dy;\n points[2] = points[4] = x - dx;\n points[5] = points[7] = y - dy;\n return points;\n }\n let j1 = 0;\n let j2 = n * 4 + (dx ? 2 : 0) + 2;\n let j3 = j2;\n let j4 = m;\n let x0 = dx + rx;\n let y0 = dy;\n let x1 = x + x0;\n let x2 = x - x0;\n let y1 = y + y0;\n points[j1++] = x1;\n points[j1++] = y1;\n points[--j2] = y1;\n points[--j2] = x2;\n if (dy) {\n const y22 = y - y0;\n points[j3++] = x2;\n points[j3++] = y22;\n points[--j4] = y22;\n points[--j4] = x1;\n }\n for (let i = 1; i < n; i++) {\n const a = Math.PI / 2 * (i / n);\n const x02 = dx + Math.cos(a) * rx;\n const y02 = dy + Math.sin(a) * ry;\n const x12 = x + x02;\n const x22 = x - x02;\n const y12 = y + y02;\n const y22 = y - y02;\n points[j1++] = x12;\n points[j1++] = y12;\n points[--j2] = y12;\n points[--j2] = x22;\n points[j3++] = x22;\n points[j3++] = y22;\n points[--j4] = y22;\n points[--j4] = x12;\n }\n x0 = dx;\n y0 = dy + ry;\n x1 = x + x0;\n x2 = x - x0;\n y1 = y + y0;\n const y2 = y - y0;\n points[j1++] = x1;\n points[j1++] = y1;\n points[--j4] = y2;\n points[--j4] = x1;\n if (dx) {\n points[j1++] = x2;\n points[j1++] = y1;\n points[--j4] = y2;\n points[--j4] = x2;\n }\n return points;\n },\n triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {\n if (points.length === 0) {\n return;\n }\n let centerX = 0;\n let centerY = 0;\n for (let i = 0; i < points.length; i += 2) {\n centerX += points[i];\n centerY += points[i + 1];\n }\n centerX /= points.length / 2;\n centerY /= points.length / 2;\n let count = verticesOffset;\n vertices[count * verticesStride] = centerX;\n vertices[count * verticesStride + 1] = centerY;\n const centerIndex = count++;\n for (let i = 0; i < points.length; i += 2) {\n vertices[count * verticesStride] = points[i];\n vertices[count * verticesStride + 1] = points[i + 1];\n if (i > 0) {\n indices[indicesOffset++] = count;\n indices[indicesOffset++] = centerIndex;\n indices[indicesOffset++] = count - 1;\n }\n count++;\n }\n indices[indicesOffset++] = centerIndex + 1;\n indices[indicesOffset++] = centerIndex;\n indices[indicesOffset++] = count - 1;\n }\n};\nconst buildEllipse = { ...buildCircle, extension: { ...buildCircle.extension, name: \"ellipse\" } };\nconst buildRoundedRectangle = { ...buildCircle, extension: { ...buildCircle.extension, name: \"roundedRectangle\" } };\n\nexport { buildCircle, buildEllipse, buildRoundedRectangle };\n//# sourceMappingURL=buildCircle.mjs.map\n","\"use strict\";\nconst closePointEps = 1e-4;\nconst curveEps = 1e-4;\n\nexport { closePointEps, curveEps };\n//# sourceMappingURL=const.mjs.map\n","import { Point } from '../../../../maths/point/Point.mjs';\nimport { closePointEps, curveEps } from '../const.mjs';\nimport { getOrientationOfPoints } from '../utils/getOrientationOfPoints.mjs';\n\n\"use strict\";\nfunction square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {\n const ix = x - nx * innerWeight;\n const iy = y - ny * innerWeight;\n const ox = x + nx * outerWeight;\n const oy = y + ny * outerWeight;\n let exx;\n let eyy;\n if (clockwise) {\n exx = ny;\n eyy = -nx;\n } else {\n exx = -ny;\n eyy = nx;\n }\n const eix = ix + exx;\n const eiy = iy + eyy;\n const eox = ox + exx;\n const eoy = oy + eyy;\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n return 2;\n}\nfunction round(cx, cy, sx, sy, ex, ey, verts, clockwise) {\n const cx2p0x = sx - cx;\n const cy2p0y = sy - cy;\n let angle0 = Math.atan2(cx2p0x, cy2p0y);\n let angle1 = Math.atan2(ex - cx, ey - cy);\n if (clockwise && angle0 < angle1) {\n angle0 += Math.PI * 2;\n } else if (!clockwise && angle0 > angle1) {\n angle1 += Math.PI * 2;\n }\n let startAngle = angle0;\n const angleDiff = angle1 - angle0;\n const absAngleDiff = Math.abs(angleDiff);\n const radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y);\n const segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1;\n const angleInc = angleDiff / segCount;\n startAngle += angleInc;\n if (clockwise) {\n verts.push(cx, cy);\n verts.push(sx, sy);\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {\n verts.push(cx, cy);\n verts.push(\n cx + Math.sin(angle) * radius,\n cy + Math.cos(angle) * radius\n );\n }\n verts.push(cx, cy);\n verts.push(ex, ey);\n } else {\n verts.push(sx, sy);\n verts.push(cx, cy);\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {\n verts.push(\n cx + Math.sin(angle) * radius,\n cy + Math.cos(angle) * radius\n );\n verts.push(cx, cy);\n }\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n return segCount * 2;\n}\nfunction buildLine(points, lineStyle, flipAlignment, closed, vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {\n const eps = closePointEps;\n if (points.length === 0) {\n return;\n }\n const style = lineStyle;\n let alignment = style.alignment;\n if (lineStyle.alignment !== 0.5) {\n let orientation = getOrientationOfPoints(points);\n if (flipAlignment)\n orientation *= -1;\n alignment = (alignment - 0.5) * orientation + 0.5;\n }\n const firstPoint = new Point(points[0], points[1]);\n const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n const closedShape = closed;\n const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;\n if (closedShape) {\n points = points.slice();\n if (closedPath) {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n const midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n const midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n const verts = vertices;\n const length = points.length / 2;\n let indexCount = points.length;\n const indexStart = verts.length / 2;\n const width = style.width / 2;\n const widthSquared = width * width;\n const miterLimitSquared = style.miterLimit * style.miterLimit;\n let x0 = points[0];\n let y0 = points[1];\n let x1 = points[2];\n let y1 = points[3];\n let x2 = 0;\n let y2 = 0;\n let perpX = -(y0 - y1);\n let perpY = x0 - x1;\n let perp1x = 0;\n let perp1y = 0;\n let dist = Math.sqrt(perpX * perpX + perpY * perpY);\n perpX /= dist;\n perpY /= dist;\n perpX *= width;\n perpY *= width;\n const ratio = alignment;\n const innerWeight = (1 - ratio) * 2;\n const outerWeight = ratio * 2;\n if (!closedShape) {\n if (style.cap === \"round\") {\n indexCount += round(\n x0 - perpX * (innerWeight - outerWeight) * 0.5,\n y0 - perpY * (innerWeight - outerWeight) * 0.5,\n x0 - perpX * innerWeight,\n y0 - perpY * innerWeight,\n x0 + perpX * outerWeight,\n y0 + perpY * outerWeight,\n verts,\n true\n ) + 2;\n } else if (style.cap === \"square\") {\n indexCount += square(x0, y0, perpX, perpY, innerWeight, outerWeight, true, verts);\n }\n }\n verts.push(\n x0 - perpX * innerWeight,\n y0 - perpY * innerWeight\n );\n verts.push(\n x0 + perpX * outerWeight,\n y0 + perpY * outerWeight\n );\n for (let i = 1; i < length - 1; ++i) {\n x0 = points[(i - 1) * 2];\n y0 = points[(i - 1) * 2 + 1];\n x1 = points[i * 2];\n y1 = points[i * 2 + 1];\n x2 = points[(i + 1) * 2];\n y2 = points[(i + 1) * 2 + 1];\n perpX = -(y0 - y1);\n perpY = x0 - x1;\n dist = Math.sqrt(perpX * perpX + perpY * perpY);\n perpX /= dist;\n perpY /= dist;\n perpX *= width;\n perpY *= width;\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n const dx0 = x1 - x0;\n const dy0 = y0 - y1;\n const dx1 = x1 - x2;\n const dy1 = y2 - y1;\n const dot = dx0 * dx1 + dy0 * dy1;\n const cross = dy0 * dx1 - dy1 * dx0;\n const clockwise = cross < 0;\n if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {\n verts.push(\n x1 - perpX * innerWeight,\n y1 - perpY * innerWeight\n );\n verts.push(\n x1 + perpX * outerWeight,\n y1 + perpY * outerWeight\n );\n if (dot >= 0) {\n if (style.join === \"round\") {\n indexCount += round(\n x1,\n y1,\n x1 - perpX * innerWeight,\n y1 - perpY * innerWeight,\n x1 - perp1x * innerWeight,\n y1 - perp1y * innerWeight,\n verts,\n false\n ) + 4;\n } else {\n indexCount += 2;\n }\n verts.push(\n x1 - perp1x * outerWeight,\n y1 - perp1y * outerWeight\n );\n verts.push(\n x1 + perp1x * innerWeight,\n y1 + perp1y * innerWeight\n );\n }\n continue;\n }\n const c1 = (-perpX + x0) * (-perpY + y1) - (-perpX + x1) * (-perpY + y0);\n const c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2);\n const px = (dx0 * c2 - dx1 * c1) / cross;\n const py = (dy1 * c1 - dy0 * c2) / cross;\n const pDist = (px - x1) * (px - x1) + (py - y1) * (py - y1);\n const imx = x1 + (px - x1) * innerWeight;\n const imy = y1 + (py - y1) * innerWeight;\n const omx = x1 - (px - x1) * outerWeight;\n const omy = y1 - (py - y1) * outerWeight;\n const smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1);\n const insideWeight = clockwise ? innerWeight : outerWeight;\n const smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;\n const insideMiterOk = pDist <= smallerInsideDiagonalSq;\n if (insideMiterOk) {\n if (style.join === \"bevel\" || pDist / widthSquared > miterLimitSquared) {\n if (clockwise) {\n verts.push(imx, imy);\n verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);\n verts.push(imx, imy);\n verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);\n } else {\n verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);\n verts.push(omx, omy);\n verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);\n verts.push(omx, omy);\n }\n indexCount += 2;\n } else if (style.join === \"round\") {\n if (clockwise) {\n verts.push(imx, imy);\n verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);\n indexCount += round(\n x1,\n y1,\n x1 + perpX * outerWeight,\n y1 + perpY * outerWeight,\n x1 + perp1x * outerWeight,\n y1 + perp1y * outerWeight,\n verts,\n true\n ) + 4;\n verts.push(imx, imy);\n verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);\n } else {\n verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);\n verts.push(omx, omy);\n indexCount += round(\n x1,\n y1,\n x1 - perpX * innerWeight,\n y1 - perpY * innerWeight,\n x1 - perp1x * innerWeight,\n y1 - perp1y * innerWeight,\n verts,\n false\n ) + 4;\n verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);\n verts.push(omx, omy);\n }\n } else {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n } else {\n verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);\n verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);\n if (style.join === \"round\") {\n if (clockwise) {\n indexCount += round(\n x1,\n y1,\n x1 + perpX * outerWeight,\n y1 + perpY * outerWeight,\n x1 + perp1x * outerWeight,\n y1 + perp1y * outerWeight,\n verts,\n true\n ) + 2;\n } else {\n indexCount += round(\n x1,\n y1,\n x1 - perpX * innerWeight,\n y1 - perpY * innerWeight,\n x1 - perp1x * innerWeight,\n y1 - perp1y * innerWeight,\n verts,\n false\n ) + 2;\n }\n } else if (style.join === \"miter\" && pDist / widthSquared <= miterLimitSquared) {\n if (clockwise) {\n verts.push(omx, omy);\n verts.push(omx, omy);\n } else {\n verts.push(imx, imy);\n verts.push(imx, imy);\n }\n indexCount += 2;\n }\n verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);\n verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);\n indexCount += 2;\n }\n }\n x0 = points[(length - 2) * 2];\n y0 = points[(length - 2) * 2 + 1];\n x1 = points[(length - 1) * 2];\n y1 = points[(length - 1) * 2 + 1];\n perpX = -(y0 - y1);\n perpY = x0 - x1;\n dist = Math.sqrt(perpX * perpX + perpY * perpY);\n perpX /= dist;\n perpY /= dist;\n perpX *= width;\n perpY *= width;\n verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);\n verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);\n if (!closedShape) {\n if (style.cap === \"round\") {\n indexCount += round(\n x1 - perpX * (innerWeight - outerWeight) * 0.5,\n y1 - perpY * (innerWeight - outerWeight) * 0.5,\n x1 - perpX * innerWeight,\n y1 - perpY * innerWeight,\n x1 + perpX * outerWeight,\n y1 + perpY * outerWeight,\n verts,\n false\n ) + 2;\n } else if (style.cap === \"square\") {\n indexCount += square(x1, y1, perpX, perpY, innerWeight, outerWeight, false, verts);\n }\n }\n const eps2 = curveEps * curveEps;\n for (let i = indexStart; i < indexCount + indexStart - 2; ++i) {\n x0 = verts[i * 2];\n y0 = verts[i * 2 + 1];\n x1 = verts[(i + 1) * 2];\n y1 = verts[(i + 1) * 2 + 1];\n x2 = verts[(i + 2) * 2];\n y2 = verts[(i + 2) * 2 + 1];\n if (Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) {\n continue;\n }\n indices.push(i, i + 1, i + 2);\n }\n}\n\nexport { buildLine };\n//# sourceMappingURL=buildLine.mjs.map\n","import earcut from 'earcut';\n\n\"use strict\";\nfunction triangulateWithHoles(points, holes, vertices, verticesStride, verticesOffset, indices, indicesOffset) {\n const triangles = earcut(points, holes, 2);\n if (!triangles) {\n return;\n }\n for (let i = 0; i < triangles.length; i += 3) {\n indices[indicesOffset++] = triangles[i] + verticesOffset;\n indices[indicesOffset++] = triangles[i + 1] + verticesOffset;\n indices[indicesOffset++] = triangles[i + 2] + verticesOffset;\n }\n let index = verticesOffset * verticesStride;\n for (let i = 0; i < points.length; i += 2) {\n vertices[index] = points[i];\n vertices[index + 1] = points[i + 1];\n index += verticesStride;\n }\n}\n\nexport { triangulateWithHoles };\n//# sourceMappingURL=triangulateWithHoles.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { triangulateWithHoles } from '../utils/triangulateWithHoles.mjs';\n\n\"use strict\";\nconst emptyArray = [];\nconst buildPolygon = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: \"polygon\"\n },\n build(shape, points) {\n for (let i = 0; i < shape.points.length; i++) {\n points[i] = shape.points[i];\n }\n return points;\n },\n triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {\n triangulateWithHoles(points, emptyArray, vertices, verticesStride, verticesOffset, indices, indicesOffset);\n }\n};\n\nexport { buildPolygon };\n//# sourceMappingURL=buildPolygon.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nconst buildRectangle = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: \"rectangle\"\n },\n build(shape, points) {\n const rectData = shape;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n if (!(width >= 0 && height >= 0)) {\n return points;\n }\n points[0] = x;\n points[1] = y;\n points[2] = x + width;\n points[3] = y;\n points[4] = x + width;\n points[5] = y + height;\n points[6] = x;\n points[7] = y + height;\n return points;\n },\n triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {\n let count = 0;\n verticesOffset *= verticesStride;\n vertices[verticesOffset + count] = points[0];\n vertices[verticesOffset + count + 1] = points[1];\n count += verticesStride;\n vertices[verticesOffset + count] = points[2];\n vertices[verticesOffset + count + 1] = points[3];\n count += verticesStride;\n vertices[verticesOffset + count] = points[6];\n vertices[verticesOffset + count + 1] = points[7];\n count += verticesStride;\n vertices[verticesOffset + count] = points[4];\n vertices[verticesOffset + count + 1] = points[5];\n count += verticesStride;\n const verticesIndex = verticesOffset / verticesStride;\n indices[indicesOffset++] = verticesIndex;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 2;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 3;\n indices[indicesOffset++] = verticesIndex + 2;\n }\n};\n\nexport { buildRectangle };\n//# sourceMappingURL=buildRectangle.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nconst buildTriangle = {\n extension: {\n type: ExtensionType.ShapeBuilder,\n name: \"triangle\"\n },\n build(shape, points) {\n points[0] = shape.x;\n points[1] = shape.y;\n points[2] = shape.x2;\n points[3] = shape.y2;\n points[4] = shape.x3;\n points[5] = shape.y3;\n return points;\n },\n triangulate(points, vertices, verticesStride, verticesOffset, indices, indicesOffset) {\n let count = 0;\n verticesOffset *= verticesStride;\n vertices[verticesOffset + count] = points[0];\n vertices[verticesOffset + count + 1] = points[1];\n count += verticesStride;\n vertices[verticesOffset + count] = points[2];\n vertices[verticesOffset + count + 1] = points[3];\n count += verticesStride;\n vertices[verticesOffset + count] = points[4];\n vertices[verticesOffset + count + 1] = points[5];\n const verticesIndex = verticesOffset / verticesStride;\n indices[indicesOffset++] = verticesIndex;\n indices[indicesOffset++] = verticesIndex + 1;\n indices[indicesOffset++] = verticesIndex + 2;\n }\n};\n\nexport { buildTriangle };\n//# sourceMappingURL=buildTriangle.mjs.map\n","import { extensions, ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { buildUvs, buildSimpleUvs } from '../../../../rendering/renderers/shared/geometry/utils/buildUvs.mjs';\nimport { transformVertices } from '../../../../rendering/renderers/shared/geometry/utils/transformVertices.mjs';\nimport { Texture } from '../../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { BigPool } from '../../../../utils/pool/PoolGroup.mjs';\nimport { BatchableGraphics } from '../BatchableGraphics.mjs';\nimport { buildCircle, buildEllipse, buildRoundedRectangle } from '../buildCommands/buildCircle.mjs';\nimport { buildLine } from '../buildCommands/buildLine.mjs';\nimport { buildPolygon } from '../buildCommands/buildPolygon.mjs';\nimport { buildRectangle } from '../buildCommands/buildRectangle.mjs';\nimport { buildTriangle } from '../buildCommands/buildTriangle.mjs';\nimport { triangulateWithHoles } from './triangulateWithHoles.mjs';\n\n\"use strict\";\nconst shapeBuilders = {};\nextensions.handleByMap(ExtensionType.ShapeBuilder, shapeBuilders);\nextensions.add(buildRectangle, buildPolygon, buildTriangle, buildCircle, buildEllipse, buildRoundedRectangle);\nconst tempRect = new Rectangle();\nfunction buildContextBatches(context, gpuContext) {\n const { geometryData, batches } = gpuContext;\n batches.length = 0;\n geometryData.indices.length = 0;\n geometryData.vertices.length = 0;\n geometryData.uvs.length = 0;\n for (let i = 0; i < context.instructions.length; i++) {\n const instruction = context.instructions[i];\n if (instruction.action === \"texture\") {\n addTextureToGeometryData(instruction.data, batches, geometryData);\n } else if (instruction.action === \"fill\" || instruction.action === \"stroke\") {\n const isStroke = instruction.action === \"stroke\";\n const shapePath = instruction.data.path.shapePath;\n const style = instruction.data.style;\n const hole = instruction.data.hole;\n if (isStroke && hole) {\n addShapePathToGeometryData(hole.shapePath, style, null, true, batches, geometryData);\n }\n addShapePathToGeometryData(shapePath, style, hole, isStroke, batches, geometryData);\n }\n }\n}\nfunction addTextureToGeometryData(data, batches, geometryData) {\n const { vertices, uvs, indices } = geometryData;\n const indexOffset = indices.length;\n const vertOffset = vertices.length / 2;\n const points = [];\n const build = shapeBuilders.rectangle;\n const rect = tempRect;\n const texture = data.image;\n rect.x = data.dx;\n rect.y = data.dy;\n rect.width = data.dw;\n rect.height = data.dh;\n const matrix = data.transform;\n build.build(rect, points);\n if (matrix) {\n transformVertices(points, matrix);\n }\n build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);\n const textureUvs = texture.uvs;\n uvs.push(\n textureUvs.x0,\n textureUvs.y0,\n textureUvs.x1,\n textureUvs.y1,\n textureUvs.x3,\n textureUvs.y3,\n textureUvs.x2,\n textureUvs.y2\n );\n const graphicsBatch = BigPool.get(BatchableGraphics);\n graphicsBatch.indexOffset = indexOffset;\n graphicsBatch.indexSize = indices.length - indexOffset;\n graphicsBatch.vertexOffset = vertOffset;\n graphicsBatch.vertexSize = vertices.length / 2 - vertOffset;\n graphicsBatch.color = data.style;\n graphicsBatch.alpha = data.alpha;\n graphicsBatch.texture = texture;\n graphicsBatch.geometryData = geometryData;\n batches.push(graphicsBatch);\n}\nfunction addShapePathToGeometryData(shapePath, style, hole, isStroke, batches, geometryData) {\n const { vertices, uvs, indices } = geometryData;\n const lastIndex = shapePath.shapePrimitives.length - 1;\n shapePath.shapePrimitives.forEach(({ shape, transform: matrix }, i) => {\n const indexOffset = indices.length;\n const vertOffset = vertices.length / 2;\n const points = [];\n const build = shapeBuilders[shape.type];\n build.build(shape, points);\n if (matrix) {\n transformVertices(points, matrix);\n }\n if (!isStroke) {\n if (hole && lastIndex === i) {\n if (lastIndex !== 0) {\n console.warn(\"[Pixi Graphics] only the last shape have be cut out\");\n }\n const holeIndices = [];\n const otherPoints = points.slice();\n const holeArrays = getHoleArrays(hole.shapePath);\n holeArrays.forEach((holePoints) => {\n holeIndices.push(otherPoints.length / 2);\n otherPoints.push(...holePoints);\n });\n triangulateWithHoles(otherPoints, holeIndices, vertices, 2, vertOffset, indices, indexOffset);\n } else {\n build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);\n }\n } else {\n const close = shape.closePath ?? true;\n const lineStyle = style;\n buildLine(points, lineStyle, false, close, vertices, 2, vertOffset, indices, indexOffset);\n }\n const uvsOffset = uvs.length / 2;\n const texture = style.texture;\n if (texture !== Texture.WHITE) {\n const textureMatrix = style.matrix;\n if (textureMatrix) {\n if (matrix) {\n textureMatrix.append(matrix.clone().invert());\n }\n buildUvs(vertices, 2, vertOffset, uvs, uvsOffset, 2, vertices.length / 2 - vertOffset, textureMatrix);\n }\n } else {\n buildSimpleUvs(uvs, uvsOffset, 2, vertices.length / 2 - vertOffset);\n }\n const graphicsBatch = BigPool.get(BatchableGraphics);\n graphicsBatch.indexOffset = indexOffset;\n graphicsBatch.indexSize = indices.length - indexOffset;\n graphicsBatch.vertexOffset = vertOffset;\n graphicsBatch.vertexSize = vertices.length / 2 - vertOffset;\n graphicsBatch.color = style.color;\n graphicsBatch.alpha = style.alpha;\n graphicsBatch.texture = texture;\n graphicsBatch.geometryData = geometryData;\n batches.push(graphicsBatch);\n });\n}\nfunction getHoleArrays(shape) {\n if (!shape)\n return [];\n const holePrimitives = shape.shapePrimitives;\n const holeArrays = [];\n for (let k = 0; k < holePrimitives.length; k++) {\n const holePrimitive = holePrimitives[k].shape;\n const holePoints = [];\n const holeBuilder = shapeBuilders[holePrimitive.type];\n holeBuilder.build(holePrimitive, holePoints);\n holeArrays.push(holePoints);\n }\n return holeArrays;\n}\n\nexport { buildContextBatches, shapeBuilders };\n//# sourceMappingURL=buildContextBatches.mjs.map\n","\"use strict\";\nfunction getOrientationOfPoints(points) {\n const m = points.length;\n if (m < 6) {\n return 1;\n }\n let area = 0;\n for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {\n const x2 = points[i];\n const y2 = points[i + 1];\n area += (x2 - x1) * (y2 + y1);\n x1 = x2;\n y1 = y2;\n }\n if (area < 0) {\n return -1;\n }\n return 1;\n}\n\nexport { getOrientationOfPoints };\n//# sourceMappingURL=getOrientationOfPoints.mjs.map\n","\"use strict\";\nfunction buildUvs(vertices, verticesStride, verticesOffset, uvs, uvsOffset, uvsStride, size, matrix = null) {\n let index = 0;\n verticesOffset *= verticesStride;\n uvsOffset *= uvsStride;\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n while (index < size) {\n const x = vertices[verticesOffset];\n const y = vertices[verticesOffset + 1];\n uvs[uvsOffset] = a * x + c * y + tx;\n uvs[uvsOffset + 1] = b * x + d * y + ty;\n uvsOffset += uvsStride;\n verticesOffset += verticesStride;\n index++;\n }\n}\nfunction buildSimpleUvs(uvs, uvsOffset, uvsStride, size) {\n let index = 0;\n uvsOffset *= uvsStride;\n while (index < size) {\n uvs[uvsOffset] = 0;\n uvs[uvsOffset + 1] = 0;\n uvsOffset += uvsStride;\n index++;\n }\n}\n\nexport { buildSimpleUvs, buildUvs };\n//# sourceMappingURL=buildUvs.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { getTextureBatchBindGroup } from '../../../rendering/batcher/gpu/getTextureBatchBindGroup.mjs';\nimport { Batcher } from '../../../rendering/batcher/shared/Batcher.mjs';\nimport { BatchGeometry } from '../../../rendering/batcher/shared/BatchGeometry.mjs';\nimport { InstructionSet } from '../../../rendering/renderers/shared/instructions/InstructionSet.mjs';\nimport { BigPool } from '../../../utils/pool/PoolGroup.mjs';\nimport { buildContextBatches } from './utils/buildContextBatches.mjs';\n\n\"use strict\";\nclass GpuGraphicsContext {\n constructor() {\n this.batcher = new Batcher();\n this.batches = [];\n this.geometryData = {\n vertices: [],\n uvs: [],\n indices: []\n };\n }\n}\nclass GraphicsContextRenderData {\n constructor() {\n this.geometry = new BatchGeometry();\n this.instructions = new InstructionSet();\n }\n init() {\n this.instructions.reset();\n }\n}\nconst _GraphicsContextSystem = class _GraphicsContextSystem {\n constructor() {\n // the root context batches, used to either make a batch or geometry\n // all graphics use this as a base\n this._gpuContextHash = {};\n // used for non-batchable graphics\n this._graphicsDataContextHash = /* @__PURE__ */ Object.create(null);\n }\n /**\n * Runner init called, update the default options\n * @ignore\n */\n init(options) {\n _GraphicsContextSystem.defaultOptions.bezierSmoothness = options?.bezierSmoothness ?? _GraphicsContextSystem.defaultOptions.bezierSmoothness;\n }\n getContextRenderData(context) {\n return this._graphicsDataContextHash[context.uid] || this._initContextRenderData(context);\n }\n // Context management functions\n updateGpuContext(context) {\n let gpuContext = this._gpuContextHash[context.uid] || this._initContext(context);\n if (context.dirty) {\n if (gpuContext) {\n this._cleanGraphicsContextData(context);\n } else {\n gpuContext = this._initContext(context);\n }\n buildContextBatches(context, gpuContext);\n const batchMode = context.batchMode;\n if (context.customShader || batchMode === \"no-batch\") {\n gpuContext.isBatchable = false;\n } else if (batchMode === \"auto\") {\n gpuContext.isBatchable = gpuContext.geometryData.vertices.length < 400;\n }\n context.dirty = false;\n }\n return gpuContext;\n }\n getGpuContext(context) {\n return this._gpuContextHash[context.uid] || this._initContext(context);\n }\n _initContextRenderData(context) {\n const graphicsData = BigPool.get(GraphicsContextRenderData);\n const { batches, geometryData, batcher } = this._gpuContextHash[context.uid];\n const vertexSize = geometryData.vertices.length;\n const indexSize = geometryData.indices.length;\n for (let i = 0; i < batches.length; i++) {\n batches[i].applyTransform = false;\n }\n batcher.ensureAttributeBuffer(vertexSize);\n batcher.ensureIndexBuffer(indexSize);\n batcher.begin();\n for (let i = 0; i < batches.length; i++) {\n const batch = batches[i];\n batcher.add(batch);\n }\n batcher.finish(graphicsData.instructions);\n const geometry = graphicsData.geometry;\n geometry.indexBuffer.setDataWithSize(batcher.indexBuffer, batcher.indexSize, true);\n geometry.buffers[0].setDataWithSize(batcher.attributeBuffer.float32View, batcher.attributeSize, true);\n const drawBatches = batcher.batches;\n for (let i = 0; i < drawBatches.length; i++) {\n const batch = drawBatches[i];\n batch.bindGroup = getTextureBatchBindGroup(batch.textures.textures, batch.textures.count);\n }\n this._graphicsDataContextHash[context.uid] = graphicsData;\n return graphicsData;\n }\n _initContext(context) {\n const gpuContext = new GpuGraphicsContext();\n gpuContext.context = context;\n this._gpuContextHash[context.uid] = gpuContext;\n context.on(\"destroy\", this.onGraphicsContextDestroy, this);\n return this._gpuContextHash[context.uid];\n }\n onGraphicsContextDestroy(context) {\n this._cleanGraphicsContextData(context);\n context.off(\"destroy\", this.onGraphicsContextDestroy, this);\n this._gpuContextHash[context.uid] = null;\n }\n _cleanGraphicsContextData(context) {\n const gpuContext = this._gpuContextHash[context.uid];\n if (!gpuContext.isBatchable) {\n if (this._graphicsDataContextHash[context.uid]) {\n BigPool.return(this.getContextRenderData(context));\n this._graphicsDataContextHash[context.uid] = null;\n }\n }\n if (gpuContext.batches) {\n gpuContext.batches.forEach((batch) => {\n BigPool.return(batch);\n });\n }\n }\n destroy() {\n for (const i in this._gpuContextHash) {\n if (this._gpuContextHash[i]) {\n this.onGraphicsContextDestroy(this._gpuContextHash[i].context);\n }\n }\n }\n};\n/** @ignore */\n_GraphicsContextSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"graphicsContext\"\n};\n/** The default options for the GraphicsContextSystem. */\n_GraphicsContextSystem.defaultOptions = {\n /**\n * A value from 0 to 1 that controls the smoothness of bezier curves (the higher the smoother)\n * @default 0.5\n */\n bezierSmoothness: 0.5\n};\nlet GraphicsContextSystem = _GraphicsContextSystem;\n\nexport { GpuGraphicsContext, GraphicsContextRenderData, GraphicsContextSystem };\n//# sourceMappingURL=GraphicsContextSystem.mjs.map\n","import { GraphicsContextSystem } from '../GraphicsContextSystem.mjs';\n\n\"use strict\";\nconst RECURSION_LIMIT = 8;\nconst FLT_EPSILON = 11920929e-14;\nconst PATH_DISTANCE_EPSILON = 1;\nconst curveAngleToleranceEpsilon = 0.01;\nconst mAngleTolerance = 0;\nconst mCuspLimit = 0;\nfunction buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {\n const scale = 1;\n const smoothing = Math.min(\n 0.99,\n // a value of 1.0 actually inverts smoothing, so we cap it at 0.99\n Math.max(0, smoothness ?? GraphicsContextSystem.defaultOptions.bezierSmoothness)\n );\n let distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;\n distanceTolerance *= distanceTolerance;\n begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);\n return points;\n}\nfunction begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance) {\n recursive(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance, 0);\n points.push(eX, eY);\n}\nfunction recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, level) {\n if (level > RECURSION_LIMIT) {\n return;\n }\n const pi = Math.PI;\n const x12 = (x1 + x2) / 2;\n const y12 = (y1 + y2) / 2;\n const x23 = (x2 + x3) / 2;\n const y23 = (y2 + y3) / 2;\n const x34 = (x3 + x4) / 2;\n const y34 = (y3 + y4) / 2;\n const x123 = (x12 + x23) / 2;\n const y123 = (y12 + y23) / 2;\n const x234 = (x23 + x34) / 2;\n const y234 = (y23 + y34) / 2;\n const x1234 = (x123 + x234) / 2;\n const y1234 = (y123 + y234) / 2;\n if (level > 0) {\n let dx = x4 - x1;\n let dy = y4 - y1;\n const d2 = Math.abs((x2 - x4) * dy - (y2 - y4) * dx);\n const d3 = Math.abs((x3 - x4) * dy - (y3 - y4) * dx);\n let da1;\n let da2;\n if (d2 > FLT_EPSILON && d3 > FLT_EPSILON) {\n if ((d2 + d3) * (d2 + d3) <= distanceTolerance * (dx * dx + dy * dy)) {\n if (mAngleTolerance < curveAngleToleranceEpsilon) {\n points.push(x1234, y1234);\n return;\n }\n const a23 = Math.atan2(y3 - y2, x3 - x2);\n da1 = Math.abs(a23 - Math.atan2(y2 - y1, x2 - x1));\n da2 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - a23);\n if (da1 >= pi)\n da1 = 2 * pi - da1;\n if (da2 >= pi)\n da2 = 2 * pi - da2;\n if (da1 + da2 < mAngleTolerance) {\n points.push(x1234, y1234);\n return;\n }\n if (mCuspLimit !== 0) {\n if (da1 > mCuspLimit) {\n points.push(x2, y2);\n return;\n }\n if (da2 > mCuspLimit) {\n points.push(x3, y3);\n return;\n }\n }\n }\n } else if (d2 > FLT_EPSILON) {\n if (d2 * d2 <= distanceTolerance * (dx * dx + dy * dy)) {\n if (mAngleTolerance < curveAngleToleranceEpsilon) {\n points.push(x1234, y1234);\n return;\n }\n da1 = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));\n if (da1 >= pi)\n da1 = 2 * pi - da1;\n if (da1 < mAngleTolerance) {\n points.push(x2, y2);\n points.push(x3, y3);\n return;\n }\n if (mCuspLimit !== 0) {\n if (da1 > mCuspLimit) {\n points.push(x2, y2);\n return;\n }\n }\n }\n } else if (d3 > FLT_EPSILON) {\n if (d3 * d3 <= distanceTolerance * (dx * dx + dy * dy)) {\n if (mAngleTolerance < curveAngleToleranceEpsilon) {\n points.push(x1234, y1234);\n return;\n }\n da1 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - Math.atan2(y3 - y2, x3 - x2));\n if (da1 >= pi)\n da1 = 2 * pi - da1;\n if (da1 < mAngleTolerance) {\n points.push(x2, y2);\n points.push(x3, y3);\n return;\n }\n if (mCuspLimit !== 0) {\n if (da1 > mCuspLimit) {\n points.push(x3, y3);\n return;\n }\n }\n }\n } else {\n dx = x1234 - (x1 + x4) / 2;\n dy = y1234 - (y1 + y4) / 2;\n if (dx * dx + dy * dy <= distanceTolerance) {\n points.push(x1234, y1234);\n return;\n }\n }\n }\n recursive(x1, y1, x12, y12, x123, y123, x1234, y1234, points, distanceTolerance, level + 1);\n recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);\n}\n\nexport { buildAdaptiveBezier };\n//# sourceMappingURL=buildAdaptiveBezier.mjs.map\n","import { GraphicsContextSystem } from '../GraphicsContextSystem.mjs';\n\n\"use strict\";\nconst RECURSION_LIMIT = 8;\nconst FLT_EPSILON = 11920929e-14;\nconst PATH_DISTANCE_EPSILON = 1;\nconst curveAngleToleranceEpsilon = 0.01;\nconst mAngleTolerance = 0;\nfunction buildAdaptiveQuadratic(points, sX, sY, cp1x, cp1y, eX, eY, smoothness) {\n const scale = 1;\n const smoothing = Math.min(\n 0.99,\n // a value of 1.0 actually inverts smoothing, so we cap it at 0.99\n Math.max(0, smoothness ?? GraphicsContextSystem.defaultOptions.bezierSmoothness)\n );\n let distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;\n distanceTolerance *= distanceTolerance;\n begin(sX, sY, cp1x, cp1y, eX, eY, points, distanceTolerance);\n return points;\n}\nfunction begin(sX, sY, cp1x, cp1y, eX, eY, points, distanceTolerance) {\n recursive(points, sX, sY, cp1x, cp1y, eX, eY, distanceTolerance, 0);\n points.push(eX, eY);\n}\nfunction recursive(points, x1, y1, x2, y2, x3, y3, distanceTolerance, level) {\n if (level > RECURSION_LIMIT) {\n return;\n }\n const pi = Math.PI;\n const x12 = (x1 + x2) / 2;\n const y12 = (y1 + y2) / 2;\n const x23 = (x2 + x3) / 2;\n const y23 = (y2 + y3) / 2;\n const x123 = (x12 + x23) / 2;\n const y123 = (y12 + y23) / 2;\n let dx = x3 - x1;\n let dy = y3 - y1;\n const d = Math.abs((x2 - x3) * dy - (y2 - y3) * dx);\n if (d > FLT_EPSILON) {\n if (d * d <= distanceTolerance * (dx * dx + dy * dy)) {\n if (mAngleTolerance < curveAngleToleranceEpsilon) {\n points.push(x123, y123);\n return;\n }\n let da = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));\n if (da >= pi)\n da = 2 * pi - da;\n if (da < mAngleTolerance) {\n points.push(x123, y123);\n return;\n }\n }\n } else {\n dx = x123 - (x1 + x3) / 2;\n dy = y123 - (y1 + y3) / 2;\n if (dx * dx + dy * dy <= distanceTolerance) {\n points.push(x123, y123);\n return;\n }\n }\n recursive(points, x1, y1, x12, y12, x123, y123, distanceTolerance, level + 1);\n recursive(points, x123, y123, x23, y23, x3, y3, distanceTolerance, level + 1);\n}\n\nexport { buildAdaptiveQuadratic };\n//# sourceMappingURL=buildAdaptiveQuadratic.mjs.map\n","\"use strict\";\nfunction buildArc(points, x, y, radius, start, end, clockwise, steps) {\n let dist = Math.abs(start - end);\n if (!clockwise && start > end) {\n dist = 2 * Math.PI - dist;\n } else if (clockwise && end > start) {\n dist = 2 * Math.PI - dist;\n }\n steps = steps || Math.max(6, Math.floor(6 * Math.pow(radius, 1 / 3) * (dist / Math.PI)));\n steps = Math.max(steps, 3);\n let f = dist / steps;\n let t = start;\n f *= clockwise ? -1 : 1;\n for (let i = 0; i < steps + 1; i++) {\n const cs = Math.cos(t);\n const sn = Math.sin(t);\n const nx = x + cs * radius;\n const ny = y + sn * radius;\n points.push(nx, ny);\n t += f;\n }\n}\n\nexport { buildArc };\n//# sourceMappingURL=buildArc.mjs.map\n","import { buildAdaptiveBezier } from './buildAdaptiveBezier.mjs';\n\n\"use strict\";\nconst TAU = Math.PI * 2;\nconst out = {\n centerX: 0,\n centerY: 0,\n ang1: 0,\n ang2: 0\n};\nconst mapToEllipse = ({ x, y }, rx, ry, cosPhi, sinPhi, centerX, centerY, out2) => {\n x *= rx;\n y *= ry;\n const xp = cosPhi * x - sinPhi * y;\n const yp = sinPhi * x + cosPhi * y;\n out2.x = xp + centerX;\n out2.y = yp + centerY;\n return out2;\n};\nfunction approxUnitArc(ang1, ang2) {\n const a1 = ang2 === -1.5707963267948966 ? -0.551915024494 : 4 / 3 * Math.tan(ang2 / 4);\n const a = ang2 === 1.5707963267948966 ? 0.551915024494 : a1;\n const x1 = Math.cos(ang1);\n const y1 = Math.sin(ang1);\n const x2 = Math.cos(ang1 + ang2);\n const y2 = Math.sin(ang1 + ang2);\n return [\n {\n x: x1 - y1 * a,\n y: y1 + x1 * a\n },\n {\n x: x2 + y2 * a,\n y: y2 - x2 * a\n },\n {\n x: x2,\n y: y2\n }\n ];\n}\nconst vectorAngle = (ux, uy, vx, vy) => {\n const sign = ux * vy - uy * vx < 0 ? -1 : 1;\n let dot = ux * vx + uy * vy;\n if (dot > 1) {\n dot = 1;\n }\n if (dot < -1) {\n dot = -1;\n }\n return sign * Math.acos(dot);\n};\nconst getArcCenter = (px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinPhi, cosPhi, pxp, pyp, out2) => {\n const rxSq = Math.pow(rx, 2);\n const rySq = Math.pow(ry, 2);\n const pxpSq = Math.pow(pxp, 2);\n const pypSq = Math.pow(pyp, 2);\n let radicant = rxSq * rySq - rxSq * pypSq - rySq * pxpSq;\n if (radicant < 0) {\n radicant = 0;\n }\n radicant /= rxSq * pypSq + rySq * pxpSq;\n radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1);\n const centerXp = radicant * rx / ry * pyp;\n const centerYp = radicant * -ry / rx * pxp;\n const centerX = cosPhi * centerXp - sinPhi * centerYp + (px + cx) / 2;\n const centerY = sinPhi * centerXp + cosPhi * centerYp + (py + cy) / 2;\n const vx1 = (pxp - centerXp) / rx;\n const vy1 = (pyp - centerYp) / ry;\n const vx2 = (-pxp - centerXp) / rx;\n const vy2 = (-pyp - centerYp) / ry;\n const ang1 = vectorAngle(1, 0, vx1, vy1);\n let ang2 = vectorAngle(vx1, vy1, vx2, vy2);\n if (sweepFlag === 0 && ang2 > 0) {\n ang2 -= TAU;\n }\n if (sweepFlag === 1 && ang2 < 0) {\n ang2 += TAU;\n }\n out2.centerX = centerX;\n out2.centerY = centerY;\n out2.ang1 = ang1;\n out2.ang2 = ang2;\n};\nfunction buildArcToSvg(points, px, py, cx, cy, rx, ry, xAxisRotation = 0, largeArcFlag = 0, sweepFlag = 0) {\n if (rx === 0 || ry === 0) {\n return;\n }\n const sinPhi = Math.sin(xAxisRotation * TAU / 360);\n const cosPhi = Math.cos(xAxisRotation * TAU / 360);\n const pxp = cosPhi * (px - cx) / 2 + sinPhi * (py - cy) / 2;\n const pyp = -sinPhi * (px - cx) / 2 + cosPhi * (py - cy) / 2;\n if (pxp === 0 && pyp === 0) {\n return;\n }\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n const lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2);\n if (lambda > 1) {\n rx *= Math.sqrt(lambda);\n ry *= Math.sqrt(lambda);\n }\n getArcCenter(\n px,\n py,\n cx,\n cy,\n rx,\n ry,\n largeArcFlag,\n sweepFlag,\n sinPhi,\n cosPhi,\n pxp,\n pyp,\n out\n );\n let { ang1, ang2 } = out;\n const { centerX, centerY } = out;\n let ratio = Math.abs(ang2) / (TAU / 4);\n if (Math.abs(1 - ratio) < 1e-7) {\n ratio = 1;\n }\n const segments = Math.max(Math.ceil(ratio), 1);\n ang2 /= segments;\n let lastX = points[points.length - 2];\n let lastY = points[points.length - 1];\n const outCurvePoint = { x: 0, y: 0 };\n for (let i = 0; i < segments; i++) {\n const curve = approxUnitArc(ang1, ang2);\n const { x: x1, y: y1 } = mapToEllipse(curve[0], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);\n const { x: x2, y: y2 } = mapToEllipse(curve[1], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);\n const { x, y } = mapToEllipse(curve[2], rx, ry, cosPhi, sinPhi, centerX, centerY, outCurvePoint);\n buildAdaptiveBezier(\n points,\n lastX,\n lastY,\n x1,\n y1,\n x2,\n y2,\n x,\n y\n );\n lastX = x;\n lastY = y;\n ang1 += ang2;\n }\n}\n\nexport { buildArcToSvg };\n//# sourceMappingURL=buildArcToSvg.mjs.map\n","import { Circle } from '../../../../maths/shapes/Circle.mjs';\nimport { Ellipse } from '../../../../maths/shapes/Ellipse.mjs';\nimport { Polygon } from '../../../../maths/shapes/Polygon.mjs';\nimport { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { RoundedRectangle } from '../../../../maths/shapes/RoundedRectangle.mjs';\nimport { Bounds } from '../../../container/bounds/Bounds.mjs';\nimport { buildAdaptiveBezier } from '../buildCommands/buildAdaptiveBezier.mjs';\nimport { buildAdaptiveQuadratic } from '../buildCommands/buildAdaptiveQuadratic.mjs';\nimport { buildArc } from '../buildCommands/buildArc.mjs';\nimport { buildArcTo } from '../buildCommands/buildArcTo.mjs';\nimport { buildArcToSvg } from '../buildCommands/buildArcToSvg.mjs';\nimport { roundedShapeQuadraticCurve, roundedShapeArc } from './roundShape.mjs';\n\n\"use strict\";\nconst tempRectangle = new Rectangle();\nclass ShapePath {\n constructor(graphicsPath2D) {\n /** The list of shape primitives that make up the path. */\n this.shapePrimitives = [];\n this._currentPoly = null;\n this._bounds = new Bounds();\n this._graphicsPath2D = graphicsPath2D;\n }\n /**\n * Sets the starting point for a new sub-path. Any subsequent drawing commands are considered part of this path.\n * @param x - The x-coordinate for the starting point.\n * @param y - The y-coordinate for the starting point.\n * @returns The instance of the current object for chaining.\n */\n moveTo(x, y) {\n this.startPoly(x, y);\n return this;\n }\n /**\n * Connects the current point to a new point with a straight line. This method updates the current path.\n * @param x - The x-coordinate of the new point to connect to.\n * @param y - The y-coordinate of the new point to connect to.\n * @returns The instance of the current object for chaining.\n */\n lineTo(x, y) {\n this._ensurePoly();\n const points = this._currentPoly.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n if (fromX !== x || fromY !== y) {\n points.push(x, y);\n }\n return this;\n }\n /**\n * Adds an arc to the path. The arc is centered at (x, y)\n * position with radius `radius` starting at `startAngle` and ending at `endAngle`.\n * @param x - The x-coordinate of the arc's center.\n * @param y - The y-coordinate of the arc's center.\n * @param radius - The radius of the arc.\n * @param startAngle - The starting angle of the arc, in radians.\n * @param endAngle - The ending angle of the arc, in radians.\n * @param counterclockwise - Specifies whether the arc should be drawn in the anticlockwise direction. False by default.\n * @returns The instance of the current object for chaining.\n */\n arc(x, y, radius, startAngle, endAngle, counterclockwise) {\n this._ensurePoly(false);\n const points = this._currentPoly.points;\n buildArc(points, x, y, radius, startAngle, endAngle, counterclockwise);\n return this;\n }\n /**\n * Adds an arc to the path with the arc tangent to the line joining two specified points.\n * The arc radius is specified by `radius`.\n * @param x1 - The x-coordinate of the first point.\n * @param y1 - The y-coordinate of the first point.\n * @param x2 - The x-coordinate of the second point.\n * @param y2 - The y-coordinate of the second point.\n * @param radius - The radius of the arc.\n * @returns The instance of the current object for chaining.\n */\n arcTo(x1, y1, x2, y2, radius) {\n this._ensurePoly();\n const points = this._currentPoly.points;\n buildArcTo(points, x1, y1, x2, y2, radius);\n return this;\n }\n /**\n * Adds an SVG-style arc to the path, allowing for elliptical arcs based on the SVG spec.\n * @param rx - The x-radius of the ellipse.\n * @param ry - The y-radius of the ellipse.\n * @param xAxisRotation - The rotation of the ellipse's x-axis relative\n * to the x-axis of the coordinate system, in degrees.\n * @param largeArcFlag - Determines if the arc should be greater than or less than 180 degrees.\n * @param sweepFlag - Determines if the arc should be swept in a positive angle direction.\n * @param x - The x-coordinate of the arc's end point.\n * @param y - The y-coordinate of the arc's end point.\n * @returns The instance of the current object for chaining.\n */\n arcToSvg(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {\n const points = this._currentPoly.points;\n buildArcToSvg(\n points,\n this._currentPoly.lastX,\n this._currentPoly.lastY,\n x,\n y,\n rx,\n ry,\n xAxisRotation,\n largeArcFlag,\n sweepFlag\n );\n return this;\n }\n /**\n * Adds a cubic Bezier curve to the path.\n * It requires three points: the first two are control points and the third one is the end point.\n * The starting point is the last point in the current path.\n * @param cp1x - The x-coordinate of the first control point.\n * @param cp1y - The y-coordinate of the first control point.\n * @param cp2x - The x-coordinate of the second control point.\n * @param cp2y - The y-coordinate of the second control point.\n * @param x - The x-coordinate of the end point.\n * @param y - The y-coordinate of the end point.\n * @param smoothness - Optional parameter to adjust the smoothness of the curve.\n * @returns The instance of the current object for chaining.\n */\n bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {\n this._ensurePoly();\n const currentPoly = this._currentPoly;\n buildAdaptiveBezier(\n this._currentPoly.points,\n currentPoly.lastX,\n currentPoly.lastY,\n cp1x,\n cp1y,\n cp2x,\n cp2y,\n x,\n y,\n smoothness\n );\n return this;\n }\n /**\n * Adds a quadratic curve to the path. It requires two points: the control point and the end point.\n * The starting point is the last point in the current path.\n * @param cp1x - The x-coordinate of the control point.\n * @param cp1y - The y-coordinate of the control point.\n * @param x - The x-coordinate of the end point.\n * @param y - The y-coordinate of the end point.\n * @param smoothing - Optional parameter to adjust the smoothness of the curve.\n * @returns The instance of the current object for chaining.\n */\n quadraticCurveTo(cp1x, cp1y, x, y, smoothing) {\n this._ensurePoly();\n const currentPoly = this._currentPoly;\n buildAdaptiveQuadratic(\n this._currentPoly.points,\n currentPoly.lastX,\n currentPoly.lastY,\n cp1x,\n cp1y,\n x,\n y,\n smoothing\n );\n return this;\n }\n /**\n * Closes the current path by drawing a straight line back to the start.\n * If the shape is already closed or there are no points in the path, this method does nothing.\n * @returns The instance of the current object for chaining.\n */\n closePath() {\n this.endPoly(true);\n return this;\n }\n /**\n * Adds another path to the current path. This method allows for the combination of multiple paths into one.\n * @param path - The `GraphicsPath` object representing the path to add.\n * @param transform - An optional `Matrix` object to apply a transformation to the path before adding it.\n * @returns The instance of the current object for chaining.\n */\n addPath(path, transform) {\n this.endPoly();\n if (transform && !transform.isIdentity()) {\n path = path.clone(true);\n path.transform(transform);\n }\n for (let i = 0; i < path.instructions.length; i++) {\n const instruction = path.instructions[i];\n this[instruction.action](...instruction.data);\n }\n return this;\n }\n /**\n * Finalizes the drawing of the current path. Optionally, it can close the path.\n * @param closePath - A boolean indicating whether to close the path after finishing. False by default.\n */\n finish(closePath = false) {\n this.endPoly(closePath);\n }\n /**\n * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.\n * @param x - The x-coordinate of the top-left corner of the rectangle.\n * @param y - The y-coordinate of the top-left corner of the rectangle.\n * @param w - The width of the rectangle.\n * @param h - The height of the rectangle.\n * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.\n * @returns The instance of the current object for chaining.\n */\n rect(x, y, w, h, transform) {\n this.drawShape(new Rectangle(x, y, w, h), transform);\n return this;\n }\n /**\n * Draws a circle shape. This method adds a new circle path to the current drawing.\n * @param x - The x-coordinate of the center of the circle.\n * @param y - The y-coordinate of the center of the circle.\n * @param radius - The radius of the circle.\n * @param transform - An optional `Matrix` object to apply a transformation to the circle.\n * @returns The instance of the current object for chaining.\n */\n circle(x, y, radius, transform) {\n this.drawShape(new Circle(x, y, radius), transform);\n return this;\n }\n /**\n * Draws a polygon shape. This method allows for the creation of complex polygons by specifying a sequence of points.\n * @param points - An array of numbers, or or an array of PointData objects eg [{x,y}, {x,y}, {x,y}]\n * representing the x and y coordinates of the polygon's vertices, in sequence.\n * @param close - A boolean indicating whether to close the polygon path. True by default.\n * @param transform - An optional `Matrix` object to apply a transformation to the polygon.\n * @returns The instance of the current object for chaining.\n */\n poly(points, close, transform) {\n const polygon = new Polygon(points);\n polygon.closePath = close;\n this.drawShape(polygon, transform);\n return this;\n }\n /**\n * Draws a regular polygon with a specified number of sides. All sides and angles are equal.\n * @param x - The x-coordinate of the center of the polygon.\n * @param y - The y-coordinate of the center of the polygon.\n * @param radius - The radius of the circumscribed circle of the polygon.\n * @param sides - The number of sides of the polygon. Must be 3 or more.\n * @param rotation - The rotation angle of the polygon, in radians. Zero by default.\n * @param transform - An optional `Matrix` object to apply a transformation to the polygon.\n * @returns The instance of the current object for chaining.\n */\n regularPoly(x, y, radius, sides, rotation = 0, transform) {\n sides = Math.max(sides | 0, 3);\n const startAngle = -1 * Math.PI / 2 + rotation;\n const delta = Math.PI * 2 / sides;\n const polygon = [];\n for (let i = 0; i < sides; i++) {\n const angle = i * delta + startAngle;\n polygon.push(\n x + radius * Math.cos(angle),\n y + radius * Math.sin(angle)\n );\n }\n this.poly(polygon, true, transform);\n return this;\n }\n /**\n * Draws a polygon with rounded corners.\n * Similar to `regularPoly` but with the ability to round the corners of the polygon.\n * @param x - The x-coordinate of the center of the polygon.\n * @param y - The y-coordinate of the center of the polygon.\n * @param radius - The radius of the circumscribed circle of the polygon.\n * @param sides - The number of sides of the polygon. Must be 3 or more.\n * @param corner - The radius of the rounding of the corners.\n * @param rotation - The rotation angle of the polygon, in radians. Zero by default.\n * @param smoothness - Optional parameter to adjust the smoothness of the rounding.\n * @returns The instance of the current object for chaining.\n */\n roundPoly(x, y, radius, sides, corner, rotation = 0, smoothness) {\n sides = Math.max(sides | 0, 3);\n if (corner <= 0) {\n return this.regularPoly(x, y, radius, sides, rotation);\n }\n const sideLength = radius * Math.sin(Math.PI / sides) - 1e-3;\n corner = Math.min(corner, sideLength);\n const startAngle = -1 * Math.PI / 2 + rotation;\n const delta = Math.PI * 2 / sides;\n const internalAngle = (sides - 2) * Math.PI / sides / 2;\n for (let i = 0; i < sides; i++) {\n const angle = i * delta + startAngle;\n const x0 = x + radius * Math.cos(angle);\n const y0 = y + radius * Math.sin(angle);\n const a1 = angle + Math.PI + internalAngle;\n const a2 = angle - Math.PI - internalAngle;\n const x1 = x0 + corner * Math.cos(a1);\n const y1 = y0 + corner * Math.sin(a1);\n const x3 = x0 + corner * Math.cos(a2);\n const y3 = y0 + corner * Math.sin(a2);\n if (i === 0) {\n this.moveTo(x1, y1);\n } else {\n this.lineTo(x1, y1);\n }\n this.quadraticCurveTo(x0, y0, x3, y3, smoothness);\n }\n return this.closePath();\n }\n /**\n * Draws a shape with rounded corners. This function supports custom radius for each corner of the shape.\n * Optionally, corners can be rounded using a quadratic curve instead of an arc, providing a different aesthetic.\n * @param points - An array of `RoundedPoint` representing the corners of the shape to draw.\n * A minimum of 3 points is required.\n * @param radius - The default radius for the corners.\n * This radius is applied to all corners unless overridden in `points`.\n * @param useQuadratic - If set to true, rounded corners are drawn using a quadraticCurve\n * method instead of an arc method. Defaults to false.\n * @param smoothness - Specifies the smoothness of the curve when `useQuadratic` is true.\n * Higher values make the curve smoother.\n * @returns The instance of the current object for chaining.\n */\n roundShape(points, radius, useQuadratic = false, smoothness) {\n if (points.length < 3) {\n return this;\n }\n if (useQuadratic) {\n roundedShapeQuadraticCurve(this, points, radius, smoothness);\n } else {\n roundedShapeArc(this, points, radius);\n }\n return this.closePath();\n }\n /**\n * Draw Rectangle with fillet corners. This is much like rounded rectangle\n * however it support negative numbers as well for the corner radius.\n * @param x - Upper left corner of rect\n * @param y - Upper right corner of rect\n * @param width - Width of rect\n * @param height - Height of rect\n * @param fillet - accept negative or positive values\n */\n filletRect(x, y, width, height, fillet) {\n if (fillet === 0) {\n return this.rect(x, y, width, height);\n }\n const maxFillet = Math.min(width, height) / 2;\n const inset = Math.min(maxFillet, Math.max(-maxFillet, fillet));\n const right = x + width;\n const bottom = y + height;\n const dir = inset < 0 ? -inset : 0;\n const size = Math.abs(inset);\n return this.moveTo(x, y + size).arcTo(x + dir, y + dir, x + size, y, size).lineTo(right - size, y).arcTo(right - dir, y + dir, right, y + size, size).lineTo(right, bottom - size).arcTo(right - dir, bottom - dir, x + width - size, bottom, size).lineTo(x + size, bottom).arcTo(x + dir, bottom - dir, x, bottom - size, size).closePath();\n }\n /**\n * Draw Rectangle with chamfer corners. These are angled corners.\n * @param x - Upper left corner of rect\n * @param y - Upper right corner of rect\n * @param width - Width of rect\n * @param height - Height of rect\n * @param chamfer - non-zero real number, size of corner cutout\n * @param transform\n */\n chamferRect(x, y, width, height, chamfer, transform) {\n if (chamfer <= 0) {\n return this.rect(x, y, width, height);\n }\n const inset = Math.min(chamfer, Math.min(width, height) / 2);\n const right = x + width;\n const bottom = y + height;\n const points = [\n x + inset,\n y,\n right - inset,\n y,\n right,\n y + inset,\n right,\n bottom - inset,\n right - inset,\n bottom,\n x + inset,\n bottom,\n x,\n bottom - inset,\n x,\n y + inset\n ];\n for (let i = points.length - 1; i >= 2; i -= 2) {\n if (points[i] === points[i - 2] && points[i - 1] === points[i - 3]) {\n points.splice(i - 1, 2);\n }\n }\n return this.poly(points, true, transform);\n }\n /**\n * Draws an ellipse at the specified location and with the given x and y radii.\n * An optional transformation can be applied, allowing for rotation, scaling, and translation.\n * @param x - The x-coordinate of the center of the ellipse.\n * @param y - The y-coordinate of the center of the ellipse.\n * @param radiusX - The horizontal radius of the ellipse.\n * @param radiusY - The vertical radius of the ellipse.\n * @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.\n * @returns The instance of the current object for chaining.\n */\n ellipse(x, y, radiusX, radiusY, transform) {\n this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);\n return this;\n }\n /**\n * Draws a rectangle with rounded corners.\n * The corner radius can be specified to determine how rounded the corners should be.\n * An optional transformation can be applied, which allows for rotation, scaling, and translation of the rectangle.\n * @param x - The x-coordinate of the top-left corner of the rectangle.\n * @param y - The y-coordinate of the top-left corner of the rectangle.\n * @param w - The width of the rectangle.\n * @param h - The height of the rectangle.\n * @param radius - The radius of the rectangle's corners. If not specified, corners will be sharp.\n * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.\n * @returns The instance of the current object for chaining.\n */\n roundRect(x, y, w, h, radius, transform) {\n this.drawShape(new RoundedRectangle(x, y, w, h, radius), transform);\n return this;\n }\n /**\n * Draws a given shape on the canvas.\n * This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.\n * An optional transformation matrix can be applied to the shape, allowing for complex transformations.\n * @param shape - The shape to draw, defined as a `ShapePrimitive` object.\n * @param matrix - An optional `Matrix` for transforming the shape. This can include rotations,\n * scaling, and translations.\n * @returns The instance of the current object for chaining.\n */\n drawShape(shape, matrix) {\n this.endPoly();\n this.shapePrimitives.push({ shape, transform: matrix });\n return this;\n }\n /**\n * Starts a new polygon path from the specified starting point.\n * This method initializes a new polygon or ends the current one if it exists.\n * @param x - The x-coordinate of the starting point of the new polygon.\n * @param y - The y-coordinate of the starting point of the new polygon.\n * @returns The instance of the current object for chaining.\n */\n startPoly(x, y) {\n let currentPoly = this._currentPoly;\n if (currentPoly) {\n this.endPoly();\n }\n currentPoly = new Polygon();\n currentPoly.points.push(x, y);\n this._currentPoly = currentPoly;\n return this;\n }\n /**\n * Ends the current polygon path. If `closePath` is set to true,\n * the path is closed by connecting the last point to the first one.\n * This method finalizes the current polygon and prepares it for drawing or adding to the shape primitives.\n * @param closePath - A boolean indicating whether to close the polygon by connecting the last point\n * back to the starting point. False by default.\n * @returns The instance of the current object for chaining.\n */\n endPoly(closePath = false) {\n const shape = this._currentPoly;\n if (shape && shape.points.length > 2) {\n shape.closePath = closePath;\n this.shapePrimitives.push({ shape });\n }\n this._currentPoly = null;\n return this;\n }\n _ensurePoly(start = true) {\n if (this._currentPoly)\n return;\n this._currentPoly = new Polygon();\n if (start) {\n const lastShape = this.shapePrimitives[this.shapePrimitives.length - 1];\n if (lastShape) {\n let lx = lastShape.shape.x;\n let ly = lastShape.shape.y;\n if (lastShape.transform && !lastShape.transform.isIdentity()) {\n const t = lastShape.transform;\n const tempX = lx;\n lx = t.a * lx + t.c * ly + t.tx;\n ly = t.b * tempX + t.d * ly + t.ty;\n }\n this._currentPoly.points.push(lx, ly);\n } else {\n this._currentPoly.points.push(0, 0);\n }\n }\n }\n /** Builds the path. */\n buildPath() {\n const path = this._graphicsPath2D;\n this.shapePrimitives.length = 0;\n this._currentPoly = null;\n for (let i = 0; i < path.instructions.length; i++) {\n const instruction = path.instructions[i];\n this[instruction.action](...instruction.data);\n }\n this.finish();\n }\n /** Gets the bounds of the path. */\n get bounds() {\n const bounds = this._bounds;\n bounds.clear();\n const shapePrimitives = this.shapePrimitives;\n for (let i = 0; i < shapePrimitives.length; i++) {\n const shapePrimitive = shapePrimitives[i];\n const boundsRect = shapePrimitive.shape.getBounds(tempRectangle);\n if (shapePrimitive.transform) {\n bounds.addRect(boundsRect, shapePrimitive.transform);\n } else {\n bounds.addRect(boundsRect);\n }\n }\n return bounds;\n }\n}\n\nexport { ShapePath };\n//# sourceMappingURL=ShapePath.mjs.map\n","import { buildArc } from './buildArc.mjs';\n\n\"use strict\";\nfunction buildArcTo(points, x1, y1, x2, y2, radius) {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs(a1 * b2 - b1 * a2);\n if (mm < 1e-8 || radius === 0) {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) {\n points.push(x1, y1);\n }\n return;\n }\n const dd = a1 * a1 + b1 * b1;\n const cc = a2 * a2 + b2 * b2;\n const tt = a1 * a2 + b1 * b2;\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = k1 * b2 + k2 * b1;\n const cy = k1 * a2 + k2 * a1;\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n buildArc(\n points,\n cx + x1,\n cy + y1,\n radius,\n startAngle,\n endAngle,\n b1 * a2 > b2 * a1\n );\n}\n\nexport { buildArcTo };\n//# sourceMappingURL=buildArcTo.mjs.map\n","\"use strict\";\nfunction roundedShapeArc(g, points, radius) {\n const vecFrom = (p, pp) => {\n const x = pp.x - p.x;\n const y = pp.y - p.y;\n const len = Math.sqrt(x * x + y * y);\n const nx = x / len;\n const ny = y / len;\n return { len, nx, ny };\n };\n const sharpCorner = (i, p) => {\n if (i === 0) {\n g.moveTo(p.x, p.y);\n } else {\n g.lineTo(p.x, p.y);\n }\n };\n let p1 = points[points.length - 1];\n for (let i = 0; i < points.length; i++) {\n const p2 = points[i % points.length];\n const pRadius = p2.radius ?? radius;\n if (pRadius <= 0) {\n sharpCorner(i, p2);\n p1 = p2;\n continue;\n }\n const p3 = points[(i + 1) % points.length];\n const v1 = vecFrom(p2, p1);\n const v2 = vecFrom(p2, p3);\n if (v1.len < 1e-4 || v2.len < 1e-4) {\n sharpCorner(i, p2);\n p1 = p2;\n continue;\n }\n let angle = Math.asin(v1.nx * v2.ny - v1.ny * v2.nx);\n let radDirection = 1;\n let drawDirection = false;\n if (v1.nx * v2.nx - v1.ny * -v2.ny < 0) {\n if (angle < 0) {\n angle = Math.PI + angle;\n } else {\n angle = Math.PI - angle;\n radDirection = -1;\n drawDirection = true;\n }\n } else if (angle > 0) {\n radDirection = -1;\n drawDirection = true;\n }\n const halfAngle = angle / 2;\n let cRadius;\n let lenOut = Math.abs(\n Math.cos(halfAngle) * pRadius / Math.sin(halfAngle)\n );\n if (lenOut > Math.min(v1.len / 2, v2.len / 2)) {\n lenOut = Math.min(v1.len / 2, v2.len / 2);\n cRadius = Math.abs(lenOut * Math.sin(halfAngle) / Math.cos(halfAngle));\n } else {\n cRadius = pRadius;\n }\n const cX = p2.x + v2.nx * lenOut + -v2.ny * cRadius * radDirection;\n const cY = p2.y + v2.ny * lenOut + v2.nx * cRadius * radDirection;\n const startAngle = Math.atan2(v1.ny, v1.nx) + Math.PI / 2 * radDirection;\n const endAngle = Math.atan2(v2.ny, v2.nx) - Math.PI / 2 * radDirection;\n if (i === 0) {\n g.moveTo(\n cX + Math.cos(startAngle) * cRadius,\n cY + Math.sin(startAngle) * cRadius\n );\n }\n g.arc(cX, cY, cRadius, startAngle, endAngle, drawDirection);\n p1 = p2;\n }\n}\nfunction roundedShapeQuadraticCurve(g, points, radius, smoothness) {\n const distance = (p1, p2) => Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);\n const pointLerp = (p1, p2, t) => ({\n x: p1.x + (p2.x - p1.x) * t,\n y: p1.y + (p2.y - p1.y) * t\n });\n const numPoints = points.length;\n for (let i = 0; i < numPoints; i++) {\n const thisPoint = points[(i + 1) % numPoints];\n const pRadius = thisPoint.radius ?? radius;\n if (pRadius <= 0) {\n if (i === 0) {\n g.moveTo(thisPoint.x, thisPoint.y);\n } else {\n g.lineTo(thisPoint.x, thisPoint.y);\n }\n continue;\n }\n const lastPoint = points[i];\n const nextPoint = points[(i + 2) % numPoints];\n const lastEdgeLength = distance(lastPoint, thisPoint);\n let start;\n if (lastEdgeLength < 1e-4) {\n start = thisPoint;\n } else {\n const lastOffsetDistance = Math.min(lastEdgeLength / 2, pRadius);\n start = pointLerp(\n thisPoint,\n lastPoint,\n lastOffsetDistance / lastEdgeLength\n );\n }\n const nextEdgeLength = distance(nextPoint, thisPoint);\n let end;\n if (nextEdgeLength < 1e-4) {\n end = thisPoint;\n } else {\n const nextOffsetDistance = Math.min(nextEdgeLength / 2, pRadius);\n end = pointLerp(\n thisPoint,\n nextPoint,\n nextOffsetDistance / nextEdgeLength\n );\n }\n if (i === 0) {\n g.moveTo(start.x, start.y);\n } else {\n g.lineTo(start.x, start.y);\n }\n g.quadraticCurveTo(thisPoint.x, thisPoint.y, end.x, end.y, smoothness);\n }\n}\n\nexport { roundedShapeArc, roundedShapeQuadraticCurve };\n//# sourceMappingURL=roundShape.mjs.map\n","import { Point } from '../../../../maths/point/Point.mjs';\nimport { uid } from '../../../../utils/data/uid.mjs';\nimport { warn } from '../../../../utils/logging/warn.mjs';\nimport { SVGToGraphicsPath } from '../svg/SVGToGraphicsPath.mjs';\nimport { ShapePath } from './ShapePath.mjs';\n\n\"use strict\";\nclass GraphicsPath {\n /**\n * Creates a `GraphicsPath` instance optionally from an SVG path string or an array of `PathInstruction`.\n * @param instructions - An SVG path string or an array of `PathInstruction` objects.\n */\n constructor(instructions) {\n this.instructions = [];\n /** unique id for this graphics path */\n this.uid = uid(\"graphicsPath\");\n this._dirty = true;\n if (typeof instructions === \"string\") {\n SVGToGraphicsPath(instructions, this);\n } else {\n this.instructions = instructions?.slice() ?? [];\n }\n }\n /**\n * Provides access to the internal shape path, ensuring it is up-to-date with the current instructions.\n * @returns The `ShapePath` instance associated with this `GraphicsPath`.\n */\n get shapePath() {\n if (!this._shapePath) {\n this._shapePath = new ShapePath(this);\n }\n if (this._dirty) {\n this._dirty = false;\n this._shapePath.buildPath();\n }\n return this._shapePath;\n }\n /**\n * Adds another `GraphicsPath` to this path, optionally applying a transformation.\n * @param path - The `GraphicsPath` to add.\n * @param transform - An optional transformation to apply to the added path.\n * @returns The instance of the current object for chaining.\n */\n addPath(path, transform) {\n path = path.clone();\n this.instructions.push({ action: \"addPath\", data: [path, transform] });\n this._dirty = true;\n return this;\n }\n arc(...args) {\n this.instructions.push({ action: \"arc\", data: args });\n this._dirty = true;\n return this;\n }\n arcTo(...args) {\n this.instructions.push({ action: \"arcTo\", data: args });\n this._dirty = true;\n return this;\n }\n arcToSvg(...args) {\n this.instructions.push({ action: \"arcToSvg\", data: args });\n this._dirty = true;\n return this;\n }\n bezierCurveTo(...args) {\n this.instructions.push({ action: \"bezierCurveTo\", data: args });\n this._dirty = true;\n return this;\n }\n /**\n * Adds a cubic Bezier curve to the path.\n * It requires two points: the second control point and the end point. The first control point is assumed to be\n * The starting point is the last point in the current path.\n * @param cp2x - The x-coordinate of the second control point.\n * @param cp2y - The y-coordinate of the second control point.\n * @param x - The x-coordinate of the end point.\n * @param y - The y-coordinate of the end point.\n * @param smoothness - Optional parameter to adjust the smoothness of the curve.\n * @returns The instance of the current object for chaining.\n */\n bezierCurveToShort(cp2x, cp2y, x, y, smoothness) {\n const last = this.instructions[this.instructions.length - 1];\n const lastPoint = this.getLastPoint(Point.shared);\n let cp1x = 0;\n let cp1y = 0;\n if (!last || last.action !== \"bezierCurveTo\") {\n cp1x = lastPoint.x;\n cp1y = lastPoint.y;\n } else {\n cp1x = last.data[2];\n cp1y = last.data[3];\n const currentX = lastPoint.x;\n const currentY = lastPoint.y;\n cp1x = currentX + (currentX - cp1x);\n cp1y = currentY + (currentY - cp1y);\n }\n this.instructions.push({ action: \"bezierCurveTo\", data: [cp1x, cp1y, cp2x, cp2y, x, y, smoothness] });\n this._dirty = true;\n return this;\n }\n /**\n * Closes the current path by drawing a straight line back to the start.\n * If the shape is already closed or there are no points in the path, this method does nothing.\n * @returns The instance of the current object for chaining.\n */\n closePath() {\n this.instructions.push({ action: \"closePath\", data: [] });\n this._dirty = true;\n return this;\n }\n ellipse(...args) {\n this.instructions.push({ action: \"ellipse\", data: args });\n this._dirty = true;\n return this;\n }\n lineTo(...args) {\n this.instructions.push({ action: \"lineTo\", data: args });\n this._dirty = true;\n return this;\n }\n moveTo(...args) {\n this.instructions.push({ action: \"moveTo\", data: args });\n return this;\n }\n quadraticCurveTo(...args) {\n this.instructions.push({ action: \"quadraticCurveTo\", data: args });\n this._dirty = true;\n return this;\n }\n /**\n * Adds a quadratic curve to the path. It uses the previous point as the control point.\n * @param x - The x-coordinate of the end point.\n * @param y - The y-coordinate of the end point.\n * @param smoothness - Optional parameter to adjust the smoothness of the curve.\n * @returns The instance of the current object for chaining.\n */\n quadraticCurveToShort(x, y, smoothness) {\n const last = this.instructions[this.instructions.length - 1];\n const lastPoint = this.getLastPoint(Point.shared);\n let cpx1 = 0;\n let cpy1 = 0;\n if (!last || last.action !== \"quadraticCurveTo\") {\n cpx1 = lastPoint.x;\n cpy1 = lastPoint.y;\n } else {\n cpx1 = last.data[0];\n cpy1 = last.data[1];\n const currentX = lastPoint.x;\n const currentY = lastPoint.y;\n cpx1 = currentX + (currentX - cpx1);\n cpy1 = currentY + (currentY - cpy1);\n }\n this.instructions.push({ action: \"quadraticCurveTo\", data: [cpx1, cpy1, x, y, smoothness] });\n this._dirty = true;\n return this;\n }\n /**\n * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.\n * @param x - The x-coordinate of the top-left corner of the rectangle.\n * @param y - The y-coordinate of the top-left corner of the rectangle.\n * @param w - The width of the rectangle.\n * @param h - The height of the rectangle.\n * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.\n * @returns The instance of the current object for chaining.\n */\n rect(x, y, w, h, transform) {\n this.instructions.push({ action: \"rect\", data: [x, y, w, h, transform] });\n this._dirty = true;\n return this;\n }\n /**\n * Draws a circle shape. This method adds a new circle path to the current drawing.\n * @param x - The x-coordinate of the center of the circle.\n * @param y - The y-coordinate of the center of the circle.\n * @param radius - The radius of the circle.\n * @param transform - An optional `Matrix` object to apply a transformation to the circle.\n * @returns The instance of the current object for chaining.\n */\n circle(x, y, radius, transform) {\n this.instructions.push({ action: \"circle\", data: [x, y, radius, transform] });\n this._dirty = true;\n return this;\n }\n roundRect(...args) {\n this.instructions.push({ action: \"roundRect\", data: args });\n this._dirty = true;\n return this;\n }\n poly(...args) {\n this.instructions.push({ action: \"poly\", data: args });\n this._dirty = true;\n return this;\n }\n regularPoly(...args) {\n this.instructions.push({ action: \"regularPoly\", data: args });\n this._dirty = true;\n return this;\n }\n roundPoly(...args) {\n this.instructions.push({ action: \"roundPoly\", data: args });\n this._dirty = true;\n return this;\n }\n roundShape(...args) {\n this.instructions.push({ action: \"roundShape\", data: args });\n this._dirty = true;\n return this;\n }\n filletRect(...args) {\n this.instructions.push({ action: \"filletRect\", data: args });\n this._dirty = true;\n return this;\n }\n chamferRect(...args) {\n this.instructions.push({ action: \"chamferRect\", data: args });\n this._dirty = true;\n return this;\n }\n /**\n * Draws a star shape centered at a specified location. This method allows for the creation\n * of stars with a variable number of points, outer radius, optional inner radius, and rotation.\n * The star is drawn as a closed polygon with alternating outer and inner vertices to create the star's points.\n * An optional transformation can be applied to scale, rotate, or translate the star as needed.\n * @param x - The x-coordinate of the center of the star.\n * @param y - The y-coordinate of the center of the star.\n * @param points - The number of points of the star.\n * @param radius - The outer radius of the star (distance from the center to the outer points).\n * @param innerRadius - Optional. The inner radius of the star\n * (distance from the center to the inner points between the outer points).\n * If not provided, defaults to half of the `radius`.\n * @param rotation - Optional. The rotation of the star in radians, where 0 is aligned with the y-axis.\n * Defaults to 0, meaning one point is directly upward.\n * @param transform - An optional `Matrix` object to apply a transformation to the star.\n * This can include rotations, scaling, and translations.\n * @returns The instance of the current object for chaining further drawing commands.\n */\n // eslint-disable-next-line max-len\n star(x, y, points, radius, innerRadius, rotation, transform) {\n innerRadius = innerRadius || radius / 2;\n const startAngle = -1 * Math.PI / 2 + rotation;\n const len = points * 2;\n const delta = Math.PI * 2 / len;\n const polygon = [];\n for (let i = 0; i < len; i++) {\n const r = i % 2 ? innerRadius : radius;\n const angle = i * delta + startAngle;\n polygon.push(\n x + r * Math.cos(angle),\n y + r * Math.sin(angle)\n );\n }\n this.poly(polygon, true, transform);\n return this;\n }\n /**\n * Creates a copy of the current `GraphicsPath` instance. This method supports both shallow and deep cloning.\n * A shallow clone copies the reference of the instructions array, while a deep clone creates a new array and\n * copies each instruction individually, ensuring that modifications to the instructions of the cloned `GraphicsPath`\n * do not affect the original `GraphicsPath` and vice versa.\n * @param deep - A boolean flag indicating whether the clone should be deep.\n * @returns A new `GraphicsPath` instance that is a clone of the current instance.\n */\n clone(deep = false) {\n const newGraphicsPath2D = new GraphicsPath();\n if (!deep) {\n newGraphicsPath2D.instructions = this.instructions.slice();\n } else {\n for (let i = 0; i < this.instructions.length; i++) {\n const instruction = this.instructions[i];\n newGraphicsPath2D.instructions.push({ action: instruction.action, data: instruction.data.slice() });\n }\n }\n return newGraphicsPath2D;\n }\n clear() {\n this.instructions.length = 0;\n this._dirty = true;\n return this;\n }\n /**\n * Applies a transformation matrix to all drawing instructions within the `GraphicsPath`.\n * This method enables the modification of the path's geometry according to the provided\n * transformation matrix, which can include translations, rotations, scaling, and skewing.\n *\n * Each drawing instruction in the path is updated to reflect the transformation,\n * ensuring the visual representation of the path is consistent with the applied matrix.\n *\n * Note: The transformation is applied directly to the coordinates and control points of the drawing instructions,\n * not to the path as a whole. This means the transformation's effects are baked into the individual instructions,\n * allowing for fine-grained control over the path's appearance.\n * @param matrix - A `Matrix` object representing the transformation to apply.\n * @returns The instance of the current object for chaining further operations.\n */\n transform(matrix) {\n if (matrix.isIdentity())\n return this;\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n let x = 0;\n let y = 0;\n let cpx1 = 0;\n let cpy1 = 0;\n let cpx2 = 0;\n let cpy2 = 0;\n let rx = 0;\n let ry = 0;\n for (let i = 0; i < this.instructions.length; i++) {\n const instruction = this.instructions[i];\n const data = instruction.data;\n switch (instruction.action) {\n case \"moveTo\":\n case \"lineTo\":\n x = data[0];\n y = data[1];\n data[0] = a * x + c * y + tx;\n data[1] = b * x + d * y + ty;\n break;\n case \"bezierCurveTo\":\n cpx1 = data[0];\n cpy1 = data[1];\n cpx2 = data[2];\n cpy2 = data[3];\n x = data[4];\n y = data[5];\n data[0] = a * cpx1 + c * cpy1 + tx;\n data[1] = b * cpx1 + d * cpy1 + ty;\n data[2] = a * cpx2 + c * cpy2 + tx;\n data[3] = b * cpx2 + d * cpy2 + ty;\n data[4] = a * x + c * y + tx;\n data[5] = b * x + d * y + ty;\n break;\n case \"quadraticCurveTo\":\n cpx1 = data[0];\n cpy1 = data[1];\n x = data[2];\n y = data[3];\n data[0] = a * cpx1 + c * cpy1 + tx;\n data[1] = b * cpx1 + d * cpy1 + ty;\n data[2] = a * x + c * y + tx;\n data[3] = b * x + d * y + ty;\n break;\n case \"arcToSvg\":\n x = data[5];\n y = data[6];\n rx = data[0];\n ry = data[1];\n data[0] = a * rx + c * ry;\n data[1] = b * rx + d * ry;\n data[5] = a * x + c * y + tx;\n data[6] = b * x + d * y + ty;\n break;\n case \"circle\":\n data[4] = adjustTransform(data[3], matrix);\n break;\n case \"rect\":\n data[4] = adjustTransform(data[4], matrix);\n break;\n case \"ellipse\":\n data[8] = adjustTransform(data[8], matrix);\n break;\n case \"roundRect\":\n data[5] = adjustTransform(data[5], matrix);\n break;\n case \"addPath\":\n data[0].transform(matrix);\n break;\n case \"poly\":\n data[2] = adjustTransform(data[2], matrix);\n break;\n default:\n warn(\"unknown transform action\", instruction.action);\n break;\n }\n }\n this._dirty = true;\n return this;\n }\n get bounds() {\n return this.shapePath.bounds;\n }\n /**\n * Retrieves the last point from the current drawing instructions in the `GraphicsPath`.\n * This method is useful for operations that depend on the path's current endpoint,\n * such as connecting subsequent shapes or paths. It supports various drawing instructions,\n * ensuring the last point's position is accurately determined regardless of the path's complexity.\n *\n * If the last instruction is a `closePath`, the method iterates backward through the instructions\n * until it finds an actionable instruction that defines a point (e.g., `moveTo`, `lineTo`,\n * `quadraticCurveTo`, etc.). For compound paths added via `addPath`, it recursively retrieves\n * the last point from the nested path.\n * @param out - A `Point` object where the last point's coordinates will be stored.\n * This object is modified directly to contain the result.\n * @returns The `Point` object containing the last point's coordinates.\n */\n getLastPoint(out) {\n let index = this.instructions.length - 1;\n let lastInstruction = this.instructions[index];\n if (!lastInstruction) {\n out.x = 0;\n out.y = 0;\n return out;\n }\n while (lastInstruction.action === \"closePath\") {\n index--;\n if (index < 0) {\n out.x = 0;\n out.y = 0;\n return out;\n }\n lastInstruction = this.instructions[index];\n }\n switch (lastInstruction.action) {\n case \"moveTo\":\n case \"lineTo\":\n out.x = lastInstruction.data[0];\n out.y = lastInstruction.data[1];\n break;\n case \"quadraticCurveTo\":\n out.x = lastInstruction.data[2];\n out.y = lastInstruction.data[3];\n break;\n case \"bezierCurveTo\":\n out.x = lastInstruction.data[4];\n out.y = lastInstruction.data[5];\n break;\n case \"arc\":\n case \"arcToSvg\":\n out.x = lastInstruction.data[5];\n out.y = lastInstruction.data[6];\n break;\n case \"addPath\":\n lastInstruction.data[0].getLastPoint(out);\n break;\n }\n return out;\n }\n}\nfunction adjustTransform(currentMatrix, transform) {\n if (currentMatrix) {\n return currentMatrix.prepend(transform);\n }\n return transform.clone();\n}\n\nexport { GraphicsPath };\n//# sourceMappingURL=GraphicsPath.mjs.map\n","import parse from 'parse-svg-path';\nimport { warn } from '../../../../utils/logging/warn.mjs';\n\n\"use strict\";\nfunction SVGToGraphicsPath(svgPath, path) {\n const commands = parse(svgPath);\n const subpaths = [];\n let currentSubPath = null;\n let lastX = 0;\n let lastY = 0;\n for (let i = 0; i < commands.length; i++) {\n const command = commands[i];\n const type = command[0];\n const data = command;\n switch (type) {\n case \"M\":\n lastX = data[1];\n lastY = data[2];\n path.moveTo(lastX, lastY);\n break;\n case \"m\":\n lastX += data[1];\n lastY += data[2];\n path.moveTo(lastX, lastY);\n break;\n case \"H\":\n lastX = data[1];\n path.lineTo(lastX, lastY);\n break;\n case \"h\":\n lastX += data[1];\n path.lineTo(lastX, lastY);\n break;\n case \"V\":\n lastY = data[1];\n path.lineTo(lastX, lastY);\n break;\n case \"v\":\n lastY += data[1];\n path.lineTo(lastX, lastY);\n break;\n case \"L\":\n lastX = data[1];\n lastY = data[2];\n path.lineTo(lastX, lastY);\n break;\n case \"l\":\n lastX += data[1];\n lastY += data[2];\n path.lineTo(lastX, lastY);\n break;\n case \"C\":\n lastX = data[5];\n lastY = data[6];\n path.bezierCurveTo(\n data[1],\n data[2],\n data[3],\n data[4],\n lastX,\n lastY\n );\n break;\n case \"c\":\n path.bezierCurveTo(\n lastX + data[1],\n lastY + data[2],\n lastX + data[3],\n lastY + data[4],\n lastX + data[5],\n lastY + data[6]\n );\n lastX += data[5];\n lastY += data[6];\n break;\n case \"S\":\n lastX = data[3];\n lastY = data[4];\n path.bezierCurveToShort(\n data[1],\n data[2],\n lastX,\n lastY\n );\n break;\n case \"s\":\n path.bezierCurveToShort(\n lastX + data[1],\n lastY + data[2],\n lastX + data[3],\n lastY + data[4]\n );\n lastX += data[3];\n lastY += data[4];\n break;\n case \"Q\":\n lastX = data[3];\n lastY = data[4];\n path.quadraticCurveTo(\n data[1],\n data[2],\n lastX,\n lastY\n );\n break;\n case \"q\":\n path.quadraticCurveTo(\n lastX + data[1],\n lastY + data[2],\n lastX + data[3],\n lastY + data[4]\n );\n lastX += data[3];\n lastY += data[4];\n break;\n case \"T\":\n lastX = data[1];\n lastY = data[2];\n path.quadraticCurveToShort(\n lastX,\n lastY\n );\n break;\n case \"t\":\n lastX += data[1];\n lastY += data[2];\n path.quadraticCurveToShort(\n lastX,\n lastY\n );\n break;\n case \"A\":\n lastX = data[6];\n lastY = data[7];\n path.arcToSvg(\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n lastX,\n lastY\n );\n break;\n case \"a\":\n lastX += data[6];\n lastY += data[7];\n path.arcToSvg(\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n lastX,\n lastY\n );\n break;\n case \"Z\":\n case \"z\":\n path.closePath();\n if (subpaths.length > 0) {\n currentSubPath = subpaths.pop();\n if (currentSubPath) {\n lastX = currentSubPath.startX;\n lastY = currentSubPath.startY;\n } else {\n lastX = 0;\n lastY = 0;\n }\n }\n currentSubPath = null;\n break;\n default:\n warn(`Unknown SVG path command: ${type}`);\n }\n if (type !== \"Z\" && type !== \"z\") {\n if (currentSubPath === null) {\n currentSubPath = { startX: lastX, startY: lastY };\n subpaths.push(currentSubPath);\n }\n }\n }\n return path;\n}\n\nexport { SVGToGraphicsPath };\n//# sourceMappingURL=SVGToGraphicsPath.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { GraphicsPath } from '../path/GraphicsPath.mjs';\n\n\"use strict\";\nfunction SVGParser(svg, graphicsContext) {\n if (typeof svg === \"string\") {\n const div = document.createElement(\"div\");\n div.innerHTML = svg.trim();\n svg = div.querySelector(\"svg\");\n }\n const session = {\n context: graphicsContext,\n path: new GraphicsPath()\n };\n renderChildren(svg, session, null, null);\n return graphicsContext;\n}\nfunction renderChildren(svg, session, fillStyle, strokeStyle) {\n const children = svg.children;\n const { fillStyle: f1, strokeStyle: s1 } = parseStyle(svg);\n if (f1 && fillStyle) {\n fillStyle = { ...fillStyle, ...f1 };\n } else if (f1) {\n fillStyle = f1;\n }\n if (s1 && strokeStyle) {\n strokeStyle = { ...strokeStyle, ...s1 };\n } else if (s1) {\n strokeStyle = s1;\n }\n session.context.fillStyle = fillStyle;\n session.context.strokeStyle = strokeStyle;\n let x;\n let y;\n let x1;\n let y1;\n let x2;\n let y2;\n let cx;\n let cy;\n let r;\n let rx;\n let ry;\n let points;\n let pointsString;\n let d;\n let graphicsPath;\n let width;\n let height;\n switch (svg.nodeName.toLowerCase()) {\n case \"path\":\n d = svg.getAttribute(\"d\");\n graphicsPath = new GraphicsPath(d);\n session.context.path(graphicsPath);\n if (fillStyle)\n session.context.fill();\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"circle\":\n cx = parseFloatAttribute(svg, \"cx\", 0);\n cy = parseFloatAttribute(svg, \"cy\", 0);\n r = parseFloatAttribute(svg, \"r\", 0);\n session.context.ellipse(cx, cy, r, r);\n if (fillStyle)\n session.context.fill();\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"rect\":\n x = parseFloatAttribute(svg, \"x\", 0);\n y = parseFloatAttribute(svg, \"y\", 0);\n width = parseFloatAttribute(svg, \"width\", 0);\n height = parseFloatAttribute(svg, \"height\", 0);\n rx = parseFloatAttribute(svg, \"rx\", 0);\n ry = parseFloatAttribute(svg, \"ry\", 0);\n if (rx || ry) {\n session.context.roundRect(x, y, width, height, rx || ry);\n } else {\n session.context.rect(x, y, width, height);\n }\n if (fillStyle)\n session.context.fill();\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"ellipse\":\n cx = parseFloatAttribute(svg, \"cx\", 0);\n cy = parseFloatAttribute(svg, \"cy\", 0);\n rx = parseFloatAttribute(svg, \"rx\", 0);\n ry = parseFloatAttribute(svg, \"ry\", 0);\n session.context.beginPath();\n session.context.ellipse(cx, cy, rx, ry);\n if (fillStyle)\n session.context.fill();\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"line\":\n x1 = parseFloatAttribute(svg, \"x1\", 0);\n y1 = parseFloatAttribute(svg, \"y1\", 0);\n x2 = parseFloatAttribute(svg, \"x2\", 0);\n y2 = parseFloatAttribute(svg, \"y2\", 0);\n session.context.beginPath();\n session.context.moveTo(x1, y1);\n session.context.lineTo(x2, y2);\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"polygon\":\n pointsString = svg.getAttribute(\"points\");\n points = pointsString.match(/\\d+/g).map((n) => parseInt(n, 10));\n session.context.poly(points, true);\n if (fillStyle)\n session.context.fill();\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"polyline\":\n pointsString = svg.getAttribute(\"points\");\n points = pointsString.match(/\\d+/g).map((n) => parseInt(n, 10));\n session.context.poly(points, false);\n if (strokeStyle)\n session.context.stroke();\n break;\n case \"g\":\n case \"svg\":\n break;\n default: {\n console.info(`[SVG parser] <${svg.nodeName}> elements unsupported`);\n break;\n }\n }\n for (let i = 0; i < children.length; i++) {\n renderChildren(children[i], session, fillStyle, strokeStyle);\n }\n}\nfunction parseFloatAttribute(svg, id, defaultValue) {\n const value = svg.getAttribute(id);\n return value ? Number(value) : defaultValue;\n}\nfunction parseStyle(svg) {\n const style = svg.getAttribute(\"style\");\n const strokeStyle = {};\n const fillStyle = {};\n let useFill = false;\n let useStroke = false;\n if (style) {\n const styleParts = style.split(\";\");\n for (let i = 0; i < styleParts.length; i++) {\n const stylePart = styleParts[i];\n const [key, value] = stylePart.split(\":\");\n switch (key) {\n case \"stroke\":\n if (value !== \"none\") {\n strokeStyle.color = Color.shared.setValue(value).toNumber();\n useStroke = true;\n }\n break;\n case \"stroke-width\":\n strokeStyle.width = Number(value);\n break;\n case \"fill\":\n if (value !== \"none\") {\n useFill = true;\n fillStyle.color = Color.shared.setValue(value).toNumber();\n }\n break;\n case \"fill-opacity\":\n fillStyle.alpha = Number(value);\n break;\n case \"stroke-opacity\":\n strokeStyle.alpha = Number(value);\n break;\n case \"opacity\":\n fillStyle.alpha = Number(value);\n strokeStyle.alpha = Number(value);\n break;\n }\n }\n } else {\n const stroke = svg.getAttribute(\"stroke\");\n if (stroke && stroke !== \"none\") {\n useStroke = true;\n strokeStyle.color = Color.shared.setValue(stroke).toNumber();\n strokeStyle.width = parseFloatAttribute(svg, \"stroke-width\", 1);\n }\n const fill = svg.getAttribute(\"fill\");\n if (fill && fill !== \"none\") {\n useFill = true;\n fillStyle.color = Color.shared.setValue(fill).toNumber();\n }\n }\n return {\n strokeStyle: useStroke ? strokeStyle : null,\n fillStyle: useFill ? fillStyle : null\n };\n}\n\nexport { SVGParser };\n//# sourceMappingURL=SVGParser.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { Texture } from '../../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { FillGradient } from '../fill/FillGradient.mjs';\nimport { FillPattern } from '../fill/FillPattern.mjs';\n\n\"use strict\";\nfunction isColorLike(value) {\n return Color.isColorLike(value);\n}\nfunction isFillPattern(value) {\n return value instanceof FillPattern;\n}\nfunction isFillGradient(value) {\n return value instanceof FillGradient;\n}\nfunction handleColorLike(fill, value, defaultStyle) {\n const temp = Color.shared.setValue(value ?? 0);\n fill.color = temp.toNumber();\n fill.alpha = temp.alpha === 1 ? defaultStyle.alpha : temp.alpha;\n fill.texture = Texture.WHITE;\n return { ...defaultStyle, ...fill };\n}\nfunction handleFillPattern(fill, value, defaultStyle) {\n fill.fill = value;\n fill.color = 16777215;\n fill.texture = value.texture;\n fill.matrix = value.transform;\n return { ...defaultStyle, ...fill };\n}\nfunction handleFillGradient(fill, value, defaultStyle) {\n value.buildLinearGradient();\n fill.fill = value;\n fill.color = 16777215;\n fill.texture = value.texture;\n fill.matrix = value.transform;\n return { ...defaultStyle, ...fill };\n}\nfunction handleFillObject(value, defaultStyle) {\n const style = { ...defaultStyle, ...value };\n if (style.texture) {\n if (style.texture !== Texture.WHITE) {\n const m = style.matrix?.invert() || new Matrix();\n m.translate(style.texture.frame.x, style.texture.frame.y);\n m.scale(1 / style.texture.source.width, 1 / style.texture.source.height);\n style.matrix = m;\n }\n const sourceStyle = style.texture.source.style;\n if (sourceStyle.addressMode === \"clamp-to-edge\") {\n sourceStyle.addressMode = \"repeat\";\n sourceStyle.update();\n }\n }\n const color = Color.shared.setValue(style.color);\n style.alpha *= color.alpha;\n style.color = color.toNumber();\n style.matrix = style.matrix ? style.matrix.clone() : null;\n return style;\n}\nfunction toFillStyle(value, defaultStyle) {\n if (value === void 0 || value === null) {\n return null;\n }\n const fill = {};\n const objectStyle = value;\n if (isColorLike(value)) {\n return handleColorLike(fill, value, defaultStyle);\n } else if (isFillPattern(value)) {\n return handleFillPattern(fill, value, defaultStyle);\n } else if (isFillGradient(value)) {\n return handleFillGradient(fill, value, defaultStyle);\n } else if (objectStyle.fill && isFillPattern(objectStyle.fill)) {\n return handleFillPattern(objectStyle, objectStyle.fill, defaultStyle);\n } else if (objectStyle.fill && isFillGradient(objectStyle.fill)) {\n return handleFillGradient(objectStyle, objectStyle.fill, defaultStyle);\n }\n return handleFillObject(objectStyle, defaultStyle);\n}\nfunction toStrokeStyle(value, defaultStyle) {\n const { width, alignment, miterLimit, cap, join, ...rest } = defaultStyle;\n const fill = toFillStyle(value, rest);\n if (!fill) {\n return null;\n }\n return {\n width,\n alignment,\n miterLimit,\n cap,\n join,\n ...fill\n };\n}\n\nexport { toFillStyle, toStrokeStyle };\n//# sourceMappingURL=convertFillInputToFillStyle.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { Color } from '../../../color/Color.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { Point } from '../../../maths/point/Point.mjs';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { uid } from '../../../utils/data/uid.mjs';\nimport { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';\nimport { Bounds } from '../../container/bounds/Bounds.mjs';\nimport { GraphicsPath } from './path/GraphicsPath.mjs';\nimport { SVGParser } from './svg/SVGParser.mjs';\nimport { toFillStyle, toStrokeStyle } from './utils/convertFillInputToFillStyle.mjs';\n\n\"use strict\";\nconst tmpPoint = new Point();\nconst tempMatrix = new Matrix();\nconst _GraphicsContext = class _GraphicsContext extends EventEmitter {\n constructor() {\n super(...arguments);\n /** unique id for this graphics context */\n this.uid = uid(\"graphicsContext\");\n this.dirty = true;\n this.batchMode = \"auto\";\n this.instructions = [];\n this._activePath = new GraphicsPath();\n this._transform = new Matrix();\n this._fillStyle = { ..._GraphicsContext.defaultFillStyle };\n this._strokeStyle = { ..._GraphicsContext.defaultStrokeStyle };\n this._stateStack = [];\n this._tick = 0;\n this._bounds = new Bounds();\n this._boundsDirty = true;\n }\n /**\n * Creates a new GraphicsContext object that is a clone of this instance, copying all properties,\n * including the current drawing state, transformations, styles, and instructions.\n * @returns A new GraphicsContext instance with the same properties and state as this one.\n */\n clone() {\n const clone = new _GraphicsContext();\n clone.batchMode = this.batchMode;\n clone.instructions = this.instructions.slice();\n clone._activePath = this._activePath.clone();\n clone._transform = this._transform.clone();\n clone._fillStyle = { ...this._fillStyle };\n clone._strokeStyle = { ...this._strokeStyle };\n clone._stateStack = this._stateStack.slice();\n clone._bounds = this._bounds.clone();\n clone._boundsDirty = true;\n return clone;\n }\n /**\n * The current fill style of the graphics context. This can be a color, gradient, pattern, or a more complex style defined by a FillStyle object.\n */\n get fillStyle() {\n return this._fillStyle;\n }\n set fillStyle(value) {\n this._fillStyle = toFillStyle(value, _GraphicsContext.defaultFillStyle);\n }\n /**\n * The current stroke style of the graphics context. Similar to fill styles, stroke styles can encompass colors, gradients, patterns, or more detailed configurations via a StrokeStyle object.\n */\n get strokeStyle() {\n return this._strokeStyle;\n }\n set strokeStyle(value) {\n this._strokeStyle = toStrokeStyle(value, _GraphicsContext.defaultStrokeStyle);\n }\n /**\n * Sets the current fill style of the graphics context. The fill style can be a color, gradient,\n * pattern, or a more complex style defined by a FillStyle object.\n * @param style - The fill style to apply. This can be a simple color, a gradient or pattern object,\n * or a FillStyle or ConvertedFillStyle object.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n setFillStyle(style) {\n this._fillStyle = toFillStyle(style, _GraphicsContext.defaultFillStyle);\n return this;\n }\n /**\n * Sets the current stroke style of the graphics context. Similar to fill styles, stroke styles can\n * encompass colors, gradients, patterns, or more detailed configurations via a StrokeStyle object.\n * @param style - The stroke style to apply. Can be defined as a color, a gradient or pattern,\n * or a StrokeStyle or ConvertedStrokeStyle object.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n setStrokeStyle(style) {\n this._strokeStyle = toFillStyle(style, _GraphicsContext.defaultStrokeStyle);\n return this;\n }\n texture(texture, tint, dx, dy, dw, dh) {\n this.instructions.push({\n action: \"texture\",\n data: {\n image: texture,\n dx: dx || 0,\n dy: dy || 0,\n dw: dw || texture.frame.width,\n dh: dh || texture.frame.height,\n transform: this._transform.clone(),\n alpha: this._fillStyle.alpha,\n style: tint ? Color.shared.setValue(tint).toNumber() : 16777215\n }\n });\n this.onUpdate();\n return this;\n }\n /**\n * Resets the current path. Any previous path and its commands are discarded and a new path is\n * started. This is typically called before beginning a new shape or series of drawing commands.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n beginPath() {\n this._activePath = new GraphicsPath();\n return this;\n }\n fill(style, alpha) {\n let path;\n const lastInstruction = this.instructions[this.instructions.length - 1];\n if (this._tick === 0 && lastInstruction && lastInstruction.action === \"stroke\") {\n path = lastInstruction.data.path;\n } else {\n path = this._activePath.clone();\n }\n if (!path)\n return this;\n if (style != null) {\n if (alpha !== void 0 && typeof style === \"number\") {\n deprecation(v8_0_0, \"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead\");\n style = { color: style, alpha };\n }\n this._fillStyle = toFillStyle(style, _GraphicsContext.defaultFillStyle);\n }\n this.instructions.push({\n action: \"fill\",\n // TODO copy fill style!\n data: { style: this.fillStyle, path }\n });\n this.onUpdate();\n this._initNextPathLocation();\n this._tick = 0;\n return this;\n }\n _initNextPathLocation() {\n const { x, y } = this._activePath.getLastPoint(Point.shared);\n this._activePath.clear();\n this._activePath.moveTo(x, y);\n }\n /**\n * Strokes the current path with the current stroke style. This method can take an optional\n * FillInput parameter to define the stroke's appearance, including its color, width, and other properties.\n * @param style - (Optional) The stroke style to apply. Can be defined as a simple color or a more complex style object. If omitted, uses the current stroke style.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n stroke(style) {\n let path;\n const lastInstruction = this.instructions[this.instructions.length - 1];\n if (this._tick === 0 && lastInstruction && lastInstruction.action === \"fill\") {\n path = lastInstruction.data.path;\n } else {\n path = this._activePath.clone();\n }\n if (!path)\n return this;\n if (style != null) {\n this._strokeStyle = toStrokeStyle(style, _GraphicsContext.defaultStrokeStyle);\n }\n this.instructions.push({\n action: \"stroke\",\n // TODO copy fill style!\n data: { style: this.strokeStyle, path }\n });\n this.onUpdate();\n this._initNextPathLocation();\n this._tick = 0;\n return this;\n }\n /**\n * Applies a cutout to the last drawn shape. This is used to create holes or complex shapes by\n * subtracting a path from the previously drawn path. If a hole is not completely in a shape, it will\n * fail to cut correctly!\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n cut() {\n for (let i = 0; i < 2; i++) {\n const lastInstruction = this.instructions[this.instructions.length - 1 - i];\n const holePath = this._activePath.clone();\n if (lastInstruction) {\n if (lastInstruction.action === \"stroke\" || lastInstruction.action === \"fill\") {\n if (lastInstruction.data.hole) {\n lastInstruction.data.hole.addPath(holePath);\n } else {\n lastInstruction.data.hole = holePath;\n break;\n }\n }\n }\n }\n this._initNextPathLocation();\n return this;\n }\n /**\n * Adds an arc to the current path, which is centered at (x, y) with the specified radius,\n * starting and ending angles, and direction.\n * @param x - The x-coordinate of the arc's center.\n * @param y - The y-coordinate of the arc's center.\n * @param radius - The arc's radius.\n * @param startAngle - The starting angle, in radians.\n * @param endAngle - The ending angle, in radians.\n * @param counterclockwise - (Optional) Specifies whether the arc is drawn counterclockwise (true) or clockwise (false). Defaults to false.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n arc(x, y, radius, startAngle, endAngle, counterclockwise) {\n this._tick++;\n const t = this._transform;\n this._activePath.arc(\n t.a * x + t.c * y + t.tx,\n t.b * x + t.d * y + t.ty,\n radius,\n startAngle,\n endAngle,\n counterclockwise\n );\n return this;\n }\n /**\n * Adds an arc to the current path with the given control points and radius, connected to the previous point\n * by a straight line if necessary.\n * @param x1 - The x-coordinate of the first control point.\n * @param y1 - The y-coordinate of the first control point.\n * @param x2 - The x-coordinate of the second control point.\n * @param y2 - The y-coordinate of the second control point.\n * @param radius - The arc's radius.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n arcTo(x1, y1, x2, y2, radius) {\n this._tick++;\n const t = this._transform;\n this._activePath.arcTo(\n t.a * x1 + t.c * y1 + t.tx,\n t.b * x1 + t.d * y1 + t.ty,\n t.a * x2 + t.c * y2 + t.tx,\n t.b * x2 + t.d * y2 + t.ty,\n radius\n );\n return this;\n }\n /**\n * Adds an SVG-style arc to the path, allowing for elliptical arcs based on the SVG spec.\n * @param rx - The x-radius of the ellipse.\n * @param ry - The y-radius of the ellipse.\n * @param xAxisRotation - The rotation of the ellipse's x-axis relative\n * to the x-axis of the coordinate system, in degrees.\n * @param largeArcFlag - Determines if the arc should be greater than or less than 180 degrees.\n * @param sweepFlag - Determines if the arc should be swept in a positive angle direction.\n * @param x - The x-coordinate of the arc's end point.\n * @param y - The y-coordinate of the arc's end point.\n * @returns The instance of the current object for chaining.\n */\n arcToSvg(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {\n this._tick++;\n const t = this._transform;\n this._activePath.arcToSvg(\n rx,\n ry,\n xAxisRotation,\n // should we rotate this with transform??\n largeArcFlag,\n sweepFlag,\n t.a * x + t.c * y + t.tx,\n t.b * x + t.d * y + t.ty\n );\n return this;\n }\n /**\n * Adds a cubic Bezier curve to the path.\n * It requires three points: the first two are control points and the third one is the end point.\n * The starting point is the last point in the current path.\n * @param cp1x - The x-coordinate of the first control point.\n * @param cp1y - The y-coordinate of the first control point.\n * @param cp2x - The x-coordinate of the second control point.\n * @param cp2y - The y-coordinate of the second control point.\n * @param x - The x-coordinate of the end point.\n * @param y - The y-coordinate of the end point.\n * @param smoothness - Optional parameter to adjust the smoothness of the curve.\n * @returns The instance of the current object for chaining.\n */\n bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {\n this._tick++;\n const t = this._transform;\n this._activePath.bezierCurveTo(\n t.a * cp1x + t.c * cp1y + t.tx,\n t.b * cp1x + t.d * cp1y + t.ty,\n t.a * cp2x + t.c * cp2y + t.tx,\n t.b * cp2x + t.d * cp2y + t.ty,\n t.a * x + t.c * y + t.tx,\n t.b * x + t.d * y + t.ty,\n smoothness\n );\n return this;\n }\n /**\n * Closes the current path by drawing a straight line back to the start.\n * If the shape is already closed or there are no points in the path, this method does nothing.\n * @returns The instance of the current object for chaining.\n */\n closePath() {\n this._tick++;\n this._activePath?.closePath();\n return this;\n }\n /**\n * Draws an ellipse at the specified location and with the given x and y radii.\n * An optional transformation can be applied, allowing for rotation, scaling, and translation.\n * @param x - The x-coordinate of the center of the ellipse.\n * @param y - The y-coordinate of the center of the ellipse.\n * @param radiusX - The horizontal radius of the ellipse.\n * @param radiusY - The vertical radius of the ellipse.\n * @returns The instance of the current object for chaining.\n */\n ellipse(x, y, radiusX, radiusY) {\n this._tick++;\n this._activePath.ellipse(x, y, radiusX, radiusY, this._transform.clone());\n return this;\n }\n /**\n * Draws a circle shape. This method adds a new circle path to the current drawing.\n * @param x - The x-coordinate of the center of the circle.\n * @param y - The y-coordinate of the center of the circle.\n * @param radius - The radius of the circle.\n * @returns The instance of the current object for chaining.\n */\n circle(x, y, radius) {\n this._tick++;\n this._activePath.circle(x, y, radius, this._transform.clone());\n return this;\n }\n /**\n * Adds another `GraphicsPath` to this path, optionally applying a transformation.\n * @param path - The `GraphicsPath` to add.\n * @returns The instance of the current object for chaining.\n */\n path(path) {\n this._tick++;\n this._activePath.addPath(path, this._transform.clone());\n return this;\n }\n /**\n * Connects the current point to a new point with a straight line. This method updates the current path.\n * @param x - The x-coordinate of the new point to connect to.\n * @param y - The y-coordinate of the new point to connect to.\n * @returns The instance of the current object for chaining.\n */\n lineTo(x, y) {\n this._tick++;\n const t = this._transform;\n this._activePath.lineTo(\n t.a * x + t.c * y + t.tx,\n t.b * x + t.d * y + t.ty\n );\n return this;\n }\n /**\n * Sets the starting point for a new sub-path. Any subsequent drawing commands are considered part of this path.\n * @param x - The x-coordinate for the starting point.\n * @param y - The y-coordinate for the starting point.\n * @returns The instance of the current object for chaining.\n */\n moveTo(x, y) {\n this._tick++;\n const t = this._transform;\n const instructions = this._activePath.instructions;\n const transformedX = t.a * x + t.c * y + t.tx;\n const transformedY = t.b * x + t.d * y + t.ty;\n if (instructions.length === 1 && instructions[0].action === \"moveTo\") {\n instructions[0].data[0] = transformedX;\n instructions[0].data[1] = transformedY;\n return this;\n }\n this._activePath.moveTo(\n transformedX,\n transformedY\n );\n return this;\n }\n /**\n * Adds a quadratic curve to the path. It requires two points: the control point and the end point.\n * The starting point is the last point in the current path.\n * @param cpx - The x-coordinate of the control point.\n * @param cpy - The y-coordinate of the control point.\n * @param x - The x-coordinate of the end point.\n * @param y - The y-coordinate of the end point.\n * @param smoothness - Optional parameter to adjust the smoothness of the curve.\n * @returns The instance of the current object for chaining.\n */\n quadraticCurveTo(cpx, cpy, x, y, smoothness) {\n this._tick++;\n const t = this._transform;\n this._activePath.quadraticCurveTo(\n t.a * cpx + t.c * cpy + t.tx,\n t.b * cpx + t.d * cpy + t.ty,\n t.a * x + t.c * y + t.tx,\n t.b * x + t.d * y + t.ty,\n smoothness\n );\n return this;\n }\n /**\n * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.\n * @param x - The x-coordinate of the top-left corner of the rectangle.\n * @param y - The y-coordinate of the top-left corner of the rectangle.\n * @param w - The width of the rectangle.\n * @param h - The height of the rectangle.\n * @returns The instance of the current object for chaining.\n */\n rect(x, y, w, h) {\n this._tick++;\n this._activePath.rect(x, y, w, h, this._transform.clone());\n return this;\n }\n /**\n * Draws a rectangle with rounded corners.\n * The corner radius can be specified to determine how rounded the corners should be.\n * An optional transformation can be applied, which allows for rotation, scaling, and translation of the rectangle.\n * @param x - The x-coordinate of the top-left corner of the rectangle.\n * @param y - The y-coordinate of the top-left corner of the rectangle.\n * @param w - The width of the rectangle.\n * @param h - The height of the rectangle.\n * @param radius - The radius of the rectangle's corners. If not specified, corners will be sharp.\n * @returns The instance of the current object for chaining.\n */\n roundRect(x, y, w, h, radius) {\n this._tick++;\n this._activePath.roundRect(x, y, w, h, radius, this._transform.clone());\n return this;\n }\n /**\n * Draws a polygon shape by specifying a sequence of points. This method allows for the creation of complex polygons,\n * which can be both open and closed. An optional transformation can be applied, enabling the polygon to be scaled,\n * rotated, or translated as needed.\n * @param points - An array of numbers, or an array of PointData objects eg [{x,y}, {x,y}, {x,y}]\n * representing the x and y coordinates, of the polygon's vertices, in sequence.\n * @param close - A boolean indicating whether to close the polygon path. True by default.\n */\n poly(points, close) {\n this._tick++;\n this._activePath.poly(points, close, this._transform.clone());\n return this;\n }\n /**\n * Draws a regular polygon with a specified number of sides. All sides and angles are equal.\n * @param x - The x-coordinate of the center of the polygon.\n * @param y - The y-coordinate of the center of the polygon.\n * @param radius - The radius of the circumscribed circle of the polygon.\n * @param sides - The number of sides of the polygon. Must be 3 or more.\n * @param rotation - The rotation angle of the polygon, in radians. Zero by default.\n * @param transform - An optional `Matrix` object to apply a transformation to the polygon.\n * @returns The instance of the current object for chaining.\n */\n regularPoly(x, y, radius, sides, rotation = 0, transform) {\n this._tick++;\n this._activePath.regularPoly(x, y, radius, sides, rotation, transform);\n return this;\n }\n /**\n * Draws a polygon with rounded corners.\n * Similar to `regularPoly` but with the ability to round the corners of the polygon.\n * @param x - The x-coordinate of the center of the polygon.\n * @param y - The y-coordinate of the center of the polygon.\n * @param radius - The radius of the circumscribed circle of the polygon.\n * @param sides - The number of sides of the polygon. Must be 3 or more.\n * @param corner - The radius of the rounding of the corners.\n * @param rotation - The rotation angle of the polygon, in radians. Zero by default.\n * @returns The instance of the current object for chaining.\n */\n roundPoly(x, y, radius, sides, corner, rotation) {\n this._tick++;\n this._activePath.roundPoly(x, y, radius, sides, corner, rotation);\n return this;\n }\n /**\n * Draws a shape with rounded corners. This function supports custom radius for each corner of the shape.\n * Optionally, corners can be rounded using a quadratic curve instead of an arc, providing a different aesthetic.\n * @param points - An array of `RoundedPoint` representing the corners of the shape to draw.\n * A minimum of 3 points is required.\n * @param radius - The default radius for the corners.\n * This radius is applied to all corners unless overridden in `points`.\n * @param useQuadratic - If set to true, rounded corners are drawn using a quadraticCurve\n * method instead of an arc method. Defaults to false.\n * @param smoothness - Specifies the smoothness of the curve when `useQuadratic` is true.\n * Higher values make the curve smoother.\n * @returns The instance of the current object for chaining.\n */\n roundShape(points, radius, useQuadratic, smoothness) {\n this._tick++;\n this._activePath.roundShape(points, radius, useQuadratic, smoothness);\n return this;\n }\n /**\n * Draw Rectangle with fillet corners. This is much like rounded rectangle\n * however it support negative numbers as well for the corner radius.\n * @param x - Upper left corner of rect\n * @param y - Upper right corner of rect\n * @param width - Width of rect\n * @param height - Height of rect\n * @param fillet - accept negative or positive values\n */\n filletRect(x, y, width, height, fillet) {\n this._tick++;\n this._activePath.filletRect(x, y, width, height, fillet);\n return this;\n }\n /**\n * Draw Rectangle with chamfer corners. These are angled corners.\n * @param x - Upper left corner of rect\n * @param y - Upper right corner of rect\n * @param width - Width of rect\n * @param height - Height of rect\n * @param chamfer - non-zero real number, size of corner cutout\n * @param transform\n */\n chamferRect(x, y, width, height, chamfer, transform) {\n this._tick++;\n this._activePath.chamferRect(x, y, width, height, chamfer, transform);\n return this;\n }\n /**\n * Draws a star shape centered at a specified location. This method allows for the creation\n * of stars with a variable number of points, outer radius, optional inner radius, and rotation.\n * The star is drawn as a closed polygon with alternating outer and inner vertices to create the star's points.\n * An optional transformation can be applied to scale, rotate, or translate the star as needed.\n * @param x - The x-coordinate of the center of the star.\n * @param y - The y-coordinate of the center of the star.\n * @param points - The number of points of the star.\n * @param radius - The outer radius of the star (distance from the center to the outer points).\n * @param innerRadius - Optional. The inner radius of the star\n * (distance from the center to the inner points between the outer points).\n * If not provided, defaults to half of the `radius`.\n * @param rotation - Optional. The rotation of the star in radians, where 0 is aligned with the y-axis.\n * Defaults to 0, meaning one point is directly upward.\n * @returns The instance of the current object for chaining further drawing commands.\n */\n star(x, y, points, radius, innerRadius = 0, rotation = 0) {\n this._tick++;\n this._activePath.star(x, y, points, radius, innerRadius, rotation, this._transform.clone());\n return this;\n }\n /**\n * Parses and renders an SVG string into the graphics context. This allows for complex shapes and paths\n * defined in SVG format to be drawn within the graphics context.\n * @param svg - The SVG string to be parsed and rendered.\n */\n svg(svg) {\n this._tick++;\n SVGParser(svg, this);\n return this;\n }\n /**\n * Restores the most recently saved graphics state by popping the top of the graphics state stack.\n * This includes transformations, fill styles, and stroke styles.\n */\n restore() {\n const state = this._stateStack.pop();\n if (state) {\n this._transform = state.transform;\n this._fillStyle = state.fillStyle;\n this._strokeStyle = state.strokeStyle;\n }\n return this;\n }\n /** Saves the current graphics state, including transformations, fill styles, and stroke styles, onto a stack. */\n save() {\n this._stateStack.push({\n transform: this._transform.clone(),\n fillStyle: { ...this._fillStyle },\n strokeStyle: { ...this._strokeStyle }\n });\n return this;\n }\n /**\n * Returns the current transformation matrix of the graphics context.\n * @returns The current transformation matrix.\n */\n getTransform() {\n return this._transform;\n }\n /**\n * Resets the current transformation matrix to the identity matrix, effectively removing any transformations (rotation, scaling, translation) previously applied.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n resetTransform() {\n this._transform.identity();\n return this;\n }\n /**\n * Applies a rotation transformation to the graphics context around the current origin.\n * @param angle - The angle of rotation in radians.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n rotate(angle) {\n this._transform.rotate(angle);\n return this;\n }\n /**\n * Applies a scaling transformation to the graphics context, scaling drawings by x horizontally and by y vertically.\n * @param x - The scale factor in the horizontal direction.\n * @param y - (Optional) The scale factor in the vertical direction. If not specified, the x value is used for both directions.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n scale(x, y = x) {\n this._transform.scale(x, y);\n return this;\n }\n setTransform(a, b, c, d, dx, dy) {\n if (a instanceof Matrix) {\n this._transform.set(a.a, a.b, a.c, a.d, a.tx, a.ty);\n return this;\n }\n this._transform.set(a, b, c, d, dx, dy);\n return this;\n }\n transform(a, b, c, d, dx, dy) {\n if (a instanceof Matrix) {\n this._transform.append(a);\n return this;\n }\n tempMatrix.set(a, b, c, d, dx, dy);\n this._transform.append(tempMatrix);\n return this;\n }\n /**\n * Applies a translation transformation to the graphics context, moving the origin by the specified amounts.\n * @param x - The amount to translate in the horizontal direction.\n * @param y - (Optional) The amount to translate in the vertical direction. If not specified, the x value is used for both directions.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n translate(x, y = x) {\n this._transform.translate(x, y);\n return this;\n }\n /**\n * Clears all drawing commands from the graphics context, effectively resetting it. This includes clearing the path,\n * and optionally resetting transformations to the identity matrix.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n clear() {\n this._activePath.clear();\n this.instructions.length = 0;\n this.resetTransform();\n this.onUpdate();\n return this;\n }\n onUpdate() {\n if (this.dirty)\n return;\n this.emit(\"update\", this, 16);\n this.dirty = true;\n this._boundsDirty = true;\n }\n /** The bounds of the graphic shape. */\n get bounds() {\n if (!this._boundsDirty)\n return this._bounds;\n const bounds = this._bounds;\n bounds.clear();\n for (let i = 0; i < this.instructions.length; i++) {\n const instruction = this.instructions[i];\n const action = instruction.action;\n if (action === \"fill\") {\n const data = instruction.data;\n bounds.addBounds(data.path.bounds);\n } else if (action === \"texture\") {\n const data = instruction.data;\n bounds.addFrame(data.dx, data.dy, data.dx + data.dw, data.dy + data.dh, data.transform);\n }\n if (action === \"stroke\") {\n const data = instruction.data;\n const padding = data.style.width / 2;\n const _bounds = data.path.bounds;\n bounds.addFrame(\n _bounds.minX - padding,\n _bounds.minY - padding,\n _bounds.maxX + padding,\n _bounds.maxY + padding\n );\n }\n }\n return bounds;\n }\n /**\n * Check to see if a point is contained within this geometry.\n * @param point - Point to check if it's contained.\n * @returns {boolean} `true` if the point is contained within geometry.\n */\n containsPoint(point) {\n if (!this.bounds.containsPoint(point.x, point.y))\n return false;\n const instructions = this.instructions;\n let hasHit = false;\n for (let k = 0; k < instructions.length; k++) {\n const instruction = instructions[k];\n const data = instruction.data;\n const path = data.path;\n if (!instruction.action || !path)\n continue;\n const style = data.style;\n const shapes = path.shapePath.shapePrimitives;\n for (let i = 0; i < shapes.length; i++) {\n const shape = shapes[i].shape;\n if (!style || !shape)\n continue;\n const transform = shapes[i].transform;\n const transformedPoint = transform ? transform.applyInverse(point, tmpPoint) : point;\n if (instruction.action === \"fill\") {\n hasHit = shape.contains(transformedPoint.x, transformedPoint.y);\n } else {\n hasHit = shape.strokeContains(transformedPoint.x, transformedPoint.y, style.width);\n }\n const holes = data.hole;\n if (holes) {\n const holeShapes = holes.shapePath?.shapePrimitives;\n if (holeShapes) {\n for (let j = 0; j < holeShapes.length; j++) {\n if (holeShapes[j].shape.contains(transformedPoint.x, transformedPoint.y)) {\n hasHit = false;\n }\n }\n }\n }\n if (hasHit) {\n return true;\n }\n }\n }\n return hasHit;\n }\n /**\n * Destroys the GraphicsData object.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the fill/stroke style?\n * @param {boolean} [options.textureSource=false] - Should it destroy the texture source of the fill/stroke style?\n */\n destroy(options = false) {\n this._stateStack.length = 0;\n this._transform = null;\n this.emit(\"destroy\", this);\n this.removeAllListeners();\n const destroyTexture = typeof options === \"boolean\" ? options : options?.texture;\n if (destroyTexture) {\n const destroyTextureSource = typeof options === \"boolean\" ? options : options?.textureSource;\n if (this._fillStyle.texture) {\n this._fillStyle.texture.destroy(destroyTextureSource);\n }\n if (this._strokeStyle.texture) {\n this._strokeStyle.texture.destroy(destroyTextureSource);\n }\n }\n this._fillStyle = null;\n this._strokeStyle = null;\n this.instructions = null;\n this._activePath = null;\n this._bounds = null;\n this._stateStack = null;\n this.customShader = null;\n this._transform = null;\n }\n};\n/** The default fill style to use when none is provided. */\n_GraphicsContext.defaultFillStyle = {\n /** The color to use for the fill. */\n color: 16777215,\n /** The alpha value to use for the fill. */\n alpha: 1,\n /** The texture to use for the fill. */\n texture: Texture.WHITE,\n /** The matrix to apply. */\n matrix: null,\n /** The fill pattern to use. */\n fill: null\n};\n/** The default stroke style to use when none is provided. */\n_GraphicsContext.defaultStrokeStyle = {\n /** The width of the stroke. */\n width: 1,\n /** The color to use for the stroke. */\n color: 16777215,\n /** The alpha value to use for the stroke. */\n alpha: 1,\n /** The alignment of the stroke. */\n alignment: 0.5,\n /** The miter limit to use. */\n miterLimit: 10,\n /** The line cap style to use. */\n cap: \"butt\",\n /** The line join style to use. */\n join: \"miter\",\n /** The texture to use for the fill. */\n texture: Texture.WHITE,\n /** The matrix to apply. */\n matrix: null,\n /** The fill pattern to use. */\n fill: null\n};\nlet GraphicsContext = _GraphicsContext;\n\nexport { GraphicsContext };\n//# sourceMappingURL=GraphicsContext.mjs.map\n","import { Color } from '../../../color/Color.mjs';\n\n\"use strict\";\nconst valuesToIterateForKeys = [\n \"align\",\n \"breakWords\",\n \"cssOverrides\",\n \"fontVariant\",\n \"fontWeight\",\n \"leading\",\n \"letterSpacing\",\n \"lineHeight\",\n \"padding\",\n \"textBaseline\",\n \"trim\",\n \"whiteSpace\",\n \"wordWrap\",\n \"wordWrapWidth\",\n \"fontFamily\",\n \"fontStyle\",\n \"fontSize\"\n];\nfunction generateTextStyleKey(style) {\n const key = [];\n let index = 0;\n for (let i = 0; i < valuesToIterateForKeys.length; i++) {\n const prop = `_${valuesToIterateForKeys[i]}`;\n key[index++] = style[prop];\n }\n index = addFillStyleKey(style._fill, key, index);\n index = addStokeStyleKey(style._stroke, key, index);\n index = addDropShadowKey(style.dropShadow, key, index);\n return key.join(\"-\");\n}\nfunction addFillStyleKey(fillStyle, key, index) {\n if (!fillStyle)\n return index;\n key[index++] = fillStyle.color;\n key[index++] = fillStyle.alpha;\n key[index++] = fillStyle.fill?.styleKey;\n return index;\n}\nfunction addStokeStyleKey(strokeStyle, key, index) {\n if (!strokeStyle)\n return index;\n index = addFillStyleKey(strokeStyle, key, index);\n key[index++] = strokeStyle.width;\n key[index++] = strokeStyle.alignment;\n key[index++] = strokeStyle.cap;\n key[index++] = strokeStyle.join;\n key[index++] = strokeStyle.miterLimit;\n return index;\n}\nfunction addDropShadowKey(dropShadow, key, index) {\n if (!dropShadow)\n return index;\n key[index++] = dropShadow.alpha;\n key[index++] = dropShadow.angle;\n key[index++] = dropShadow.blur;\n key[index++] = dropShadow.distance;\n key[index++] = Color.shared.setValue(dropShadow.color).toNumber();\n return index;\n}\n\nexport { generateTextStyleKey };\n//# sourceMappingURL=generateTextStyleKey.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { Color } from '../../color/Color.mjs';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\nimport { FillGradient } from '../graphics/shared/fill/FillGradient.mjs';\nimport { FillPattern } from '../graphics/shared/fill/FillPattern.mjs';\nimport { GraphicsContext } from '../graphics/shared/GraphicsContext.mjs';\nimport { toFillStyle, toStrokeStyle } from '../graphics/shared/utils/convertFillInputToFillStyle.mjs';\nimport { generateTextStyleKey } from './utils/generateTextStyleKey.mjs';\n\n\"use strict\";\nconst _TextStyle = class _TextStyle extends EventEmitter {\n constructor(style = {}) {\n super();\n convertV7Tov8Style(style);\n const fullStyle = { ..._TextStyle.defaultTextStyle, ...style };\n for (const key in fullStyle) {\n const thisKey = key;\n this[thisKey] = fullStyle[key];\n }\n this.update();\n }\n /**\n * Alignment for multiline text, does not affect single line text.\n * @member {'left'|'center'|'right'|'justify'}\n */\n get align() {\n return this._align;\n }\n set align(value) {\n this._align = value;\n this.update();\n }\n /** Indicates if lines can be wrapped within words, it needs wordWrap to be set to true. */\n get breakWords() {\n return this._breakWords;\n }\n set breakWords(value) {\n this._breakWords = value;\n this.update();\n }\n /** Set a drop shadow for the text. */\n get dropShadow() {\n return this._dropShadow;\n }\n set dropShadow(value) {\n if (value !== null && typeof value === \"object\") {\n this._dropShadow = this._createProxy({ ..._TextStyle.defaultDropShadow, ...value });\n } else {\n this._dropShadow = value ? this._createProxy({ ..._TextStyle.defaultDropShadow }) : null;\n }\n this.update();\n }\n /** The font family, can be a single font name, or a list of names where the first is the preferred font. */\n get fontFamily() {\n return this._fontFamily;\n }\n set fontFamily(value) {\n this._fontFamily = value;\n this.update();\n }\n /** The font size (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') */\n get fontSize() {\n return this._fontSize;\n }\n set fontSize(value) {\n if (typeof value === \"string\") {\n this._fontSize = parseInt(value, 10);\n } else {\n this._fontSize = value;\n }\n this.update();\n }\n /**\n * The font style.\n * @member {'normal'|'italic'|'oblique'}\n */\n get fontStyle() {\n return this._fontStyle;\n }\n set fontStyle(value) {\n this._fontStyle = value;\n this.update();\n }\n /**\n * The font variant.\n * @member {'normal'|'small-caps'}\n */\n get fontVariant() {\n return this._fontVariant;\n }\n set fontVariant(value) {\n this._fontVariant = value;\n this.update();\n }\n /**\n * The font weight.\n * @member {'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900'}\n */\n get fontWeight() {\n return this._fontWeight;\n }\n set fontWeight(value) {\n this._fontWeight = value;\n this.update();\n }\n /** The space between lines. */\n get leading() {\n return this._leading;\n }\n set leading(value) {\n this._leading = value;\n this.update();\n }\n /** The amount of spacing between letters, default is 0. */\n get letterSpacing() {\n return this._letterSpacing;\n }\n set letterSpacing(value) {\n this._letterSpacing = value;\n this.update();\n }\n /** The line height, a number that represents the vertical space that a letter uses. */\n get lineHeight() {\n return this._lineHeight;\n }\n set lineHeight(value) {\n this._lineHeight = value;\n this.update();\n }\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n */\n get padding() {\n return this._padding;\n }\n set padding(value) {\n this._padding = value;\n this.update();\n }\n /** Trim transparent borders. This is an expensive operation so only use this if you have to! */\n get trim() {\n return this._trim;\n }\n set trim(value) {\n this._trim = value;\n this.update();\n }\n /**\n * The baseline of the text that is rendered.\n * @member {'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom'}\n */\n get textBaseline() {\n return this._textBaseline;\n }\n set textBaseline(value) {\n this._textBaseline = value;\n this.update();\n }\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n * @member {'normal'|'pre'|'pre-line'}\n */\n get whiteSpace() {\n return this._whiteSpace;\n }\n set whiteSpace(value) {\n this._whiteSpace = value;\n this.update();\n }\n /** Indicates if word wrap should be used. */\n get wordWrap() {\n return this._wordWrap;\n }\n set wordWrap(value) {\n this._wordWrap = value;\n this.update();\n }\n /** The width at which text will wrap, it needs wordWrap to be set to true. */\n get wordWrapWidth() {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(value) {\n this._wordWrapWidth = value;\n this.update();\n }\n /** A fillstyle that will be used on the text e.g., 'red', '#00FF00'. */\n get fill() {\n return this._originalFill;\n }\n set fill(value) {\n if (value === this._originalFill)\n return;\n this._originalFill = value;\n if (this._isFillStyle(value)) {\n this._originalFill = this._createProxy({ ...GraphicsContext.defaultFillStyle, ...value }, () => {\n this._fill = toFillStyle(\n { ...this._originalFill },\n GraphicsContext.defaultFillStyle\n );\n });\n }\n this._fill = toFillStyle(\n value === 0 ? \"black\" : value,\n GraphicsContext.defaultFillStyle\n );\n this.update();\n }\n /** A fillstyle that will be used on the text stroke, e.g., 'blue', '#FCFF00'. */\n get stroke() {\n return this._originalStroke;\n }\n set stroke(value) {\n if (value === this._originalStroke)\n return;\n this._originalStroke = value;\n if (this._isFillStyle(value)) {\n this._originalStroke = this._createProxy({ ...GraphicsContext.defaultStrokeStyle, ...value }, () => {\n this._stroke = toStrokeStyle(\n { ...this._originalStroke },\n GraphicsContext.defaultStrokeStyle\n );\n });\n }\n this._stroke = toStrokeStyle(value, GraphicsContext.defaultStrokeStyle);\n this.update();\n }\n _generateKey() {\n this._styleKey = generateTextStyleKey(this);\n return this._styleKey;\n }\n update() {\n this._styleKey = null;\n this.emit(\"update\", this);\n }\n /** Resets all properties to the default values */\n reset() {\n const defaultStyle = _TextStyle.defaultTextStyle;\n for (const key in defaultStyle) {\n this[key] = defaultStyle[key];\n }\n }\n get styleKey() {\n return this._styleKey || this._generateKey();\n }\n /**\n * Creates a new TextStyle object with the same values as this one.\n * @returns New cloned TextStyle object\n */\n clone() {\n return new _TextStyle({\n align: this.align,\n breakWords: this.breakWords,\n dropShadow: this._dropShadow ? { ...this._dropShadow } : null,\n fill: this._fill,\n fontFamily: this.fontFamily,\n fontSize: this.fontSize,\n fontStyle: this.fontStyle,\n fontVariant: this.fontVariant,\n fontWeight: this.fontWeight,\n leading: this.leading,\n letterSpacing: this.letterSpacing,\n lineHeight: this.lineHeight,\n padding: this.padding,\n stroke: this._stroke,\n textBaseline: this.textBaseline,\n whiteSpace: this.whiteSpace,\n wordWrap: this.wordWrap,\n wordWrapWidth: this.wordWrapWidth\n });\n }\n /**\n * Destroys this text style.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.texture=false] - Should it destroy the texture of the this style\n * @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the this style\n */\n destroy(options = false) {\n this.removeAllListeners();\n const destroyTexture = typeof options === \"boolean\" ? options : options?.texture;\n if (destroyTexture) {\n const destroyTextureSource = typeof options === \"boolean\" ? options : options?.textureSource;\n if (this._fill?.texture) {\n this._fill.texture.destroy(destroyTextureSource);\n }\n if (this._originalFill?.texture) {\n this._originalFill.texture.destroy(destroyTextureSource);\n }\n if (this._stroke?.texture) {\n this._stroke.texture.destroy(destroyTextureSource);\n }\n if (this._originalStroke?.texture) {\n this._originalStroke.texture.destroy(destroyTextureSource);\n }\n }\n this._fill = null;\n this._stroke = null;\n this.dropShadow = null;\n this._originalStroke = null;\n this._originalFill = null;\n }\n _createProxy(value, cb) {\n return new Proxy(value, {\n set: (target, property, newValue) => {\n target[property] = newValue;\n cb?.(property, newValue);\n this.update();\n return true;\n }\n });\n }\n _isFillStyle(value) {\n return (value ?? null) !== null && !(Color.isColorLike(value) || value instanceof FillGradient || value instanceof FillPattern);\n }\n};\n/** The default drop shadow settings */\n_TextStyle.defaultDropShadow = {\n /** Set alpha for the drop shadow */\n alpha: 1,\n /** Set a angle of the drop shadow */\n angle: Math.PI / 6,\n /** Set a shadow blur radius */\n blur: 0,\n /** A fill style to be used on the e.g., 'red', '#00FF00' */\n color: \"black\",\n /** Set a distance of the drop shadow */\n distance: 5\n};\n/** The default text style settings */\n_TextStyle.defaultTextStyle = {\n /**\n * See {@link TextStyle.align}\n * @type {'left'|'center'|'right'|'justify'}\n */\n align: \"left\",\n /** See {@link TextStyle.breakWords} */\n breakWords: false,\n /** See {@link TextStyle.dropShadow} */\n dropShadow: null,\n /**\n * See {@link TextStyle.fill}\n * @type {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n fill: \"black\",\n /**\n * See {@link TextStyle.fontFamily}\n * @type {string|string[]}\n */\n fontFamily: \"Arial\",\n /**\n * See {@link TextStyle.fontSize}\n * @type {number|string}\n */\n fontSize: 26,\n /**\n * See {@link TextStyle.fontStyle}\n * @type {'normal'|'italic'|'oblique'}\n */\n fontStyle: \"normal\",\n /**\n * See {@link TextStyle.fontVariant}\n * @type {'normal'|'small-caps'}\n */\n fontVariant: \"normal\",\n /**\n * See {@link TextStyle.fontWeight}\n * @type {'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900'}\n */\n fontWeight: \"normal\",\n /** See {@link TextStyle.leading} */\n leading: 0,\n /** See {@link TextStyle.letterSpacing} */\n letterSpacing: 0,\n /** See {@link TextStyle.lineHeight} */\n lineHeight: 0,\n /** See {@link TextStyle.padding} */\n padding: 0,\n /**\n * See {@link TextStyle.stroke}\n * @type {string|number}\n */\n stroke: null,\n /**\n * See {@link TextStyle.textBaseline}\n * @type {'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom'}\n */\n textBaseline: \"alphabetic\",\n /** See {@link TextStyle.trim} */\n trim: false,\n /**\n * See {@link TextStyle.whiteSpace}\n * @type {'normal'|'pre'|'pre-line'}\n */\n whiteSpace: \"pre\",\n /** See {@link TextStyle.wordWrap} */\n wordWrap: false,\n /** See {@link TextStyle.wordWrapWidth} */\n wordWrapWidth: 100\n};\nlet TextStyle = _TextStyle;\nfunction convertV7Tov8Style(style) {\n const oldStyle = style;\n if (typeof oldStyle.dropShadow === \"boolean\" && oldStyle.dropShadow) {\n const defaults = TextStyle.defaultDropShadow;\n style.dropShadow = {\n alpha: oldStyle.dropShadowAlpha ?? defaults.alpha,\n angle: oldStyle.dropShadowAngle ?? defaults.angle,\n blur: oldStyle.dropShadowBlur ?? defaults.blur,\n color: oldStyle.dropShadowColor ?? defaults.color,\n distance: oldStyle.dropShadowDistance ?? defaults.distance\n };\n }\n if (oldStyle.strokeThickness !== void 0) {\n deprecation(v8_0_0, \"strokeThickness is now a part of stroke\");\n const color = oldStyle.stroke;\n let obj = {};\n if (Color.isColorLike(color)) {\n obj.color = color;\n } else if (color instanceof FillGradient || color instanceof FillPattern) {\n obj.fill = color;\n } else if (Object.hasOwnProperty.call(color, \"color\") || Object.hasOwnProperty.call(color, \"fill\")) {\n obj = color;\n } else {\n throw new Error(\"Invalid stroke value.\");\n }\n style.stroke = {\n ...obj,\n width: oldStyle.strokeThickness\n };\n }\n if (Array.isArray(oldStyle.fillGradientStops)) {\n deprecation(v8_0_0, \"gradient fill is now a fill pattern: `new FillGradient(...)`\");\n let fontSize;\n if (style.fontSize == null) {\n style.fontSize = TextStyle.defaultTextStyle.fontSize;\n } else if (typeof style.fontSize === \"string\") {\n fontSize = parseInt(style.fontSize, 10);\n } else {\n fontSize = style.fontSize;\n }\n const gradientFill = new FillGradient(0, 0, 0, fontSize * 1.7);\n const fills = oldStyle.fillGradientStops.map((color) => Color.shared.setValue(color).toNumber());\n fills.forEach((number, index) => {\n const ratio = index / (fills.length - 1);\n gradientFill.addColorStop(ratio, number);\n });\n style.fill = {\n fill: gradientFill\n };\n }\n}\n\nexport { TextStyle };\n//# sourceMappingURL=TextStyle.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { nextPow2 } from '../../../../maths/misc/pow2.mjs';\n\n\"use strict\";\nclass CanvasPoolClass {\n constructor(canvasOptions) {\n this._canvasPool = /* @__PURE__ */ Object.create(null);\n this.canvasOptions = canvasOptions || {};\n this.enableFullScreen = false;\n }\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param pixelWidth - Width of texture in pixels.\n * @param pixelHeight - Height of texture in pixels.\n */\n _createCanvasAndContext(pixelWidth, pixelHeight) {\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = pixelWidth;\n canvas.height = pixelHeight;\n const context = canvas.getContext(\"2d\");\n return { canvas, context };\n }\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @returns The new render texture.\n */\n getOptimalCanvasAndContext(minWidth, minHeight, resolution = 1) {\n minWidth = Math.ceil(minWidth * resolution - 1e-6);\n minHeight = Math.ceil(minHeight * resolution - 1e-6);\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n const key = (minWidth << 17) + (minHeight << 1);\n if (!this._canvasPool[key]) {\n this._canvasPool[key] = [];\n }\n let canvasAndContext = this._canvasPool[key].pop();\n if (!canvasAndContext) {\n canvasAndContext = this._createCanvasAndContext(minWidth, minHeight);\n }\n return canvasAndContext;\n }\n /**\n * Place a render texture back into the pool.\n * @param canvasAndContext\n */\n returnCanvasAndContext(canvasAndContext) {\n const canvas = canvasAndContext.canvas;\n const { width, height } = canvas;\n const key = (width << 17) + (height << 1);\n this._canvasPool[key].push(canvasAndContext);\n }\n clear() {\n this._canvasPool = {};\n }\n}\nconst CanvasPool = new CanvasPoolClass();\n\nexport { CanvasPool, CanvasPoolClass };\n//# sourceMappingURL=CanvasPool.mjs.map\n","\"use strict\";\nconst genericFontFamilies = [\n \"serif\",\n \"sans-serif\",\n \"monospace\",\n \"cursive\",\n \"fantasy\",\n \"system-ui\"\n];\nfunction fontStringFromTextStyle(style) {\n const fontSizeString = typeof style.fontSize === \"number\" ? `${style.fontSize}px` : style.fontSize;\n let fontFamilies = style.fontFamily;\n if (!Array.isArray(style.fontFamily)) {\n fontFamilies = style.fontFamily.split(\",\");\n }\n for (let i = fontFamilies.length - 1; i >= 0; i--) {\n let fontFamily = fontFamilies[i].trim();\n if (!/([\\\"\\'])[^\\'\\\"]+\\1/.test(fontFamily) && !genericFontFamilies.includes(fontFamily)) {\n fontFamily = `\"${fontFamily}\"`;\n }\n fontFamilies[i] = fontFamily;\n }\n return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} ${fontFamilies.join(\",\")}`;\n}\n\nexport { fontStringFromTextStyle };\n//# sourceMappingURL=fontStringFromTextStyle.mjs.map\n","import { DOMAdapter } from '../../../environment/adapter.mjs';\nimport { fontStringFromTextStyle } from './utils/fontStringFromTextStyle.mjs';\n\n\"use strict\";\nconst contextSettings = {\n // TextMetrics requires getImageData readback for measuring fonts.\n willReadFrequently: true\n};\nconst _CanvasTextMetrics = class _CanvasTextMetrics {\n /**\n * Checking that we can use modern canvas 2D API.\n *\n * Note: This is an unstable API, Chrome < 94 use `textLetterSpacing`, later versions use `letterSpacing`.\n * @see TextMetrics.experimentalLetterSpacing\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ICanvasRenderingContext2D/letterSpacing\n * @see https://developer.chrome.com/origintrials/#/view_trial/3585991203293757441\n */\n static get experimentalLetterSpacingSupported() {\n let result = _CanvasTextMetrics._experimentalLetterSpacingSupported;\n if (result !== void 0) {\n const proto = DOMAdapter.get().getCanvasRenderingContext2D().prototype;\n result = _CanvasTextMetrics._experimentalLetterSpacingSupported = \"letterSpacing\" in proto || \"textLetterSpacing\" in proto;\n }\n return result;\n }\n /**\n * @param text - the text that was measured\n * @param style - the style that was measured\n * @param width - the measured width of the text\n * @param height - the measured height of the text\n * @param lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param lineWidths - an array of the line widths for each line matched to `lines`\n * @param lineHeight - the measured line height for this style\n * @param maxLineWidth - the maximum line width for all measured lines\n * @param {FontMetrics} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) {\n this.text = text;\n this.style = style;\n this.width = width;\n this.height = height;\n this.lines = lines;\n this.lineWidths = lineWidths;\n this.lineHeight = lineHeight;\n this.maxLineWidth = maxLineWidth;\n this.fontProperties = fontProperties;\n }\n /**\n * Measures the supplied string of text and returns a Rectangle.\n * @param text - The text to measure.\n * @param style - The text style to use for measuring\n * @param canvas - optional specification of the canvas to use for measuring.\n * @param wordWrap\n * @returns Measured width and height of the text.\n */\n static measureText(text = \" \", style, canvas = _CanvasTextMetrics._canvas, wordWrap = style.wordWrap) {\n const textKey = `${text}:${style.styleKey}`;\n if (_CanvasTextMetrics._measurementCache[textKey])\n return _CanvasTextMetrics._measurementCache[textKey];\n const font = fontStringFromTextStyle(style);\n const fontProperties = _CanvasTextMetrics.measureFont(font);\n if (fontProperties.fontSize === 0) {\n fontProperties.fontSize = style.fontSize;\n fontProperties.ascent = style.fontSize;\n }\n const context = _CanvasTextMetrics.__context;\n context.font = font;\n const outputText = wordWrap ? _CanvasTextMetrics._wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n for (let i = 0; i < lines.length; i++) {\n const lineWidth = _CanvasTextMetrics._measureText(lines[i], style.letterSpacing, context);\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n const strokeWidth = style._stroke?.width || 0;\n let width = maxLineWidth + strokeWidth;\n if (style.dropShadow) {\n width += style.dropShadow.distance;\n }\n const lineHeight = style.lineHeight || fontProperties.fontSize;\n let height = Math.max(lineHeight, fontProperties.fontSize + strokeWidth) + (lines.length - 1) * (lineHeight + style.leading);\n if (style.dropShadow) {\n height += style.dropShadow.distance;\n }\n const measurements = new _CanvasTextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n return measurements;\n }\n static _measureText(text, letterSpacing, context) {\n let useExperimentalLetterSpacing = false;\n if (_CanvasTextMetrics.experimentalLetterSpacingSupported) {\n if (_CanvasTextMetrics.experimentalLetterSpacing) {\n context.letterSpacing = `${letterSpacing}px`;\n context.textLetterSpacing = `${letterSpacing}px`;\n useExperimentalLetterSpacing = true;\n } else {\n context.letterSpacing = \"0px\";\n context.textLetterSpacing = \"0px\";\n }\n }\n let width = context.measureText(text).width;\n if (width > 0) {\n if (useExperimentalLetterSpacing) {\n width -= letterSpacing;\n } else {\n width += (_CanvasTextMetrics.graphemeSegmenter(text).length - 1) * letterSpacing;\n }\n }\n return width;\n }\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n * @param text - String to apply word wrapping to\n * @param style - the style to use when wrapping\n * @param canvas - optional specification of the canvas to use for measuring.\n * @returns New string with new lines applied where required\n */\n static _wordWrap(text, style, canvas = _CanvasTextMetrics._canvas) {\n const context = canvas.getContext(\"2d\", contextSettings);\n let width = 0;\n let line = \"\";\n let lines = \"\";\n const cache = /* @__PURE__ */ Object.create(null);\n const { letterSpacing, whiteSpace } = style;\n const collapseSpaces = _CanvasTextMetrics._collapseSpaces(whiteSpace);\n const collapseNewlines = _CanvasTextMetrics._collapseNewlines(whiteSpace);\n let canPrependSpaces = !collapseSpaces;\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n const tokens = _CanvasTextMetrics._tokenize(text);\n for (let i = 0; i < tokens.length; i++) {\n let token = tokens[i];\n if (_CanvasTextMetrics._isNewline(token)) {\n if (!collapseNewlines) {\n lines += _CanvasTextMetrics._addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = \"\";\n width = 0;\n continue;\n }\n token = \" \";\n }\n if (collapseSpaces) {\n const currIsBreakingSpace = _CanvasTextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = _CanvasTextMetrics.isBreakingSpace(line[line.length - 1]);\n if (currIsBreakingSpace && lastIsBreakingSpace) {\n continue;\n }\n }\n const tokenWidth = _CanvasTextMetrics._getFromCache(token, letterSpacing, cache, context);\n if (tokenWidth > wordWrapWidth) {\n if (line !== \"\") {\n lines += _CanvasTextMetrics._addLine(line);\n line = \"\";\n width = 0;\n }\n if (_CanvasTextMetrics.canBreakWords(token, style.breakWords)) {\n const characters = _CanvasTextMetrics.wordWrapSplit(token);\n for (let j = 0; j < characters.length; j++) {\n let char = characters[j];\n let lastChar = char;\n let k = 1;\n while (characters[j + k]) {\n const nextChar = characters[j + k];\n if (!_CanvasTextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) {\n char += nextChar;\n } else {\n break;\n }\n lastChar = nextChar;\n k++;\n }\n j += k - 1;\n const characterWidth = _CanvasTextMetrics._getFromCache(char, letterSpacing, cache, context);\n if (characterWidth + width > wordWrapWidth) {\n lines += _CanvasTextMetrics._addLine(line);\n canPrependSpaces = false;\n line = \"\";\n width = 0;\n }\n line += char;\n width += characterWidth;\n }\n } else {\n if (line.length > 0) {\n lines += _CanvasTextMetrics._addLine(line);\n line = \"\";\n width = 0;\n }\n const isLastToken = i === tokens.length - 1;\n lines += _CanvasTextMetrics._addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = \"\";\n width = 0;\n }\n } else {\n if (tokenWidth + width > wordWrapWidth) {\n canPrependSpaces = false;\n lines += _CanvasTextMetrics._addLine(line);\n line = \"\";\n width = 0;\n }\n if (line.length > 0 || !_CanvasTextMetrics.isBreakingSpace(token) || canPrependSpaces) {\n line += token;\n width += tokenWidth;\n }\n }\n }\n lines += _CanvasTextMetrics._addLine(line, false);\n return lines;\n }\n /**\n * Convenience function for logging each line added during the wordWrap method.\n * @param line - The line of text to add\n * @param newLine - Add new line character to end\n * @returns A formatted line\n */\n static _addLine(line, newLine = true) {\n line = _CanvasTextMetrics._trimRight(line);\n line = newLine ? `${line}\n` : line;\n return line;\n }\n /**\n * Gets & sets the widths of calculated characters in a cache object\n * @param key - The key\n * @param letterSpacing - The letter spacing\n * @param cache - The cache\n * @param context - The canvas context\n * @returns The from cache.\n */\n static _getFromCache(key, letterSpacing, cache, context) {\n let width = cache[key];\n if (typeof width !== \"number\") {\n width = _CanvasTextMetrics._measureText(key, letterSpacing, context) + letterSpacing;\n cache[key] = width;\n }\n return width;\n }\n /**\n * Determines whether we should collapse breaking spaces.\n * @param whiteSpace - The TextStyle property whiteSpace\n * @returns Should collapse\n */\n static _collapseSpaces(whiteSpace) {\n return whiteSpace === \"normal\" || whiteSpace === \"pre-line\";\n }\n /**\n * Determines whether we should collapse newLine chars.\n * @param whiteSpace - The white space\n * @returns should collapse\n */\n static _collapseNewlines(whiteSpace) {\n return whiteSpace === \"normal\";\n }\n /**\n * Trims breaking whitespaces from string.\n * @param text - The text\n * @returns Trimmed string\n */\n static _trimRight(text) {\n if (typeof text !== \"string\") {\n return \"\";\n }\n for (let i = text.length - 1; i >= 0; i--) {\n const char = text[i];\n if (!_CanvasTextMetrics.isBreakingSpace(char)) {\n break;\n }\n text = text.slice(0, -1);\n }\n return text;\n }\n /**\n * Determines if char is a newline.\n * @param char - The character\n * @returns True if newline, False otherwise.\n */\n static _isNewline(char) {\n if (typeof char !== \"string\") {\n return false;\n }\n return _CanvasTextMetrics._newlines.includes(char.charCodeAt(0));\n }\n /**\n * Determines if char is a breaking whitespace.\n *\n * It allows one to determine whether char should be a breaking whitespace\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n * @param char - The character\n * @param [_nextChar] - The next character\n * @returns True if whitespace, False otherwise.\n */\n static isBreakingSpace(char, _nextChar) {\n if (typeof char !== \"string\") {\n return false;\n }\n return _CanvasTextMetrics._breakingSpaces.includes(char.charCodeAt(0));\n }\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n * @param text - The text\n * @returns A tokenized array\n */\n static _tokenize(text) {\n const tokens = [];\n let token = \"\";\n if (typeof text !== \"string\") {\n return tokens;\n }\n for (let i = 0; i < text.length; i++) {\n const char = text[i];\n const nextChar = text[i + 1];\n if (_CanvasTextMetrics.isBreakingSpace(char, nextChar) || _CanvasTextMetrics._isNewline(char)) {\n if (token !== \"\") {\n tokens.push(token);\n token = \"\";\n }\n tokens.push(char);\n continue;\n }\n token += char;\n }\n if (token !== \"\") {\n tokens.push(token);\n }\n return tokens;\n }\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n * @param _token - The token\n * @param breakWords - The style attr break words\n * @returns Whether to break word or not\n */\n static canBreakWords(_token, breakWords) {\n return breakWords;\n }\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n * @param _char - The character\n * @param _nextChar - The next character\n * @param _token - The token/word the characters are from\n * @param _index - The index in the token of the char\n * @param _breakWords - The style attr break words\n * @returns whether to break word or not\n */\n static canBreakChars(_char, _nextChar, _token, _index, _breakWords) {\n return true;\n }\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n * @param token - The token to split\n * @returns The characters of the token\n * @see CanvasTextMetrics.graphemeSegmenter\n */\n static wordWrapSplit(token) {\n return _CanvasTextMetrics.graphemeSegmenter(token);\n }\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n * @param font - String representing the style of the font\n * @returns Font properties object\n */\n static measureFont(font) {\n if (_CanvasTextMetrics._fonts[font]) {\n return _CanvasTextMetrics._fonts[font];\n }\n const context = _CanvasTextMetrics._context;\n context.font = font;\n const metrics = context.measureText(_CanvasTextMetrics.METRICS_STRING + _CanvasTextMetrics.BASELINE_SYMBOL);\n const properties = {\n ascent: metrics.actualBoundingBoxAscent,\n descent: metrics.actualBoundingBoxDescent,\n fontSize: metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent\n };\n _CanvasTextMetrics._fonts[font] = properties;\n return properties;\n }\n /**\n * Clear font metrics in metrics cache.\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n static clearMetrics(font = \"\") {\n if (font) {\n delete _CanvasTextMetrics._fonts[font];\n } else {\n _CanvasTextMetrics._fonts = {};\n }\n }\n /**\n * Cached canvas element for measuring text\n * TODO: this should be private, but isn't because of backward compat, will fix later.\n * @ignore\n */\n static get _canvas() {\n if (!_CanvasTextMetrics.__canvas) {\n let canvas;\n try {\n const c = new OffscreenCanvas(0, 0);\n const context = c.getContext(\"2d\", contextSettings);\n if (context?.measureText) {\n _CanvasTextMetrics.__canvas = c;\n return c;\n }\n canvas = DOMAdapter.get().createCanvas();\n } catch (ex) {\n canvas = DOMAdapter.get().createCanvas();\n }\n canvas.width = canvas.height = 10;\n _CanvasTextMetrics.__canvas = canvas;\n }\n return _CanvasTextMetrics.__canvas;\n }\n /**\n * TODO: this should be private, but isn't because of backward compat, will fix later.\n * @ignore\n */\n static get _context() {\n if (!_CanvasTextMetrics.__context) {\n _CanvasTextMetrics.__context = _CanvasTextMetrics._canvas.getContext(\"2d\", contextSettings);\n }\n return _CanvasTextMetrics.__context;\n }\n};\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n */\n_CanvasTextMetrics.METRICS_STRING = \"|\\xC9q\\xC5\";\n/** Baseline symbol for calculate font metrics. */\n_CanvasTextMetrics.BASELINE_SYMBOL = \"M\";\n/** Baseline multiplier for calculate font metrics. */\n_CanvasTextMetrics.BASELINE_MULTIPLIER = 1.4;\n/** Height multiplier for setting height of canvas to calculate font metrics. */\n_CanvasTextMetrics.HEIGHT_MULTIPLIER = 2;\n/**\n * A Unicode \"character\", or \"grapheme cluster\", can be composed of multiple Unicode code points,\n * such as letters with diacritical marks (e.g. `'\\u0065\\u0301'`, letter e with acute)\n * or emojis with modifiers (e.g. `'\\uD83E\\uDDD1\\u200D\\uD83D\\uDCBB'`, technologist).\n * The new `Intl.Segmenter` API in ES2022 can split the string into grapheme clusters correctly. If it is not available,\n * PixiJS will fallback to use the iterator of String, which can only spilt the string into code points.\n * If you want to get full functionality in environments that don't support `Intl.Segmenter` (such as Firefox),\n * you can use other libraries such as [grapheme-splitter]{@link https://www.npmjs.com/package/grapheme-splitter}\n * or [graphemer]{@link https://www.npmjs.com/package/graphemer} to create a polyfill. Since these libraries can be\n * relatively large in size to handle various Unicode grapheme clusters properly, PixiJS won't use them directly.\n */\n_CanvasTextMetrics.graphemeSegmenter = (() => {\n if (typeof Intl?.Segmenter === \"function\") {\n const segmenter = new Intl.Segmenter();\n return (s) => [...segmenter.segment(s)].map((x) => x.segment);\n }\n return (s) => [...s];\n})();\n/**\n * New rendering behavior for letter-spacing which uses Chrome's new native API. This will\n * lead to more accurate letter-spacing results because it does not try to manually draw\n * each character. However, this Chrome API is experimental and may not serve all cases yet.\n * @see TextMetrics.experimentalLetterSpacingSupported\n */\n_CanvasTextMetrics.experimentalLetterSpacing = false;\n/** Cache of {@see TextMetrics.FontMetrics} objects. */\n_CanvasTextMetrics._fonts = {};\n/** Cache of new line chars. */\n_CanvasTextMetrics._newlines = [\n 10,\n // line feed\n 13\n // carriage return\n];\n/** Cache of breaking spaces. */\n_CanvasTextMetrics._breakingSpaces = [\n 9,\n // character tabulation\n 32,\n // space\n 8192,\n // en quad\n 8193,\n // em quad\n 8194,\n // en space\n 8195,\n // em space\n 8196,\n // three-per-em space\n 8197,\n // four-per-em space\n 8198,\n // six-per-em space\n 8200,\n // punctuation space\n 8201,\n // thin space\n 8202,\n // hair space\n 8287,\n // medium mathematical space\n 12288\n // ideographic space\n];\n_CanvasTextMetrics._measurementCache = {};\nlet CanvasTextMetrics = _CanvasTextMetrics;\n\nexport { CanvasTextMetrics };\n//# sourceMappingURL=CanvasTextMetrics.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { Texture } from '../../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { warn } from '../../../../utils/logging/warn.mjs';\nimport { FillGradient } from '../../../graphics/shared/fill/FillGradient.mjs';\nimport { FillPattern } from '../../../graphics/shared/fill/FillPattern.mjs';\n\n\"use strict\";\nfunction getCanvasFillStyle(fillStyle, context) {\n if (fillStyle.texture === Texture.WHITE && !fillStyle.fill) {\n return Color.shared.setValue(fillStyle.color).toHex();\n } else if (!fillStyle.fill) {\n const pattern = context.createPattern(fillStyle.texture.source.resource, \"repeat\");\n const tempMatrix = fillStyle.matrix.copyTo(Matrix.shared);\n tempMatrix.scale(fillStyle.texture.frame.width, fillStyle.texture.frame.height);\n pattern.setTransform(tempMatrix);\n return pattern;\n } else if (fillStyle.fill instanceof FillPattern) {\n const fillPattern = fillStyle.fill;\n const pattern = context.createPattern(fillPattern.texture.source.resource, \"repeat\");\n const tempMatrix = fillPattern.transform.copyTo(Matrix.shared);\n tempMatrix.scale(\n fillPattern.texture.frame.width,\n fillPattern.texture.frame.height\n );\n pattern.setTransform(tempMatrix);\n return pattern;\n } else if (fillStyle.fill instanceof FillGradient) {\n const fillGradient = fillStyle.fill;\n if (fillGradient.type === \"linear\") {\n const gradient = context.createLinearGradient(\n fillGradient.x0,\n fillGradient.y0,\n fillGradient.x1,\n fillGradient.y1\n );\n fillGradient.gradientStops.forEach((stop) => {\n gradient.addColorStop(stop.offset, Color.shared.setValue(stop.color).toHex());\n });\n return gradient;\n }\n }\n warn(\"FillStyle not recognised\", fillStyle);\n return \"red\";\n}\n\nexport { getCanvasFillStyle };\n//# sourceMappingURL=getCanvasFillStyle.mjs.map\n","\"use strict\";\nfunction resolveCharacters(chars) {\n if (chars === \"\") {\n return [];\n }\n if (typeof chars === \"string\") {\n chars = [chars];\n }\n const result = [];\n for (let i = 0, j = chars.length; i < j; i++) {\n const item = chars[i];\n if (Array.isArray(item)) {\n if (item.length !== 2) {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n if (item[0].length === 0 || item[1].length === 0) {\n throw new Error(\"[BitmapFont]: Invalid character delimiter.\");\n }\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n if (endCode < startCode) {\n throw new Error(\"[BitmapFont]: Invalid character range.\");\n }\n for (let i2 = startCode, j2 = endCode; i2 <= j2; i2++) {\n result.push(String.fromCharCode(i2));\n }\n } else {\n result.push(...Array.from(item));\n }\n }\n if (result.length === 0) {\n throw new Error(\"[BitmapFont]: Empty set when resolving characters.\");\n }\n return result;\n}\n\nexport { resolveCharacters };\n//# sourceMappingURL=resolveCharacters.mjs.map\n","import { Color } from '../../color/Color.mjs';\nimport { Rectangle } from '../../maths/shapes/Rectangle.mjs';\nimport { CanvasPool } from '../../rendering/renderers/shared/texture/CanvasPool.mjs';\nimport { ImageSource } from '../../rendering/renderers/shared/texture/sources/ImageSource.mjs';\nimport { Texture } from '../../rendering/renderers/shared/texture/Texture.mjs';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\nimport { CanvasTextMetrics } from '../text/canvas/CanvasTextMetrics.mjs';\nimport { fontStringFromTextStyle } from '../text/canvas/utils/fontStringFromTextStyle.mjs';\nimport { getCanvasFillStyle } from '../text/canvas/utils/getCanvasFillStyle.mjs';\nimport { TextStyle } from '../text/TextStyle.mjs';\nimport { AbstractBitmapFont } from './AbstractBitmapFont.mjs';\nimport { resolveCharacters } from './utils/resolveCharacters.mjs';\n\n\"use strict\";\nconst _DynamicBitmapFont = class _DynamicBitmapFont extends AbstractBitmapFont {\n /**\n * @param options - The options for the dynamic bitmap font.\n */\n constructor(options) {\n super();\n /**\n * this is a resolution modifier for the font size..\n * texture resolution will also be used to scale texture according to its font size also\n */\n this.resolution = 1;\n /** The pages of the font. */\n this.pages = [];\n this._padding = 0;\n this._measureCache = /* @__PURE__ */ Object.create(null);\n this._currentChars = [];\n this._currentX = 0;\n this._currentY = 0;\n this._currentPageIndex = -1;\n this._skipKerning = false;\n const dynamicOptions = { ..._DynamicBitmapFont.defaultOptions, ...options };\n this._textureSize = dynamicOptions.textureSize;\n this._mipmap = dynamicOptions.mipmap;\n const style = dynamicOptions.style.clone();\n if (dynamicOptions.overrideFill) {\n style._fill.color = 16777215;\n style._fill.alpha = 1;\n style._fill.texture = Texture.WHITE;\n style._fill.fill = null;\n }\n this.applyFillAsTint = dynamicOptions.overrideFill;\n const requestedFontSize = style.fontSize;\n style.fontSize = this.baseMeasurementFontSize;\n const font = fontStringFromTextStyle(style);\n if (dynamicOptions.overrideSize) {\n if (style._stroke) {\n style._stroke.width *= this.baseRenderedFontSize / requestedFontSize;\n }\n } else {\n style.fontSize = this.baseRenderedFontSize = requestedFontSize;\n }\n this._style = style;\n this._skipKerning = dynamicOptions.skipKerning ?? false;\n this.resolution = dynamicOptions.resolution ?? 1;\n this._padding = dynamicOptions.padding ?? 4;\n this.fontMetrics = CanvasTextMetrics.measureFont(font);\n this.lineHeight = style.lineHeight || this.fontMetrics.fontSize || style.fontSize;\n }\n ensureCharacters(chars) {\n const charList = resolveCharacters(chars).filter((char) => !this._currentChars.includes(char)).filter((char, index, self) => self.indexOf(char) === index);\n if (!charList.length)\n return;\n this._currentChars = [...this._currentChars, ...charList];\n let pageData;\n if (this._currentPageIndex === -1) {\n pageData = this._nextPage();\n } else {\n pageData = this.pages[this._currentPageIndex];\n }\n let { canvas, context } = pageData.canvasAndContext;\n let textureSource = pageData.texture.source;\n const style = this._style;\n let currentX = this._currentX;\n let currentY = this._currentY;\n const fontScale = this.baseRenderedFontSize / this.baseMeasurementFontSize;\n const padding = this._padding * fontScale;\n const widthScale = style.fontStyle === \"italic\" ? 2 : 1;\n let maxCharHeight = 0;\n let skipTexture = false;\n for (let i = 0; i < charList.length; i++) {\n const char = charList[i];\n const metrics = CanvasTextMetrics.measureText(char, style, canvas, false);\n metrics.lineHeight = metrics.height;\n const width = widthScale * metrics.width * fontScale;\n const height = metrics.height * fontScale;\n const paddedWidth = width + padding * 2;\n const paddedHeight = height + padding * 2;\n skipTexture = false;\n if (char !== \"\\n\" && char !== \"\\r\" && char !== \"\t\" && char !== \" \") {\n skipTexture = true;\n maxCharHeight = Math.ceil(Math.max(paddedHeight, maxCharHeight));\n }\n if (currentX + paddedWidth > this._textureSize) {\n currentY += maxCharHeight;\n maxCharHeight = paddedHeight;\n currentX = 0;\n if (currentY + maxCharHeight > this._textureSize) {\n textureSource.update();\n const pageData2 = this._nextPage();\n canvas = pageData2.canvasAndContext.canvas;\n context = pageData2.canvasAndContext.context;\n textureSource = pageData2.texture.source;\n currentY = 0;\n }\n }\n const xAdvance = width / fontScale - (style.dropShadow?.distance ?? 0) - (style._stroke?.width ?? 0);\n this.chars[char] = {\n id: char.codePointAt(0),\n xOffset: -this._padding,\n yOffset: -this._padding,\n xAdvance,\n kerning: {}\n };\n if (skipTexture) {\n this._drawGlyph(\n context,\n metrics,\n currentX + padding,\n currentY + padding,\n fontScale,\n style\n );\n const px = textureSource.width * fontScale;\n const py = textureSource.height * fontScale;\n const frame = new Rectangle(\n currentX / px * textureSource.width,\n currentY / py * textureSource.height,\n paddedWidth / px * textureSource.width,\n paddedHeight / py * textureSource.height\n );\n this.chars[char].texture = new Texture({\n source: textureSource,\n frame\n });\n currentX += Math.ceil(paddedWidth);\n }\n }\n textureSource.update();\n this._currentX = currentX;\n this._currentY = currentY;\n this._skipKerning && this._applyKerning(charList, context);\n }\n /**\n * @deprecated since 8.0.0\n * The map of base page textures (i.e., sheets of glyphs).\n */\n get pageTextures() {\n deprecation(v8_0_0, \"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead.\");\n return this.pages;\n }\n _applyKerning(newChars, context) {\n const measureCache = this._measureCache;\n for (let i = 0; i < newChars.length; i++) {\n const first = newChars[i];\n for (let j = 0; j < this._currentChars.length; j++) {\n const second = this._currentChars[j];\n let c1 = measureCache[first];\n if (!c1)\n c1 = measureCache[first] = context.measureText(first).width;\n let c2 = measureCache[second];\n if (!c2)\n c2 = measureCache[second] = context.measureText(second).width;\n let total = context.measureText(first + second).width;\n let amount = total - (c1 + c2);\n if (amount) {\n this.chars[first].kerning[second] = amount;\n }\n total = context.measureText(first + second).width;\n amount = total - (c1 + c2);\n if (amount) {\n this.chars[second].kerning[first] = amount;\n }\n }\n }\n }\n _nextPage() {\n this._currentPageIndex++;\n const textureResolution = this.resolution;\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(\n this._textureSize,\n this._textureSize,\n textureResolution\n );\n this._setupContext(canvasAndContext.context, this._style, textureResolution);\n const resolution = textureResolution * (this.baseRenderedFontSize / this.baseMeasurementFontSize);\n const texture = new Texture({\n source: new ImageSource({\n resource: canvasAndContext.canvas,\n resolution,\n alphaMode: \"premultiply-alpha-on-upload\",\n autoGenerateMipmaps: this._mipmap\n })\n });\n const pageData = {\n canvasAndContext,\n texture\n };\n this.pages[this._currentPageIndex] = pageData;\n return pageData;\n }\n // canvas style!\n _setupContext(context, style, resolution) {\n style.fontSize = this.baseRenderedFontSize;\n context.scale(resolution, resolution);\n context.font = fontStringFromTextStyle(style);\n style.fontSize = this.baseMeasurementFontSize;\n context.textBaseline = style.textBaseline;\n const stroke = style._stroke;\n const strokeThickness = stroke?.width ?? 0;\n if (stroke) {\n context.lineWidth = strokeThickness;\n context.lineJoin = stroke.join;\n context.miterLimit = stroke.miterLimit;\n context.strokeStyle = getCanvasFillStyle(stroke, context);\n }\n if (style._fill) {\n context.fillStyle = getCanvasFillStyle(style._fill, context);\n }\n if (style.dropShadow) {\n const shadowOptions = style.dropShadow;\n const rgb = Color.shared.setValue(shadowOptions.color).toArray();\n const dropShadowBlur = shadowOptions.blur * resolution;\n const dropShadowDistance = shadowOptions.distance * resolution;\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${shadowOptions.alpha})`;\n context.shadowBlur = dropShadowBlur;\n context.shadowOffsetX = Math.cos(shadowOptions.angle) * dropShadowDistance;\n context.shadowOffsetY = Math.sin(shadowOptions.angle) * dropShadowDistance;\n } else {\n context.shadowColor = \"black\";\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n }\n _drawGlyph(context, metrics, x, y, fontScale, style) {\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n const stroke = style._stroke;\n const strokeThickness = (stroke?.width ?? 0) * fontScale;\n const tx = x + strokeThickness / 2;\n const ty = y - strokeThickness / 2;\n const descent = fontProperties.descent * fontScale;\n const lineHeight = metrics.lineHeight * fontScale;\n if (style.stroke && strokeThickness) {\n context.strokeText(char, tx, ty + lineHeight - descent);\n }\n if (style._fill) {\n context.fillText(char, tx, ty + lineHeight - descent);\n }\n }\n destroy() {\n super.destroy();\n for (let i = 0; i < this.pages.length; i++) {\n const { canvasAndContext, texture } = this.pages[i];\n canvasAndContext.canvas.width = canvasAndContext.canvas.width;\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n texture.destroy(true);\n }\n this.pages = null;\n }\n};\n_DynamicBitmapFont.defaultOptions = {\n textureSize: 512,\n style: new TextStyle(),\n mipmap: true\n};\nlet DynamicBitmapFont = _DynamicBitmapFont;\n\nexport { DynamicBitmapFont };\n//# sourceMappingURL=DynamicBitmapFont.mjs.map\n","\"use strict\";\nfunction getBitmapTextLayout(chars, style, font) {\n const layoutData = {\n width: 0,\n height: 0,\n offsetY: 0,\n scale: style.fontSize / font.baseMeasurementFontSize,\n lines: [{\n width: 0,\n charPositions: [],\n spaceWidth: 0,\n spacesIndex: [],\n chars: []\n }]\n };\n layoutData.offsetY = font.baseLineOffset;\n let currentLine = layoutData.lines[0];\n let previousChar = null;\n let firstWord = true;\n const currentWord = {\n spaceWord: false,\n width: 0,\n start: 0,\n index: 0,\n // use index to not modify the array as we use it a lot!\n positions: [],\n chars: []\n };\n const nextWord = (word) => {\n const start = currentLine.width;\n for (let j = 0; j < currentWord.index; j++) {\n const position = word.positions[j];\n currentLine.chars.push(word.chars[j]);\n currentLine.charPositions.push(position + start);\n }\n currentLine.width += word.width;\n firstWord = false;\n currentWord.width = 0;\n currentWord.index = 0;\n currentWord.chars.length = 0;\n };\n const nextLine = () => {\n let index = currentLine.chars.length - 1;\n let lastChar = currentLine.chars[index];\n while (lastChar === \" \") {\n currentLine.width -= font.chars[lastChar].xAdvance;\n lastChar = currentLine.chars[--index];\n }\n layoutData.width = Math.max(layoutData.width, currentLine.width);\n currentLine = {\n width: 0,\n charPositions: [],\n chars: [],\n spaceWidth: 0,\n spacesIndex: []\n };\n firstWord = true;\n layoutData.lines.push(currentLine);\n layoutData.height += font.lineHeight;\n };\n const scale = font.baseMeasurementFontSize / style.fontSize;\n const adjustedLetterSpacing = style.letterSpacing * scale;\n const adjustedWordWrapWidth = style.wordWrapWidth * scale;\n for (let i = 0; i < chars.length + 1; i++) {\n let char;\n const isEnd = i === chars.length;\n if (!isEnd) {\n char = chars[i];\n }\n const charData = font.chars[char] || font.chars[\" \"];\n const isSpace = /(?:\\s)/.test(char);\n const isWordBreak = isSpace || char === \"\\r\" || char === \"\\n\" || isEnd;\n if (isWordBreak) {\n const addWordToNextLine = !firstWord && style.wordWrap && currentLine.width + currentWord.width - adjustedLetterSpacing > adjustedWordWrapWidth;\n if (addWordToNextLine) {\n nextLine();\n nextWord(currentWord);\n if (!isEnd) {\n currentLine.charPositions.push(0);\n }\n } else {\n currentWord.start = currentLine.width;\n nextWord(currentWord);\n if (!isEnd) {\n currentLine.charPositions.push(0);\n }\n }\n if (char === \"\\r\" || char === \"\\n\") {\n if (currentLine.width !== 0) {\n nextLine();\n }\n } else if (!isEnd) {\n const spaceWidth = charData.xAdvance + (charData.kerning[previousChar] || 0) + adjustedLetterSpacing;\n currentLine.width += spaceWidth;\n currentLine.spaceWidth = spaceWidth;\n currentLine.spacesIndex.push(currentLine.charPositions.length);\n currentLine.chars.push(char);\n }\n } else {\n const kerning = charData.kerning[previousChar] || 0;\n const nextCharWidth = charData.xAdvance + kerning + adjustedLetterSpacing;\n currentWord.positions[currentWord.index++] = currentWord.width + kerning;\n currentWord.chars.push(char);\n currentWord.width += nextCharWidth;\n }\n previousChar = char;\n }\n nextLine();\n if (style.align === \"center\") {\n alignCenter(layoutData);\n } else if (style.align === \"right\") {\n alignRight(layoutData);\n } else if (style.align === \"justify\") {\n alignJustify(layoutData);\n }\n return layoutData;\n}\nfunction alignCenter(measurementData) {\n for (let i = 0; i < measurementData.lines.length; i++) {\n const line = measurementData.lines[i];\n const offset = measurementData.width / 2 - line.width / 2;\n for (let j = 0; j < line.charPositions.length; j++) {\n line.charPositions[j] += offset;\n }\n }\n}\nfunction alignRight(measurementData) {\n for (let i = 0; i < measurementData.lines.length; i++) {\n const line = measurementData.lines[i];\n const offset = measurementData.width - line.width;\n for (let j = 0; j < line.charPositions.length; j++) {\n line.charPositions[j] += offset;\n }\n }\n}\nfunction alignJustify(measurementData) {\n const width = measurementData.width;\n for (let i = 0; i < measurementData.lines.length; i++) {\n const line = measurementData.lines[i];\n let indy = 0;\n let spaceIndex = line.spacesIndex[indy++];\n let offset = 0;\n const totalSpaces = line.spacesIndex.length;\n const newSpaceWidth = (width - line.width) / totalSpaces;\n const spaceWidth = newSpaceWidth;\n for (let j = 0; j < line.charPositions.length; j++) {\n if (j === spaceIndex) {\n spaceIndex = line.spacesIndex[indy++];\n offset += spaceWidth;\n }\n line.charPositions[j] += offset;\n }\n }\n}\n\nexport { getBitmapTextLayout };\n//# sourceMappingURL=getBitmapTextLayout.mjs.map\n","import { Cache } from '../../assets/cache/Cache.mjs';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\nimport { warn } from '../../utils/logging/warn.mjs';\nimport { TextStyle } from '../text/TextStyle.mjs';\nimport { DynamicBitmapFont } from './DynamicBitmapFont.mjs';\nimport { getBitmapTextLayout } from './utils/getBitmapTextLayout.mjs';\nimport { resolveCharacters } from './utils/resolveCharacters.mjs';\n\n\"use strict\";\nlet fontCount = 0;\nclass BitmapFontManagerClass {\n constructor() {\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n * @type {string[][]}\n * @example\n * BitmapFont.from('ExampleFont', style, { chars: BitmapFont.ALPHA })\n */\n this.ALPHA = [[\"a\", \"z\"], [\"A\", \"Z\"], \" \"];\n /**\n * This character set includes all decimal digits (from 0 to 9).\n * @type {string[][]}\n * @example\n * BitmapFont.from('ExampleFont', style, { chars: BitmapFont.NUMERIC })\n */\n this.NUMERIC = [[\"0\", \"9\"]];\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n * @type {string[][]}\n */\n this.ALPHANUMERIC = [[\"a\", \"z\"], [\"A\", \"Z\"], [\"0\", \"9\"], \" \"];\n /**\n * This character set consists of all the ASCII table.\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n this.ASCII = [[\" \", \"~\"]];\n /** Default options for installing a new BitmapFont. */\n this.defaultOptions = {\n chars: this.ALPHANUMERIC,\n resolution: 1,\n padding: 4,\n skipKerning: false\n };\n }\n /**\n * Get a font for the specified text and style.\n * @param text - The text to get the font for\n * @param style - The style to use\n */\n getFont(text, style) {\n let fontFamilyKey = `${style.fontFamily}-bitmap`;\n let overrideFill = true;\n if (style._fill.fill && !style._stroke) {\n fontFamilyKey += style._fill.fill.styleKey;\n overrideFill = false;\n } else if (style._stroke || style.dropShadow) {\n let key = style.styleKey;\n key = key.substring(0, key.lastIndexOf(\"-\"));\n fontFamilyKey = `${key}-bitmap`;\n overrideFill = false;\n }\n if (!Cache.has(fontFamilyKey)) {\n const fnt = new DynamicBitmapFont({\n style,\n overrideFill,\n overrideSize: true,\n ...this.defaultOptions\n });\n fontCount++;\n if (fontCount > 50) {\n warn(\"BitmapText\", `You have dynamically created ${fontCount} bitmap fonts, this can be inefficient. Try pre installing your font styles using \\`BitmapFont.install({name:\"style1\", style})\\``);\n }\n fnt.once(\"destroy\", () => {\n fontCount--;\n Cache.remove(fontFamilyKey);\n });\n Cache.set(\n fontFamilyKey,\n fnt\n );\n }\n const dynamicFont = Cache.get(fontFamilyKey);\n dynamicFont.ensureCharacters?.(text);\n return dynamicFont;\n }\n /**\n * Get the layout of a text for the specified style.\n * @param text - The text to get the layout for\n * @param style - The style to use\n */\n getLayout(text, style) {\n const bitmapFont = this.getFont(text, style);\n return getBitmapTextLayout([...text], style, bitmapFont);\n }\n /**\n * Measure the text using the specified style.\n * @param text - The text to measure\n * @param style - The style to use\n */\n measureText(text, style) {\n return this.getLayout(text, style);\n }\n // eslint-disable-next-line max-len\n install(...args) {\n let options = args[0];\n if (typeof options === \"string\") {\n options = {\n name: options,\n style: args[1],\n chars: args[2]?.chars,\n resolution: args[2]?.resolution,\n padding: args[2]?.padding,\n skipKerning: args[2]?.skipKerning\n };\n deprecation(v8_0_0, \"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})\");\n }\n const name = options?.name;\n if (!name) {\n throw new Error(\"[BitmapFontManager] Property `name` is required.\");\n }\n options = { ...this.defaultOptions, ...options };\n const textStyle = options.style;\n const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);\n const overrideFill = style._fill.fill !== null && style._fill.fill !== void 0;\n const font = new DynamicBitmapFont({\n style,\n overrideFill,\n skipKerning: options.skipKerning,\n padding: options.padding,\n resolution: options.resolution,\n overrideSize: false\n });\n const flatChars = resolveCharacters(options.chars);\n font.ensureCharacters(flatChars.join(\"\"));\n Cache.set(`${name}-bitmap`, font);\n font.once(\"destroy\", () => Cache.remove(`${name}-bitmap`));\n return font;\n }\n /**\n * Uninstalls a bitmap font from the cache.\n * @param {string} name - The name of the bitmap font to uninstall.\n */\n uninstall(name) {\n const cacheKey = `${name}-bitmap`;\n const font = Cache.get(cacheKey);\n if (font) {\n Cache.remove(cacheKey);\n font.destroy();\n }\n }\n}\nconst BitmapFontManager = new BitmapFontManagerClass();\n\nexport { BitmapFontManager };\n//# sourceMappingURL=BitmapFontManager.mjs.map\n","import { Rectangle } from '../../maths/shapes/Rectangle.mjs';\nimport { Texture } from '../../rendering/renderers/shared/texture/Texture.mjs';\nimport { AbstractBitmapFont } from './AbstractBitmapFont.mjs';\nimport { BitmapFontManager } from './BitmapFontManager.mjs';\n\n\"use strict\";\nclass BitmapFont extends AbstractBitmapFont {\n constructor(options, url) {\n super();\n const { textures, data } = options;\n Object.keys(data.pages).forEach((key) => {\n const pageData = data.pages[parseInt(key, 10)];\n const texture = textures[pageData.id];\n this.pages.push({ texture });\n });\n Object.keys(data.chars).forEach((key) => {\n const charData = data.chars[key];\n const {\n frame: textureFrame,\n source: textureSource\n } = textures[charData.page];\n const frameReal = new Rectangle(\n charData.x + textureFrame.x,\n charData.y + textureFrame.y,\n charData.width,\n charData.height\n );\n const texture = new Texture({\n source: textureSource,\n frame: frameReal\n });\n this.chars[key] = {\n id: key.codePointAt(0),\n xOffset: charData.xOffset,\n yOffset: charData.yOffset,\n xAdvance: charData.xAdvance,\n kerning: charData.kerning ?? {},\n texture\n };\n });\n this.baseRenderedFontSize = data.fontSize;\n this.baseMeasurementFontSize = data.fontSize;\n this.fontMetrics = {\n ascent: 0,\n descent: 0,\n fontSize: data.fontSize\n };\n this.baseLineOffset = data.baseLineOffset;\n this.lineHeight = data.lineHeight;\n this.fontFamily = data.fontFamily;\n this.distanceField = data.distanceField ?? {\n type: \"none\",\n range: 0\n };\n this.url = url;\n }\n /** Destroys the BitmapFont object. */\n destroy() {\n super.destroy();\n for (let i = 0; i < this.pages.length; i++) {\n const { texture } = this.pages[i];\n texture.destroy(true);\n }\n this.pages = null;\n }\n /**\n * Generates a bitmap-font for the given style and character set\n * @param options - Setup options for font generation.\n * @returns Font generated by style options.\n * @example\n * import { BitmapFont, BitmapText } from 'pixi.js';\n *\n * BitmapFont.install('TitleFont', {\n * fontFamily: 'Arial',\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: 'purple',\n * });\n *\n * const title = new BitmapText({ text: 'This is the title', fontFamily: 'TitleFont' });\n */\n static install(options) {\n BitmapFontManager.install(options);\n }\n /**\n * Uninstalls a bitmap font from the cache.\n * @param {string} name - The name of the bitmap font to uninstall.\n */\n static uninstall(name) {\n BitmapFontManager.uninstall(name);\n }\n}\n\nexport { BitmapFont };\n//# sourceMappingURL=BitmapFont.mjs.map\n","\"use strict\";\nconst bitmapFontTextParser = {\n test(data) {\n return typeof data === \"string\" && data.startsWith(\"info face=\");\n },\n parse(txt) {\n const items = txt.match(/^[a-z]+\\s+.+$/gm);\n const rawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n distanceField: []\n };\n for (const i in items) {\n const name = items[i].match(/^[a-z]+/gm)[0];\n const attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n const itemData = {};\n for (const i2 in attributeList) {\n const split = attributeList[i2].split(\"=\");\n const key = split[0];\n const strValue = split[1].replace(/\"/gm, \"\");\n const floatValue = parseFloat(strValue);\n const value = isNaN(floatValue) ? strValue : floatValue;\n itemData[key] = value;\n }\n rawData[name].push(itemData);\n }\n const font = {\n chars: {},\n pages: [],\n lineHeight: 0,\n fontSize: 0,\n fontFamily: \"\",\n distanceField: null,\n baseLineOffset: 0\n };\n const [info] = rawData.info;\n const [common] = rawData.common;\n const [distanceField] = rawData.distanceField ?? [];\n if (distanceField) {\n font.distanceField = {\n range: parseInt(distanceField.distanceRange, 10),\n type: distanceField.fieldType\n };\n }\n font.fontSize = parseInt(info.size, 10);\n font.fontFamily = info.face;\n font.lineHeight = parseInt(common.lineHeight, 10);\n const page = rawData.page;\n for (let i = 0; i < page.length; i++) {\n font.pages.push({\n id: parseInt(page[i].id, 10) || 0,\n file: page[i].file\n });\n }\n const map = {};\n font.baseLineOffset = font.lineHeight - parseInt(common.base, 10);\n const char = rawData.char;\n for (let i = 0; i < char.length; i++) {\n const charNode = char[i];\n const id = parseInt(charNode.id, 10);\n let letter = charNode.letter ?? charNode.char ?? String.fromCharCode(id);\n if (letter === \"space\")\n letter = \" \";\n map[id] = letter;\n font.chars[letter] = {\n id,\n // texture deets..\n page: parseInt(charNode.page, 10) || 0,\n x: parseInt(charNode.x, 10),\n y: parseInt(charNode.y, 10),\n width: parseInt(charNode.width, 10),\n height: parseInt(charNode.height, 10),\n xOffset: parseInt(charNode.xoffset, 10),\n yOffset: parseInt(charNode.yoffset, 10),\n xAdvance: parseInt(charNode.xadvance, 10),\n kerning: {}\n };\n }\n const kerning = rawData.kerning || [];\n for (let i = 0; i < kerning.length; i++) {\n const first = parseInt(kerning[i].first, 10);\n const second = parseInt(kerning[i].second, 10);\n const amount = parseInt(kerning[i].amount, 10);\n font.chars[map[second]].kerning[map[first]] = amount;\n }\n return font;\n }\n};\n\nexport { bitmapFontTextParser };\n//# sourceMappingURL=bitmapFontTextParser.mjs.map\n","\"use strict\";\nconst bitmapFontXMLParser = {\n test(data) {\n const xml = data;\n return typeof xml !== \"string\" && \"getElementsByTagName\" in xml && xml.getElementsByTagName(\"page\").length && xml.getElementsByTagName(\"info\")[0].getAttribute(\"face\") !== null;\n },\n parse(xml) {\n const data = {\n chars: {},\n pages: [],\n lineHeight: 0,\n fontSize: 0,\n fontFamily: \"\",\n distanceField: null,\n baseLineOffset: 0\n };\n const info = xml.getElementsByTagName(\"info\")[0];\n const common = xml.getElementsByTagName(\"common\")[0];\n const distanceField = xml.getElementsByTagName(\"distanceField\")[0];\n if (distanceField) {\n data.distanceField = {\n type: distanceField.getAttribute(\"fieldType\"),\n range: parseInt(distanceField.getAttribute(\"distanceRange\"), 10)\n };\n }\n const page = xml.getElementsByTagName(\"page\");\n const char = xml.getElementsByTagName(\"char\");\n const kerning = xml.getElementsByTagName(\"kerning\");\n data.fontSize = parseInt(info.getAttribute(\"size\"), 10);\n data.fontFamily = info.getAttribute(\"face\");\n data.lineHeight = parseInt(common.getAttribute(\"lineHeight\"), 10);\n for (let i = 0; i < page.length; i++) {\n data.pages.push({\n id: parseInt(page[i].getAttribute(\"id\"), 10) || 0,\n file: page[i].getAttribute(\"file\")\n });\n }\n const map = {};\n data.baseLineOffset = data.lineHeight - parseInt(common.getAttribute(\"base\"), 10);\n for (let i = 0; i < char.length; i++) {\n const charNode = char[i];\n const id = parseInt(charNode.getAttribute(\"id\"), 10);\n let letter = charNode.getAttribute(\"letter\") ?? charNode.getAttribute(\"char\") ?? String.fromCharCode(id);\n if (letter === \"space\")\n letter = \" \";\n map[id] = letter;\n data.chars[letter] = {\n id,\n // texture deets..\n page: parseInt(charNode.getAttribute(\"page\"), 10) || 0,\n x: parseInt(charNode.getAttribute(\"x\"), 10),\n y: parseInt(charNode.getAttribute(\"y\"), 10),\n width: parseInt(charNode.getAttribute(\"width\"), 10),\n height: parseInt(charNode.getAttribute(\"height\"), 10),\n // render deets..\n xOffset: parseInt(charNode.getAttribute(\"xoffset\"), 10),\n yOffset: parseInt(charNode.getAttribute(\"yoffset\"), 10),\n // + baseLineOffset,\n xAdvance: parseInt(charNode.getAttribute(\"xadvance\"), 10),\n kerning: {}\n };\n }\n for (let i = 0; i < kerning.length; i++) {\n const first = parseInt(kerning[i].getAttribute(\"first\"), 10);\n const second = parseInt(kerning[i].getAttribute(\"second\"), 10);\n const amount = parseInt(kerning[i].getAttribute(\"amount\"), 10);\n data.chars[map[second]].kerning[map[first]] = amount;\n }\n return data;\n }\n};\n\nexport { bitmapFontXMLParser };\n//# sourceMappingURL=bitmapFontXMLParser.mjs.map\n","import { DOMAdapter } from '../../../environment/adapter.mjs';\nimport { bitmapFontXMLParser } from './bitmapFontXMLParser.mjs';\n\n\"use strict\";\nconst bitmapFontXMLStringParser = {\n test(data) {\n if (typeof data === \"string\" && data.includes(\"\")) {\n return bitmapFontXMLParser.test(DOMAdapter.get().parseXML(data));\n }\n return false;\n },\n parse(data) {\n return bitmapFontXMLParser.parse(DOMAdapter.get().parseXML(data));\n }\n};\n\nexport { bitmapFontXMLStringParser };\n//# sourceMappingURL=bitmapFontXMLStringParser.mjs.map\n","import { LoaderParserPriority } from '../../../assets/loader/parsers/LoaderParser.mjs';\nimport { copySearchParams } from '../../../assets/utils/copySearchParams.mjs';\nimport { DOMAdapter } from '../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { path } from '../../../utils/path.mjs';\nimport { BitmapFont } from '../BitmapFont.mjs';\nimport { bitmapFontTextParser } from './bitmapFontTextParser.mjs';\nimport { bitmapFontXMLStringParser } from './bitmapFontXMLStringParser.mjs';\n\n\"use strict\";\nconst validExtensions = [\".xml\", \".fnt\"];\nconst bitmapFontCachePlugin = {\n extension: {\n type: ExtensionType.CacheParser,\n name: \"cacheBitmapFont\"\n },\n test: (asset) => asset instanceof BitmapFont,\n getCacheableAssets(keys, asset) {\n const out = {};\n keys.forEach((key) => {\n out[key] = asset;\n out[`${key}-bitmap`] = asset;\n });\n out[`${asset.fontFamily}-bitmap`] = asset;\n return out;\n }\n};\nconst loadBitmapFont = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Normal\n },\n name: \"loadBitmapFont\",\n test(url) {\n return validExtensions.includes(path.extname(url).toLowerCase());\n },\n async testParse(data) {\n return bitmapFontTextParser.test(data) || bitmapFontXMLStringParser.test(data);\n },\n async parse(asset, data, loader) {\n const bitmapFontData = bitmapFontTextParser.test(asset) ? bitmapFontTextParser.parse(asset) : bitmapFontXMLStringParser.parse(asset);\n const { src } = data;\n const { pages } = bitmapFontData;\n const textureUrls = [];\n const textureOptions = bitmapFontData.distanceField ? {\n scaleMode: \"linear\",\n alphaMode: \"premultiply-alpha-on-upload\",\n autoGenerateMipmaps: false,\n resolution: 1\n } : {};\n for (let i = 0; i < pages.length; ++i) {\n const pageFile = pages[i].file;\n let imagePath = path.join(path.dirname(src), pageFile);\n imagePath = copySearchParams(imagePath, src);\n textureUrls.push({\n src: imagePath,\n data: textureOptions\n });\n }\n const loadedTextures = await loader.load(textureUrls);\n const textures = textureUrls.map((url) => loadedTextures[url.src]);\n const bitmapFont = new BitmapFont({\n data: bitmapFontData,\n textures\n }, src);\n return bitmapFont;\n },\n async load(url, _options) {\n const response = await DOMAdapter.get().fetch(url);\n return await response.text();\n },\n async unload(bitmapFont, _resolvedAsset, loader) {\n await Promise.all(bitmapFont.pages.map((page) => loader.unload(page.texture.source._sourceOrigin)));\n bitmapFont.destroy();\n }\n};\n\nexport { bitmapFontCachePlugin, loadBitmapFont };\n//# sourceMappingURL=loadBitmapFont.mjs.map\n","\"use strict\";\nclass BackgroundLoader {\n /**\n * @param loader\n * @param verbose - should the loader log to the console\n */\n constructor(loader, verbose = false) {\n this._loader = loader;\n this._assetList = [];\n this._isLoading = false;\n this._maxConcurrent = 1;\n this.verbose = verbose;\n }\n /**\n * Adds an array of assets to load.\n * @param assetUrls - assets to load\n */\n add(assetUrls) {\n assetUrls.forEach((a) => {\n this._assetList.push(a);\n });\n if (this.verbose) {\n console.log(\"[BackgroundLoader] assets: \", this._assetList);\n }\n if (this._isActive && !this._isLoading) {\n void this._next();\n }\n }\n /**\n * Loads the next set of assets. Will try to load as many assets as it can at the same time.\n *\n * The max assets it will try to load at one time will be 4.\n */\n async _next() {\n if (this._assetList.length && this._isActive) {\n this._isLoading = true;\n const toLoad = [];\n const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);\n for (let i = 0; i < toLoadAmount; i++) {\n toLoad.push(this._assetList.pop());\n }\n await this._loader.load(toLoad);\n this._isLoading = false;\n void this._next();\n }\n }\n /**\n * Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.\n * @returns whether the class is active\n */\n get active() {\n return this._isActive;\n }\n set active(value) {\n if (this._isActive === value)\n return;\n this._isActive = value;\n if (value && !this._isLoading) {\n void this._next();\n }\n }\n}\n\nexport { BackgroundLoader };\n//# sourceMappingURL=BackgroundLoader.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';\n\n\"use strict\";\nconst cacheTextureArray = {\n extension: {\n type: ExtensionType.CacheParser,\n name: \"cacheTextureArray\"\n },\n test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),\n getCacheableAssets: (keys, asset) => {\n const out = {};\n keys.forEach((key) => {\n asset.forEach((item, i) => {\n out[key + (i === 0 ? \"\" : i + 1)] = item;\n });\n });\n return out;\n }\n};\n\nexport { cacheTextureArray };\n//# sourceMappingURL=cacheTextureArray.mjs.map\n","\"use strict\";\nasync function testImageFormat(imageData) {\n if (\"Image\" in globalThis) {\n return new Promise((resolve) => {\n const image = new Image();\n image.onload = () => {\n resolve(true);\n };\n image.onerror = () => {\n resolve(false);\n };\n image.src = imageData;\n });\n }\n if (\"createImageBitmap\" in globalThis && \"fetch\" in globalThis) {\n try {\n const blob = await (await fetch(imageData)).blob();\n await createImageBitmap(blob);\n } catch (e) {\n return false;\n }\n return true;\n }\n return false;\n}\n\nexport { testImageFormat };\n//# sourceMappingURL=testImageFormat.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { testImageFormat } from '../utils/testImageFormat.mjs';\n\n\"use strict\";\nconst detectAvif = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 1\n },\n test: async () => testImageFormat(\n // eslint-disable-next-line max-len\n \"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=\"\n ),\n add: async (formats) => [...formats, \"avif\"],\n remove: async (formats) => formats.filter((f) => f !== \"avif\")\n};\n\nexport { detectAvif };\n//# sourceMappingURL=detectAvif.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nconst imageFormats = [\"png\", \"jpg\", \"jpeg\"];\nconst detectDefaults = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: -1\n },\n test: () => Promise.resolve(true),\n add: async (formats) => [...formats, ...imageFormats],\n remove: async (formats) => formats.filter((f) => !imageFormats.includes(f))\n};\n\nexport { detectDefaults };\n//# sourceMappingURL=detectDefaults.mjs.map\n","\"use strict\";\nconst inWorker = \"WorkerGlobalScope\" in globalThis && globalThis instanceof globalThis.WorkerGlobalScope;\nfunction testVideoFormat(mimeType) {\n if (inWorker) {\n return false;\n }\n const video = document.createElement(\"video\");\n return video.canPlayType(mimeType) !== \"\";\n}\n\nexport { testVideoFormat };\n//# sourceMappingURL=testVideoFormat.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { testVideoFormat } from '../utils/testVideoFormat.mjs';\n\n\"use strict\";\nconst detectMp4 = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0\n },\n test: async () => testVideoFormat(\"video/mp4\"),\n add: async (formats) => [...formats, \"mp4\", \"m4v\"],\n remove: async (formats) => formats.filter((f) => f !== \"mp4\" && f !== \"m4v\")\n};\n\nexport { detectMp4 };\n//# sourceMappingURL=detectMp4.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { testVideoFormat } from '../utils/testVideoFormat.mjs';\n\n\"use strict\";\nconst detectOgv = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0\n },\n test: async () => testVideoFormat(\"video/ogg\"),\n add: async (formats) => [...formats, \"ogv\"],\n remove: async (formats) => formats.filter((f) => f !== \"ogv\")\n};\n\nexport { detectOgv };\n//# sourceMappingURL=detectOgv.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { testVideoFormat } from '../utils/testVideoFormat.mjs';\n\n\"use strict\";\nconst detectWebm = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0\n },\n test: async () => testVideoFormat(\"video/webm\"),\n add: async (formats) => [...formats, \"webm\"],\n remove: async (formats) => formats.filter((f) => f !== \"webm\")\n};\n\nexport { detectWebm };\n//# sourceMappingURL=detectWebm.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { testImageFormat } from '../utils/testImageFormat.mjs';\n\n\"use strict\";\nconst detectWebp = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0\n },\n test: async () => testImageFormat(\n \"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=\"\n ),\n add: async (formats) => [...formats, \"webp\"],\n remove: async (formats) => formats.filter((f) => f !== \"webp\")\n};\n\nexport { detectWebp };\n//# sourceMappingURL=detectWebp.mjs.map\n","import { warn } from '../../utils/logging/warn.mjs';\nimport { path } from '../../utils/path.mjs';\nimport { convertToList } from '../utils/convertToList.mjs';\nimport { isSingleItem } from '../utils/isSingleItem.mjs';\n\n\"use strict\";\nclass Loader {\n constructor() {\n this._parsers = [];\n this._parsersValidated = false;\n /**\n * All loader parsers registered\n * @type {assets.LoaderParser[]}\n */\n this.parsers = new Proxy(this._parsers, {\n set: (target, key, value) => {\n this._parsersValidated = false;\n target[key] = value;\n return true;\n }\n });\n /** Cache loading promises that ae currently active */\n this.promiseCache = {};\n }\n /** function used for testing */\n reset() {\n this._parsersValidated = false;\n this.promiseCache = {};\n }\n /**\n * Used internally to generate a promise for the asset to be loaded.\n * @param url - The URL to be loaded\n * @param data - any custom additional information relevant to the asset being loaded\n * @returns - a promise that will resolve to an Asset for example a Texture of a JSON object\n */\n _getLoadPromiseAndParser(url, data) {\n const result = {\n promise: null,\n parser: null\n };\n result.promise = (async () => {\n let asset = null;\n let parser = null;\n if (data.loadParser) {\n parser = this._parserHash[data.loadParser];\n if (!parser) {\n warn(`[Assets] specified load parser \"${data.loadParser}\" not found while loading ${url}`);\n }\n }\n if (!parser) {\n for (let i = 0; i < this.parsers.length; i++) {\n const parserX = this.parsers[i];\n if (parserX.load && parserX.test?.(url, data, this)) {\n parser = parserX;\n break;\n }\n }\n if (!parser) {\n warn(`[Assets] ${url} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`);\n return null;\n }\n }\n asset = await parser.load(url, data, this);\n result.parser = parser;\n for (let i = 0; i < this.parsers.length; i++) {\n const parser2 = this.parsers[i];\n if (parser2.parse) {\n if (parser2.parse && await parser2.testParse?.(asset, data, this)) {\n asset = await parser2.parse(asset, data, this) || asset;\n result.parser = parser2;\n }\n }\n }\n return asset;\n })();\n return result;\n }\n async load(assetsToLoadIn, onProgress) {\n if (!this._parsersValidated) {\n this._validateParsers();\n }\n let count = 0;\n const assets = {};\n const singleAsset = isSingleItem(assetsToLoadIn);\n const assetsToLoad = convertToList(assetsToLoadIn, (item) => ({\n alias: [item],\n src: item,\n data: {}\n }));\n const total = assetsToLoad.length;\n const promises = assetsToLoad.map(async (asset) => {\n const url = path.toAbsolute(asset.src);\n if (!assets[asset.src]) {\n try {\n if (!this.promiseCache[url]) {\n this.promiseCache[url] = this._getLoadPromiseAndParser(url, asset);\n }\n assets[asset.src] = await this.promiseCache[url].promise;\n if (onProgress)\n onProgress(++count / total);\n } catch (e) {\n delete this.promiseCache[url];\n delete assets[asset.src];\n throw new Error(`[Loader.load] Failed to load ${url}.\n${e}`);\n }\n }\n });\n await Promise.all(promises);\n return singleAsset ? assets[assetsToLoad[0].src] : assets;\n }\n /**\n * Unloads one or more assets. Any unloaded assets will be destroyed, freeing up memory for your app.\n * The parser that created the asset, will be the one that unloads it.\n * @example\n * // Single asset:\n * const asset = await Loader.load('cool.png');\n *\n * await Loader.unload('cool.png');\n *\n * console.log(asset.destroyed); // true\n * @param assetsToUnloadIn - urls that you want to unload, or a single one!\n */\n async unload(assetsToUnloadIn) {\n const assetsToUnload = convertToList(assetsToUnloadIn, (item) => ({\n alias: [item],\n src: item\n }));\n const promises = assetsToUnload.map(async (asset) => {\n const url = path.toAbsolute(asset.src);\n const loadPromise = this.promiseCache[url];\n if (loadPromise) {\n const loadedAsset = await loadPromise.promise;\n delete this.promiseCache[url];\n await loadPromise.parser?.unload?.(loadedAsset, asset, this);\n }\n });\n await Promise.all(promises);\n }\n /** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */\n _validateParsers() {\n this._parsersValidated = true;\n this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => {\n if (!parser.name) {\n warn(`[Assets] loadParser should have a name`);\n } else if (hash[parser.name]) {\n warn(`[Assets] loadParser name conflict \"${parser.name}\"`);\n }\n return { ...hash, [parser.name]: parser };\n }, {});\n }\n}\n\nexport { Loader };\n//# sourceMappingURL=Loader.mjs.map\n","\"use strict\";\nfunction checkDataUrl(url, mimes) {\n if (Array.isArray(mimes)) {\n for (const mime of mimes) {\n if (url.startsWith(`data:${mime}`))\n return true;\n }\n return false;\n }\n return url.startsWith(`data:${mimes}`);\n}\n\nexport { checkDataUrl };\n//# sourceMappingURL=checkDataUrl.mjs.map\n","import { path } from '../../utils/path.mjs';\n\n\"use strict\";\nfunction checkExtension(url, extension) {\n const tempURL = url.split(\"?\")[0];\n const ext = path.extname(tempURL).toLowerCase();\n if (Array.isArray(extension)) {\n return extension.includes(ext);\n }\n return ext === extension;\n}\n\nexport { checkExtension };\n//# sourceMappingURL=checkExtension.mjs.map\n","import { DOMAdapter } from '../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { checkDataUrl } from '../../utils/checkDataUrl.mjs';\nimport { checkExtension } from '../../utils/checkExtension.mjs';\nimport { LoaderParserPriority } from './LoaderParser.mjs';\n\n\"use strict\";\nconst validJSONExtension = \".json\";\nconst validJSONMIME = \"application/json\";\nconst loadJson = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low\n },\n name: \"loadJson\",\n test(url) {\n return checkDataUrl(url, validJSONMIME) || checkExtension(url, validJSONExtension);\n },\n async load(url) {\n const response = await DOMAdapter.get().fetch(url);\n const json = await response.json();\n return json;\n }\n};\n\nexport { loadJson };\n//# sourceMappingURL=loadJson.mjs.map\n","import { DOMAdapter } from '../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { checkDataUrl } from '../../utils/checkDataUrl.mjs';\nimport { checkExtension } from '../../utils/checkExtension.mjs';\nimport { LoaderParserPriority } from './LoaderParser.mjs';\n\n\"use strict\";\nconst validTXTExtension = \".txt\";\nconst validTXTMIME = \"text/plain\";\nconst loadTxt = {\n name: \"loadTxt\",\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low,\n name: \"loadTxt\"\n },\n test(url) {\n return checkDataUrl(url, validTXTMIME) || checkExtension(url, validTXTExtension);\n },\n async load(url) {\n const response = await DOMAdapter.get().fetch(url);\n const txt = await response.text();\n return txt;\n }\n};\n\nexport { loadTxt };\n//# sourceMappingURL=loadTxt.mjs.map\n","import { DOMAdapter } from '../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\nimport { path } from '../../../utils/path.mjs';\nimport { Cache } from '../../cache/Cache.mjs';\nimport { checkDataUrl } from '../../utils/checkDataUrl.mjs';\nimport { checkExtension } from '../../utils/checkExtension.mjs';\nimport { LoaderParserPriority } from './LoaderParser.mjs';\n\n\"use strict\";\nconst validWeights = [\n \"normal\",\n \"bold\",\n \"100\",\n \"200\",\n \"300\",\n \"400\",\n \"500\",\n \"600\",\n \"700\",\n \"800\",\n \"900\"\n];\nconst validFontExtensions = [\".ttf\", \".otf\", \".woff\", \".woff2\"];\nconst validFontMIMEs = [\n \"font/ttf\",\n \"font/otf\",\n \"font/woff\",\n \"font/woff2\"\n];\nconst CSS_IDENT_TOKEN_REGEX = /^(--|-?[A-Z_])[0-9A-Z_-]*$/i;\nfunction getFontFamilyName(url) {\n const ext = path.extname(url);\n const name = path.basename(url, ext);\n const nameWithSpaces = name.replace(/(-|_)/g, \" \");\n const nameTokens = nameWithSpaces.toLowerCase().split(\" \").map((word) => word.charAt(0).toUpperCase() + word.slice(1));\n let valid = nameTokens.length > 0;\n for (const token of nameTokens) {\n if (!token.match(CSS_IDENT_TOKEN_REGEX)) {\n valid = false;\n break;\n }\n }\n let fontFamilyName = nameTokens.join(\" \");\n if (!valid) {\n fontFamilyName = `\"${fontFamilyName.replace(/[\\\\\"]/g, \"\\\\$&\")}\"`;\n }\n return fontFamilyName;\n}\nconst validURICharactersRegex = /^[0-9A-Za-z%:/?#\\[\\]@!\\$&'()\\*\\+,;=\\-._~]*$/;\nfunction encodeURIWhenNeeded(uri) {\n if (validURICharactersRegex.test(uri)) {\n return uri;\n }\n return encodeURI(uri);\n}\nconst loadWebFont = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low\n },\n name: \"loadWebFont\",\n test(url) {\n return checkDataUrl(url, validFontMIMEs) || checkExtension(url, validFontExtensions);\n },\n async load(url, options) {\n const fonts = DOMAdapter.get().getFontFaceSet();\n if (fonts) {\n const fontFaces = [];\n const name = options.data?.family ?? getFontFamilyName(url);\n const weights = options.data?.weights?.filter((weight) => validWeights.includes(weight)) ?? [\"normal\"];\n const data = options.data ?? {};\n for (let i = 0; i < weights.length; i++) {\n const weight = weights[i];\n const font = new FontFace(name, `url(${encodeURIWhenNeeded(url)})`, {\n ...data,\n weight\n });\n await font.load();\n fonts.add(font);\n fontFaces.push(font);\n }\n Cache.set(`${name}-and-url`, {\n url,\n fontFaces\n });\n return fontFaces.length === 1 ? fontFaces[0] : fontFaces;\n }\n warn(\"[loadWebFont] FontFace API is not supported. Skipping loading font\");\n return null;\n },\n unload(font) {\n (Array.isArray(font) ? font : [font]).forEach((t) => {\n Cache.remove(t.family);\n DOMAdapter.get().getFontFaceSet().delete(t);\n });\n }\n};\n\nexport { getFontFamilyName, loadWebFont };\n//# sourceMappingURL=loadWebFont.mjs.map\n","import { Resolver } from '../../assets/resolver/Resolver.mjs';\n\n\"use strict\";\nfunction getResolutionOfUrl(url, defaultValue = 1) {\n const resolution = Resolver.RETINA_PREFIX?.exec(url);\n if (resolution) {\n return parseFloat(resolution[1]);\n }\n return defaultValue;\n}\n\nexport { getResolutionOfUrl };\n//# sourceMappingURL=getResolutionOfUrl.mjs.map\n","import { Texture } from '../../../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { warn } from '../../../../../utils/logging/warn.mjs';\nimport { Cache } from '../../../../cache/Cache.mjs';\n\n\"use strict\";\nfunction createTexture(source, loader, url) {\n source.label = url;\n source._sourceOrigin = url;\n const texture = new Texture({\n source,\n label: url\n });\n const unload = () => {\n delete loader.promiseCache[url];\n if (Cache.has(url)) {\n Cache.remove(url);\n }\n };\n texture.source.once(\"destroy\", () => {\n if (loader.promiseCache[url]) {\n warn(\"[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource.\");\n unload();\n }\n });\n texture.once(\"destroy\", () => {\n if (!source.destroyed) {\n warn(\"[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture.\");\n unload();\n }\n });\n return texture;\n}\n\nexport { createTexture };\n//# sourceMappingURL=createTexture.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { ImageSource } from '../../../../rendering/renderers/shared/texture/sources/ImageSource.mjs';\nimport { GraphicsContext } from '../../../../scene/graphics/shared/GraphicsContext.mjs';\nimport { getResolutionOfUrl } from '../../../../utils/network/getResolutionOfUrl.mjs';\nimport { checkDataUrl } from '../../../utils/checkDataUrl.mjs';\nimport { checkExtension } from '../../../utils/checkExtension.mjs';\nimport { LoaderParserPriority } from '../LoaderParser.mjs';\nimport { createTexture } from './utils/createTexture.mjs';\n\n\"use strict\";\nconst validSVGExtension = \".svg\";\nconst validSVGMIME = \"image/svg+xml\";\nconst loadSvg = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low,\n name: \"loadSVG\"\n },\n name: \"loadSVG\",\n config: {\n crossOrigin: \"anonymous\",\n parseAsGraphicsContext: false\n },\n test(url) {\n return checkDataUrl(url, validSVGMIME) || checkExtension(url, validSVGExtension);\n },\n async load(url, asset, loader) {\n if (asset.data.parseAsGraphicsContext ?? this.config.parseAsGraphicsContext) {\n return loadAsGraphics(url);\n }\n return loadAsTexture(url, asset, loader, this.config.crossOrigin);\n },\n unload(asset) {\n asset.destroy(true);\n }\n};\nasync function loadAsTexture(url, asset, loader, crossOrigin) {\n const response = await DOMAdapter.get().fetch(url);\n const blob = await response.blob();\n const blobUrl = URL.createObjectURL(blob);\n const image = new Image();\n image.src = blobUrl;\n image.crossOrigin = crossOrigin;\n await image.decode();\n URL.revokeObjectURL(blobUrl);\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n const resolution = asset.data?.resolution || getResolutionOfUrl(url);\n const width = asset.data?.width ?? image.width;\n const height = asset.data?.height ?? image.height;\n canvas.width = width * resolution;\n canvas.height = height * resolution;\n context.drawImage(image, 0, 0, width * resolution, height * resolution);\n const { parseAsGraphicsContext: _p, ...rest } = asset.data;\n const base = new ImageSource({\n resource: canvas,\n alphaMode: \"premultiply-alpha-on-upload\",\n resolution,\n ...rest\n });\n return createTexture(base, loader, url);\n}\nasync function loadAsGraphics(url) {\n const response = await DOMAdapter.get().fetch(url);\n const svgSource = await response.text();\n const context = new GraphicsContext();\n context.svg(svgSource);\n return context;\n}\n\nexport { loadSvg };\n//# sourceMappingURL=loadSVG.mjs.map\n","const WORKER_CODE = \"(function () {\\n 'use strict';\\n\\n const WHITE_PNG = \\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=\\\";\\n async function checkImageBitmap() {\\n try {\\n if (typeof createImageBitmap !== \\\"function\\\")\\n return false;\\n const response = await fetch(WHITE_PNG);\\n const imageBlob = await response.blob();\\n const imageBitmap = await createImageBitmap(imageBlob);\\n return imageBitmap.width === 1 && imageBitmap.height === 1;\\n } catch (e) {\\n return false;\\n }\\n }\\n void checkImageBitmap().then((result) => {\\n self.postMessage(result);\\n });\\n\\n})();\\n\";\nlet WORKER_URL = null;\nclass WorkerInstance\n{\n constructor()\n {\n if (!WORKER_URL)\n {\n WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: 'application/javascript' }));\n }\n this.worker = new Worker(WORKER_URL);\n }\n}\nWorkerInstance.revokeObjectURL = function revokeObjectURL()\n{\n if (WORKER_URL)\n {\n URL.revokeObjectURL(WORKER_URL);\n WORKER_URL = null;\n }\n};\n\nexport { WorkerInstance as default };\n//# sourceMappingURL=checkImageBitmap.worker.mjs.map\n","const WORKER_CODE = \"(function () {\\n 'use strict';\\n\\n async function loadImageBitmap(url) {\\n const response = await fetch(url);\\n if (!response.ok) {\\n throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);\\n }\\n const imageBlob = await response.blob();\\n const imageBitmap = await createImageBitmap(imageBlob);\\n return imageBitmap;\\n }\\n self.onmessage = async (event) => {\\n try {\\n const imageBitmap = await loadImageBitmap(event.data.data[0]);\\n self.postMessage({\\n data: imageBitmap,\\n uuid: event.data.uuid,\\n id: event.data.id\\n }, [imageBitmap]);\\n } catch (e) {\\n self.postMessage({\\n error: e,\\n uuid: event.data.uuid,\\n id: event.data.id\\n });\\n }\\n };\\n\\n})();\\n\";\nlet WORKER_URL = null;\nclass WorkerInstance\n{\n constructor()\n {\n if (!WORKER_URL)\n {\n WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: 'application/javascript' }));\n }\n this.worker = new Worker(WORKER_URL);\n }\n}\nWorkerInstance.revokeObjectURL = function revokeObjectURL()\n{\n if (WORKER_URL)\n {\n URL.revokeObjectURL(WORKER_URL);\n WORKER_URL = null;\n }\n};\n\nexport { WorkerInstance as default };\n//# sourceMappingURL=loadImageBitmap.worker.mjs.map\n","import WorkerInstance from '../../../_virtual/checkImageBitmap.worker.mjs';\nimport WorkerInstance$1 from '../../../_virtual/loadImageBitmap.worker.mjs';\n\n\"use strict\";\nlet UUID = 0;\nlet MAX_WORKERS;\nclass WorkerManagerClass {\n constructor() {\n this._initialized = false;\n this._createdWorkers = 0;\n this._workerPool = [];\n this._queue = [];\n this._resolveHash = {};\n }\n isImageBitmapSupported() {\n if (this._isImageBitmapSupported !== void 0)\n return this._isImageBitmapSupported;\n this._isImageBitmapSupported = new Promise((resolve) => {\n const { worker } = new WorkerInstance();\n worker.addEventListener(\"message\", (event) => {\n worker.terminate();\n WorkerInstance.revokeObjectURL();\n resolve(event.data);\n });\n });\n return this._isImageBitmapSupported;\n }\n loadImageBitmap(src) {\n return this._run(\"loadImageBitmap\", [src]);\n }\n async _initWorkers() {\n if (this._initialized)\n return;\n this._initialized = true;\n }\n _getWorker() {\n if (MAX_WORKERS === void 0) {\n MAX_WORKERS = navigator.hardwareConcurrency || 4;\n }\n let worker = this._workerPool.pop();\n if (!worker && this._createdWorkers < MAX_WORKERS) {\n this._createdWorkers++;\n worker = new WorkerInstance$1().worker;\n worker.addEventListener(\"message\", (event) => {\n this._complete(event.data);\n this._returnWorker(event.target);\n this._next();\n });\n }\n return worker;\n }\n _returnWorker(worker) {\n this._workerPool.push(worker);\n }\n _complete(data) {\n if (data.error !== void 0) {\n this._resolveHash[data.uuid].reject(data.error);\n } else {\n this._resolveHash[data.uuid].resolve(data.data);\n }\n this._resolveHash[data.uuid] = null;\n }\n async _run(id, args) {\n await this._initWorkers();\n const promise = new Promise((resolve, reject) => {\n this._queue.push({ id, arguments: args, resolve, reject });\n });\n this._next();\n return promise;\n }\n _next() {\n if (!this._queue.length)\n return;\n const worker = this._getWorker();\n if (!worker) {\n return;\n }\n const toDo = this._queue.pop();\n const id = toDo.id;\n this._resolveHash[UUID] = { resolve: toDo.resolve, reject: toDo.reject };\n worker.postMessage({\n data: toDo.arguments,\n uuid: UUID++,\n id\n });\n }\n}\nconst WorkerManager = new WorkerManagerClass();\n\nexport { WorkerManager };\n//# sourceMappingURL=WorkerManager.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { ImageSource } from '../../../../rendering/renderers/shared/texture/sources/ImageSource.mjs';\nimport { getResolutionOfUrl } from '../../../../utils/network/getResolutionOfUrl.mjs';\nimport { checkDataUrl } from '../../../utils/checkDataUrl.mjs';\nimport { checkExtension } from '../../../utils/checkExtension.mjs';\nimport { WorkerManager } from '../../workers/WorkerManager.mjs';\nimport { LoaderParserPriority } from '../LoaderParser.mjs';\nimport { createTexture } from './utils/createTexture.mjs';\n\n\"use strict\";\nconst validImageExtensions = [\".jpeg\", \".jpg\", \".png\", \".webp\", \".avif\"];\nconst validImageMIMEs = [\n \"image/jpeg\",\n \"image/png\",\n \"image/webp\",\n \"image/avif\"\n];\nasync function loadImageBitmap(url) {\n const response = await DOMAdapter.get().fetch(url);\n if (!response.ok) {\n throw new Error(`[loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);\n }\n const imageBlob = await response.blob();\n const imageBitmap = await createImageBitmap(imageBlob);\n return imageBitmap;\n}\nconst loadTextures = {\n name: \"loadTextures\",\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.High,\n name: \"loadTextures\"\n },\n config: {\n preferWorkers: true,\n preferCreateImageBitmap: true,\n crossOrigin: \"anonymous\"\n },\n test(url) {\n return checkDataUrl(url, validImageMIMEs) || checkExtension(url, validImageExtensions);\n },\n async load(url, asset, loader) {\n let src = null;\n if (globalThis.createImageBitmap && this.config.preferCreateImageBitmap) {\n if (this.config.preferWorkers && await WorkerManager.isImageBitmapSupported()) {\n src = await WorkerManager.loadImageBitmap(url);\n } else {\n src = await loadImageBitmap(url);\n }\n } else {\n src = await new Promise((resolve) => {\n src = new Image();\n src.crossOrigin = this.config.crossOrigin;\n src.src = url;\n if (src.complete) {\n resolve(src);\n } else {\n src.onload = () => {\n resolve(src);\n };\n }\n });\n }\n const base = new ImageSource({\n resource: src,\n alphaMode: \"premultiply-alpha-on-upload\",\n resolution: asset.data?.resolution || getResolutionOfUrl(url),\n ...asset.data\n });\n return createTexture(base, loader, url);\n },\n unload(texture) {\n texture.destroy(true);\n }\n};\n\nexport { loadImageBitmap, loadTextures };\n//# sourceMappingURL=loadTextures.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { VideoSource } from '../../../../rendering/renderers/shared/texture/sources/VideoSource.mjs';\nimport { detectVideoAlphaMode } from '../../../../utils/browser/detectVideoAlphaMode.mjs';\nimport { getResolutionOfUrl } from '../../../../utils/network/getResolutionOfUrl.mjs';\nimport { checkDataUrl } from '../../../utils/checkDataUrl.mjs';\nimport { checkExtension } from '../../../utils/checkExtension.mjs';\nimport { createTexture } from './utils/createTexture.mjs';\n\n\"use strict\";\nconst validVideoExtensions = [\".mp4\", \".m4v\", \".webm\", \".ogg\", \".ogv\", \".h264\", \".avi\", \".mov\"];\nconst validVideoMIMEs = validVideoExtensions.map((ext) => `video/${ext.substring(1)}`);\nfunction crossOrigin(element, url, crossorigin) {\n if (crossorigin === void 0 && !url.startsWith(\"data:\")) {\n element.crossOrigin = determineCrossOrigin(url);\n } else if (crossorigin !== false) {\n element.crossOrigin = typeof crossorigin === \"string\" ? crossorigin : \"anonymous\";\n }\n}\nfunction preloadVideo(element) {\n return new Promise((resolve, reject) => {\n element.addEventListener(\"canplaythrough\", loaded);\n element.addEventListener(\"error\", error);\n element.load();\n function loaded() {\n cleanup();\n resolve();\n }\n function error(err) {\n cleanup();\n reject(err);\n }\n function cleanup() {\n element.removeEventListener(\"canplaythrough\", loaded);\n element.removeEventListener(\"error\", error);\n }\n });\n}\nfunction determineCrossOrigin(url, loc = globalThis.location) {\n if (url.startsWith(\"data:\")) {\n return \"\";\n }\n loc = loc || globalThis.location;\n const parsedUrl = new URL(url, document.baseURI);\n if (parsedUrl.hostname !== loc.hostname || parsedUrl.port !== loc.port || parsedUrl.protocol !== loc.protocol) {\n return \"anonymous\";\n }\n return \"\";\n}\nconst loadVideoTextures = {\n name: \"loadVideo\",\n extension: {\n type: ExtensionType.LoadParser,\n name: \"loadVideo\"\n },\n test(url) {\n const isValidDataUrl = checkDataUrl(url, validVideoMIMEs);\n const isValidExtension = checkExtension(url, validVideoExtensions);\n return isValidDataUrl || isValidExtension;\n },\n async load(url, asset, loader) {\n const options = {\n ...VideoSource.defaultOptions,\n resolution: asset.data?.resolution || getResolutionOfUrl(url),\n alphaMode: asset.data?.alphaMode || await detectVideoAlphaMode(),\n ...asset.data\n };\n const videoElement = document.createElement(\"video\");\n const attributeMap = {\n preload: options.autoLoad !== false ? \"auto\" : void 0,\n \"webkit-playsinline\": options.playsinline !== false ? \"\" : void 0,\n playsinline: options.playsinline !== false ? \"\" : void 0,\n muted: options.muted === true ? \"\" : void 0,\n loop: options.loop === true ? \"\" : void 0,\n autoplay: options.autoPlay !== false ? \"\" : void 0\n };\n Object.keys(attributeMap).forEach((key) => {\n const value = attributeMap[key];\n if (value !== void 0)\n videoElement.setAttribute(key, value);\n });\n if (options.muted === true) {\n videoElement.muted = true;\n }\n crossOrigin(videoElement, url, options.crossorigin);\n const sourceElement = document.createElement(\"source\");\n let mime;\n if (url.startsWith(\"data:\")) {\n mime = url.slice(5, url.indexOf(\";\"));\n } else if (!url.startsWith(\"blob:\")) {\n const ext = url.split(\"?\")[0].slice(url.lastIndexOf(\".\") + 1).toLowerCase();\n mime = VideoSource.MIME_TYPES[ext] || `video/${ext}`;\n }\n sourceElement.src = url;\n if (mime) {\n sourceElement.type = mime;\n }\n return new Promise((resolve) => {\n const onCanPlay = async () => {\n const base = new VideoSource({ ...options, resource: videoElement });\n videoElement.removeEventListener(\"canplay\", onCanPlay);\n if (asset.data.preload) {\n await preloadVideo(videoElement);\n }\n resolve(createTexture(base, loader, url));\n };\n videoElement.addEventListener(\"canplay\", onCanPlay);\n videoElement.appendChild(sourceElement);\n });\n },\n unload(texture) {\n texture.destroy(true);\n }\n};\n\nexport { crossOrigin, determineCrossOrigin, loadVideoTextures, preloadVideo };\n//# sourceMappingURL=loadVideoTextures.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { loadTextures } from '../../loader/parsers/textures/loadTextures.mjs';\nimport { Resolver } from '../Resolver.mjs';\n\n\"use strict\";\nconst resolveTextureUrl = {\n extension: {\n type: ExtensionType.ResolveParser,\n name: \"resolveTexture\"\n },\n test: loadTextures.test,\n parse: (value) => ({\n resolution: parseFloat(Resolver.RETINA_PREFIX.exec(value)?.[1] ?? \"1\"),\n format: value.split(\".\").pop(),\n src: value\n })\n};\n\nexport { resolveTextureUrl };\n//# sourceMappingURL=resolveTextureUrl.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Resolver } from '../Resolver.mjs';\nimport { resolveTextureUrl } from './resolveTextureUrl.mjs';\n\n\"use strict\";\nconst resolveJsonUrl = {\n extension: {\n type: ExtensionType.ResolveParser,\n priority: -2,\n name: \"resolveJson\"\n },\n test: (value) => Resolver.RETINA_PREFIX.test(value) && value.endsWith(\".json\"),\n parse: resolveTextureUrl.parse\n};\n\nexport { resolveJsonUrl };\n//# sourceMappingURL=resolveJsonUrl.mjs.map\n","import { extensions, ExtensionType } from '../extensions/Extensions.mjs';\nimport { loadBitmapFont, bitmapFontCachePlugin } from '../scene/text-bitmap/asset/loadBitmapFont.mjs';\nimport { warn } from '../utils/logging/warn.mjs';\nimport { BackgroundLoader } from './BackgroundLoader.mjs';\nimport { Cache } from './cache/Cache.mjs';\nimport { cacheTextureArray } from './cache/parsers/cacheTextureArray.mjs';\nimport { detectAvif } from './detections/parsers/detectAvif.mjs';\nimport { detectDefaults } from './detections/parsers/detectDefaults.mjs';\nimport { detectMp4 } from './detections/parsers/detectMp4.mjs';\nimport { detectOgv } from './detections/parsers/detectOgv.mjs';\nimport { detectWebm } from './detections/parsers/detectWebm.mjs';\nimport { detectWebp } from './detections/parsers/detectWebp.mjs';\nimport { Loader } from './loader/Loader.mjs';\nimport { loadJson } from './loader/parsers/loadJson.mjs';\nimport { loadTxt } from './loader/parsers/loadTxt.mjs';\nimport { loadWebFont } from './loader/parsers/loadWebFont.mjs';\nimport { loadSvg } from './loader/parsers/textures/loadSVG.mjs';\nimport { loadTextures } from './loader/parsers/textures/loadTextures.mjs';\nimport { loadVideoTextures } from './loader/parsers/textures/loadVideoTextures.mjs';\nimport { resolveJsonUrl } from './resolver/parsers/resolveJsonUrl.mjs';\nimport { resolveTextureUrl } from './resolver/parsers/resolveTextureUrl.mjs';\nimport { Resolver } from './resolver/Resolver.mjs';\nimport { convertToList } from './utils/convertToList.mjs';\nimport { isSingleItem } from './utils/isSingleItem.mjs';\n\n\"use strict\";\nclass AssetsClass {\n constructor() {\n this._detections = [];\n this._initialized = false;\n this.resolver = new Resolver();\n this.loader = new Loader();\n this.cache = Cache;\n this._backgroundLoader = new BackgroundLoader(this.loader);\n this._backgroundLoader.active = true;\n this.reset();\n }\n /**\n * Best practice is to call this function before any loading commences\n * Initiating is the best time to add any customization to the way things are loaded.\n *\n * you do not need to call this for the Assets class to work, only if you want to set any initial properties\n * @param options - options to initialize the Assets manager with\n */\n async init(options = {}) {\n if (this._initialized) {\n warn(\"[Assets]AssetManager already initialized, did you load before calling this Assets.init()?\");\n return;\n }\n this._initialized = true;\n if (options.defaultSearchParams) {\n this.resolver.setDefaultSearchParams(options.defaultSearchParams);\n }\n if (options.basePath) {\n this.resolver.basePath = options.basePath;\n }\n if (options.bundleIdentifier) {\n this.resolver.setBundleIdentifier(options.bundleIdentifier);\n }\n if (options.manifest) {\n let manifest = options.manifest;\n if (typeof manifest === \"string\") {\n manifest = await this.load(manifest);\n }\n this.resolver.addManifest(manifest);\n }\n const resolutionPref = options.texturePreference?.resolution ?? 1;\n const resolution = typeof resolutionPref === \"number\" ? [resolutionPref] : resolutionPref;\n const formats = await this._detectFormats({\n preferredFormats: options.texturePreference?.format,\n skipDetections: options.skipDetections,\n detections: this._detections\n });\n this.resolver.prefer({\n params: {\n format: formats,\n resolution\n }\n });\n if (options.preferences) {\n this.setPreferences(options.preferences);\n }\n }\n /**\n * Allows you to specify how to resolve any assets load requests.\n * There are a few ways to add things here as shown below:\n * @example\n * import { Assets } from 'pixi.js';\n *\n * // Simple\n * Assets.add({alias: 'bunnyBooBoo', src: 'bunny.png'});\n * const bunny = await Assets.load('bunnyBooBoo');\n *\n * // Multiple keys:\n * Assets.add({alias: ['burger', 'chicken'], src: 'bunny.png'});\n *\n * const bunny = await Assets.load('burger');\n * const bunny2 = await Assets.load('chicken');\n *\n * // passing options to to the object\n * Assets.add({\n * alias: 'bunnyBooBooSmooth',\n * src: 'bunny{png,webp}',\n * data: { scaleMode: SCALE_MODES.NEAREST }, // Base texture options\n * });\n *\n * // Multiple assets\n *\n * // The following all do the same thing:\n *\n * Assets.add({alias: 'bunnyBooBoo', src: 'bunny{png,webp}'});\n *\n * Assets.add({\n * alias: 'bunnyBooBoo',\n * src: [\n * 'bunny.png',\n * 'bunny.webp',\n * ],\n * });\n *\n * const bunny = await Assets.load('bunnyBooBoo'); // Will try to load WebP if available\n * @param assets - the unresolved assets to add to the resolver\n */\n add(assets) {\n this.resolver.add(assets);\n }\n async load(urls, onProgress) {\n if (!this._initialized) {\n await this.init();\n }\n const singleAsset = isSingleItem(urls);\n const urlArray = convertToList(urls).map((url) => {\n if (typeof url !== \"string\") {\n const aliases = this.resolver.getAlias(url);\n if (aliases.some((alias) => !this.resolver.hasKey(alias))) {\n this.add(url);\n }\n return Array.isArray(aliases) ? aliases[0] : aliases;\n }\n if (!this.resolver.hasKey(url))\n this.add({ alias: url, src: url });\n return url;\n });\n const resolveResults = this.resolver.resolve(urlArray);\n const out = await this._mapLoadToResolve(resolveResults, onProgress);\n return singleAsset ? out[urlArray[0]] : out;\n }\n /**\n * This adds a bundle of assets in one go so that you can load them as a group.\n * For example you could add a bundle for each screen in you pixi app\n * @example\n * import { Assets } from 'pixi.js';\n *\n * Assets.addBundle('animals', [\n * { alias: 'bunny', src: 'bunny.png' },\n * { alias: 'chicken', src: 'chicken.png' },\n * { alias: 'thumper', src: 'thumper.png' },\n * ]);\n * // or\n * Assets.addBundle('animals', {\n * bunny: 'bunny.png',\n * chicken: 'chicken.png',\n * thumper: 'thumper.png',\n * });\n *\n * const assets = await Assets.loadBundle('animals');\n * @param bundleId - the id of the bundle to add\n * @param assets - a record of the asset or assets that will be chosen from when loading via the specified key\n */\n addBundle(bundleId, assets) {\n this.resolver.addBundle(bundleId, assets);\n }\n /**\n * Bundles are a way to load multiple assets at once.\n * If a manifest has been provided to the init function then you can load a bundle, or bundles.\n * you can also add bundles via `addBundle`\n * @example\n * import { Assets } from 'pixi.js';\n *\n * // Manifest Example\n * const manifest = {\n * bundles: [\n * {\n * name: 'load-screen',\n * assets: [\n * {\n * alias: 'background',\n * src: 'sunset.png',\n * },\n * {\n * alias: 'bar',\n * src: 'load-bar.{png,webp}',\n * },\n * ],\n * },\n * {\n * name: 'game-screen',\n * assets: [\n * {\n * alias: 'character',\n * src: 'robot.png',\n * },\n * {\n * alias: 'enemy',\n * src: 'bad-guy.png',\n * },\n * ],\n * },\n * ]\n * };\n *\n * await Assets.init({ manifest });\n *\n * // Load a bundle...\n * loadScreenAssets = await Assets.loadBundle('load-screen');\n * // Load another bundle...\n * gameScreenAssets = await Assets.loadBundle('game-screen');\n * @param bundleIds - the bundle id or ids to load\n * @param onProgress - Optional function that is called when progress on asset loading is made.\n * The function is passed a single parameter, `progress`, which represents the percentage (0.0 - 1.0)\n * of the assets loaded. Do not use this function to detect when assets are complete and available,\n * instead use the Promise returned by this function.\n * @returns all the bundles assets or a hash of assets for each bundle specified\n */\n async loadBundle(bundleIds, onProgress) {\n if (!this._initialized) {\n await this.init();\n }\n let singleAsset = false;\n if (typeof bundleIds === \"string\") {\n singleAsset = true;\n bundleIds = [bundleIds];\n }\n const resolveResults = this.resolver.resolveBundle(bundleIds);\n const out = {};\n const keys = Object.keys(resolveResults);\n let count = 0;\n let total = 0;\n const _onProgress = () => {\n onProgress?.(++count / total);\n };\n const promises = keys.map((bundleId) => {\n const resolveResult = resolveResults[bundleId];\n total += Object.keys(resolveResult).length;\n return this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {\n out[bundleId] = resolveResult2;\n });\n });\n await Promise.all(promises);\n return singleAsset ? out[bundleIds[0]] : out;\n }\n /**\n * Initiate a background load of some assets. It will passively begin to load these assets in the background.\n * So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately\n *\n * An example of this might be that you would background load game assets after your initial load.\n * then when you got to actually load your game screen assets when a player goes to the game - the loading\n * would already have stared or may even be complete, saving you having to show an interim load bar.\n * @example\n * import { Assets } from 'pixi.js';\n *\n * Assets.backgroundLoad('bunny.png');\n *\n * // later on in your app...\n * await Assets.loadBundle('bunny.png'); // Will resolve quicker as loading may have completed!\n * @param urls - the url / urls you want to background load\n */\n async backgroundLoad(urls) {\n if (!this._initialized) {\n await this.init();\n }\n if (typeof urls === \"string\") {\n urls = [urls];\n }\n const resolveResults = this.resolver.resolve(urls);\n this._backgroundLoader.add(Object.values(resolveResults));\n }\n /**\n * Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.\n * this can only be used if the loader has been initiated with a manifest\n * @example\n * import { Assets } from 'pixi.js';\n *\n * await Assets.init({\n * manifest: {\n * bundles: [\n * {\n * name: 'load-screen',\n * assets: [...],\n * },\n * ...\n * ],\n * },\n * });\n *\n * Assets.backgroundLoadBundle('load-screen');\n *\n * // Later on in your app...\n * await Assets.loadBundle('load-screen'); // Will resolve quicker as loading may have completed!\n * @param bundleIds - the bundleId / bundleIds you want to background load\n */\n async backgroundLoadBundle(bundleIds) {\n if (!this._initialized) {\n await this.init();\n }\n if (typeof bundleIds === \"string\") {\n bundleIds = [bundleIds];\n }\n const resolveResults = this.resolver.resolveBundle(bundleIds);\n Object.values(resolveResults).forEach((resolveResult) => {\n this._backgroundLoader.add(Object.values(resolveResult));\n });\n }\n /**\n * Only intended for development purposes.\n * This will wipe the resolver and caches.\n * You will need to reinitialize the Asset\n */\n reset() {\n this.resolver.reset();\n this.loader.reset();\n this.cache.reset();\n this._initialized = false;\n }\n get(keys) {\n if (typeof keys === \"string\") {\n return Cache.get(keys);\n }\n const assets = {};\n for (let i = 0; i < keys.length; i++) {\n assets[i] = Cache.get(keys[i]);\n }\n return assets;\n }\n /**\n * helper function to map resolved assets back to loaded assets\n * @param resolveResults - the resolve results from the resolver\n * @param onProgress - the progress callback\n */\n async _mapLoadToResolve(resolveResults, onProgress) {\n const resolveArray = [...new Set(Object.values(resolveResults))];\n this._backgroundLoader.active = false;\n const loadedAssets = await this.loader.load(resolveArray, onProgress);\n this._backgroundLoader.active = true;\n const out = {};\n resolveArray.forEach((resolveResult) => {\n const asset = loadedAssets[resolveResult.src];\n const keys = [resolveResult.src];\n if (resolveResult.alias) {\n keys.push(...resolveResult.alias);\n }\n keys.forEach((key) => {\n out[key] = asset;\n });\n Cache.set(keys, asset);\n });\n return out;\n }\n /**\n * Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function\n * this will make sure to destroy any assets and release them from memory.\n * Once unloaded, you will need to load the asset again.\n *\n * Use this to help manage assets if you find that you have a large app and you want to free up memory.\n *\n * - it's up to you as the developer to make sure that textures are not actively being used when you unload them,\n * Pixi won't break but you will end up with missing assets. Not a good look for the user!\n * @example\n * import { Assets } from 'pixi.js';\n *\n * // Load a URL:\n * const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture\n *\n * await Assets.unload('http://some.url.com/image.png')\n *\n * // myImageTexture will be destroyed now.\n *\n * // Unload multiple assets:\n * const textures = await Assets.unload(['thumper', 'chicko']);\n * @param urls - the urls to unload\n */\n async unload(urls) {\n if (!this._initialized) {\n await this.init();\n }\n const urlArray = convertToList(urls).map((url) => typeof url !== \"string\" ? url.src : url);\n const resolveResults = this.resolver.resolve(urlArray);\n await this._unloadFromResolved(resolveResults);\n }\n /**\n * Bundles are a way to manage multiple assets at once.\n * this will unload all files in a bundle.\n *\n * once a bundle has been unloaded, you need to load it again to have access to the assets.\n * @example\n * import { Assets } from 'pixi.js';\n *\n * Assets.addBundle({\n * 'thumper': 'http://some.url.com/thumper.png',\n * })\n *\n * const assets = await Assets.loadBundle('thumper');\n *\n * // Now to unload...\n *\n * await Assets.unloadBundle('thumper');\n *\n * // All assets in the assets object will now have been destroyed and purged from the cache\n * @param bundleIds - the bundle id or ids to unload\n */\n async unloadBundle(bundleIds) {\n if (!this._initialized) {\n await this.init();\n }\n bundleIds = convertToList(bundleIds);\n const resolveResults = this.resolver.resolveBundle(bundleIds);\n const promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));\n await Promise.all(promises);\n }\n async _unloadFromResolved(resolveResult) {\n const resolveArray = Object.values(resolveResult);\n resolveArray.forEach((resolveResult2) => {\n Cache.remove(resolveResult2.src);\n });\n await this.loader.unload(resolveArray);\n }\n /**\n * Detects the supported formats for the browser, and returns an array of supported formats, respecting\n * the users preferred formats order.\n * @param options - the options to use when detecting formats\n * @param options.preferredFormats - the preferred formats to use\n * @param options.skipDetections - if we should skip the detections altogether\n * @param options.detections - the detections to use\n * @returns - the detected formats\n */\n async _detectFormats(options) {\n let formats = [];\n if (options.preferredFormats) {\n formats = Array.isArray(options.preferredFormats) ? options.preferredFormats : [options.preferredFormats];\n }\n for (const detection of options.detections) {\n if (options.skipDetections || await detection.test()) {\n formats = await detection.add(formats);\n } else if (!options.skipDetections) {\n formats = await detection.remove(formats);\n }\n }\n formats = formats.filter((format, index) => formats.indexOf(format) === index);\n return formats;\n }\n /** All the detection parsers currently added to the Assets class. */\n get detections() {\n return this._detections;\n }\n /**\n * General setter for preferences. This is a helper function to set preferences on all parsers.\n * @param preferences - the preferences to set\n */\n setPreferences(preferences) {\n this.loader.parsers.forEach((parser) => {\n if (!parser.config)\n return;\n Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {\n parser.config[key] = preferences[key];\n });\n });\n }\n}\nconst Assets = new AssetsClass();\nextensions.handleByList(ExtensionType.LoadParser, Assets.loader.parsers).handleByList(ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(ExtensionType.CacheParser, Assets.cache.parsers).handleByList(ExtensionType.DetectionParser, Assets.detections);\nextensions.add(\n cacheTextureArray,\n detectDefaults,\n detectAvif,\n detectWebp,\n detectMp4,\n detectOgv,\n detectWebm,\n loadJson,\n loadTxt,\n loadWebFont,\n loadSvg,\n loadTextures,\n loadVideoTextures,\n loadBitmapFont,\n bitmapFontCachePlugin,\n resolveTextureUrl,\n resolveJsonUrl\n);\nconst assetKeyMap = {\n loader: ExtensionType.LoadParser,\n resolver: ExtensionType.ResolveParser,\n cache: ExtensionType.CacheParser,\n detection: ExtensionType.DetectionParser\n};\nextensions.handle(ExtensionType.Asset, (extension) => {\n const ref = extension.ref;\n Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => extensions.add(Object.assign(\n ref[key],\n // Allow the function to optionally define it's own\n // ExtensionMetadata, the use cases here is priority for LoaderParsers\n { extension: ref[key].extension ?? type }\n )));\n}, (extension) => {\n const ref = extension.ref;\n Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => extensions.remove(ref[key]));\n});\n\nexport { Assets, AssetsClass };\n//# sourceMappingURL=Assets.mjs.map\n","import { UPDATE_PRIORITY } from '../ticker/const.mjs';\nimport { Ticker } from '../ticker/Ticker.mjs';\n\n\"use strict\";\nclass EventsTickerClass {\n constructor() {\n /** The frequency that fake events will be fired. */\n this.interactionFrequency = 10;\n this._deltaTime = 0;\n this._didMove = false;\n this._tickerAdded = false;\n this._pauseUpdate = true;\n }\n /**\n * Initializes the event ticker.\n * @param events - The event system.\n */\n init(events) {\n this.removeTickerListener();\n this.events = events;\n this.interactionFrequency = 10;\n this._deltaTime = 0;\n this._didMove = false;\n this._tickerAdded = false;\n this._pauseUpdate = true;\n }\n /** Whether to pause the update checks or not. */\n get pauseUpdate() {\n return this._pauseUpdate;\n }\n set pauseUpdate(paused) {\n this._pauseUpdate = paused;\n }\n /** Adds the ticker listener. */\n addTickerListener() {\n if (this._tickerAdded || !this.domElement) {\n return;\n }\n Ticker.system.add(this._tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);\n this._tickerAdded = true;\n }\n /** Removes the ticker listener. */\n removeTickerListener() {\n if (!this._tickerAdded) {\n return;\n }\n Ticker.system.remove(this._tickerUpdate, this);\n this._tickerAdded = false;\n }\n /** Sets flag to not fire extra events when the user has already moved there mouse */\n pointerMoved() {\n this._didMove = true;\n }\n /** Updates the state of interactive objects. */\n _update() {\n if (!this.domElement || this._pauseUpdate) {\n return;\n }\n if (this._didMove) {\n this._didMove = false;\n return;\n }\n const rootPointerEvent = this.events[\"_rootPointerEvent\"];\n if (this.events.supportsTouchEvents && rootPointerEvent.pointerType === \"touch\") {\n return;\n }\n globalThis.document.dispatchEvent(new PointerEvent(\"pointermove\", {\n clientX: rootPointerEvent.clientX,\n clientY: rootPointerEvent.clientY,\n pointerType: rootPointerEvent.pointerType,\n pointerId: rootPointerEvent.pointerId\n }));\n }\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link Ticker.system}.\n * @param ticker - The throttled ticker.\n */\n _tickerUpdate(ticker) {\n this._deltaTime += ticker.deltaTime;\n if (this._deltaTime < this.interactionFrequency) {\n return;\n }\n this._deltaTime = 0;\n this._update();\n }\n}\nconst EventsTicker = new EventsTickerClass();\n\nexport { EventsTicker };\n//# sourceMappingURL=EventTicker.mjs.map\n","import { Point } from '../maths/point/Point.mjs';\nimport { FederatedEvent } from './FederatedEvent.mjs';\n\n\"use strict\";\nclass FederatedMouseEvent extends FederatedEvent {\n constructor() {\n super(...arguments);\n /** The coordinates of the mouse event relative to the canvas. */\n this.client = new Point();\n /** The movement in this pointer relative to the last `mousemove` event. */\n this.movement = new Point();\n /** The offset of the pointer coordinates w.r.t. target Container in world space. This is not supported at the moment. */\n this.offset = new Point();\n /** The pointer coordinates in world space. */\n this.global = new Point();\n /**\n * The pointer coordinates in the renderer's {@link Renderer.screen screen}. This has slightly\n * different semantics than native PointerEvent screenX/screenY.\n */\n this.screen = new Point();\n }\n /** @readonly */\n get clientX() {\n return this.client.x;\n }\n /** @readonly */\n get clientY() {\n return this.client.y;\n }\n /**\n * Alias for {@link FederatedMouseEvent.clientX this.clientX}.\n * @readonly\n */\n get x() {\n return this.clientX;\n }\n /**\n * Alias for {@link FederatedMouseEvent.clientY this.clientY}.\n * @readonly\n */\n get y() {\n return this.clientY;\n }\n /** @readonly */\n get movementX() {\n return this.movement.x;\n }\n /** @readonly */\n get movementY() {\n return this.movement.y;\n }\n /** @readonly */\n get offsetX() {\n return this.offset.x;\n }\n /** @readonly */\n get offsetY() {\n return this.offset.y;\n }\n /** @readonly */\n get globalX() {\n return this.global.x;\n }\n /** @readonly */\n get globalY() {\n return this.global.y;\n }\n /**\n * The pointer coordinates in the renderer's screen. Alias for {@code screen.x}.\n * @readonly\n */\n get screenX() {\n return this.screen.x;\n }\n /**\n * The pointer coordinates in the renderer's screen. Alias for {@code screen.y}.\n * @readonly\n */\n get screenY() {\n return this.screen.y;\n }\n /**\n * This will return the local coordinates of the specified container for this InteractionData\n * @param {Container} container - The Container that you would like the local\n * coords off\n * @param {PointData} point - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PointData} globalPos - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @returns - A point containing the coordinates of the InteractionData position relative\n * to the Container\n */\n getLocalPosition(container, point, globalPos) {\n return container.worldTransform.applyInverse(globalPos || this.global, point);\n }\n /**\n * Whether the modifier key was pressed when this event natively occurred.\n * @param key - The modifier key.\n */\n getModifierState(key) {\n return \"getModifierState\" in this.nativeEvent && this.nativeEvent.getModifierState(key);\n }\n /**\n * Not supported.\n * @param _typeArg\n * @param _canBubbleArg\n * @param _cancelableArg\n * @param _viewArg\n * @param _detailArg\n * @param _screenXArg\n * @param _screenYArg\n * @param _clientXArg\n * @param _clientYArg\n * @param _ctrlKeyArg\n * @param _altKeyArg\n * @param _shiftKeyArg\n * @param _metaKeyArg\n * @param _buttonArg\n * @param _relatedTargetArg\n * @deprecated since 7.0.0\n */\n // eslint-disable-next-line max-params\n initMouseEvent(_typeArg, _canBubbleArg, _cancelableArg, _viewArg, _detailArg, _screenXArg, _screenYArg, _clientXArg, _clientYArg, _ctrlKeyArg, _altKeyArg, _shiftKeyArg, _metaKeyArg, _buttonArg, _relatedTargetArg) {\n throw new Error(\"Method not implemented.\");\n }\n}\n\nexport { FederatedMouseEvent };\n//# sourceMappingURL=FederatedMouseEvent.mjs.map\n","import { FederatedMouseEvent } from './FederatedMouseEvent.mjs';\n\n\"use strict\";\nclass FederatedPointerEvent extends FederatedMouseEvent {\n constructor() {\n super(...arguments);\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n */\n this.width = 0;\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n */\n this.height = 0;\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n */\n this.isPrimary = false;\n }\n // Only included for completeness for now\n getCoalescedEvents() {\n if (this.type === \"pointermove\" || this.type === \"mousemove\" || this.type === \"touchmove\") {\n return [this];\n }\n return [];\n }\n // Only included for completeness for now\n getPredictedEvents() {\n throw new Error(\"getPredictedEvents is not supported!\");\n }\n}\n\nexport { FederatedPointerEvent };\n//# sourceMappingURL=FederatedPointerEvent.mjs.map\n","import { FederatedMouseEvent } from './FederatedMouseEvent.mjs';\n\n\"use strict\";\nclass FederatedWheelEvent extends FederatedMouseEvent {\n constructor() {\n super(...arguments);\n /** Units specified in pixels. */\n this.DOM_DELTA_PIXEL = 0;\n /** Units specified in lines. */\n this.DOM_DELTA_LINE = 1;\n /** Units specified in pages. */\n this.DOM_DELTA_PAGE = 2;\n }\n}\n/** Units specified in pixels. */\nFederatedWheelEvent.DOM_DELTA_PIXEL = 0;\n/** Units specified in lines. */\nFederatedWheelEvent.DOM_DELTA_LINE = 1;\n/** Units specified in pages. */\nFederatedWheelEvent.DOM_DELTA_PAGE = 2;\n\nexport { FederatedWheelEvent };\n//# sourceMappingURL=FederatedWheelEvent.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { Point } from '../maths/point/Point.mjs';\nimport { warn } from '../utils/logging/warn.mjs';\nimport { EventsTicker } from './EventTicker.mjs';\nimport { FederatedMouseEvent } from './FederatedMouseEvent.mjs';\nimport { FederatedPointerEvent } from './FederatedPointerEvent.mjs';\nimport { FederatedWheelEvent } from './FederatedWheelEvent.mjs';\n\n\"use strict\";\nconst PROPAGATION_LIMIT = 2048;\nconst tempHitLocation = new Point();\nconst tempLocalMapping = new Point();\nclass EventBoundary {\n /**\n * @param rootTarget - The holder of the event boundary.\n */\n constructor(rootTarget) {\n /**\n * Emits events after they were dispatched into the scene graph.\n *\n * This can be used for global events listening, regardless of the scene graph being used. It should\n * not be used by interactive libraries for normal use.\n *\n * Special events that do not bubble all the way to the root target are not emitted from here,\n * e.g. pointerenter, pointerleave, click.\n */\n this.dispatch = new EventEmitter();\n /**\n * This flag would emit `pointermove`, `touchmove`, and `mousemove` events on all Containers.\n *\n * The `moveOnAll` semantics mirror those of earlier versions of PixiJS. This was disabled in favor of\n * the Pointer Event API's approach.\n */\n this.moveOnAll = false;\n /** Enables the global move events. `globalpointermove`, `globaltouchmove`, and `globalmousemove` */\n this.enableGlobalMoveEvents = true;\n /**\n * State object for mapping methods.\n * @see EventBoundary#trackingData\n */\n this.mappingState = {\n trackingData: {}\n };\n /**\n * The event pool maps event constructors to an free pool of instances of those specific events.\n * @see EventBoundary#allocateEvent\n * @see EventBoundary#freeEvent\n */\n this.eventPool = /* @__PURE__ */ new Map();\n /** Every interactive element gathered from the scene. Only used in `pointermove` */\n this._allInteractiveElements = [];\n /** Every element that passed the hit test. Only used in `pointermove` */\n this._hitElements = [];\n /** Whether or not to collect all the interactive elements from the scene. Enabled in `pointermove` */\n this._isPointerMoveEvent = false;\n this.rootTarget = rootTarget;\n this.hitPruneFn = this.hitPruneFn.bind(this);\n this.hitTestFn = this.hitTestFn.bind(this);\n this.mapPointerDown = this.mapPointerDown.bind(this);\n this.mapPointerMove = this.mapPointerMove.bind(this);\n this.mapPointerOut = this.mapPointerOut.bind(this);\n this.mapPointerOver = this.mapPointerOver.bind(this);\n this.mapPointerUp = this.mapPointerUp.bind(this);\n this.mapPointerUpOutside = this.mapPointerUpOutside.bind(this);\n this.mapWheel = this.mapWheel.bind(this);\n this.mappingTable = {};\n this.addEventMapping(\"pointerdown\", this.mapPointerDown);\n this.addEventMapping(\"pointermove\", this.mapPointerMove);\n this.addEventMapping(\"pointerout\", this.mapPointerOut);\n this.addEventMapping(\"pointerleave\", this.mapPointerOut);\n this.addEventMapping(\"pointerover\", this.mapPointerOver);\n this.addEventMapping(\"pointerup\", this.mapPointerUp);\n this.addEventMapping(\"pointerupoutside\", this.mapPointerUpOutside);\n this.addEventMapping(\"wheel\", this.mapWheel);\n }\n /**\n * Adds an event mapping for the event `type` handled by `fn`.\n *\n * Event mappings can be used to implement additional or custom events. They take an event\n * coming from the upstream scene (or directly from the {@link EventSystem}) and dispatch new downstream events\n * generally trickling down and bubbling up to {@link EventBoundary.rootTarget this.rootTarget}.\n *\n * To modify the semantics of existing events, the built-in mapping methods of EventBoundary should be overridden\n * instead.\n * @param type - The type of upstream event to map.\n * @param fn - The mapping method. The context of this function must be bound manually, if desired.\n */\n addEventMapping(type, fn) {\n if (!this.mappingTable[type]) {\n this.mappingTable[type] = [];\n }\n this.mappingTable[type].push({\n fn,\n priority: 0\n });\n this.mappingTable[type].sort((a, b) => a.priority - b.priority);\n }\n /**\n * Dispatches the given event\n * @param e - The event to dispatch.\n * @param type - The type of event to dispatch. Defaults to `e.type`.\n */\n dispatchEvent(e, type) {\n e.propagationStopped = false;\n e.propagationImmediatelyStopped = false;\n this.propagate(e, type);\n this.dispatch.emit(type || e.type, e);\n }\n /**\n * Maps the given upstream event through the event boundary and propagates it downstream.\n * @param e - The event to map.\n */\n mapEvent(e) {\n if (!this.rootTarget) {\n return;\n }\n const mappers = this.mappingTable[e.type];\n if (mappers) {\n for (let i = 0, j = mappers.length; i < j; i++) {\n mappers[i].fn(e);\n }\n } else {\n warn(`[EventBoundary]: Event mapping not defined for ${e.type}`);\n }\n }\n /**\n * Finds the Container that is the target of a event at the given coordinates.\n *\n * The passed (x,y) coordinates are in the world space above this event boundary.\n * @param x - The x coordinate of the event.\n * @param y - The y coordinate of the event.\n */\n hitTest(x, y) {\n EventsTicker.pauseUpdate = true;\n const useMove = this._isPointerMoveEvent && this.enableGlobalMoveEvents;\n const fn = useMove ? \"hitTestMoveRecursive\" : \"hitTestRecursive\";\n const invertedPath = this[fn](\n this.rootTarget,\n this.rootTarget.eventMode,\n tempHitLocation.set(x, y),\n this.hitTestFn,\n this.hitPruneFn\n );\n return invertedPath && invertedPath[0];\n }\n /**\n * Propagate the passed event from from {@link EventBoundary.rootTarget this.rootTarget} to its\n * target {@code e.target}.\n * @param e - The event to propagate.\n * @param type - The type of event to propagate. Defaults to `e.type`.\n */\n propagate(e, type) {\n if (!e.target) {\n return;\n }\n const composedPath = e.composedPath();\n e.eventPhase = e.CAPTURING_PHASE;\n for (let i = 0, j = composedPath.length - 1; i < j; i++) {\n e.currentTarget = composedPath[i];\n this.notifyTarget(e, type);\n if (e.propagationStopped || e.propagationImmediatelyStopped)\n return;\n }\n e.eventPhase = e.AT_TARGET;\n e.currentTarget = e.target;\n this.notifyTarget(e, type);\n if (e.propagationStopped || e.propagationImmediatelyStopped)\n return;\n e.eventPhase = e.BUBBLING_PHASE;\n for (let i = composedPath.length - 2; i >= 0; i--) {\n e.currentTarget = composedPath[i];\n this.notifyTarget(e, type);\n if (e.propagationStopped || e.propagationImmediatelyStopped)\n return;\n }\n }\n /**\n * Emits the event {@code e} to all interactive containers. The event is propagated in the bubbling phase always.\n *\n * This is used in the `globalpointermove` event.\n * @param e - The emitted event.\n * @param type - The listeners to notify.\n * @param targets - The targets to notify.\n */\n all(e, type, targets = this._allInteractiveElements) {\n if (targets.length === 0)\n return;\n e.eventPhase = e.BUBBLING_PHASE;\n const events = Array.isArray(type) ? type : [type];\n for (let i = targets.length - 1; i >= 0; i--) {\n events.forEach((event) => {\n e.currentTarget = targets[i];\n this.notifyTarget(e, event);\n });\n }\n }\n /**\n * Finds the propagation path from {@link EventBoundary.rootTarget rootTarget} to the passed\n * {@code target}. The last element in the path is {@code target}.\n * @param target - The target to find the propagation path to.\n */\n propagationPath(target) {\n const propagationPath = [target];\n for (let i = 0; i < PROPAGATION_LIMIT && (target !== this.rootTarget && target.parent); i++) {\n if (!target.parent) {\n throw new Error(\"Cannot find propagation path to disconnected target\");\n }\n propagationPath.push(target.parent);\n target = target.parent;\n }\n propagationPath.reverse();\n return propagationPath;\n }\n hitTestMoveRecursive(currentTarget, eventMode, location, testFn, pruneFn, ignore = false) {\n let shouldReturn = false;\n if (this._interactivePrune(currentTarget))\n return null;\n if (currentTarget.eventMode === \"dynamic\" || eventMode === \"dynamic\") {\n EventsTicker.pauseUpdate = false;\n }\n if (currentTarget.interactiveChildren && currentTarget.children) {\n const children = currentTarget.children;\n for (let i = children.length - 1; i >= 0; i--) {\n const child = children[i];\n const nestedHit = this.hitTestMoveRecursive(\n child,\n this._isInteractive(eventMode) ? eventMode : child.eventMode,\n location,\n testFn,\n pruneFn,\n ignore || pruneFn(currentTarget, location)\n );\n if (nestedHit) {\n if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {\n continue;\n }\n const isInteractive = currentTarget.isInteractive();\n if (nestedHit.length > 0 || isInteractive) {\n if (isInteractive)\n this._allInteractiveElements.push(currentTarget);\n nestedHit.push(currentTarget);\n }\n if (this._hitElements.length === 0)\n this._hitElements = nestedHit;\n shouldReturn = true;\n }\n }\n }\n const isInteractiveMode = this._isInteractive(eventMode);\n const isInteractiveTarget = currentTarget.isInteractive();\n if (isInteractiveTarget && isInteractiveTarget)\n this._allInteractiveElements.push(currentTarget);\n if (ignore || this._hitElements.length > 0)\n return null;\n if (shouldReturn)\n return this._hitElements;\n if (isInteractiveMode && (!pruneFn(currentTarget, location) && testFn(currentTarget, location))) {\n return isInteractiveTarget ? [currentTarget] : [];\n }\n return null;\n }\n /**\n * Recursive implementation for {@link EventBoundary.hitTest hitTest}.\n * @param currentTarget - The Container that is to be hit tested.\n * @param eventMode - The event mode for the `currentTarget` or one of its parents.\n * @param location - The location that is being tested for overlap.\n * @param testFn - Callback that determines whether the target passes hit testing. This callback\n * can assume that `pruneFn` failed to prune the container.\n * @param pruneFn - Callback that determiness whether the target and all of its children\n * cannot pass the hit test. It is used as a preliminary optimization to prune entire subtrees\n * of the scene graph.\n * @returns An array holding the hit testing target and all its ancestors in order. The first element\n * is the target itself and the last is {@link EventBoundary.rootTarget rootTarget}. This is the opposite\n * order w.r.t. the propagation path. If no hit testing target is found, null is returned.\n */\n hitTestRecursive(currentTarget, eventMode, location, testFn, pruneFn) {\n if (this._interactivePrune(currentTarget) || pruneFn(currentTarget, location)) {\n return null;\n }\n if (currentTarget.eventMode === \"dynamic\" || eventMode === \"dynamic\") {\n EventsTicker.pauseUpdate = false;\n }\n if (currentTarget.interactiveChildren && currentTarget.children) {\n const children = currentTarget.children;\n const relativeLocation = location;\n for (let i = children.length - 1; i >= 0; i--) {\n const child = children[i];\n const nestedHit = this.hitTestRecursive(\n child,\n this._isInteractive(eventMode) ? eventMode : child.eventMode,\n relativeLocation,\n testFn,\n pruneFn\n );\n if (nestedHit) {\n if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {\n continue;\n }\n const isInteractive = currentTarget.isInteractive();\n if (nestedHit.length > 0 || isInteractive)\n nestedHit.push(currentTarget);\n return nestedHit;\n }\n }\n }\n const isInteractiveMode = this._isInteractive(eventMode);\n const isInteractiveTarget = currentTarget.isInteractive();\n if (isInteractiveMode && testFn(currentTarget, location)) {\n return isInteractiveTarget ? [currentTarget] : [];\n }\n return null;\n }\n _isInteractive(int) {\n return int === \"static\" || int === \"dynamic\";\n }\n _interactivePrune(container) {\n if (!container || !container.visible || !container.renderable || !container.includeInBuild || !container.measurable) {\n return true;\n }\n if (container.eventMode === \"none\") {\n return true;\n }\n if (container.eventMode === \"passive\" && !container.interactiveChildren) {\n return true;\n }\n return false;\n }\n /**\n * Checks whether the container or any of its children cannot pass the hit test at all.\n *\n * {@link EventBoundary}'s implementation uses the {@link Container.hitArea hitArea}\n * and {@link Container._maskEffect} for pruning.\n * @param container - The container to prune.\n * @param location - The location to test for overlap.\n */\n hitPruneFn(container, location) {\n if (container.hitArea) {\n container.worldTransform.applyInverse(location, tempLocalMapping);\n if (!container.hitArea.contains(tempLocalMapping.x, tempLocalMapping.y)) {\n return true;\n }\n }\n if (container.effects && container.effects.length) {\n for (let i = 0; i < container.effects.length; i++) {\n const effect = container.effects[i];\n if (effect.containsPoint) {\n const effectContainsPoint = effect.containsPoint(location, this.hitTestFn);\n if (!effectContainsPoint) {\n return true;\n }\n }\n }\n }\n return false;\n }\n /**\n * Checks whether the container passes hit testing for the given location.\n * @param container - The container to test.\n * @param location - The location to test for overlap.\n * @returns - Whether `container` passes hit testing for `location`.\n */\n hitTestFn(container, location) {\n if (container.hitArea) {\n return true;\n }\n if (container?.containsPoint) {\n container.worldTransform.applyInverse(location, tempLocalMapping);\n return container.containsPoint(tempLocalMapping);\n }\n return false;\n }\n /**\n * Notify all the listeners to the event's `currentTarget`.\n *\n * If the `currentTarget` contains the property `on`, then it is called here,\n * simulating the behavior from version 6.x and prior.\n * @param e - The event passed to the target.\n * @param type - The type of event to notify. Defaults to `e.type`.\n */\n notifyTarget(e, type) {\n if (!e.currentTarget.isInteractive()) {\n return;\n }\n type = type ?? e.type;\n const handlerKey = `on${type}`;\n e.currentTarget[handlerKey]?.(e);\n const key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? `${type}capture` : type;\n this._notifyListeners(e, key);\n if (e.eventPhase === e.AT_TARGET) {\n this._notifyListeners(e, type);\n }\n }\n /**\n * Maps the upstream `pointerdown` events to a downstream `pointerdown` event.\n *\n * `touchstart`, `rightdown`, `mousedown` events are also dispatched for specific pointer types.\n * @param from - The upstream `pointerdown` event.\n */\n mapPointerDown(from) {\n if (!(from instanceof FederatedPointerEvent)) {\n warn(\"EventBoundary cannot map a non-pointer event as a pointer event\");\n return;\n }\n const e = this.createPointerEvent(from);\n this.dispatchEvent(e, \"pointerdown\");\n if (e.pointerType === \"touch\") {\n this.dispatchEvent(e, \"touchstart\");\n } else if (e.pointerType === \"mouse\" || e.pointerType === \"pen\") {\n const isRightButton = e.button === 2;\n this.dispatchEvent(e, isRightButton ? \"rightdown\" : \"mousedown\");\n }\n const trackingData = this.trackingData(from.pointerId);\n trackingData.pressTargetsByButton[from.button] = e.composedPath();\n this.freeEvent(e);\n }\n /**\n * Maps the upstream `pointermove` to downstream `pointerout`, `pointerover`, and `pointermove` events, in that order.\n *\n * The tracking data for the specific pointer has an updated `overTarget`. `mouseout`, `mouseover`,\n * `mousemove`, and `touchmove` events are fired as well for specific pointer types.\n * @param from - The upstream `pointermove` event.\n */\n mapPointerMove(from) {\n if (!(from instanceof FederatedPointerEvent)) {\n warn(\"EventBoundary cannot map a non-pointer event as a pointer event\");\n return;\n }\n this._allInteractiveElements.length = 0;\n this._hitElements.length = 0;\n this._isPointerMoveEvent = true;\n const e = this.createPointerEvent(from);\n this._isPointerMoveEvent = false;\n const isMouse = e.pointerType === \"mouse\" || e.pointerType === \"pen\";\n const trackingData = this.trackingData(from.pointerId);\n const outTarget = this.findMountedTarget(trackingData.overTargets);\n if (trackingData.overTargets?.length > 0 && outTarget !== e.target) {\n const outType = from.type === \"mousemove\" ? \"mouseout\" : \"pointerout\";\n const outEvent = this.createPointerEvent(from, outType, outTarget);\n this.dispatchEvent(outEvent, \"pointerout\");\n if (isMouse)\n this.dispatchEvent(outEvent, \"mouseout\");\n if (!e.composedPath().includes(outTarget)) {\n const leaveEvent = this.createPointerEvent(from, \"pointerleave\", outTarget);\n leaveEvent.eventPhase = leaveEvent.AT_TARGET;\n while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {\n leaveEvent.currentTarget = leaveEvent.target;\n this.notifyTarget(leaveEvent);\n if (isMouse)\n this.notifyTarget(leaveEvent, \"mouseleave\");\n leaveEvent.target = leaveEvent.target.parent;\n }\n this.freeEvent(leaveEvent);\n }\n this.freeEvent(outEvent);\n }\n if (outTarget !== e.target) {\n const overType = from.type === \"mousemove\" ? \"mouseover\" : \"pointerover\";\n const overEvent = this.clonePointerEvent(e, overType);\n this.dispatchEvent(overEvent, \"pointerover\");\n if (isMouse)\n this.dispatchEvent(overEvent, \"mouseover\");\n let overTargetAncestor = outTarget?.parent;\n while (overTargetAncestor && overTargetAncestor !== this.rootTarget.parent) {\n if (overTargetAncestor === e.target)\n break;\n overTargetAncestor = overTargetAncestor.parent;\n }\n const didPointerEnter = !overTargetAncestor || overTargetAncestor === this.rootTarget.parent;\n if (didPointerEnter) {\n const enterEvent = this.clonePointerEvent(e, \"pointerenter\");\n enterEvent.eventPhase = enterEvent.AT_TARGET;\n while (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== this.rootTarget.parent) {\n enterEvent.currentTarget = enterEvent.target;\n this.notifyTarget(enterEvent);\n if (isMouse)\n this.notifyTarget(enterEvent, \"mouseenter\");\n enterEvent.target = enterEvent.target.parent;\n }\n this.freeEvent(enterEvent);\n }\n this.freeEvent(overEvent);\n }\n const allMethods = [];\n const allowGlobalPointerEvents = this.enableGlobalMoveEvents ?? true;\n this.moveOnAll ? allMethods.push(\"pointermove\") : this.dispatchEvent(e, \"pointermove\");\n allowGlobalPointerEvents && allMethods.push(\"globalpointermove\");\n if (e.pointerType === \"touch\") {\n this.moveOnAll ? allMethods.splice(1, 0, \"touchmove\") : this.dispatchEvent(e, \"touchmove\");\n allowGlobalPointerEvents && allMethods.push(\"globaltouchmove\");\n }\n if (isMouse) {\n this.moveOnAll ? allMethods.splice(1, 0, \"mousemove\") : this.dispatchEvent(e, \"mousemove\");\n allowGlobalPointerEvents && allMethods.push(\"globalmousemove\");\n this.cursor = e.target?.cursor;\n }\n if (allMethods.length > 0) {\n this.all(e, allMethods);\n }\n this._allInteractiveElements.length = 0;\n this._hitElements.length = 0;\n trackingData.overTargets = e.composedPath();\n this.freeEvent(e);\n }\n /**\n * Maps the upstream `pointerover` to downstream `pointerover` and `pointerenter` events, in that order.\n *\n * The tracking data for the specific pointer gets a new `overTarget`.\n * @param from - The upstream `pointerover` event.\n */\n mapPointerOver(from) {\n if (!(from instanceof FederatedPointerEvent)) {\n warn(\"EventBoundary cannot map a non-pointer event as a pointer event\");\n return;\n }\n const trackingData = this.trackingData(from.pointerId);\n const e = this.createPointerEvent(from);\n const isMouse = e.pointerType === \"mouse\" || e.pointerType === \"pen\";\n this.dispatchEvent(e, \"pointerover\");\n if (isMouse)\n this.dispatchEvent(e, \"mouseover\");\n if (e.pointerType === \"mouse\")\n this.cursor = e.target?.cursor;\n const enterEvent = this.clonePointerEvent(e, \"pointerenter\");\n enterEvent.eventPhase = enterEvent.AT_TARGET;\n while (enterEvent.target && enterEvent.target !== this.rootTarget.parent) {\n enterEvent.currentTarget = enterEvent.target;\n this.notifyTarget(enterEvent);\n if (isMouse)\n this.notifyTarget(enterEvent, \"mouseenter\");\n enterEvent.target = enterEvent.target.parent;\n }\n trackingData.overTargets = e.composedPath();\n this.freeEvent(e);\n this.freeEvent(enterEvent);\n }\n /**\n * Maps the upstream `pointerout` to downstream `pointerout`, `pointerleave` events, in that order.\n *\n * The tracking data for the specific pointer is cleared of a `overTarget`.\n * @param from - The upstream `pointerout` event.\n */\n mapPointerOut(from) {\n if (!(from instanceof FederatedPointerEvent)) {\n warn(\"EventBoundary cannot map a non-pointer event as a pointer event\");\n return;\n }\n const trackingData = this.trackingData(from.pointerId);\n if (trackingData.overTargets) {\n const isMouse = from.pointerType === \"mouse\" || from.pointerType === \"pen\";\n const outTarget = this.findMountedTarget(trackingData.overTargets);\n const outEvent = this.createPointerEvent(from, \"pointerout\", outTarget);\n this.dispatchEvent(outEvent);\n if (isMouse)\n this.dispatchEvent(outEvent, \"mouseout\");\n const leaveEvent = this.createPointerEvent(from, \"pointerleave\", outTarget);\n leaveEvent.eventPhase = leaveEvent.AT_TARGET;\n while (leaveEvent.target && leaveEvent.target !== this.rootTarget.parent) {\n leaveEvent.currentTarget = leaveEvent.target;\n this.notifyTarget(leaveEvent);\n if (isMouse)\n this.notifyTarget(leaveEvent, \"mouseleave\");\n leaveEvent.target = leaveEvent.target.parent;\n }\n trackingData.overTargets = null;\n this.freeEvent(outEvent);\n this.freeEvent(leaveEvent);\n }\n this.cursor = null;\n }\n /**\n * Maps the upstream `pointerup` event to downstream `pointerup`, `pointerupoutside`,\n * and `click`/`rightclick`/`pointertap` events, in that order.\n *\n * The `pointerupoutside` event bubbles from the original `pointerdown` target to the most specific\n * ancestor of the `pointerdown` and `pointerup` targets, which is also the `click` event's target. `touchend`,\n * `rightup`, `mouseup`, `touchendoutside`, `rightupoutside`, `mouseupoutside`, and `tap` are fired as well for\n * specific pointer types.\n * @param from - The upstream `pointerup` event.\n */\n mapPointerUp(from) {\n if (!(from instanceof FederatedPointerEvent)) {\n warn(\"EventBoundary cannot map a non-pointer event as a pointer event\");\n return;\n }\n const now = performance.now();\n const e = this.createPointerEvent(from);\n this.dispatchEvent(e, \"pointerup\");\n if (e.pointerType === \"touch\") {\n this.dispatchEvent(e, \"touchend\");\n } else if (e.pointerType === \"mouse\" || e.pointerType === \"pen\") {\n const isRightButton = e.button === 2;\n this.dispatchEvent(e, isRightButton ? \"rightup\" : \"mouseup\");\n }\n const trackingData = this.trackingData(from.pointerId);\n const pressTarget = this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);\n let clickTarget = pressTarget;\n if (pressTarget && !e.composedPath().includes(pressTarget)) {\n let currentTarget = pressTarget;\n while (currentTarget && !e.composedPath().includes(currentTarget)) {\n e.currentTarget = currentTarget;\n this.notifyTarget(e, \"pointerupoutside\");\n if (e.pointerType === \"touch\") {\n this.notifyTarget(e, \"touchendoutside\");\n } else if (e.pointerType === \"mouse\" || e.pointerType === \"pen\") {\n const isRightButton = e.button === 2;\n this.notifyTarget(e, isRightButton ? \"rightupoutside\" : \"mouseupoutside\");\n }\n currentTarget = currentTarget.parent;\n }\n delete trackingData.pressTargetsByButton[from.button];\n clickTarget = currentTarget;\n }\n if (clickTarget) {\n const clickEvent = this.clonePointerEvent(e, \"click\");\n clickEvent.target = clickTarget;\n clickEvent.path = null;\n if (!trackingData.clicksByButton[from.button]) {\n trackingData.clicksByButton[from.button] = {\n clickCount: 0,\n target: clickEvent.target,\n timeStamp: now\n };\n }\n const clickHistory = trackingData.clicksByButton[from.button];\n if (clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200) {\n ++clickHistory.clickCount;\n } else {\n clickHistory.clickCount = 1;\n }\n clickHistory.target = clickEvent.target;\n clickHistory.timeStamp = now;\n clickEvent.detail = clickHistory.clickCount;\n if (clickEvent.pointerType === \"mouse\") {\n const isRightButton = clickEvent.button === 2;\n this.dispatchEvent(clickEvent, isRightButton ? \"rightclick\" : \"click\");\n } else if (clickEvent.pointerType === \"touch\") {\n this.dispatchEvent(clickEvent, \"tap\");\n }\n this.dispatchEvent(clickEvent, \"pointertap\");\n this.freeEvent(clickEvent);\n }\n this.freeEvent(e);\n }\n /**\n * Maps the upstream `pointerupoutside` event to a downstream `pointerupoutside` event, bubbling from the original\n * `pointerdown` target to `rootTarget`.\n *\n * (The most specific ancestor of the `pointerdown` event and the `pointerup` event must the\n * `{@link EventBoundary}'s root because the `pointerup` event occurred outside of the boundary.)\n *\n * `touchendoutside`, `mouseupoutside`, and `rightupoutside` events are fired as well for specific pointer\n * types. The tracking data for the specific pointer is cleared of a `pressTarget`.\n * @param from - The upstream `pointerupoutside` event.\n */\n mapPointerUpOutside(from) {\n if (!(from instanceof FederatedPointerEvent)) {\n warn(\"EventBoundary cannot map a non-pointer event as a pointer event\");\n return;\n }\n const trackingData = this.trackingData(from.pointerId);\n const pressTarget = this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);\n const e = this.createPointerEvent(from);\n if (pressTarget) {\n let currentTarget = pressTarget;\n while (currentTarget) {\n e.currentTarget = currentTarget;\n this.notifyTarget(e, \"pointerupoutside\");\n if (e.pointerType === \"touch\") {\n this.notifyTarget(e, \"touchendoutside\");\n } else if (e.pointerType === \"mouse\" || e.pointerType === \"pen\") {\n this.notifyTarget(e, e.button === 2 ? \"rightupoutside\" : \"mouseupoutside\");\n }\n currentTarget = currentTarget.parent;\n }\n delete trackingData.pressTargetsByButton[from.button];\n }\n this.freeEvent(e);\n }\n /**\n * Maps the upstream `wheel` event to a downstream `wheel` event.\n * @param from - The upstream `wheel` event.\n */\n mapWheel(from) {\n if (!(from instanceof FederatedWheelEvent)) {\n warn(\"EventBoundary cannot map a non-wheel event as a wheel event\");\n return;\n }\n const wheelEvent = this.createWheelEvent(from);\n this.dispatchEvent(wheelEvent);\n this.freeEvent(wheelEvent);\n }\n /**\n * Finds the most specific event-target in the given propagation path that is still mounted in the scene graph.\n *\n * This is used to find the correct `pointerup` and `pointerout` target in the case that the original `pointerdown`\n * or `pointerover` target was unmounted from the scene graph.\n * @param propagationPath - The propagation path was valid in the past.\n * @returns - The most specific event-target still mounted at the same location in the scene graph.\n */\n findMountedTarget(propagationPath) {\n if (!propagationPath) {\n return null;\n }\n let currentTarget = propagationPath[0];\n for (let i = 1; i < propagationPath.length; i++) {\n if (propagationPath[i].parent === currentTarget) {\n currentTarget = propagationPath[i];\n } else {\n break;\n }\n }\n return currentTarget;\n }\n /**\n * Creates an event whose {@code originalEvent} is {@code from}, with an optional `type` and `target` override.\n *\n * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.\n * @param from - The {@code originalEvent} for the returned event.\n * @param [type=from.type] - The type of the returned event.\n * @param target - The target of the returned event.\n */\n createPointerEvent(from, type, target) {\n const event = this.allocateEvent(FederatedPointerEvent);\n this.copyPointerData(from, event);\n this.copyMouseData(from, event);\n this.copyData(from, event);\n event.nativeEvent = from.nativeEvent;\n event.originalEvent = from;\n event.target = target ?? this.hitTest(event.global.x, event.global.y) ?? this._hitElements[0];\n if (typeof type === \"string\") {\n event.type = type;\n }\n return event;\n }\n /**\n * Creates a wheel event whose {@code originalEvent} is {@code from}.\n *\n * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.\n * @param from - The upstream wheel event.\n */\n createWheelEvent(from) {\n const event = this.allocateEvent(FederatedWheelEvent);\n this.copyWheelData(from, event);\n this.copyMouseData(from, event);\n this.copyData(from, event);\n event.nativeEvent = from.nativeEvent;\n event.originalEvent = from;\n event.target = this.hitTest(event.global.x, event.global.y);\n return event;\n }\n /**\n * Clones the event {@code from}, with an optional {@code type} override.\n *\n * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.\n * @param from - The event to clone.\n * @param [type=from.type] - The type of the returned event.\n */\n clonePointerEvent(from, type) {\n const event = this.allocateEvent(FederatedPointerEvent);\n event.nativeEvent = from.nativeEvent;\n event.originalEvent = from.originalEvent;\n this.copyPointerData(from, event);\n this.copyMouseData(from, event);\n this.copyData(from, event);\n event.target = from.target;\n event.path = from.composedPath().slice();\n event.type = type ?? event.type;\n return event;\n }\n /**\n * Copies wheel {@link FederatedWheelEvent} data from {@code from} into {@code to}.\n *\n * The following properties are copied:\n * + deltaMode\n * + deltaX\n * + deltaY\n * + deltaZ\n * @param from - The event to copy data from.\n * @param to - The event to copy data into.\n */\n copyWheelData(from, to) {\n to.deltaMode = from.deltaMode;\n to.deltaX = from.deltaX;\n to.deltaY = from.deltaY;\n to.deltaZ = from.deltaZ;\n }\n /**\n * Copies pointer {@link FederatedPointerEvent} data from {@code from} into {@code to}.\n *\n * The following properties are copied:\n * + pointerId\n * + width\n * + height\n * + isPrimary\n * + pointerType\n * + pressure\n * + tangentialPressure\n * + tiltX\n * + tiltY\n * @param from - The event to copy data from.\n * @param to - The event to copy data into.\n */\n copyPointerData(from, to) {\n if (!(from instanceof FederatedPointerEvent && to instanceof FederatedPointerEvent))\n return;\n to.pointerId = from.pointerId;\n to.width = from.width;\n to.height = from.height;\n to.isPrimary = from.isPrimary;\n to.pointerType = from.pointerType;\n to.pressure = from.pressure;\n to.tangentialPressure = from.tangentialPressure;\n to.tiltX = from.tiltX;\n to.tiltY = from.tiltY;\n to.twist = from.twist;\n }\n /**\n * Copies mouse {@link FederatedMouseEvent} data from {@code from} to {@code to}.\n *\n * The following properties are copied:\n * + altKey\n * + button\n * + buttons\n * + clientX\n * + clientY\n * + metaKey\n * + movementX\n * + movementY\n * + pageX\n * + pageY\n * + x\n * + y\n * + screen\n * + shiftKey\n * + global\n * @param from - The event to copy data from.\n * @param to - The event to copy data into.\n */\n copyMouseData(from, to) {\n if (!(from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent))\n return;\n to.altKey = from.altKey;\n to.button = from.button;\n to.buttons = from.buttons;\n to.client.copyFrom(from.client);\n to.ctrlKey = from.ctrlKey;\n to.metaKey = from.metaKey;\n to.movement.copyFrom(from.movement);\n to.screen.copyFrom(from.screen);\n to.shiftKey = from.shiftKey;\n to.global.copyFrom(from.global);\n }\n /**\n * Copies base {@link FederatedEvent} data from {@code from} into {@code to}.\n *\n * The following properties are copied:\n * + isTrusted\n * + srcElement\n * + timeStamp\n * + type\n * @param from - The event to copy data from.\n * @param to - The event to copy data into.\n */\n copyData(from, to) {\n to.isTrusted = from.isTrusted;\n to.srcElement = from.srcElement;\n to.timeStamp = performance.now();\n to.type = from.type;\n to.detail = from.detail;\n to.view = from.view;\n to.which = from.which;\n to.layer.copyFrom(from.layer);\n to.page.copyFrom(from.page);\n }\n /**\n * @param id - The pointer ID.\n * @returns The tracking data stored for the given pointer. If no data exists, a blank\n * state will be created.\n */\n trackingData(id) {\n if (!this.mappingState.trackingData[id]) {\n this.mappingState.trackingData[id] = {\n pressTargetsByButton: {},\n clicksByButton: {},\n overTarget: null\n };\n }\n return this.mappingState.trackingData[id];\n }\n /**\n * Allocate a specific type of event from {@link EventBoundary#eventPool this.eventPool}.\n *\n * This allocation is constructor-agnostic, as long as it only takes one argument - this event\n * boundary.\n * @param constructor - The event's constructor.\n */\n allocateEvent(constructor) {\n if (!this.eventPool.has(constructor)) {\n this.eventPool.set(constructor, []);\n }\n const event = this.eventPool.get(constructor).pop() || new constructor(this);\n event.eventPhase = event.NONE;\n event.currentTarget = null;\n event.path = null;\n event.target = null;\n return event;\n }\n /**\n * Frees the event and puts it back into the event pool.\n *\n * It is illegal to reuse the event until it is allocated again, using `this.allocateEvent`.\n *\n * It is also advised that events not allocated from {@link EventBoundary#allocateEvent this.allocateEvent}\n * not be freed. This is because of the possibility that the same event is freed twice, which can cause\n * it to be allocated twice & result in overwriting.\n * @param event - The event to be freed.\n * @throws Error if the event is managed by another event boundary.\n */\n freeEvent(event) {\n if (event.manager !== this)\n throw new Error(\"It is illegal to free an event not managed by this EventBoundary!\");\n const constructor = event.constructor;\n if (!this.eventPool.has(constructor)) {\n this.eventPool.set(constructor, []);\n }\n this.eventPool.get(constructor).push(event);\n }\n /**\n * Similar to {@link EventEmitter.emit}, except it stops if the `propagationImmediatelyStopped` flag\n * is set on the event.\n * @param e - The event to call each listener with.\n * @param type - The event key.\n */\n _notifyListeners(e, type) {\n const listeners = e.currentTarget._events[type];\n if (!listeners)\n return;\n if (\"fn\" in listeners) {\n if (listeners.once)\n e.currentTarget.removeListener(type, listeners.fn, void 0, true);\n listeners.fn.call(listeners.context, e);\n } else {\n for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {\n if (listeners[i].once)\n e.currentTarget.removeListener(type, listeners[i].fn, void 0, true);\n listeners[i].fn.call(listeners[i].context, e);\n }\n }\n }\n}\n\nexport { EventBoundary };\n//# sourceMappingURL=EventBoundary.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\nimport { EventBoundary } from './EventBoundary.mjs';\nimport { EventsTicker } from './EventTicker.mjs';\nimport { FederatedPointerEvent } from './FederatedPointerEvent.mjs';\nimport { FederatedWheelEvent } from './FederatedWheelEvent.mjs';\n\n\"use strict\";\nconst MOUSE_POINTER_ID = 1;\nconst TOUCH_TO_POINTER = {\n touchstart: \"pointerdown\",\n touchend: \"pointerup\",\n touchendoutside: \"pointerupoutside\",\n touchmove: \"pointermove\",\n touchcancel: \"pointercancel\"\n};\nconst _EventSystem = class _EventSystem {\n /**\n * @param {Renderer} renderer\n */\n constructor(renderer) {\n /** Does the device support touch events https://www.w3.org/TR/touch-events/ */\n this.supportsTouchEvents = \"ontouchstart\" in globalThis;\n /** Does the device support pointer events https://www.w3.org/Submission/pointer-events/ */\n this.supportsPointerEvents = !!globalThis.PointerEvent;\n /**\n * The DOM element to which the root event listeners are bound. This is automatically set to\n * the renderer's {@link Renderer#view view}.\n */\n this.domElement = null;\n /** The resolution used to convert between the DOM client space into world space. */\n this.resolution = 1;\n this.renderer = renderer;\n this.rootBoundary = new EventBoundary(null);\n EventsTicker.init(this);\n this.autoPreventDefault = true;\n this._eventsAdded = false;\n this._rootPointerEvent = new FederatedPointerEvent(null);\n this._rootWheelEvent = new FederatedWheelEvent(null);\n this.cursorStyles = {\n default: \"inherit\",\n pointer: \"pointer\"\n };\n this.features = new Proxy({ ..._EventSystem.defaultEventFeatures }, {\n set: (target, key, value) => {\n if (key === \"globalMove\") {\n this.rootBoundary.enableGlobalMoveEvents = value;\n }\n target[key] = value;\n return true;\n }\n });\n this._onPointerDown = this._onPointerDown.bind(this);\n this._onPointerMove = this._onPointerMove.bind(this);\n this._onPointerUp = this._onPointerUp.bind(this);\n this._onPointerOverOut = this._onPointerOverOut.bind(this);\n this.onWheel = this.onWheel.bind(this);\n }\n /**\n * The default interaction mode for all display objects.\n * @see Container.eventMode\n * @type {EventMode}\n * @readonly\n * @since 7.2.0\n */\n static get defaultEventMode() {\n return this._defaultEventMode;\n }\n /**\n * Runner init called, view is available at this point.\n * @ignore\n */\n init(options) {\n const { canvas, resolution } = this.renderer;\n this.setTargetElement(canvas);\n this.resolution = resolution;\n _EventSystem._defaultEventMode = options.eventMode ?? \"passive\";\n Object.assign(this.features, options.eventFeatures ?? {});\n this.rootBoundary.enableGlobalMoveEvents = this.features.globalMove;\n }\n /**\n * Handle changing resolution.\n * @ignore\n */\n resolutionChange(resolution) {\n this.resolution = resolution;\n }\n /** Destroys all event listeners and detaches the renderer. */\n destroy() {\n this.setTargetElement(null);\n this.renderer = null;\n this._currentCursor = null;\n }\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n * @param mode - cursor mode, a key from the cursorStyles dictionary\n */\n setCursor(mode) {\n mode = mode || \"default\";\n let applyStyles = true;\n if (globalThis.OffscreenCanvas && this.domElement instanceof OffscreenCanvas) {\n applyStyles = false;\n }\n if (this._currentCursor === mode) {\n return;\n }\n this._currentCursor = mode;\n const style = this.cursorStyles[mode];\n if (style) {\n switch (typeof style) {\n case \"string\":\n if (applyStyles) {\n this.domElement.style.cursor = style;\n }\n break;\n case \"function\":\n style(mode);\n break;\n case \"object\":\n if (applyStyles) {\n Object.assign(this.domElement.style, style);\n }\n break;\n }\n } else if (applyStyles && typeof mode === \"string\" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) {\n this.domElement.style.cursor = mode;\n }\n }\n /**\n * The global pointer event.\n * Useful for getting the pointer position without listening to events.\n * @since 7.2.0\n */\n get pointer() {\n return this._rootPointerEvent;\n }\n /**\n * Event handler for pointer down events on {@link EventSystem#domElement this.domElement}.\n * @param nativeEvent - The native mouse/pointer/touch event.\n */\n _onPointerDown(nativeEvent) {\n if (!this.features.click)\n return;\n this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;\n const events = this._normalizeToPointerData(nativeEvent);\n if (this.autoPreventDefault && events[0].isNormalized) {\n const cancelable = nativeEvent.cancelable || !(\"cancelable\" in nativeEvent);\n if (cancelable) {\n nativeEvent.preventDefault();\n }\n }\n for (let i = 0, j = events.length; i < j; i++) {\n const nativeEvent2 = events[i];\n const federatedEvent = this._bootstrapEvent(this._rootPointerEvent, nativeEvent2);\n this.rootBoundary.mapEvent(federatedEvent);\n }\n this.setCursor(this.rootBoundary.cursor);\n }\n /**\n * Event handler for pointer move events on on {@link EventSystem#domElement this.domElement}.\n * @param nativeEvent - The native mouse/pointer/touch events.\n */\n _onPointerMove(nativeEvent) {\n if (!this.features.move)\n return;\n this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;\n EventsTicker.pointerMoved();\n const normalizedEvents = this._normalizeToPointerData(nativeEvent);\n for (let i = 0, j = normalizedEvents.length; i < j; i++) {\n const event = this._bootstrapEvent(this._rootPointerEvent, normalizedEvents[i]);\n this.rootBoundary.mapEvent(event);\n }\n this.setCursor(this.rootBoundary.cursor);\n }\n /**\n * Event handler for pointer up events on {@link EventSystem#domElement this.domElement}.\n * @param nativeEvent - The native mouse/pointer/touch event.\n */\n _onPointerUp(nativeEvent) {\n if (!this.features.click)\n return;\n this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;\n let target = nativeEvent.target;\n if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {\n target = nativeEvent.composedPath()[0];\n }\n const outside = target !== this.domElement ? \"outside\" : \"\";\n const normalizedEvents = this._normalizeToPointerData(nativeEvent);\n for (let i = 0, j = normalizedEvents.length; i < j; i++) {\n const event = this._bootstrapEvent(this._rootPointerEvent, normalizedEvents[i]);\n event.type += outside;\n this.rootBoundary.mapEvent(event);\n }\n this.setCursor(this.rootBoundary.cursor);\n }\n /**\n * Event handler for pointer over & out events on {@link EventSystem#domElement this.domElement}.\n * @param nativeEvent - The native mouse/pointer/touch event.\n */\n _onPointerOverOut(nativeEvent) {\n if (!this.features.click)\n return;\n this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;\n const normalizedEvents = this._normalizeToPointerData(nativeEvent);\n for (let i = 0, j = normalizedEvents.length; i < j; i++) {\n const event = this._bootstrapEvent(this._rootPointerEvent, normalizedEvents[i]);\n this.rootBoundary.mapEvent(event);\n }\n this.setCursor(this.rootBoundary.cursor);\n }\n /**\n * Passive handler for `wheel` events on {@link EventSystem.domElement this.domElement}.\n * @param nativeEvent - The native wheel event.\n */\n onWheel(nativeEvent) {\n if (!this.features.wheel)\n return;\n const wheelEvent = this.normalizeWheelEvent(nativeEvent);\n this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;\n this.rootBoundary.mapEvent(wheelEvent);\n }\n /**\n * Sets the {@link EventSystem#domElement domElement} and binds event listeners.\n *\n * To deregister the current DOM element without setting a new one, pass {@code null}.\n * @param element - The new DOM element.\n */\n setTargetElement(element) {\n this._removeEvents();\n this.domElement = element;\n EventsTicker.domElement = element;\n this._addEvents();\n }\n /** Register event listeners on {@link Renderer#domElement this.domElement}. */\n _addEvents() {\n if (this._eventsAdded || !this.domElement) {\n return;\n }\n EventsTicker.addTickerListener();\n const style = this.domElement.style;\n if (style) {\n if (globalThis.navigator.msPointerEnabled) {\n style.msContentZooming = \"none\";\n style.msTouchAction = \"none\";\n } else if (this.supportsPointerEvents) {\n style.touchAction = \"none\";\n }\n }\n if (this.supportsPointerEvents) {\n globalThis.document.addEventListener(\"pointermove\", this._onPointerMove, true);\n this.domElement.addEventListener(\"pointerdown\", this._onPointerDown, true);\n this.domElement.addEventListener(\"pointerleave\", this._onPointerOverOut, true);\n this.domElement.addEventListener(\"pointerover\", this._onPointerOverOut, true);\n globalThis.addEventListener(\"pointerup\", this._onPointerUp, true);\n } else {\n globalThis.document.addEventListener(\"mousemove\", this._onPointerMove, true);\n this.domElement.addEventListener(\"mousedown\", this._onPointerDown, true);\n this.domElement.addEventListener(\"mouseout\", this._onPointerOverOut, true);\n this.domElement.addEventListener(\"mouseover\", this._onPointerOverOut, true);\n globalThis.addEventListener(\"mouseup\", this._onPointerUp, true);\n if (this.supportsTouchEvents) {\n this.domElement.addEventListener(\"touchstart\", this._onPointerDown, true);\n this.domElement.addEventListener(\"touchend\", this._onPointerUp, true);\n this.domElement.addEventListener(\"touchmove\", this._onPointerMove, true);\n }\n }\n this.domElement.addEventListener(\"wheel\", this.onWheel, {\n passive: true,\n capture: true\n });\n this._eventsAdded = true;\n }\n /** Unregister event listeners on {@link EventSystem#domElement this.domElement}. */\n _removeEvents() {\n if (!this._eventsAdded || !this.domElement) {\n return;\n }\n EventsTicker.removeTickerListener();\n const style = this.domElement.style;\n if (style) {\n if (globalThis.navigator.msPointerEnabled) {\n style.msContentZooming = \"\";\n style.msTouchAction = \"\";\n } else if (this.supportsPointerEvents) {\n style.touchAction = \"\";\n }\n }\n if (this.supportsPointerEvents) {\n globalThis.document.removeEventListener(\"pointermove\", this._onPointerMove, true);\n this.domElement.removeEventListener(\"pointerdown\", this._onPointerDown, true);\n this.domElement.removeEventListener(\"pointerleave\", this._onPointerOverOut, true);\n this.domElement.removeEventListener(\"pointerover\", this._onPointerOverOut, true);\n globalThis.removeEventListener(\"pointerup\", this._onPointerUp, true);\n } else {\n globalThis.document.removeEventListener(\"mousemove\", this._onPointerMove, true);\n this.domElement.removeEventListener(\"mousedown\", this._onPointerDown, true);\n this.domElement.removeEventListener(\"mouseout\", this._onPointerOverOut, true);\n this.domElement.removeEventListener(\"mouseover\", this._onPointerOverOut, true);\n globalThis.removeEventListener(\"mouseup\", this._onPointerUp, true);\n if (this.supportsTouchEvents) {\n this.domElement.removeEventListener(\"touchstart\", this._onPointerDown, true);\n this.domElement.removeEventListener(\"touchend\", this._onPointerUp, true);\n this.domElement.removeEventListener(\"touchmove\", this._onPointerMove, true);\n }\n }\n this.domElement.removeEventListener(\"wheel\", this.onWheel, true);\n this.domElement = null;\n this._eventsAdded = false;\n }\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n * @param {PointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n mapPositionToPoint(point, x, y) {\n const rect = this.domElement.isConnected ? this.domElement.getBoundingClientRect() : {\n x: 0,\n y: 0,\n width: this.domElement.width,\n height: this.domElement.height,\n left: 0,\n top: 0\n };\n const resolutionMultiplier = 1 / this.resolution;\n point.x = (x - rect.left) * (this.domElement.width / rect.width) * resolutionMultiplier;\n point.y = (y - rect.top) * (this.domElement.height / rect.height) * resolutionMultiplier;\n }\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n * @param event - The original event data from a touch or mouse event\n * @returns An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n _normalizeToPointerData(event) {\n const normalizedEvents = [];\n if (this.supportsTouchEvents && event instanceof TouchEvent) {\n for (let i = 0, li = event.changedTouches.length; i < li; i++) {\n const touch = event.changedTouches[i];\n if (typeof touch.button === \"undefined\")\n touch.button = 0;\n if (typeof touch.buttons === \"undefined\")\n touch.buttons = 1;\n if (typeof touch.isPrimary === \"undefined\") {\n touch.isPrimary = event.touches.length === 1 && event.type === \"touchstart\";\n }\n if (typeof touch.width === \"undefined\")\n touch.width = touch.radiusX || 1;\n if (typeof touch.height === \"undefined\")\n touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === \"undefined\")\n touch.tiltX = 0;\n if (typeof touch.tiltY === \"undefined\")\n touch.tiltY = 0;\n if (typeof touch.pointerType === \"undefined\")\n touch.pointerType = \"touch\";\n if (typeof touch.pointerId === \"undefined\")\n touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === \"undefined\")\n touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === \"undefined\")\n touch.twist = 0;\n if (typeof touch.tangentialPressure === \"undefined\")\n touch.tangentialPressure = 0;\n if (typeof touch.layerX === \"undefined\")\n touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === \"undefined\")\n touch.layerY = touch.offsetY = touch.clientY;\n touch.isNormalized = true;\n touch.type = event.type;\n normalizedEvents.push(touch);\n }\n } else if (!globalThis.MouseEvent || event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof globalThis.PointerEvent))) {\n const tempEvent = event;\n if (typeof tempEvent.isPrimary === \"undefined\")\n tempEvent.isPrimary = true;\n if (typeof tempEvent.width === \"undefined\")\n tempEvent.width = 1;\n if (typeof tempEvent.height === \"undefined\")\n tempEvent.height = 1;\n if (typeof tempEvent.tiltX === \"undefined\")\n tempEvent.tiltX = 0;\n if (typeof tempEvent.tiltY === \"undefined\")\n tempEvent.tiltY = 0;\n if (typeof tempEvent.pointerType === \"undefined\")\n tempEvent.pointerType = \"mouse\";\n if (typeof tempEvent.pointerId === \"undefined\")\n tempEvent.pointerId = MOUSE_POINTER_ID;\n if (typeof tempEvent.pressure === \"undefined\")\n tempEvent.pressure = 0.5;\n if (typeof tempEvent.twist === \"undefined\")\n tempEvent.twist = 0;\n if (typeof tempEvent.tangentialPressure === \"undefined\")\n tempEvent.tangentialPressure = 0;\n tempEvent.isNormalized = true;\n normalizedEvents.push(tempEvent);\n } else {\n normalizedEvents.push(event);\n }\n return normalizedEvents;\n }\n /**\n * Normalizes the native {@link https://w3c.github.io/uievents/#interface-wheelevent WheelEvent}.\n *\n * The returned {@link FederatedWheelEvent} is a shared instance. It will not persist across\n * multiple native wheel events.\n * @param nativeEvent - The native wheel event that occurred on the canvas.\n * @returns A federated wheel event.\n */\n normalizeWheelEvent(nativeEvent) {\n const event = this._rootWheelEvent;\n this._transferMouseData(event, nativeEvent);\n event.deltaX = nativeEvent.deltaX;\n event.deltaY = nativeEvent.deltaY;\n event.deltaZ = nativeEvent.deltaZ;\n event.deltaMode = nativeEvent.deltaMode;\n this.mapPositionToPoint(event.screen, nativeEvent.clientX, nativeEvent.clientY);\n event.global.copyFrom(event.screen);\n event.offset.copyFrom(event.screen);\n event.nativeEvent = nativeEvent;\n event.type = nativeEvent.type;\n return event;\n }\n /**\n * Normalizes the `nativeEvent` into a federateed {@link FederatedPointerEvent}.\n * @param event\n * @param nativeEvent\n */\n _bootstrapEvent(event, nativeEvent) {\n event.originalEvent = null;\n event.nativeEvent = nativeEvent;\n event.pointerId = nativeEvent.pointerId;\n event.width = nativeEvent.width;\n event.height = nativeEvent.height;\n event.isPrimary = nativeEvent.isPrimary;\n event.pointerType = nativeEvent.pointerType;\n event.pressure = nativeEvent.pressure;\n event.tangentialPressure = nativeEvent.tangentialPressure;\n event.tiltX = nativeEvent.tiltX;\n event.tiltY = nativeEvent.tiltY;\n event.twist = nativeEvent.twist;\n this._transferMouseData(event, nativeEvent);\n this.mapPositionToPoint(event.screen, nativeEvent.clientX, nativeEvent.clientY);\n event.global.copyFrom(event.screen);\n event.offset.copyFrom(event.screen);\n event.isTrusted = nativeEvent.isTrusted;\n if (event.type === \"pointerleave\") {\n event.type = \"pointerout\";\n }\n if (event.type.startsWith(\"mouse\")) {\n event.type = event.type.replace(\"mouse\", \"pointer\");\n }\n if (event.type.startsWith(\"touch\")) {\n event.type = TOUCH_TO_POINTER[event.type] || event.type;\n }\n return event;\n }\n /**\n * Transfers base & mouse event data from the {@code nativeEvent} to the federated event.\n * @param event\n * @param nativeEvent\n */\n _transferMouseData(event, nativeEvent) {\n event.isTrusted = nativeEvent.isTrusted;\n event.srcElement = nativeEvent.srcElement;\n event.timeStamp = performance.now();\n event.type = nativeEvent.type;\n event.altKey = nativeEvent.altKey;\n event.button = nativeEvent.button;\n event.buttons = nativeEvent.buttons;\n event.client.x = nativeEvent.clientX;\n event.client.y = nativeEvent.clientY;\n event.ctrlKey = nativeEvent.ctrlKey;\n event.metaKey = nativeEvent.metaKey;\n event.movement.x = nativeEvent.movementX;\n event.movement.y = nativeEvent.movementY;\n event.page.x = nativeEvent.pageX;\n event.page.y = nativeEvent.pageY;\n event.relatedTarget = null;\n event.shiftKey = nativeEvent.shiftKey;\n }\n};\n/** @ignore */\n_EventSystem.extension = {\n name: \"events\",\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.CanvasSystem,\n ExtensionType.WebGPUSystem\n ],\n priority: -1\n};\n/**\n * The event features that are enabled by the EventSystem\n * (included in the **pixi.js** and **pixi.js-legacy** bundle), otherwise it will be ignored.\n * @since 7.2.0\n */\n_EventSystem.defaultEventFeatures = {\n /** Enables pointer events associated with pointer movement. */\n move: true,\n /** Enables global pointer move events. */\n globalMove: true,\n /** Enables pointer events associated with clicking. */\n click: true,\n /** Enables wheel events. */\n wheel: true\n};\nlet EventSystem = _EventSystem;\n\nexport { EventSystem };\n//# sourceMappingURL=EventSystem.mjs.map\n","import { EventSystem } from './EventSystem.mjs';\nimport { FederatedEvent } from './FederatedEvent.mjs';\n\n\"use strict\";\nconst FederatedContainer = {\n /**\n * Property-based event handler for the `click` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onclick = (event) => {\n * //some function here that happens on click\n * }\n */\n onclick: null,\n /**\n * Property-based event handler for the `mousedown` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmousedown = (event) => {\n * //some function here that happens on mousedown\n * }\n */\n onmousedown: null,\n /**\n * Property-based event handler for the `mouseenter` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmouseenter = (event) => {\n * //some function here that happens on mouseenter\n * }\n */\n onmouseenter: null,\n /**\n * Property-based event handler for the `mouseleave` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmouseleave = (event) => {\n * //some function here that happens on mouseleave\n * }\n */\n onmouseleave: null,\n /**\n * Property-based event handler for the `mousemove` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmousemove = (event) => {\n * //some function here that happens on mousemove\n * }\n */\n onmousemove: null,\n /**\n * Property-based event handler for the `globalmousemove` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onglobalmousemove = (event) => {\n * //some function here that happens on globalmousemove\n * }\n */\n onglobalmousemove: null,\n /**\n * Property-based event handler for the `mouseout` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmouseout = (event) => {\n * //some function here that happens on mouseout\n * }\n */\n onmouseout: null,\n /**\n * Property-based event handler for the `mouseover` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmouseover = (event) => {\n * //some function here that happens on mouseover\n * }\n */\n onmouseover: null,\n /**\n * Property-based event handler for the `mouseup` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmouseup = (event) => {\n * //some function here that happens on mouseup\n * }\n */\n onmouseup: null,\n /**\n * Property-based event handler for the `mouseupoutside` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onmouseupoutside = (event) => {\n * //some function here that happens on mouseupoutside\n * }\n */\n onmouseupoutside: null,\n /**\n * Property-based event handler for the `pointercancel` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointercancel = (event) => {\n * //some function here that happens on pointercancel\n * }\n */\n onpointercancel: null,\n /**\n * Property-based event handler for the `pointerdown` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerdown = (event) => {\n * //some function here that happens on pointerdown\n * }\n */\n onpointerdown: null,\n /**\n * Property-based event handler for the `pointerenter` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerenter = (event) => {\n * //some function here that happens on pointerenter\n * }\n */\n onpointerenter: null,\n /**\n * Property-based event handler for the `pointerleave` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerleave = (event) => {\n * //some function here that happens on pointerleave\n * }\n */\n onpointerleave: null,\n /**\n * Property-based event handler for the `pointermove` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointermove = (event) => {\n * //some function here that happens on pointermove\n * }\n */\n onpointermove: null,\n /**\n * Property-based event handler for the `globalpointermove` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onglobalpointermove = (event) => {\n * //some function here that happens on globalpointermove\n * }\n */\n onglobalpointermove: null,\n /**\n * Property-based event handler for the `pointerout` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerout = (event) => {\n * //some function here that happens on pointerout\n * }\n */\n onpointerout: null,\n /**\n * Property-based event handler for the `pointerover` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerover = (event) => {\n * //some function here that happens on pointerover\n * }\n */\n onpointerover: null,\n /**\n * Property-based event handler for the `pointertap` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointertap = (event) => {\n * //some function here that happens on pointertap\n * }\n */\n onpointertap: null,\n /**\n * Property-based event handler for the `pointerup` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerup = (event) => {\n * //some function here that happens on pointerup\n * }\n */\n onpointerup: null,\n /**\n * Property-based event handler for the `pointerupoutside` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onpointerupoutside = (event) => {\n * //some function here that happens on pointerupoutside\n * }\n */\n onpointerupoutside: null,\n /**\n * Property-based event handler for the `rightclick` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onrightclick = (event) => {\n * //some function here that happens on rightclick\n * }\n */\n onrightclick: null,\n /**\n * Property-based event handler for the `rightdown` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onrightdown = (event) => {\n * //some function here that happens on rightdown\n * }\n */\n onrightdown: null,\n /**\n * Property-based event handler for the `rightup` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onrightup = (event) => {\n * //some function here that happens on rightup\n * }\n */\n onrightup: null,\n /**\n * Property-based event handler for the `rightupoutside` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onrightupoutside = (event) => {\n * //some function here that happens on rightupoutside\n * }\n */\n onrightupoutside: null,\n /**\n * Property-based event handler for the `tap` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.ontap = (event) => {\n * //some function here that happens on tap\n * }\n */\n ontap: null,\n /**\n * Property-based event handler for the `touchcancel` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.ontouchcancel = (event) => {\n * //some function here that happens on touchcancel\n * }\n */\n ontouchcancel: null,\n /**\n * Property-based event handler for the `touchend` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.ontouchend = (event) => {\n * //some function here that happens on touchend\n * }\n */\n ontouchend: null,\n /**\n * Property-based event handler for the `touchendoutside` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.ontouchendoutside = (event) => {\n * //some function here that happens on touchendoutside\n * }\n */\n ontouchendoutside: null,\n /**\n * Property-based event handler for the `touchmove` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.ontouchmove = (event) => {\n * //some function here that happens on touchmove\n * }\n */\n ontouchmove: null,\n /**\n * Property-based event handler for the `globaltouchmove` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onglobaltouchmove = (event) => {\n * //some function here that happens on globaltouchmove\n * }\n */\n onglobaltouchmove: null,\n /**\n * Property-based event handler for the `touchstart` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.ontouchstart = (event) => {\n * //some function here that happens on touchstart\n * }\n */\n ontouchstart: null,\n /**\n * Property-based event handler for the `wheel` event.\n * @memberof scene.Container#\n * @default null\n * @example\n * this.onwheel = (event) => {\n * //some function here that happens on wheel\n * }\n */\n onwheel: null,\n /**\n * Enable interaction events for the Container. Touch, pointer and mouse\n * @memberof scene.Container#\n */\n get interactive() {\n return this.eventMode === \"dynamic\" || this.eventMode === \"static\";\n },\n set interactive(value) {\n this.eventMode = value ? \"static\" : \"passive\";\n },\n /**\n * @ignore\n */\n _internalEventMode: void 0,\n /**\n * Enable interaction events for the Container. Touch, pointer and mouse.\n * There are 5 types of interaction settings:\n * - `'none'`: Ignores all interaction events, even on its children.\n * - `'passive'`: **(default)** Does not emit events and ignores all hit testing on itself and non-interactive children.\n * Interactive children will still emit events.\n * - `'auto'`: Does not emit events but is hit tested if parent is interactive. Same as `interactive = false` in v7\n * - `'static'`: Emit events and is hit tested. Same as `interaction = true` in v7\n * - `'dynamic'`: Emits events and is hit tested but will also receive mock interaction events fired from a ticker to\n * allow for interaction when the mouse isn't moving\n * @example\n * import { Sprite } from 'pixi.js';\n *\n * const sprite = new Sprite(texture);\n * sprite.eventMode = 'static';\n * sprite.on('tap', (event) => {\n * // Handle event\n * });\n * @memberof scene.Container#\n * @since 7.2.0\n */\n get eventMode() {\n return this._internalEventMode ?? EventSystem.defaultEventMode;\n },\n set eventMode(value) {\n this._internalEventMode = value;\n },\n /**\n * Determines if the container is interactive or not\n * @returns {boolean} Whether the container is interactive or not\n * @memberof scene.Container#\n * @since 7.2.0\n * @example\n * import { Sprite } from 'pixi.js';\n *\n * const sprite = new Sprite(texture);\n * sprite.eventMode = 'static';\n * sprite.isInteractive(); // true\n *\n * sprite.eventMode = 'dynamic';\n * sprite.isInteractive(); // true\n *\n * sprite.eventMode = 'none';\n * sprite.isInteractive(); // false\n *\n * sprite.eventMode = 'passive';\n * sprite.isInteractive(); // false\n *\n * sprite.eventMode = 'auto';\n * sprite.isInteractive(); // false\n */\n isInteractive() {\n return this.eventMode === \"static\" || this.eventMode === \"dynamic\";\n },\n /**\n * Determines if the children to the container can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n * @memberof scene.Container#\n */\n interactiveChildren: true,\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the container's bounds.\n * @example\n * import { Rectangle, Sprite } from 'pixi.js';\n *\n * const sprite = new Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new Rectangle(0, 0, 100, 100);\n * @member {IHitArea}\n * @memberof scene.Container#\n */\n hitArea: null,\n /**\n * Unlike `on` or `addListener` which are methods from EventEmitter, `addEventListener`\n * seeks to be compatible with the DOM's `addEventListener` with support for options.\n * @memberof scene.Container\n * @param type - The type of event to listen to.\n * @param listener - The listener callback or object.\n * @param options - Listener options, used for capture phase.\n * @example\n * // Tell the user whether they did a single, double, triple, or nth click.\n * button.addEventListener('click', {\n * handleEvent(e): {\n * let prefix;\n *\n * switch (e.detail) {\n * case 1: prefix = 'single'; break;\n * case 2: prefix = 'double'; break;\n * case 3: prefix = 'triple'; break;\n * default: prefix = e.detail + 'th'; break;\n * }\n *\n * console.log('That was a ' + prefix + 'click');\n * }\n * });\n *\n * // But skip the first click!\n * button.parent.addEventListener('click', function blockClickOnce(e) {\n * e.stopImmediatePropagation();\n * button.parent.removeEventListener('click', blockClickOnce, true);\n * }, {\n * capture: true,\n * });\n */\n addEventListener(type, listener, options) {\n const capture = typeof options === \"boolean\" && options || typeof options === \"object\" && options.capture;\n const signal = typeof options === \"object\" ? options.signal : void 0;\n const once = typeof options === \"object\" ? options.once === true : false;\n const context = typeof listener === \"function\" ? void 0 : listener;\n type = capture ? `${type}capture` : type;\n const listenerFn = typeof listener === \"function\" ? listener : listener.handleEvent;\n const emitter = this;\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n emitter.off(type, listenerFn, context);\n });\n }\n if (once) {\n emitter.once(type, listenerFn, context);\n } else {\n emitter.on(type, listenerFn, context);\n }\n },\n /**\n * Unlike `off` or `removeListener` which are methods from EventEmitter, `removeEventListener`\n * seeks to be compatible with the DOM's `removeEventListener` with support for options.\n * @memberof scene.Container\n * @param type - The type of event the listener is bound to.\n * @param listener - The listener callback or object.\n * @param options - The original listener options. This is required to deregister a capture phase listener.\n */\n removeEventListener(type, listener, options) {\n const capture = typeof options === \"boolean\" && options || typeof options === \"object\" && options.capture;\n const context = typeof listener === \"function\" ? void 0 : listener;\n type = capture ? `${type}capture` : type;\n listener = typeof listener === \"function\" ? listener : listener.handleEvent;\n this.off(type, listener, context);\n },\n /**\n * Dispatch the event on this {@link Container} using the event's {@link EventBoundary}.\n *\n * The target of the event is set to `this` and the `defaultPrevented` flag is cleared before dispatch.\n * @memberof scene.Container\n * @param e - The event to dispatch.\n * @returns Whether the {@link FederatedEvent.preventDefault preventDefault}() method was not invoked.\n * @example\n * // Reuse a click event!\n * button.dispatchEvent(clickEvent);\n */\n dispatchEvent(e) {\n if (!(e instanceof FederatedEvent)) {\n throw new Error(\"Container cannot propagate events outside of the Federated Events API\");\n }\n e.defaultPrevented = false;\n e.path = null;\n e.target = this;\n e.manager.dispatchEvent(e);\n return !e.defaultPrevented;\n }\n};\n\nexport { FederatedContainer };\n//# sourceMappingURL=FederatedEventTarget.mjs.map\n","import { nextPow2 } from '../../../../maths/misc/pow2.mjs';\nimport { TextureSource } from './sources/TextureSource.mjs';\nimport { Texture } from './Texture.mjs';\n\n\"use strict\";\nlet count = 0;\nclass TexturePoolClass {\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {SCALE_MODE} [textureOptions.scaleMode] - See {@link SCALE_MODE} for possible values.\n */\n constructor(textureOptions) {\n this._poolKeyHash = /* @__PURE__ */ Object.create(null);\n this._texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n }\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param pixelWidth - Width of texture in pixels.\n * @param pixelHeight - Height of texture in pixels.\n * @param antialias\n */\n createTexture(pixelWidth, pixelHeight, antialias) {\n const textureSource = new TextureSource({\n ...this.textureOptions,\n width: pixelWidth,\n height: pixelHeight,\n resolution: 1,\n antialias,\n autoGarbageCollect: true\n });\n return new Texture({\n source: textureSource,\n label: `texturePool_${count++}`\n });\n }\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param frameWidth - The minimum width of the render texture.\n * @param frameHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param antialias\n * @returns The new render texture.\n */\n getOptimalTexture(frameWidth, frameHeight, resolution = 1, antialias) {\n let po2Width = Math.ceil(frameWidth * resolution - 1e-6);\n let po2Height = Math.ceil(frameHeight * resolution - 1e-6);\n po2Width = nextPow2(po2Width);\n po2Height = nextPow2(po2Height);\n const key = (po2Width << 17) + (po2Height << 1) + (antialias ? 1 : 0);\n if (!this._texturePool[key]) {\n this._texturePool[key] = [];\n }\n let texture = this._texturePool[key].pop();\n if (!texture) {\n texture = this.createTexture(po2Width, po2Height, antialias);\n }\n texture.source._resolution = resolution;\n texture.source.width = po2Width / resolution;\n texture.source.height = po2Height / resolution;\n texture.source.pixelWidth = po2Width;\n texture.source.pixelHeight = po2Height;\n texture.frame.x = 0;\n texture.frame.y = 0;\n texture.frame.width = frameWidth;\n texture.frame.height = frameHeight;\n texture.updateUvs();\n this._poolKeyHash[texture.uid] = key;\n return texture;\n }\n /**\n * Gets extra texture of the same size as input renderTexture\n * @param texture - The texture to check what size it is.\n * @param antialias - Whether to use antialias.\n * @returns A texture that is a power of two\n */\n getSameSizeTexture(texture, antialias = false) {\n const source = texture.source;\n return this.getOptimalTexture(texture.width, texture.height, source._resolution, antialias);\n }\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture) {\n const key = this._poolKeyHash[renderTexture.uid];\n this._texturePool[key].push(renderTexture);\n }\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures) {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures) {\n for (const i in this._texturePool) {\n const textures = this._texturePool[i];\n if (textures) {\n for (let j = 0; j < textures.length; j++) {\n textures[j].destroy(true);\n }\n }\n }\n }\n this._texturePool = {};\n }\n}\nconst TexturePool = new TexturePoolClass();\n\nexport { TexturePool, TexturePoolClass };\n//# sourceMappingURL=TexturePool.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\n\n\"use strict\";\nclass FilterPipe {\n constructor(renderer) {\n this._renderer = renderer;\n }\n push(filterEffect, container, instructionSet) {\n const renderPipes = this._renderer.renderPipes;\n renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"filter\",\n canBundle: false,\n action: \"pushFilter\",\n container,\n filterEffect\n });\n }\n pop(_filterEffect, _container, instructionSet) {\n this._renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"filter\",\n action: \"popFilter\",\n canBundle: false\n });\n }\n execute(instruction) {\n if (instruction.action === \"pushFilter\") {\n this._renderer.filter.push(instruction);\n } else if (instruction.action === \"popFilter\") {\n this._renderer.filter.pop();\n }\n }\n destroy() {\n this._renderer = null;\n }\n}\nFilterPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"filter\"\n};\n\nexport { FilterPipe };\n//# sourceMappingURL=FilterPipe.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { boundsPool } from './utils/matrixAndBoundsPool.mjs';\n\n\"use strict\";\nconst tempMatrix = new Matrix();\nfunction getFastGlobalBounds(target, bounds) {\n bounds.clear();\n _getGlobalBoundsRecursive(target, bounds);\n if (!bounds.isValid) {\n bounds.set(0, 0, 0, 0);\n }\n if (!target.renderGroup) {\n bounds.applyMatrix(target.parentRenderGroup.worldTransform);\n } else {\n bounds.applyMatrix(target.renderGroup.localTransform);\n }\n return bounds;\n}\nfunction _getGlobalBoundsRecursive(target, bounds) {\n if (target.localDisplayStatus !== 7 || !target.measurable) {\n return;\n }\n const manageEffects = !!target.effects.length;\n let localBounds = bounds;\n if (target.renderGroup || manageEffects) {\n localBounds = boundsPool.get().clear();\n }\n if (target.boundsArea) {\n bounds.addRect(target.boundsArea, target.worldTransform);\n } else {\n if (target.renderPipeId) {\n const viewBounds = target.bounds;\n localBounds.addFrame(\n viewBounds.minX,\n viewBounds.minY,\n viewBounds.maxX,\n viewBounds.maxY,\n target.groupTransform\n );\n }\n const children = target.children;\n for (let i = 0; i < children.length; i++) {\n _getGlobalBoundsRecursive(children[i], localBounds);\n }\n }\n if (manageEffects) {\n let advanced = false;\n for (let i = 0; i < target.effects.length; i++) {\n if (target.effects[i].addBounds) {\n if (!advanced) {\n advanced = true;\n localBounds.applyMatrix(target.parentRenderGroup.worldTransform);\n }\n target.effects[i].addBounds(localBounds, true);\n }\n }\n if (advanced) {\n localBounds.applyMatrix(target.parentRenderGroup.worldTransform.copyTo(tempMatrix).invert());\n bounds.addBounds(localBounds, target.relativeGroupTransform);\n }\n bounds.addBounds(localBounds);\n boundsPool.return(localBounds);\n } else if (target.renderGroup) {\n bounds.addBounds(localBounds, target.relativeGroupTransform);\n boundsPool.return(localBounds);\n }\n}\n\nexport { _getGlobalBoundsRecursive, getFastGlobalBounds };\n//# sourceMappingURL=getFastGlobalBounds.mjs.map\n","import { ExtensionType } from '../extensions/Extensions.mjs';\nimport { Matrix } from '../maths/matrix/Matrix.mjs';\nimport { Point } from '../maths/point/Point.mjs';\nimport { BindGroup } from '../rendering/renderers/gpu/shader/BindGroup.mjs';\nimport { Geometry } from '../rendering/renderers/shared/geometry/Geometry.mjs';\nimport { UniformGroup } from '../rendering/renderers/shared/shader/UniformGroup.mjs';\nimport { Texture } from '../rendering/renderers/shared/texture/Texture.mjs';\nimport { TexturePool } from '../rendering/renderers/shared/texture/TexturePool.mjs';\nimport { RendererType } from '../rendering/renderers/types.mjs';\nimport { Bounds } from '../scene/container/bounds/Bounds.mjs';\nimport { getFastGlobalBounds } from '../scene/container/bounds/getFastGlobalBounds.mjs';\nimport { getGlobalRenderableBounds } from '../scene/container/bounds/getRenderableBounds.mjs';\nimport { warn } from '../utils/logging/warn.mjs';\n\n\"use strict\";\nconst quadGeometry = new Geometry({\n attributes: {\n aPosition: {\n buffer: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n location: 0,\n format: \"float32x2\",\n stride: 2 * 4,\n offset: 0\n }\n },\n indexBuffer: new Uint32Array([0, 1, 2, 0, 2, 3])\n});\nclass FilterSystem {\n constructor(renderer) {\n this._filterStackIndex = 0;\n this._filterStack = [];\n this._filterGlobalUniforms = new UniformGroup({\n uInputSize: { value: new Float32Array(4), type: \"vec4\" },\n uInputPixel: { value: new Float32Array(4), type: \"vec4\" },\n uInputClamp: { value: new Float32Array(4), type: \"vec4\" },\n uOutputFrame: { value: new Float32Array(4), type: \"vec4\" },\n uGlobalFrame: { value: new Float32Array(4), type: \"vec4\" },\n uOutputTexture: { value: new Float32Array(4), type: \"vec4\" }\n });\n this._globalFilterBindGroup = new BindGroup({});\n this.renderer = renderer;\n }\n /**\n * The back texture of the currently active filter. Requires the filter to have `blendRequired` set to true.\n * @readonly\n */\n get activeBackTexture() {\n return this._activeFilterData?.backTexture;\n }\n push(instruction) {\n const renderer = this.renderer;\n const filters = instruction.filterEffect.filters;\n if (!this._filterStack[this._filterStackIndex]) {\n this._filterStack[this._filterStackIndex] = this._getFilterData();\n }\n const filterData = this._filterStack[this._filterStackIndex];\n this._filterStackIndex++;\n if (filters.length === 0) {\n filterData.skip = true;\n return;\n }\n const bounds = filterData.bounds;\n if (instruction.renderables) {\n getGlobalRenderableBounds(instruction.renderables, bounds);\n } else if (instruction.filterEffect.filterArea) {\n bounds.clear();\n bounds.addRect(instruction.filterEffect.filterArea);\n bounds.applyMatrix(instruction.container.worldTransform);\n } else {\n getFastGlobalBounds(instruction.container, bounds);\n }\n const colorTextureSource = renderer.renderTarget.renderTarget.colorTexture.source;\n let resolution = Infinity;\n let padding = 0;\n let antialias = true;\n let blendRequired = false;\n let enabled = false;\n for (let i = 0; i < filters.length; i++) {\n const filter = filters[i];\n resolution = Math.min(resolution, filter.resolution === \"inherit\" ? colorTextureSource._resolution : filter.resolution);\n padding += filter.padding;\n if (filter.antialias === \"off\") {\n antialias = false;\n } else if (filter.antialias === \"inherit\") {\n antialias && (antialias = colorTextureSource.antialias);\n }\n const isCompatible = !!(filter.compatibleRenderers & renderer.type);\n if (!isCompatible) {\n enabled = false;\n break;\n }\n if (filter.blendRequired && !(renderer.backBuffer?.useBackBuffer ?? true)) {\n warn(\"Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options.\");\n enabled = false;\n break;\n }\n enabled = filter.enabled || enabled;\n blendRequired = blendRequired || filter.blendRequired;\n }\n if (!enabled) {\n filterData.skip = true;\n return;\n }\n const viewPort = renderer.renderTarget.rootViewPort;\n bounds.scale(resolution).fitBounds(0, viewPort.width, 0, viewPort.height).scale(1 / resolution).pad(padding).ceil();\n if (!bounds.isPositive) {\n filterData.skip = true;\n return;\n }\n filterData.skip = false;\n filterData.bounds = bounds;\n filterData.blendRequired = blendRequired;\n filterData.container = instruction.container;\n filterData.filterEffect = instruction.filterEffect;\n filterData.previousRenderSurface = renderer.renderTarget.renderSurface;\n filterData.inputTexture = TexturePool.getOptimalTexture(\n bounds.width,\n bounds.height,\n resolution,\n antialias\n );\n renderer.renderTarget.bind(filterData.inputTexture, true);\n renderer.globalUniforms.push({\n offset: bounds\n });\n }\n pop() {\n const renderer = this.renderer;\n this._filterStackIndex--;\n const filterData = this._filterStack[this._filterStackIndex];\n if (filterData.skip) {\n return;\n }\n this._activeFilterData = filterData;\n const inputTexture = filterData.inputTexture;\n const bounds = filterData.bounds;\n let backTexture = Texture.EMPTY;\n renderer.renderTarget.finishRenderPass();\n if (filterData.blendRequired) {\n const previousBounds = this._filterStackIndex > 0 ? this._filterStack[this._filterStackIndex - 1].bounds : null;\n const renderTarget = renderer.renderTarget.getRenderTarget(filterData.previousRenderSurface);\n backTexture = this.getBackTexture(renderTarget, bounds, previousBounds);\n }\n filterData.backTexture = backTexture;\n const filters = filterData.filterEffect.filters;\n this._globalFilterBindGroup.setResource(inputTexture.source.style, 2);\n this._globalFilterBindGroup.setResource(backTexture.source, 3);\n renderer.globalUniforms.pop();\n if (filters.length === 1) {\n filters[0].apply(this, inputTexture, filterData.previousRenderSurface, false);\n TexturePool.returnTexture(inputTexture);\n } else {\n let flip = filterData.inputTexture;\n let flop = TexturePool.getOptimalTexture(\n bounds.width,\n bounds.height,\n flip.source._resolution,\n false\n );\n let i = 0;\n for (i = 0; i < filters.length - 1; ++i) {\n const filter = filters[i];\n filter.apply(this, flip, flop, true);\n const t = flip;\n flip = flop;\n flop = t;\n }\n filters[i].apply(this, flip, filterData.previousRenderSurface, false);\n TexturePool.returnTexture(flip);\n TexturePool.returnTexture(flop);\n }\n if (filterData.blendRequired) {\n TexturePool.returnTexture(backTexture);\n }\n }\n getBackTexture(lastRenderSurface, bounds, previousBounds) {\n const backgroundResolution = lastRenderSurface.colorTexture.source._resolution;\n const backTexture = TexturePool.getOptimalTexture(\n bounds.width,\n bounds.height,\n backgroundResolution,\n false\n );\n let x = bounds.minX;\n let y = bounds.minY;\n if (previousBounds) {\n x -= previousBounds.minX;\n y -= previousBounds.minY;\n }\n x = Math.floor(x * backgroundResolution);\n y = Math.floor(y * backgroundResolution);\n const width = Math.ceil(bounds.width * backgroundResolution);\n const height = Math.ceil(bounds.height * backgroundResolution);\n this.renderer.renderTarget.copyToTexture(\n lastRenderSurface,\n backTexture,\n { x, y },\n { width, height },\n { x: 0, y: 0 }\n );\n return backTexture;\n }\n applyFilter(filter, input, output, clear) {\n const renderer = this.renderer;\n const filterData = this._filterStack[this._filterStackIndex];\n const bounds = filterData.bounds;\n const offset = Point.shared;\n const previousRenderSurface = filterData.previousRenderSurface;\n const isFinalTarget = previousRenderSurface === output;\n let resolution = this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution;\n let currentIndex = this._filterStackIndex - 1;\n while (currentIndex > 0 && this._filterStack[currentIndex].skip) {\n --currentIndex;\n }\n if (currentIndex > 0) {\n resolution = this._filterStack[currentIndex].inputTexture.source._resolution;\n }\n const filterUniforms = this._filterGlobalUniforms;\n const uniforms = filterUniforms.uniforms;\n const outputFrame = uniforms.uOutputFrame;\n const inputSize = uniforms.uInputSize;\n const inputPixel = uniforms.uInputPixel;\n const inputClamp = uniforms.uInputClamp;\n const globalFrame = uniforms.uGlobalFrame;\n const outputTexture = uniforms.uOutputTexture;\n if (isFinalTarget) {\n let lastIndex = this._filterStackIndex;\n while (lastIndex > 0) {\n lastIndex--;\n const filterData2 = this._filterStack[this._filterStackIndex - 1];\n if (!filterData2.skip) {\n offset.x = filterData2.bounds.minX;\n offset.y = filterData2.bounds.minY;\n break;\n }\n }\n outputFrame[0] = bounds.minX - offset.x;\n outputFrame[1] = bounds.minY - offset.y;\n } else {\n outputFrame[0] = 0;\n outputFrame[1] = 0;\n }\n outputFrame[2] = input.frame.width;\n outputFrame[3] = input.frame.height;\n inputSize[0] = input.source.width;\n inputSize[1] = input.source.height;\n inputSize[2] = 1 / inputSize[0];\n inputSize[3] = 1 / inputSize[1];\n inputPixel[0] = input.source.pixelWidth;\n inputPixel[1] = input.source.pixelHeight;\n inputPixel[2] = 1 / inputPixel[0];\n inputPixel[3] = 1 / inputPixel[1];\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = input.frame.width * inputSize[2] - 0.5 * inputPixel[2];\n inputClamp[3] = input.frame.height * inputSize[3] - 0.5 * inputPixel[3];\n const rootTexture = this.renderer.renderTarget.rootRenderTarget.colorTexture;\n globalFrame[0] = offset.x * resolution;\n globalFrame[1] = offset.y * resolution;\n globalFrame[2] = rootTexture.source.width * resolution;\n globalFrame[3] = rootTexture.source.height * resolution;\n const renderTarget = this.renderer.renderTarget.getRenderTarget(output);\n renderer.renderTarget.bind(output, !!clear);\n if (output instanceof Texture) {\n outputTexture[0] = output.frame.width;\n outputTexture[1] = output.frame.height;\n } else {\n outputTexture[0] = renderTarget.width;\n outputTexture[1] = renderTarget.height;\n }\n outputTexture[2] = renderTarget.isRoot ? -1 : 1;\n filterUniforms.update();\n if (renderer.renderPipes.uniformBatch) {\n const batchUniforms = renderer.renderPipes.uniformBatch.getUboResource(filterUniforms);\n this._globalFilterBindGroup.setResource(batchUniforms, 0);\n } else {\n this._globalFilterBindGroup.setResource(filterUniforms, 0);\n }\n this._globalFilterBindGroup.setResource(input.source, 1);\n this._globalFilterBindGroup.setResource(input.source.style, 2);\n filter.groups[0] = this._globalFilterBindGroup;\n renderer.encoder.draw({\n geometry: quadGeometry,\n shader: filter,\n state: filter._state,\n topology: \"triangle-list\"\n });\n if (renderer.type === RendererType.WEBGL) {\n renderer.renderTarget.finishRenderPass();\n }\n }\n _getFilterData() {\n return {\n skip: false,\n inputTexture: null,\n bounds: new Bounds(),\n container: null,\n filterEffect: null,\n blendRequired: false,\n previousRenderSurface: null\n };\n }\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix, sprite) {\n const data = this._activeFilterData;\n const mappedMatrix = outputMatrix.set(\n data.inputTexture._source.width,\n 0,\n 0,\n data.inputTexture._source.height,\n data.bounds.minX,\n data.bounds.minY\n );\n const worldTransform = sprite.worldTransform.copyTo(Matrix.shared);\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(\n 1 / sprite.texture.frame.width,\n 1 / sprite.texture.frame.height\n );\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n return mappedMatrix;\n }\n}\n/** @ignore */\nFilterSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem\n ],\n name: \"filter\"\n};\n\nexport { FilterSystem };\n//# sourceMappingURL=FilterSystem.mjs.map\n","\"use strict\";\nfunction getGlobalRenderableBounds(renderables, bounds) {\n bounds.clear();\n const tempMatrix = bounds.matrix;\n for (let i = 0; i < renderables.length; i++) {\n const renderable = renderables[i];\n if (renderable.globalDisplayStatus < 7) {\n continue;\n }\n bounds.matrix = renderable.worldTransform;\n renderable.addBounds(bounds);\n }\n bounds.matrix = tempMatrix;\n return bounds;\n}\n\nexport { getGlobalRenderableBounds };\n//# sourceMappingURL=getRenderableBounds.mjs.map\n","var fragment = \"in vec2 vMaskCoord;\\nin vec2 vTextureCoord;\\n\\nuniform sampler2D uTexture;\\nuniform sampler2D uMaskTexture;\\n\\nuniform float uAlpha;\\nuniform vec4 uMaskClamp;\\n\\nout vec4 finalColor;\\n\\nvoid main(void)\\n{\\n float clip = step(3.5,\\n step(uMaskClamp.x, vMaskCoord.x) +\\n step(uMaskClamp.y, vMaskCoord.y) +\\n step(vMaskCoord.x, uMaskClamp.z) +\\n step(vMaskCoord.y, uMaskClamp.w));\\n\\n // TODO look into why this is needed\\n float npmAlpha = uAlpha; \\n vec4 original = texture(uTexture, vTextureCoord);\\n vec4 masky = texture(uMaskTexture, vMaskCoord);\\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\\n\\n original *= (alphaMul * masky.r * uAlpha * clip);\\n\\n finalColor = original;\\n}\\n\";\n\nexport { fragment as default };\n//# sourceMappingURL=mask.frag.mjs.map\n","var source = \"struct GlobalFilterUniforms {\\n uInputSize:vec4,\\n uInputPixel:vec4,\\n uInputClamp:vec4,\\n uOutputFrame:vec4,\\n uGlobalFrame:vec4,\\n uOutputTexture:vec4, \\n};\\n\\nstruct MaskUniforms {\\n uFilterMatrix:mat3x3,\\n uMaskClamp:vec4,\\n uAlpha:f32,\\n};\\n\\n\\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\\n@group(0) @binding(1) var uTexture: texture_2d;\\n@group(0) @binding(2) var uSampler : sampler;\\n\\n@group(1) @binding(0) var filterUniforms : MaskUniforms;\\n@group(1) @binding(1) var uMaskTexture: texture_2d;\\n\\nstruct VSOutput {\\n @builtin(position) position: vec4,\\n @location(0) uv : vec2,\\n @location(1) filterUv : vec2,\\n };\\n\\nfn filterVertexPosition(aPosition:vec2) -> vec4\\n{\\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\\n\\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\\n\\n return vec4(position, 0.0, 1.0);\\n}\\n\\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\\n{\\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\\n}\\n\\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\\n{\\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \\n}\\n\\nfn getFilterCoord(aPosition:vec2 ) -> vec2\\n{\\n return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\\n}\\n\\nfn getSize() -> vec2\\n{\\n\\n \\n return gfu.uGlobalFrame.zw;\\n}\\n \\n@vertex\\nfn mainVertex(\\n @location(0) aPosition : vec2, \\n) -> VSOutput {\\n return VSOutput(\\n filterVertexPosition(aPosition),\\n filterTextureCoord(aPosition),\\n getFilterCoord(aPosition)\\n );\\n}\\n\\n@fragment\\nfn mainFragment(\\n @location(0) uv: vec2,\\n @location(1) filterUv: vec2,\\n @builtin(position) position: vec4\\n) -> @location(0) vec4 {\\n\\n var maskClamp = filterUniforms.uMaskClamp;\\n\\n var clip = step(3.5,\\n step(maskClamp.x, filterUv.x) +\\n step(maskClamp.y, filterUv.y) +\\n step(filterUv.x, maskClamp.z) +\\n step(filterUv.y, maskClamp.w));\\n\\n var mask = textureSample(uMaskTexture, uSampler, filterUv);\\n var source = textureSample(uTexture, uSampler, uv);\\n \\n var npmAlpha = 0.0;\\n\\n var alphaMul = 1.0 - npmAlpha * (1.0 - mask.a);\\n\\n var a = (alphaMul * mask.r) * clip;\\n\\n return vec4(source.rgb, source.a) * a;\\n}\";\n\nexport { source as default };\n//# sourceMappingURL=mask.wgsl.mjs.map\n","import { Matrix } from '../../maths/matrix/Matrix.mjs';\nimport { GlProgram } from '../../rendering/renderers/gl/shader/GlProgram.mjs';\nimport { GpuProgram } from '../../rendering/renderers/gpu/shader/GpuProgram.mjs';\nimport { UniformGroup } from '../../rendering/renderers/shared/shader/UniformGroup.mjs';\nimport { TextureMatrix } from '../../rendering/renderers/shared/texture/TextureMatrix.mjs';\nimport { Filter } from '../Filter.mjs';\nimport fragment from './mask.frag.mjs';\nimport vertex from './mask.vert.mjs';\nimport source from './mask.wgsl.mjs';\n\n\"use strict\";\nclass MaskFilter extends Filter {\n constructor(options) {\n const { sprite, ...rest } = options;\n const textureMatrix = new TextureMatrix(sprite.texture);\n const filterUniforms = new UniformGroup({\n uFilterMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uMaskClamp: { value: textureMatrix.uClampFrame, type: \"vec4\" },\n uAlpha: { value: 1, type: \"f32\" }\n });\n const gpuProgram = GpuProgram.from({\n vertex: {\n source,\n entryPoint: \"mainVertex\"\n },\n fragment: {\n source,\n entryPoint: \"mainFragment\"\n }\n });\n const glProgram = GlProgram.from({\n vertex,\n fragment,\n name: \"mask-filter\"\n });\n super({\n ...rest,\n gpuProgram,\n glProgram,\n resources: {\n filterUniforms,\n uMaskTexture: sprite.texture.source\n }\n });\n this.sprite = sprite;\n this._textureMatrix = textureMatrix;\n }\n apply(filterManager, input, output, clearMode) {\n this._textureMatrix.texture = this.sprite.texture;\n filterManager.calculateSpriteMatrix(\n this.resources.filterUniforms.uniforms.uFilterMatrix,\n this.sprite\n ).prepend(this._textureMatrix.mapCoord);\n this.resources.uMaskTexture = this.sprite.texture.source;\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n\nexport { MaskFilter };\n//# sourceMappingURL=MaskFilter.mjs.map\n","var vertex = \"in vec2 aPosition;\\n\\nout vec2 vTextureCoord;\\nout vec2 vMaskCoord;\\n\\n\\nuniform vec4 uInputSize;\\nuniform vec4 uOutputFrame;\\nuniform vec4 uOutputTexture;\\nuniform mat3 uFilterMatrix;\\n\\nvec4 filterVertexPosition( vec2 aPosition )\\n{\\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\\n \\n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\\n\\n return vec4(position, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( vec2 aPosition )\\n{\\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\\n}\\n\\nvec2 getFilterCoord( vec2 aPosition )\\n{\\n return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\\n} \\n\\nvoid main(void)\\n{\\n gl_Position = filterVertexPosition(aPosition);\\n vTextureCoord = filterTextureCoord(aPosition);\\n vMaskCoord = getFilterCoord(aPosition);\\n}\\n\";\n\nexport { vertex as default };\n//# sourceMappingURL=mask.vert.mjs.map\n","import { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';\nimport { Container } from '../../container/Container.mjs';\nimport { GraphicsContext } from './GraphicsContext.mjs';\n\n\"use strict\";\nclass Graphics extends Container {\n /**\n * @param options - Options for the Graphics.\n */\n constructor(options) {\n if (options instanceof GraphicsContext) {\n options = { context: options };\n }\n const { context, roundPixels, ...rest } = options || {};\n super({\n label: \"Graphics\",\n ...rest\n });\n this.canBundle = true;\n this.renderPipeId = \"graphics\";\n this._roundPixels = 0;\n if (!context) {\n this._context = this._ownedContext = new GraphicsContext();\n } else {\n this._context = context;\n }\n this._context.on(\"update\", this.onViewUpdate, this);\n this.allowChildren = false;\n this.roundPixels = roundPixels ?? false;\n }\n set context(context) {\n if (context === this._context)\n return;\n this._context.off(\"update\", this.onViewUpdate, this);\n this._context = context;\n this._context.on(\"update\", this.onViewUpdate, this);\n this.onViewUpdate();\n }\n get context() {\n return this._context;\n }\n /**\n * The local bounds of the graphic.\n * @type {rendering.Bounds}\n */\n get bounds() {\n return this._context.bounds;\n }\n /**\n * Adds the bounds of this object to the bounds object.\n * @param bounds - The output bounds object.\n */\n addBounds(bounds) {\n bounds.addBounds(this._context.bounds);\n }\n /**\n * Checks if the object contains the given point.\n * @param point - The point to check\n */\n containsPoint(point) {\n return this._context.containsPoint(point);\n }\n /**\n * Whether or not to round the x/y position of the graphic.\n * @type {boolean}\n */\n get roundPixels() {\n return !!this._roundPixels;\n }\n set roundPixels(value) {\n this._roundPixels = value ? 1 : 0;\n }\n onViewUpdate() {\n this._didChangeId += 1 << 12;\n this._didGraphicsUpdate = true;\n if (this.didViewUpdate)\n return;\n this.didViewUpdate = true;\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.onChildViewUpdate(this);\n }\n }\n /**\n * Destroys this graphics renderable and optionally its context.\n * @param options - Options parameter. A boolean will act as if all options\n *\n * If the context was created by this graphics and `destroy(false)` or `destroy()` is called\n * then the context will still be destroyed.\n *\n * If you want to explicitly not destroy this context that this graphics created,\n * then you should pass destroy({ context: false })\n *\n * If the context was passed in as an argument to the constructor then it will not be destroyed\n * @param {boolean} [options.texture=false] - Should destroy the texture of the graphics context\n * @param {boolean} [options.textureSource=false] - Should destroy the texture source of the graphics context\n * @param {boolean} [options.context=false] - Should destroy the context\n */\n destroy(options) {\n if (this._ownedContext && !options) {\n this._ownedContext.destroy(options);\n } else if (options === true || options?.context === true) {\n this._context.destroy(options);\n }\n this._ownedContext = null;\n this._context = null;\n super.destroy(options);\n }\n _callContextMethod(method, args) {\n this.context[method](...args);\n return this;\n }\n // --------------------------------------- GraphicsContext methods ---------------------------------------\n /**\n * Sets the current fill style of the graphics context. The fill style can be a color, gradient,\n * pattern, or a more complex style defined by a FillStyle object.\n * @param {FillInput} args - The fill style to apply. This can be a simple color, a gradient or\n * pattern object, or a FillStyle or ConvertedFillStyle object.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n setFillStyle(...args) {\n return this._callContextMethod(\"setFillStyle\", args);\n }\n /**\n * Sets the current stroke style of the graphics context. Similar to fill styles, stroke styles can\n * encompass colors, gradients, patterns, or more detailed configurations via a StrokeStyle object.\n * @param {StrokeInput} args - The stroke style to apply. Can be defined as a color, a gradient or pattern,\n * or a StrokeStyle or ConvertedStrokeStyle object.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n setStrokeStyle(...args) {\n return this._callContextMethod(\"setStrokeStyle\", args);\n }\n fill(...args) {\n return this._callContextMethod(\"fill\", args);\n }\n /**\n * Strokes the current path with the current stroke style. This method can take an optional\n * FillStyle parameter to define the stroke's appearance, including its color, width, and other properties.\n * @param {FillStyle} args - (Optional) The stroke style to apply. Can be defined as a simple color or a more\n * complex style object. If omitted, uses the current stroke style.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n stroke(...args) {\n return this._callContextMethod(\"stroke\", args);\n }\n texture(...args) {\n return this._callContextMethod(\"texture\", args);\n }\n /**\n * Resets the current path. Any previous path and its commands are discarded and a new path is\n * started. This is typically called before beginning a new shape or series of drawing commands.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n beginPath() {\n return this._callContextMethod(\"beginPath\", []);\n }\n /**\n * Applies a cutout to the last drawn shape. This is used to create holes or complex shapes by\n * subtracting a path from the previously drawn path. If a hole is not completely in a shape, it will\n * fail to cut correctly!\n */\n cut() {\n return this._callContextMethod(\"cut\", []);\n }\n arc(...args) {\n return this._callContextMethod(\"arc\", args);\n }\n arcTo(...args) {\n return this._callContextMethod(\"arcTo\", args);\n }\n arcToSvg(...args) {\n return this._callContextMethod(\"arcToSvg\", args);\n }\n bezierCurveTo(...args) {\n return this._callContextMethod(\"bezierCurveTo\", args);\n }\n /**\n * Closes the current path by drawing a straight line back to the start.\n * If the shape is already closed or there are no points in the path, this method does nothing.\n * @returns The instance of the current object for chaining.\n */\n closePath() {\n return this._callContextMethod(\"closePath\", []);\n }\n ellipse(...args) {\n return this._callContextMethod(\"ellipse\", args);\n }\n circle(...args) {\n return this._callContextMethod(\"circle\", args);\n }\n path(...args) {\n return this._callContextMethod(\"path\", args);\n }\n lineTo(...args) {\n return this._callContextMethod(\"lineTo\", args);\n }\n moveTo(...args) {\n return this._callContextMethod(\"moveTo\", args);\n }\n quadraticCurveTo(...args) {\n return this._callContextMethod(\"quadraticCurveTo\", args);\n }\n rect(...args) {\n return this._callContextMethod(\"rect\", args);\n }\n roundRect(...args) {\n return this._callContextMethod(\"roundRect\", args);\n }\n poly(...args) {\n return this._callContextMethod(\"poly\", args);\n }\n regularPoly(...args) {\n return this._callContextMethod(\"regularPoly\", args);\n }\n roundPoly(...args) {\n return this._callContextMethod(\"roundPoly\", args);\n }\n roundShape(...args) {\n return this._callContextMethod(\"roundShape\", args);\n }\n filletRect(...args) {\n return this._callContextMethod(\"filletRect\", args);\n }\n chamferRect(...args) {\n return this._callContextMethod(\"chamferRect\", args);\n }\n star(...args) {\n return this._callContextMethod(\"star\", args);\n }\n svg(...args) {\n return this._callContextMethod(\"svg\", args);\n }\n restore(...args) {\n return this._callContextMethod(\"restore\", args);\n }\n /** Saves the current graphics state, including transformations, fill styles, and stroke styles, onto a stack. */\n save() {\n return this._callContextMethod(\"save\", []);\n }\n /**\n * Returns the current transformation matrix of the graphics context.\n * @returns The current transformation matrix.\n */\n getTransform() {\n return this.context.getTransform();\n }\n /**\n * Resets the current transformation matrix to the identity matrix, effectively removing\n * any transformations (rotation, scaling, translation) previously applied.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n resetTransform() {\n return this._callContextMethod(\"resetTransform\", []);\n }\n rotateTransform(...args) {\n return this._callContextMethod(\"rotate\", args);\n }\n scaleTransform(...args) {\n return this._callContextMethod(\"scale\", args);\n }\n setTransform(...args) {\n return this._callContextMethod(\"setTransform\", args);\n }\n transform(...args) {\n return this._callContextMethod(\"transform\", args);\n }\n translateTransform(...args) {\n return this._callContextMethod(\"translate\", args);\n }\n /**\n * Clears all drawing commands from the graphics context, effectively resetting it. This includes clearing the path,\n * and optionally resetting transformations to the identity matrix.\n * @returns The instance of the current GraphicsContext for method chaining.\n */\n clear() {\n return this._callContextMethod(\"clear\", []);\n }\n /**\n * The fill style to use.\n * @type {ConvertedFillStyle}\n */\n get fillStyle() {\n return this._context.fillStyle;\n }\n set fillStyle(value) {\n this._context.fillStyle = value;\n }\n /**\n * The stroke style to use.\n * @type {ConvertedStrokeStyle}\n */\n get strokeStyle() {\n return this._context.strokeStyle;\n }\n set strokeStyle(value) {\n this._context.strokeStyle = value;\n }\n /**\n * Creates a new Graphics object.\n * Note that only the context of the object is cloned, not its transform (position,scale,etc)\n * @param deep - Whether to create a deep clone of the graphics object. If false, the context\n * will be shared between the two objects (default false). If true, the context will be\n * cloned (recommended if you need to modify the context in any way).\n * @returns - A clone of the graphics object\n */\n clone(deep = false) {\n if (deep) {\n return new Graphics(this._context.clone());\n }\n this._ownedContext = null;\n const clone = new Graphics(this._context);\n return clone;\n }\n // -------- v7 deprecations ---------\n /**\n * @param width\n * @param color\n * @param alpha\n * @deprecated since 8.0.0 Use {@link Graphics#setStrokeStyle} instead\n */\n lineStyle(width, color, alpha) {\n deprecation(v8_0_0, \"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.\");\n const strokeStyle = {};\n width && (strokeStyle.width = width);\n color && (strokeStyle.color = color);\n alpha && (strokeStyle.alpha = alpha);\n this.context.strokeStyle = strokeStyle;\n return this;\n }\n /**\n * @param color\n * @param alpha\n * @deprecated since 8.0.0 Use {@link Graphics#fill} instead\n */\n beginFill(color, alpha) {\n deprecation(v8_0_0, \"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.\");\n const fillStyle = {};\n color && (fillStyle.color = color);\n alpha && (fillStyle.alpha = alpha);\n this.context.fillStyle = fillStyle;\n return this;\n }\n /**\n * @deprecated since 8.0.0 Use {@link Graphics#fill} instead\n */\n endFill() {\n deprecation(v8_0_0, \"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.\");\n this.context.fill();\n const strokeStyle = this.context.strokeStyle;\n if (strokeStyle.width !== GraphicsContext.defaultStrokeStyle.width || strokeStyle.color !== GraphicsContext.defaultStrokeStyle.color || strokeStyle.alpha !== GraphicsContext.defaultStrokeStyle.alpha) {\n this.context.stroke();\n }\n return this;\n }\n /**\n * @param {...any} args\n * @deprecated since 8.0.0 Use {@link Graphics#circle} instead\n */\n drawCircle(...args) {\n deprecation(v8_0_0, \"Graphics#drawCircle has been renamed to Graphics#circle\");\n return this._callContextMethod(\"circle\", args);\n }\n /**\n * @param {...any} args\n * @deprecated since 8.0.0 Use {@link Graphics#ellipse} instead\n */\n drawEllipse(...args) {\n deprecation(v8_0_0, \"Graphics#drawEllipse has been renamed to Graphics#ellipse\");\n return this._callContextMethod(\"ellipse\", args);\n }\n /**\n * @param {...any} args\n * @deprecated since 8.0.0 Use {@link Graphics#poly} instead\n */\n drawPolygon(...args) {\n deprecation(v8_0_0, \"Graphics#drawPolygon has been renamed to Graphics#poly\");\n return this._callContextMethod(\"poly\", args);\n }\n /**\n * @param {...any} args\n * @deprecated since 8.0.0 Use {@link Graphics#rect} instead\n */\n drawRect(...args) {\n deprecation(v8_0_0, \"Graphics#drawRect has been renamed to Graphics#rect\");\n return this._callContextMethod(\"rect\", args);\n }\n /**\n * @param {...any} args\n * @deprecated since 8.0.0 Use {@link Graphics#roundRect} instead\n */\n drawRoundedRect(...args) {\n deprecation(v8_0_0, \"Graphics#drawRoundedRect has been renamed to Graphics#roundRect\");\n return this._callContextMethod(\"roundRect\", args);\n }\n /**\n * @param {...any} args\n * @deprecated since 8.0.0 Use {@link Graphics#star} instead\n */\n drawStar(...args) {\n deprecation(v8_0_0, \"Graphics#drawStar has been renamed to Graphics#star\");\n return this._callContextMethod(\"star\", args);\n }\n}\n\nexport { Graphics };\n//# sourceMappingURL=Graphics.mjs.map\n","import { Buffer } from '../../../rendering/renderers/shared/buffer/Buffer.mjs';\nimport { BufferUsage } from '../../../rendering/renderers/shared/buffer/const.mjs';\nimport { Geometry } from '../../../rendering/renderers/shared/geometry/Geometry.mjs';\nimport { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';\n\n\"use strict\";\nconst _MeshGeometry = class _MeshGeometry extends Geometry {\n constructor(...args) {\n let options = args[0] ?? {};\n if (options instanceof Float32Array) {\n deprecation(v8_0_0, \"use new MeshGeometry({ positions, uvs, indices }) instead\");\n options = {\n positions: options,\n uvs: args[1],\n indices: args[2]\n };\n }\n options = { ..._MeshGeometry.defaultOptions, ...options };\n const positions = options.positions || new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);\n const uvs = options.uvs || new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);\n const indices = options.indices || new Uint32Array([0, 1, 2, 0, 2, 3]);\n const shrinkToFit = options.shrinkBuffersToFit;\n const positionBuffer = new Buffer({\n data: positions,\n label: \"attribute-mesh-positions\",\n shrinkToFit,\n usage: BufferUsage.VERTEX | BufferUsage.COPY_DST\n });\n const uvBuffer = new Buffer({\n data: uvs,\n label: \"attribute-mesh-uvs\",\n shrinkToFit,\n usage: BufferUsage.VERTEX | BufferUsage.COPY_DST\n });\n const indexBuffer = new Buffer({\n data: indices,\n label: \"index-mesh-buffer\",\n shrinkToFit,\n usage: BufferUsage.INDEX | BufferUsage.COPY_DST\n });\n super({\n attributes: {\n aPosition: {\n buffer: positionBuffer,\n format: \"float32x2\",\n stride: 2 * 4,\n offset: 0\n },\n aUV: {\n buffer: uvBuffer,\n format: \"float32x2\",\n stride: 2 * 4,\n offset: 0\n }\n },\n indexBuffer,\n topology: options.topology\n });\n this.batchMode = \"auto\";\n }\n /** The positions of the mesh. */\n get positions() {\n return this.attributes.aPosition.buffer.data;\n }\n set positions(value) {\n this.attributes.aPosition.buffer.data = value;\n }\n /** The UVs of the mesh. */\n get uvs() {\n return this.attributes.aUV.buffer.data;\n }\n set uvs(value) {\n this.attributes.aUV.buffer.data = value;\n }\n /** The indices of the mesh. */\n get indices() {\n return this.indexBuffer.data;\n }\n set indices(value) {\n this.indexBuffer.data = value;\n }\n};\n_MeshGeometry.defaultOptions = {\n topology: \"triangle-list\",\n shrinkBuffersToFit: false\n};\nlet MeshGeometry = _MeshGeometry;\n\nexport { MeshGeometry };\n//# sourceMappingURL=MeshGeometry.mjs.map\n","import { Texture } from '../../rendering/renderers/shared/texture/Texture.mjs';\nimport { UPDATE_PRIORITY } from '../../ticker/const.mjs';\nimport { Ticker } from '../../ticker/Ticker.mjs';\nimport { Sprite } from '../sprite/Sprite.mjs';\n\n\"use strict\";\nclass AnimatedSprite extends Sprite {\n /**\n * @param textures - An array of {@link Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use Ticker.shared to auto update animation time.\n */\n constructor(textures, autoUpdate = true) {\n super(textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n this._textures = null;\n this._durations = null;\n this._autoUpdate = autoUpdate;\n this._isConnectedToTicker = false;\n this.animationSpeed = 1;\n this.loop = true;\n this.updateAnchor = false;\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n this._currentTime = 0;\n this._playing = false;\n this._previousFrame = null;\n this.textures = textures;\n }\n /** Stops the AnimatedSprite. */\n stop() {\n if (!this._playing) {\n return;\n }\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker) {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n /** Plays the AnimatedSprite. */\n play() {\n if (this._playing) {\n return;\n }\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker) {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n }\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n * @param frameNumber - Frame index to stop at.\n */\n gotoAndStop(frameNumber) {\n this.stop();\n this.currentFrame = frameNumber;\n }\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n * @param frameNumber - Frame index to start at.\n */\n gotoAndPlay(frameNumber) {\n this.currentFrame = frameNumber;\n this.play();\n }\n /**\n * Updates the object transform for rendering.\n * @param ticker - the ticker to use to update the object.\n */\n update(ticker) {\n if (!this._playing) {\n return;\n }\n const deltaTime = ticker.deltaTime;\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n if (this._durations !== null) {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n lag += elapsed / 60 * 1e3;\n while (lag < 0) {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n const sign = Math.sign(this.animationSpeed * deltaTime);\n this._currentTime = Math.floor(this._currentTime);\n while (lag >= this._durations[this.currentFrame]) {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n this._currentTime += lag / this._durations[this.currentFrame];\n } else {\n this._currentTime += elapsed;\n }\n if (this._currentTime < 0 && !this.loop) {\n this.gotoAndStop(0);\n if (this.onComplete) {\n this.onComplete();\n }\n } else if (this._currentTime >= this._textures.length && !this.loop) {\n this.gotoAndStop(this._textures.length - 1);\n if (this.onComplete) {\n this.onComplete();\n }\n } else if (previousFrame !== this.currentFrame) {\n if (this.loop && this.onLoop) {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame || this.animationSpeed < 0 && this.currentFrame > previousFrame) {\n this.onLoop();\n }\n }\n this._updateTexture();\n }\n }\n /** Updates the displayed texture to match the current frame index. */\n _updateTexture() {\n const currentFrame = this.currentFrame;\n if (this._previousFrame === currentFrame) {\n return;\n }\n this._previousFrame = currentFrame;\n this.texture = this._textures[currentFrame];\n if (this.updateAnchor) {\n this.anchor.copyFrom(this.texture.defaultAnchor);\n }\n if (this.onFrameChange) {\n this.onFrameChange(this.currentFrame);\n }\n }\n /** Stops the AnimatedSprite and destroys it. */\n destroy() {\n this.stop();\n super.destroy();\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n }\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n * @param frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @returns - The new animated sprite with the specified frames.\n */\n static fromFrames(frames) {\n const textures = [];\n for (let i = 0; i < frames.length; ++i) {\n textures.push(Texture.from(frames[i]));\n }\n return new AnimatedSprite(textures);\n }\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n * @param images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @returns The new animate sprite with the specified images as frames.\n */\n static fromImages(images) {\n const textures = [];\n for (let i = 0; i < images.length; ++i) {\n textures.push(Texture.from(images[i]));\n }\n return new AnimatedSprite(textures);\n }\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n * @readonly\n * @default 0\n */\n get totalFrames() {\n return this._textures.length;\n }\n /** The array of textures used for this AnimatedSprite. */\n get textures() {\n return this._textures;\n }\n set textures(value) {\n if (value[0] instanceof Texture) {\n this._textures = value;\n this._durations = null;\n } else {\n this._textures = [];\n this._durations = [];\n for (let i = 0; i < value.length; i++) {\n this._textures.push(value[i].texture);\n this._durations.push(value[i].time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this._updateTexture();\n }\n /** The AnimatedSprite's current frame index. */\n get currentFrame() {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n if (currentFrame < 0) {\n currentFrame += this._textures.length;\n }\n return currentFrame;\n }\n set currentFrame(value) {\n if (value < 0 || value > this.totalFrames - 1) {\n throw new Error(`[AnimatedSprite]: Invalid frame index value ${value}, expected to be between 0 and totalFrames ${this.totalFrames}.`);\n }\n const previousFrame = this.currentFrame;\n this._currentTime = value;\n if (previousFrame !== this.currentFrame) {\n this._updateTexture();\n }\n }\n /**\n * Indicates if the AnimatedSprite is currently playing.\n * @readonly\n */\n get playing() {\n return this._playing;\n }\n /** Whether to use Ticker.shared to auto update animation time. */\n get autoUpdate() {\n return this._autoUpdate;\n }\n set autoUpdate(value) {\n if (value !== this._autoUpdate) {\n this._autoUpdate = value;\n if (!this._autoUpdate && this._isConnectedToTicker) {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n } else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n}\n\nexport { AnimatedSprite };\n//# sourceMappingURL=AnimatedSprite.mjs.map\n","import { ObservablePoint } from '../../maths/point/ObservablePoint.mjs';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\nimport { Bounds } from '../container/bounds/Bounds.mjs';\nimport { Container } from '../container/Container.mjs';\n\n\"use strict\";\nclass AbstractText extends Container {\n constructor(options, styleClass) {\n const { text, resolution, style, anchor, width, height, roundPixels, ...rest } = options;\n super({\n ...rest\n });\n this.batched = true;\n this._resolution = null;\n this._autoResolution = true;\n this._didTextUpdate = true;\n this._roundPixels = 0;\n this._bounds = new Bounds();\n this._boundsDirty = true;\n this._styleClass = styleClass;\n this.text = text ?? \"\";\n this.style = style;\n this.resolution = resolution ?? null;\n this.allowChildren = false;\n this._anchor = new ObservablePoint(\n {\n _onUpdate: () => {\n this.onViewUpdate();\n }\n }\n );\n if (anchor)\n this.anchor = anchor;\n this.roundPixels = roundPixels ?? false;\n if (width !== void 0)\n this.width = width;\n if (height !== void 0)\n this.height = height;\n }\n /**\n * The anchor sets the origin point of the text.\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * import { Text } from 'pixi.js';\n *\n * const text = new Text('hello world');\n * text.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor() {\n return this._anchor;\n }\n set anchor(value) {\n typeof value === \"number\" ? this._anchor.set(value) : this._anchor.copyFrom(value);\n }\n /**\n * Whether or not to round the x/y position of the text.\n * @type {boolean}\n */\n get roundPixels() {\n return !!this._roundPixels;\n }\n set roundPixels(value) {\n this._roundPixels = value ? 1 : 0;\n }\n /** Set the copy for the text object. To split a line you can use '\\n'. */\n set text(value) {\n value = value.toString();\n if (this._text === value)\n return;\n this._text = value;\n this.onViewUpdate();\n }\n get text() {\n return this._text;\n }\n /**\n * The resolution / device pixel ratio of the canvas.\n * @default 1\n */\n set resolution(value) {\n this._autoResolution = value === null;\n this._resolution = value;\n this.onViewUpdate();\n }\n get resolution() {\n return this._resolution;\n }\n get style() {\n return this._style;\n }\n /**\n * Set the style of the text.\n *\n * Set up an event listener to listen for changes on the style object and mark the text as dirty.\n *\n * If setting the `style` can also be partial {@link AnyTextStyleOptions}.\n * @type {\n * text.TextStyle |\n * Partial |\n * text.TextStyleOptions |\n * text.HTMLTextStyle |\n * Partial |\n * text.HTMLTextStyleOptions\n * }\n */\n set style(style) {\n style = style || {};\n this._style?.off(\"update\", this.onViewUpdate, this);\n if (style instanceof this._styleClass) {\n this._style = style;\n } else {\n this._style = new this._styleClass(style);\n }\n this._style.on(\"update\", this.onViewUpdate, this);\n this.onViewUpdate();\n }\n /**\n * The local bounds of the Text.\n * @type {rendering.Bounds}\n */\n get bounds() {\n if (this._boundsDirty) {\n this._updateBounds();\n this._boundsDirty = false;\n }\n return this._bounds;\n }\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width() {\n return Math.abs(this.scale.x) * this.bounds.width;\n }\n set width(value) {\n this._setWidth(value, this.bounds.width);\n }\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height() {\n return Math.abs(this.scale.y) * this.bounds.height;\n }\n set height(value) {\n this._setHeight(value, this.bounds.height);\n }\n /**\n * Retrieves the size of the Text as a [Size]{@link Size} object.\n * This is faster than get the width and height separately.\n * @param out - Optional object to store the size in.\n * @returns - The size of the Text.\n */\n getSize(out) {\n if (!out) {\n out = {};\n }\n out.width = Math.abs(this.scale.x) * this.bounds.width;\n out.height = Math.abs(this.scale.y) * this.bounds.height;\n return out;\n }\n /**\n * Sets the size of the Text to the specified width and height.\n * This is faster than setting the width and height separately.\n * @param value - This can be either a number or a [Size]{@link Size} object.\n * @param height - The height to set. Defaults to the value of `width` if not provided.\n */\n setSize(value, height) {\n let convertedWidth;\n let convertedHeight;\n if (typeof value !== \"object\") {\n convertedWidth = value;\n convertedHeight = height ?? value;\n } else {\n convertedWidth = value.width;\n convertedHeight = value.height ?? value.width;\n }\n if (convertedWidth !== void 0) {\n this._setWidth(convertedWidth, this.bounds.width);\n }\n if (convertedHeight !== void 0) {\n this._setHeight(convertedHeight, this.bounds.height);\n }\n }\n /**\n * Adds the bounds of this text to the bounds object.\n * @param bounds - The output bounds object.\n */\n addBounds(bounds) {\n const _bounds = this.bounds;\n bounds.addFrame(\n _bounds.minX,\n _bounds.minY,\n _bounds.maxX,\n _bounds.maxY\n );\n }\n /**\n * Checks if the text contains the given point.\n * @param point - The point to check\n */\n containsPoint(point) {\n const width = this.bounds.width;\n const height = this.bounds.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n if (point.x >= x1 && point.x <= x1 + width) {\n y1 = -height * this.anchor.y;\n if (point.y >= y1 && point.y <= y1 + height)\n return true;\n }\n return false;\n }\n onViewUpdate() {\n this._didChangeId += 1 << 12;\n this._boundsDirty = true;\n if (this.didViewUpdate)\n return;\n this.didViewUpdate = true;\n this._didTextUpdate = true;\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n if (renderGroup) {\n renderGroup.onChildViewUpdate(this);\n }\n }\n _getKey() {\n return `${this.text}:${this._style.styleKey}:${this._resolution}`;\n }\n /**\n * Destroys this text renderable and optionally its style texture.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.texture=false] - Should it destroy the texture of the text style\n * @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the text style\n * @param {boolean} [options.style=false] - Should it destroy the style of the text\n */\n destroy(options = false) {\n super.destroy(options);\n this.owner = null;\n this._bounds = null;\n this._anchor = null;\n if (typeof options === \"boolean\" ? options : options?.style) {\n this._style.destroy(options);\n }\n this._style = null;\n this._text = null;\n }\n}\nfunction ensureOptions(args, name) {\n let options = args[0] ?? {};\n if (typeof options === \"string\" || args[1]) {\n deprecation(v8_0_0, `use new ${name}({ text: \"hi!\", style }) instead`);\n options = {\n text: options,\n style: args[1]\n };\n }\n return options;\n}\n\nexport { AbstractText, ensureOptions };\n//# sourceMappingURL=AbstractText.mjs.map\n","import { AbstractText, ensureOptions } from './AbstractText.mjs';\nimport { CanvasTextMetrics } from './canvas/CanvasTextMetrics.mjs';\nimport { TextStyle } from './TextStyle.mjs';\n\n\"use strict\";\nclass Text extends AbstractText {\n constructor(...args) {\n const options = ensureOptions(args, \"Text\");\n super(options, TextStyle);\n this.renderPipeId = \"text\";\n }\n _updateBounds() {\n const bounds = this._bounds;\n const anchor = this._anchor;\n const canvasMeasurement = CanvasTextMetrics.measureText(\n this._text,\n this._style\n );\n const { width, height } = canvasMeasurement;\n bounds.minX = -anchor._x * width;\n bounds.maxX = bounds.minX + width;\n bounds.minY = -anchor._y * height;\n bounds.maxY = bounds.minY + height;\n }\n}\n\nexport { Text };\n//# sourceMappingURL=Text.mjs.map\n","import { Color } from '../../../color/Color.mjs';\n\n\"use strict\";\nfunction textStyleToCSS(style) {\n const stroke = style._stroke;\n const fill = style._fill;\n const cssStyleString = [\n `color: ${Color.shared.setValue(fill.color).toHex()}`,\n `font-size: ${style.fontSize}px`,\n `font-family: ${style.fontFamily}`,\n `font-weight: ${style.fontWeight}`,\n `font-style: ${style.fontStyle}`,\n `font-variant: ${style.fontVariant}`,\n `letter-spacing: ${style.letterSpacing}px`,\n `text-align: ${style.align}`,\n `padding: ${style.padding}px`,\n `white-space: ${style.whiteSpace === \"pre\" && style.wordWrap ? \"pre-wrap\" : style.whiteSpace}`,\n ...style.lineHeight ? [`line-height: ${style.lineHeight}px`] : [],\n ...style.wordWrap ? [\n `word-wrap: ${style.breakWords ? \"break-all\" : \"break-word\"}`,\n `max-width: ${style.wordWrapWidth}px`\n ] : [],\n ...stroke ? [strokeToCSS(stroke)] : [],\n ...style.dropShadow ? [dropShadowToCSS(style.dropShadow)] : [],\n ...style.cssOverrides\n ].join(\";\");\n const cssStyles = [`div { ${cssStyleString} }`];\n tagStyleToCSS(style.tagStyles, cssStyles);\n return cssStyles.join(\" \");\n}\nfunction dropShadowToCSS(dropShadowStyle) {\n const color = Color.shared.setValue(dropShadowStyle.color).setAlpha(dropShadowStyle.alpha).toHexa();\n const x = Math.round(Math.cos(dropShadowStyle.angle) * dropShadowStyle.distance);\n const y = Math.round(Math.sin(dropShadowStyle.angle) * dropShadowStyle.distance);\n const position = `${x}px ${y}px`;\n if (dropShadowStyle.blur > 0) {\n return `text-shadow: ${position} ${dropShadowStyle.blur}px ${color}`;\n }\n return `text-shadow: ${position} ${color}`;\n}\nfunction strokeToCSS(stroke) {\n return [\n `-webkit-text-stroke-width: ${stroke.width}px`,\n `-webkit-text-stroke-color: ${Color.shared.setValue(stroke.color).toHex()}`,\n `text-stroke-width: ${stroke.width}px`,\n `text-stroke-color: ${Color.shared.setValue(stroke.color).toHex()}`,\n \"paint-order: stroke\"\n ].join(\";\");\n}\nconst templates = {\n fontSize: `font-size: {{VALUE}}px`,\n fontFamily: `font-family: {{VALUE}}`,\n fontWeight: `font-weight: {{VALUE}}`,\n fontStyle: `font-style: {{VALUE}}`,\n fontVariant: `font-variant: {{VALUE}}`,\n letterSpacing: `letter-spacing: {{VALUE}}px`,\n align: `text-align: {{VALUE}}`,\n padding: `padding: {{VALUE}}px`,\n whiteSpace: `white-space: {{VALUE}}`,\n lineHeight: `line-height: {{VALUE}}px`,\n wordWrapWidth: `max-width: {{VALUE}}px`\n};\nconst transform = {\n fill: (value) => `color: ${Color.shared.setValue(value).toHex()}`,\n breakWords: (value) => `word-wrap: ${value ? \"break-all\" : \"break-word\"}`,\n stroke: strokeToCSS,\n dropShadow: dropShadowToCSS\n};\nfunction tagStyleToCSS(tagStyles, out) {\n for (const i in tagStyles) {\n const tagStyle = tagStyles[i];\n const cssTagStyle = [];\n for (const j in tagStyle) {\n if (transform[j]) {\n cssTagStyle.push(transform[j](tagStyle[j]));\n } else if (templates[j]) {\n cssTagStyle.push(templates[j].replace(\"{{VALUE}}\", tagStyle[j]));\n }\n }\n out.push(`${i} { ${cssTagStyle.join(\";\")} }`);\n }\n}\n\nexport { textStyleToCSS };\n//# sourceMappingURL=textStyleToCSS.mjs.map\n","import { warn } from '../../utils/logging/warn.mjs';\nimport { TextStyle } from '../text/TextStyle.mjs';\nimport { generateTextStyleKey } from '../text/utils/generateTextStyleKey.mjs';\nimport { textStyleToCSS } from './utils/textStyleToCSS.mjs';\n\n\"use strict\";\nclass HTMLTextStyle extends TextStyle {\n constructor(options = {}) {\n super(options);\n this._cssOverrides = [];\n this.cssOverrides ?? (this.cssOverrides = options.cssOverrides);\n this.tagStyles = options.tagStyles ?? {};\n }\n /** List of style overrides that will be applied to the HTML text. */\n set cssOverrides(value) {\n this._cssOverrides = value instanceof Array ? value : [value];\n this.update();\n }\n get cssOverrides() {\n return this._cssOverrides;\n }\n _generateKey() {\n this._styleKey = generateTextStyleKey(this) + this._cssOverrides.join(\"-\");\n return this._styleKey;\n }\n update() {\n this._cssStyle = null;\n super.update();\n }\n /**\n * Creates a new HTMLTextStyle object with the same values as this one.\n * @returns New cloned HTMLTextStyle object\n */\n clone() {\n return new HTMLTextStyle({\n align: this.align,\n breakWords: this.breakWords,\n dropShadow: this.dropShadow ? { ...this.dropShadow } : null,\n fill: this._fill,\n fontFamily: this.fontFamily,\n fontSize: this.fontSize,\n fontStyle: this.fontStyle,\n fontVariant: this.fontVariant,\n fontWeight: this.fontWeight,\n letterSpacing: this.letterSpacing,\n lineHeight: this.lineHeight,\n padding: this.padding,\n stroke: this._stroke,\n whiteSpace: this.whiteSpace,\n wordWrap: this.wordWrap,\n wordWrapWidth: this.wordWrapWidth,\n cssOverrides: this.cssOverrides\n });\n }\n get cssStyle() {\n if (!this._cssStyle) {\n this._cssStyle = textStyleToCSS(this);\n }\n return this._cssStyle;\n }\n /**\n * Add a style override, this can be any CSS property\n * it will override any built-in style. This is the\n * property and the value as a string (e.g., `color: red`).\n * This will override any other internal style.\n * @param {string} value - CSS style(s) to add.\n * @example\n * style.addOverride('background-color: red');\n */\n addOverride(...value) {\n const toAdd = value.filter((v) => !this.cssOverrides.includes(v));\n if (toAdd.length > 0) {\n this.cssOverrides.push(...toAdd);\n this.update();\n }\n }\n /**\n * Remove any overrides that match the value.\n * @param {string} value - CSS style to remove.\n * @example\n * style.removeOverride('background-color: red');\n */\n removeOverride(...value) {\n const toRemove = value.filter((v) => this.cssOverrides.includes(v));\n if (toRemove.length > 0) {\n this.cssOverrides = this.cssOverrides.filter((v) => !toRemove.includes(v));\n this.update();\n }\n }\n set fill(value) {\n if (typeof value !== \"string\" && typeof value !== \"number\") {\n warn(\"[HTMLTextStyle] only color fill is not supported by HTMLText\");\n }\n super.fill = value;\n }\n set stroke(value) {\n if (value && typeof value !== \"string\" && typeof value !== \"number\") {\n warn(\"[HTMLTextStyle] only color stroke is not supported by HTMLText\");\n }\n super.stroke = value;\n }\n}\n\nexport { HTMLTextStyle };\n//# sourceMappingURL=HtmlTextStyle.mjs.map\n","\"use strict\";\nconst nssvg = \"http://www.w3.org/2000/svg\";\nconst nsxhtml = \"http://www.w3.org/1999/xhtml\";\nclass HTMLTextRenderData {\n constructor() {\n this.svgRoot = document.createElementNS(nssvg, \"svg\");\n this.foreignObject = document.createElementNS(nssvg, \"foreignObject\");\n this.domElement = document.createElementNS(nsxhtml, \"div\");\n this.styleElement = document.createElementNS(nsxhtml, \"style\");\n this.image = new Image();\n const { foreignObject, svgRoot, styleElement, domElement } = this;\n foreignObject.setAttribute(\"width\", \"10000\");\n foreignObject.setAttribute(\"height\", \"10000\");\n foreignObject.style.overflow = \"hidden\";\n svgRoot.appendChild(foreignObject);\n foreignObject.appendChild(styleElement);\n foreignObject.appendChild(domElement);\n }\n}\n\nexport { HTMLTextRenderData, nssvg, nsxhtml };\n//# sourceMappingURL=HTMLTextRenderData.mjs.map\n","import { CanvasTextMetrics } from '../../text/canvas/CanvasTextMetrics.mjs';\nimport { HTMLTextRenderData } from '../HTMLTextRenderData.mjs';\n\n\"use strict\";\nlet tempHTMLTextRenderData;\nfunction measureHtmlText(text, style, fontStyleCSS, htmlTextRenderData) {\n htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextRenderData());\n const { domElement, styleElement, svgRoot } = htmlTextRenderData;\n domElement.innerHTML = `
${text}
`;\n domElement.setAttribute(\"style\", \"transform-origin: top left; display: inline-block\");\n if (fontStyleCSS) {\n styleElement.textContent = fontStyleCSS;\n }\n document.body.appendChild(svgRoot);\n const contentBounds = domElement.getBoundingClientRect();\n svgRoot.remove();\n const descenderPadding = CanvasTextMetrics.measureFont(style.fontStyle).descent;\n const doublePadding = style.padding * 2;\n return {\n width: contentBounds.width - doublePadding,\n height: contentBounds.height + descenderPadding - doublePadding\n };\n}\n\nexport { measureHtmlText };\n//# sourceMappingURL=measureHtmlText.mjs.map\n","import { warn } from '../../../../utils/logging/warn.mjs';\n\n\"use strict\";\nfunction addBits(srcParts, parts, name) {\n if (srcParts) {\n for (const i in srcParts) {\n const id = i.toLocaleLowerCase();\n const part = parts[id];\n if (part) {\n let sanitisedPart = srcParts[i];\n if (i === \"header\") {\n sanitisedPart = sanitisedPart.replace(/@in\\s+[^;]+;\\s*/g, \"\").replace(/@out\\s+[^;]+;\\s*/g, \"\");\n }\n if (name) {\n part.push(`//----${name}----//`);\n }\n part.push(sanitisedPart);\n } else {\n warn(`${i} placement hook does not exist in shader`);\n }\n }\n }\n}\n\nexport { addBits };\n//# sourceMappingURL=addBits.mjs.map\n","\"use strict\";\nconst findHooksRx = /\\{\\{(.*?)\\}\\}/g;\nfunction compileHooks(programSrc) {\n const parts = {};\n const partMatches = programSrc.match(findHooksRx)?.map((hook) => hook.replace(/[{()}]/g, \"\")) ?? [];\n partMatches.forEach((hook) => {\n parts[hook] = [];\n });\n return parts;\n}\n\nexport { compileHooks, findHooksRx };\n//# sourceMappingURL=compileHooks.mjs.map\n","\"use strict\";\nfunction extractInputs(fragmentSource, out) {\n let match;\n const regex = /@in\\s+([^;]+);/g;\n while ((match = regex.exec(fragmentSource)) !== null) {\n out.push(match[1]);\n }\n}\nfunction compileInputs(fragments, template, sort = false) {\n const results = [];\n extractInputs(template, results);\n fragments.forEach((fragment) => {\n if (fragment.header) {\n extractInputs(fragment.header, results);\n }\n });\n const mainInput = results;\n if (sort) {\n mainInput.sort();\n }\n const finalString = mainInput.map((inValue, i) => ` @location(${i}) ${inValue},`).join(\"\\n\");\n let cleanedString = template.replace(/@in\\s+[^;]+;\\s*/g, \"\");\n cleanedString = cleanedString.replace(\"{{in}}\", `\n${finalString}\n`);\n return cleanedString;\n}\n\nexport { compileInputs };\n//# sourceMappingURL=compileInputs.mjs.map\n","\"use strict\";\nfunction extractOutputs(fragmentSource, out) {\n let match;\n const regex = /@out\\s+([^;]+);/g;\n while ((match = regex.exec(fragmentSource)) !== null) {\n out.push(match[1]);\n }\n}\nfunction extractVariableName(value) {\n const regex = /\\b(\\w+)\\s*:/g;\n const match = regex.exec(value);\n return match ? match[1] : \"\";\n}\nfunction stripVariable(value) {\n const regex = /@.*?\\s+/g;\n return value.replace(regex, \"\");\n}\nfunction compileOutputs(fragments, template) {\n const results = [];\n extractOutputs(template, results);\n fragments.forEach((fragment) => {\n if (fragment.header) {\n extractOutputs(fragment.header, results);\n }\n });\n let index = 0;\n const mainStruct = results.sort().map((inValue) => {\n if (inValue.indexOf(\"builtin\") > -1) {\n return inValue;\n }\n return `@location(${index++}) ${inValue}`;\n }).join(\",\\n\");\n const mainStart = results.sort().map((inValue) => ` var ${stripVariable(inValue)};`).join(\"\\n\");\n const mainEnd = `return VSOutput(\n ${results.sort().map((inValue) => ` ${extractVariableName(inValue)}`).join(\",\\n\")});`;\n let compiledCode = template.replace(/@out\\s+[^;]+;\\s*/g, \"\");\n compiledCode = compiledCode.replace(\"{{struct}}\", `\n${mainStruct}\n`);\n compiledCode = compiledCode.replace(\"{{start}}\", `\n${mainStart}\n`);\n compiledCode = compiledCode.replace(\"{{return}}\", `\n${mainEnd}\n`);\n return compiledCode;\n}\n\nexport { compileOutputs };\n//# sourceMappingURL=compileOutputs.mjs.map\n","\"use strict\";\nfunction injectBits(templateSrc, fragmentParts) {\n let out = templateSrc;\n for (const i in fragmentParts) {\n const parts = fragmentParts[i];\n const toInject = parts.join(\"\\n\");\n if (toInject.length) {\n out = out.replace(`{{${i}}}`, `//-----${i} START-----//\n${parts.join(\"\\n\")}\n//----${i} FINISH----//`);\n } else {\n out = out.replace(`{{${i}}}`, \"\");\n }\n }\n return out;\n}\n\nexport { injectBits };\n//# sourceMappingURL=injectBits.mjs.map\n","import { addBits } from './utils/addBits.mjs';\nimport { compileHooks } from './utils/compileHooks.mjs';\nimport { compileInputs } from './utils/compileInputs.mjs';\nimport { compileOutputs } from './utils/compileOutputs.mjs';\nimport { injectBits } from './utils/injectBits.mjs';\n\n\"use strict\";\nconst cacheMap = /* @__PURE__ */ Object.create(null);\nconst bitCacheMap = /* @__PURE__ */ new Map();\nlet CACHE_UID = 0;\nfunction compileHighShader({\n template,\n bits\n}) {\n const cacheId = generateCacheId(template, bits);\n if (cacheMap[cacheId])\n return cacheMap[cacheId];\n const { vertex, fragment } = compileInputsAndOutputs(template, bits);\n cacheMap[cacheId] = compileBits(vertex, fragment, bits);\n return cacheMap[cacheId];\n}\nfunction compileHighShaderGl({\n template,\n bits\n}) {\n const cacheId = generateCacheId(template, bits);\n if (cacheMap[cacheId])\n return cacheMap[cacheId];\n cacheMap[cacheId] = compileBits(template.vertex, template.fragment, bits);\n return cacheMap[cacheId];\n}\nfunction compileInputsAndOutputs(template, bits) {\n const vertexFragments = bits.map((shaderBit) => shaderBit.vertex).filter((v) => !!v);\n const fragmentFragments = bits.map((shaderBit) => shaderBit.fragment).filter((v) => !!v);\n let compiledVertex = compileInputs(vertexFragments, template.vertex, true);\n compiledVertex = compileOutputs(vertexFragments, compiledVertex);\n const compiledFragment = compileInputs(fragmentFragments, template.fragment, true);\n return {\n vertex: compiledVertex,\n fragment: compiledFragment\n };\n}\nfunction generateCacheId(template, bits) {\n return bits.map((highFragment) => {\n if (!bitCacheMap.has(highFragment)) {\n bitCacheMap.set(highFragment, CACHE_UID++);\n }\n return bitCacheMap.get(highFragment);\n }).sort((a, b) => a - b).join(\"-\") + template.vertex + template.fragment;\n}\nfunction compileBits(vertex, fragment, bits) {\n const vertexParts = compileHooks(vertex);\n const fragmentParts = compileHooks(fragment);\n bits.forEach((shaderBit) => {\n addBits(shaderBit.vertex, vertexParts, shaderBit.name);\n addBits(shaderBit.fragment, fragmentParts, shaderBit.name);\n });\n return {\n vertex: injectBits(vertex, vertexParts),\n fragment: injectBits(fragment, fragmentParts)\n };\n}\n\nexport { compileHighShader, compileHighShaderGl };\n//# sourceMappingURL=compileHighShader.mjs.map\n","\"use strict\";\nconst vertexGPUTemplate = (\n /* wgsl */\n `\n @in aPosition: vec2;\n @in aUV: vec2;\n\n @out @builtin(position) vPosition: vec4;\n @out vUV : vec2;\n @out vColor : vec4;\n\n {{header}}\n\n struct VSOutput {\n {{struct}}\n };\n\n @vertex\n fn main( {{in}} ) -> VSOutput {\n\n var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n var modelMatrix = mat3x3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n var position = aPosition;\n var uv = aUV;\n\n {{start}}\n \n vColor = vec4(1., 1., 1., 1.);\n\n {{main}}\n\n vUV = uv;\n\n var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n \n vColor *= globalUniforms.uWorldColorAlpha;\n\n {{end}}\n\n {{return}}\n };\n`\n);\nconst fragmentGPUTemplate = (\n /* wgsl */\n `\n @in vUV : vec2;\n @in vColor : vec4;\n \n {{header}}\n\n @fragment\n fn main(\n {{in}}\n ) -> @location(0) vec4 {\n \n {{start}}\n\n var outColor:vec4;\n \n {{main}}\n \n return outColor * vColor;\n };\n`\n);\nconst vertexGlTemplate = (\n /* glsl */\n `\n in vec2 aPosition;\n in vec2 aUV;\n\n out vec4 vColor;\n out vec2 vUV;\n\n {{header}}\n\n void main(void){\n\n mat3 worldTransformMatrix = uWorldTransformMatrix;\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n vec2 position = aPosition;\n vec2 uv = aUV;\n \n {{start}}\n \n vColor = vec4(1.);\n \n {{main}}\n \n vUV = uv;\n \n mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= uWorldColorAlpha;\n\n {{end}}\n }\n`\n);\nconst fragmentGlTemplate = (\n /* glsl */\n `\n \n in vec4 vColor;\n in vec2 vUV;\n\n out vec4 finalColor;\n\n {{header}}\n\n void main(void) {\n \n {{start}}\n\n vec4 outColor;\n \n {{main}}\n \n finalColor = outColor * vColor;\n }\n`\n);\n\nexport { fragmentGPUTemplate, fragmentGlTemplate, vertexGPUTemplate, vertexGlTemplate };\n//# sourceMappingURL=defaultProgramTemplate.mjs.map\n","\"use strict\";\nconst globalUniformsBit = {\n name: \"global-uniforms-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n struct GlobalUniforms {\n uProjectionMatrix:mat3x3,\n uWorldTransformMatrix:mat3x3,\n uWorldColorAlpha: vec4,\n uResolution: vec2,\n }\n\n @group(0) @binding(0) var globalUniforms : GlobalUniforms;\n `\n )\n }\n};\nconst globalUniformsUBOBitGl = {\n name: \"global-uniforms-ubo-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n uniform globalUniforms {\n mat3 uProjectionMatrix;\n mat3 uWorldTransformMatrix;\n vec4 uWorldColorAlpha;\n vec2 uResolution;\n };\n `\n )\n }\n};\nconst globalUniformsBitGl = {\n name: \"global-uniforms-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform vec4 uWorldColorAlpha;\n uniform vec2 uResolution;\n `\n )\n }\n};\n\nexport { globalUniformsBit, globalUniformsBitGl, globalUniformsUBOBitGl };\n//# sourceMappingURL=globalUniformsBit.mjs.map\n","import { GlProgram } from '../renderers/gl/shader/GlProgram.mjs';\nimport { GpuProgram } from '../renderers/gpu/shader/GpuProgram.mjs';\nimport { compileHighShader, compileHighShaderGl } from './compiler/compileHighShader.mjs';\nimport { fragmentGPUTemplate, vertexGPUTemplate, vertexGlTemplate, fragmentGlTemplate } from './defaultProgramTemplate.mjs';\nimport { globalUniformsBit, globalUniformsBitGl } from './shader-bits/globalUniformsBit.mjs';\n\n\"use strict\";\nfunction compileHighShaderGpuProgram({ bits, name }) {\n const source = compileHighShader({\n template: {\n fragment: fragmentGPUTemplate,\n vertex: vertexGPUTemplate\n },\n bits: [\n globalUniformsBit,\n ...bits\n ]\n });\n return GpuProgram.from({\n name,\n vertex: {\n source: source.vertex,\n entryPoint: \"main\"\n },\n fragment: {\n source: source.fragment,\n entryPoint: \"main\"\n }\n });\n}\nfunction compileHighShaderGlProgram({ bits, name }) {\n return new GlProgram({\n name,\n ...compileHighShaderGl({\n template: {\n vertex: vertexGlTemplate,\n fragment: fragmentGlTemplate\n },\n bits: [\n globalUniformsBitGl,\n ...bits\n ]\n })\n });\n}\n\nexport { compileHighShaderGlProgram, compileHighShaderGpuProgram };\n//# sourceMappingURL=compileHighShaderToProgram.mjs.map\n","\"use strict\";\nconst colorBit = {\n name: \"color-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n @in aColor: vec4;\n `\n ),\n main: (\n /* wgsl */\n `\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n `\n )\n }\n};\nconst colorBitGl = {\n name: \"color-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n in vec4 aColor;\n `\n ),\n main: (\n /* glsl */\n `\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n `\n )\n }\n};\n\nexport { colorBit, colorBitGl };\n//# sourceMappingURL=colorBit.mjs.map\n","\"use strict\";\nconst textureBatchBitGpuCache = {};\nfunction generateBindingSrc(maxTextures) {\n const src = [];\n if (maxTextures === 1) {\n src.push(\"@group(1) @binding(0) var textureSource1: texture_2d;\");\n src.push(\"@group(1) @binding(1) var textureSampler1: sampler;\");\n } else {\n let bindingIndex = 0;\n for (let i = 0; i < maxTextures; i++) {\n src.push(`@group(1) @binding(${bindingIndex++}) var textureSource${i + 1}: texture_2d;`);\n src.push(`@group(1) @binding(${bindingIndex++}) var textureSampler${i + 1}: sampler;`);\n }\n }\n return src.join(\"\\n\");\n}\nfunction generateSampleSrc(maxTextures) {\n const src = [];\n if (maxTextures === 1) {\n src.push(\"outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);\");\n } else {\n src.push(\"switch vTextureId {\");\n for (let i = 0; i < maxTextures; i++) {\n if (i === maxTextures - 1) {\n src.push(` default:{`);\n } else {\n src.push(` case ${i}:{`);\n }\n src.push(` outColor = textureSampleGrad(textureSource${i + 1}, textureSampler${i + 1}, vUV, uvDx, uvDy);`);\n src.push(` break;}`);\n }\n src.push(`}`);\n }\n return src.join(\"\\n\");\n}\nfunction generateTextureBatchBit(maxTextures) {\n if (!textureBatchBitGpuCache[maxTextures]) {\n textureBatchBitGpuCache[maxTextures] = {\n name: \"texture-batch-bit\",\n vertex: {\n header: `\n @in aTextureIdAndRound: vec2;\n @out @interpolate(flat) vTextureId : u32;\n `,\n main: `\n vTextureId = aTextureIdAndRound.y;\n `,\n end: `\n if(aTextureIdAndRound.x == 1)\n {\n vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n `\n },\n fragment: {\n header: `\n @in @interpolate(flat) vTextureId: u32;\n\n ${generateBindingSrc(maxTextures)}\n `,\n main: `\n var uvDx = dpdx(vUV);\n var uvDy = dpdy(vUV);\n\n ${generateSampleSrc(maxTextures)}\n `\n }\n };\n }\n return textureBatchBitGpuCache[maxTextures];\n}\nconst textureBatchBitGlCache = {};\nfunction generateSampleGlSrc(maxTextures) {\n const src = [];\n for (let i = 0; i < maxTextures; i++) {\n if (i > 0) {\n src.push(\"else\");\n }\n if (i < maxTextures - 1) {\n src.push(`if(vTextureId < ${i}.5)`);\n }\n src.push(\"{\");\n src.push(`\toutColor = texture(uTextures[${i}], vUV);`);\n src.push(\"}\");\n }\n return src.join(\"\\n\");\n}\nfunction generateTextureBatchBitGl(maxTextures) {\n if (!textureBatchBitGlCache[maxTextures]) {\n textureBatchBitGlCache[maxTextures] = {\n name: \"texture-batch-bit\",\n vertex: {\n header: `\n in vec2 aTextureIdAndRound;\n out float vTextureId;\n\n `,\n main: `\n vTextureId = aTextureIdAndRound.y;\n `,\n end: `\n if(aTextureIdAndRound.x == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n `\n },\n fragment: {\n header: `\n in float vTextureId;\n\n uniform sampler2D uTextures[${maxTextures}];\n\n `,\n main: `\n\n ${generateSampleGlSrc(maxTextures)}\n `\n }\n };\n }\n return textureBatchBitGlCache[maxTextures];\n}\n\nexport { generateTextureBatchBit, generateTextureBatchBitGl };\n//# sourceMappingURL=generateTextureBatchBit.mjs.map\n","\"use strict\";\nconst roundPixelsBit = {\n name: \"round-pixels-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n fn roundPixels(position: vec2, targetSize: vec2) -> vec2 \n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n `\n )\n }\n};\nconst roundPixelsBitGl = {\n name: \"round-pixels-bit\",\n vertex: {\n header: (\n /* glsl */\n ` \n vec2 roundPixels(vec2 position, vec2 targetSize)\n { \n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n `\n )\n }\n};\n\nexport { roundPixelsBit, roundPixelsBitGl };\n//# sourceMappingURL=roundPixelsBit.mjs.map\n","import { UniformGroup } from '../../shared/shader/UniformGroup.mjs';\n\n\"use strict\";\nconst batchSamplersUniformGroupHash = {};\nfunction getBatchSamplersUniformGroup(maxTextures) {\n let batchSamplersUniformGroup = batchSamplersUniformGroupHash[maxTextures];\n if (batchSamplersUniformGroup)\n return batchSamplersUniformGroup;\n const sampleValues = new Int32Array(maxTextures);\n for (let i = 0; i < maxTextures; i++) {\n sampleValues[i] = i;\n }\n batchSamplersUniformGroup = batchSamplersUniformGroupHash[maxTextures] = new UniformGroup({\n uTextures: { value: sampleValues, type: `i32`, size: maxTextures }\n }, { isStatic: true });\n return batchSamplersUniformGroup;\n}\n\nexport { getBatchSamplersUniformGroup };\n//# sourceMappingURL=getBatchSamplersUniformGroup.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { compileHighShaderGlProgram } from '../../high-shader/compileHighShaderToProgram.mjs';\nimport { colorBitGl } from '../../high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBitGl } from '../../high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { roundPixelsBitGl } from '../../high-shader/shader-bits/roundPixelsBit.mjs';\nimport { getBatchSamplersUniformGroup } from '../../renderers/gl/shader/getBatchSamplersUniformGroup.mjs';\nimport { Shader } from '../../renderers/shared/shader/Shader.mjs';\nimport { State } from '../../renderers/shared/state/State.mjs';\nimport { getMaxTexturesPerBatch } from './utils/maxRecommendedTextures.mjs';\n\n\"use strict\";\nclass GlBatchAdaptor {\n constructor() {\n this._didUpload = false;\n this._tempState = State.for2d();\n }\n init(batcherPipe) {\n const maxTextures = getMaxTexturesPerBatch();\n const glProgram = compileHighShaderGlProgram({\n name: \"batch\",\n bits: [\n colorBitGl,\n generateTextureBatchBitGl(maxTextures),\n roundPixelsBitGl\n ]\n });\n this._shader = new Shader({\n glProgram,\n resources: {\n batchSamplers: getBatchSamplersUniformGroup(maxTextures)\n }\n });\n batcherPipe.renderer.runners.contextChange.add(this);\n }\n contextChange() {\n this._didUpload = false;\n }\n start(batchPipe, geometry) {\n const renderer = batchPipe.renderer;\n renderer.shader.bind(this._shader, this._didUpload);\n renderer.shader.updateUniformGroup(renderer.globalUniforms.uniformGroup);\n renderer.geometry.bind(geometry, this._shader.glProgram);\n }\n execute(batchPipe, batch) {\n const renderer = batchPipe.renderer;\n this._didUpload = true;\n this._tempState.blendMode = batch.blendMode;\n renderer.state.set(this._tempState);\n const textures = batch.textures.textures;\n for (let i = 0; i < batch.textures.count; i++) {\n renderer.texture.bind(textures[i], i);\n }\n renderer.geometry.draw(\"triangle-list\", batch.size, batch.start);\n }\n destroy() {\n this._shader.destroy(true);\n this._shader = null;\n }\n}\n/** @ignore */\nGlBatchAdaptor.extension = {\n type: [\n ExtensionType.WebGLPipesAdaptor\n ],\n name: \"batch\"\n};\n\nexport { GlBatchAdaptor };\n//# sourceMappingURL=GlBatchAdaptor.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { compileHighShaderGpuProgram } from '../../high-shader/compileHighShaderToProgram.mjs';\nimport { colorBit } from '../../high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBit } from '../../high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { roundPixelsBit } from '../../high-shader/shader-bits/roundPixelsBit.mjs';\nimport { Shader } from '../../renderers/shared/shader/Shader.mjs';\nimport { State } from '../../renderers/shared/state/State.mjs';\nimport { getMaxTexturesPerBatch } from '../gl/utils/maxRecommendedTextures.mjs';\nimport { getTextureBatchBindGroup } from './getTextureBatchBindGroup.mjs';\n\n\"use strict\";\nconst tempState = State.for2d();\nclass GpuBatchAdaptor {\n init() {\n const gpuProgram = compileHighShaderGpuProgram({\n name: \"batch\",\n bits: [\n colorBit,\n generateTextureBatchBit(getMaxTexturesPerBatch()),\n roundPixelsBit\n ]\n });\n this._shader = new Shader({\n gpuProgram,\n groups: {\n // these will be dynamically allocated\n }\n });\n }\n start(batchPipe, geometry) {\n const renderer = batchPipe.renderer;\n const encoder = renderer.encoder;\n const program = this._shader.gpuProgram;\n this._geometry = geometry;\n encoder.setGeometry(geometry);\n tempState.blendMode = \"normal\";\n renderer.pipeline.getPipeline(\n geometry,\n program,\n tempState\n );\n const globalUniformsBindGroup = renderer.globalUniforms.bindGroup;\n encoder.resetBindGroup(1);\n encoder.setBindGroup(0, globalUniformsBindGroup, program);\n }\n execute(batchPipe, batch) {\n const program = this._shader.gpuProgram;\n const renderer = batchPipe.renderer;\n const encoder = renderer.encoder;\n if (!batch.bindGroup) {\n const textureBatch = batch.textures;\n batch.bindGroup = getTextureBatchBindGroup(textureBatch.textures, textureBatch.count);\n }\n tempState.blendMode = batch.blendMode;\n const gpuBindGroup = renderer.bindGroup.getBindGroup(\n batch.bindGroup,\n program,\n 1\n );\n const pipeline = renderer.pipeline.getPipeline(\n this._geometry,\n program,\n tempState\n );\n batch.bindGroup._touch(renderer.textureGC.count);\n encoder.setPipeline(pipeline);\n encoder.renderPassEncoder.setBindGroup(1, gpuBindGroup);\n encoder.renderPassEncoder.drawIndexed(batch.size, 1, batch.start);\n }\n destroy() {\n this._shader.destroy(true);\n this._shader = null;\n }\n}\n/** @ignore */\nGpuBatchAdaptor.extension = {\n type: [\n ExtensionType.WebGPUPipesAdaptor\n ],\n name: \"batch\"\n};\n\nexport { GpuBatchAdaptor };\n//# sourceMappingURL=GpuBatchAdaptor.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { State } from '../../renderers/shared/state/State.mjs';\nimport { Batcher } from './Batcher.mjs';\nimport { BatchGeometry } from './BatchGeometry.mjs';\n\n\"use strict\";\nclass BatcherPipe {\n constructor(renderer, adaptor) {\n this.state = State.for2d();\n this._batches = /* @__PURE__ */ Object.create(null);\n this._geometries = /* @__PURE__ */ Object.create(null);\n this.renderer = renderer;\n this._adaptor = adaptor;\n this._adaptor.init(this);\n }\n buildStart(instructionSet) {\n if (!this._batches[instructionSet.uid]) {\n const batcher = new Batcher();\n this._batches[instructionSet.uid] = batcher;\n this._geometries[batcher.uid] = new BatchGeometry();\n }\n this._activeBatch = this._batches[instructionSet.uid];\n this._activeGeometry = this._geometries[this._activeBatch.uid];\n this._activeBatch.begin();\n }\n addToBatch(batchableObject) {\n this._activeBatch.add(batchableObject);\n }\n break(instructionSet) {\n this._activeBatch.break(instructionSet);\n }\n buildEnd(instructionSet) {\n const activeBatch = this._activeBatch;\n const geometry = this._activeGeometry;\n activeBatch.finish(instructionSet);\n geometry.indexBuffer.setDataWithSize(activeBatch.indexBuffer, activeBatch.indexSize, true);\n geometry.buffers[0].setDataWithSize(activeBatch.attributeBuffer.float32View, activeBatch.attributeSize, false);\n }\n upload(instructionSet) {\n const batcher = this._batches[instructionSet.uid];\n const geometry = this._geometries[batcher.uid];\n if (batcher.dirty) {\n batcher.dirty = false;\n geometry.buffers[0].update(batcher.attributeSize * 4);\n }\n }\n execute(batch) {\n if (batch.action === \"startBatch\") {\n const batcher = batch.batcher;\n const geometry = this._geometries[batcher.uid];\n this._adaptor.start(this, geometry);\n }\n this._adaptor.execute(this, batch);\n }\n destroy() {\n this.state = null;\n this.renderer = null;\n this._adaptor.destroy();\n this._adaptor = null;\n for (const i in this._batches) {\n this._batches[i].destroy();\n }\n this._batches = null;\n for (const i in this._geometries) {\n this._geometries[i].destroy();\n }\n this._geometries = null;\n }\n}\n/** @ignore */\nBatcherPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"batch\"\n};\n\nexport { BatcherPipe };\n//# sourceMappingURL=BatcherPipe.mjs.map\n","\"use strict\";\nconst localUniformBit = {\n name: \"local-uniform-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n\n struct LocalUniforms {\n uTransformMatrix:mat3x3,\n uColor:vec4,\n uRound:f32,\n }\n\n @group(1) @binding(0) var localUniforms : LocalUniforms;\n `\n ),\n main: (\n /* wgsl */\n `\n vColor *= localUniforms.uColor;\n modelMatrix *= localUniforms.uTransformMatrix;\n `\n ),\n end: (\n /* wgsl */\n `\n if(localUniforms.uRound == 1)\n {\n vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n `\n )\n }\n};\nconst localUniformBitGroup2 = {\n ...localUniformBit,\n vertex: {\n ...localUniformBit.vertex,\n // replace the group!\n header: localUniformBit.vertex.header.replace(\"group(1)\", \"group(2)\")\n }\n};\nconst localUniformBitGl = {\n name: \"local-uniform-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n\n uniform mat3 uTransformMatrix;\n uniform vec4 uColor;\n uniform float uRound;\n `\n ),\n main: (\n /* glsl */\n `\n vColor *= uColor;\n modelMatrix = uTransformMatrix;\n `\n ),\n end: (\n /* glsl */\n `\n if(uRound == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n `\n )\n }\n};\n\nexport { localUniformBit, localUniformBitGl, localUniformBitGroup2 };\n//# sourceMappingURL=localUniformBit.mjs.map\n","\"use strict\";\nconst textureBit = {\n name: \"texture-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n\n struct TextureUniforms {\n uTextureMatrix:mat3x3,\n }\n\n @group(2) @binding(2) var textureUniforms : TextureUniforms;\n `\n ),\n main: (\n /* wgsl */\n `\n uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;\n `\n )\n },\n fragment: {\n header: (\n /* wgsl */\n `\n @group(2) @binding(0) var uTexture: texture_2d;\n @group(2) @binding(1) var uSampler: sampler;\n\n \n `\n ),\n main: (\n /* wgsl */\n `\n outColor = textureSample(uTexture, uSampler, vUV);\n `\n )\n }\n};\nconst textureBitGl = {\n name: \"texture-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n uniform mat3 uTextureMatrix;\n `\n ),\n main: (\n /* glsl */\n `\n uv = (uTextureMatrix * vec3(uv, 1.0)).xy;\n `\n )\n },\n fragment: {\n header: (\n /* glsl */\n `\n uniform sampler2D uTexture;\n\n \n `\n ),\n main: (\n /* glsl */\n `\n outColor = texture(uTexture, vUV);\n `\n )\n }\n};\n\nexport { textureBit, textureBitGl };\n//# sourceMappingURL=textureBit.mjs.map\n","\"use strict\";\nfunction buildInstructions(renderGroup, renderPipes) {\n const root = renderGroup.root;\n const instructionSet = renderGroup.instructionSet;\n instructionSet.reset();\n renderPipes.batch.buildStart(instructionSet);\n renderPipes.blendMode.buildStart();\n renderPipes.colorMask.buildStart();\n if (root.sortableChildren) {\n root.sortChildren();\n }\n collectAllRenderablesAdvanced(root, instructionSet, renderPipes, true);\n renderPipes.batch.buildEnd(instructionSet);\n renderPipes.blendMode.buildEnd(instructionSet);\n}\nfunction collectAllRenderables(container, instructionSet, rendererPipes) {\n if (container.globalDisplayStatus < 7 || !container.includeInBuild)\n return;\n if (container.sortableChildren) {\n container.sortChildren();\n }\n if (container.isSimple) {\n collectAllRenderablesSimple(container, instructionSet, rendererPipes);\n } else {\n collectAllRenderablesAdvanced(container, instructionSet, rendererPipes, false);\n }\n}\nfunction collectAllRenderablesSimple(container, instructionSet, renderPipes) {\n if (container.renderPipeId) {\n renderPipes.blendMode.setBlendMode(container, container.groupBlendMode, instructionSet);\n container.didViewUpdate = false;\n const rp = renderPipes;\n rp[container.renderPipeId].addRenderable(container, instructionSet);\n }\n if (!container.renderGroup) {\n const children = container.children;\n const length = children.length;\n for (let i = 0; i < length; i++) {\n collectAllRenderables(children[i], instructionSet, renderPipes);\n }\n }\n}\nfunction collectAllRenderablesAdvanced(container, instructionSet, renderPipes, isRoot) {\n if (!isRoot && container.renderGroup) {\n renderPipes.renderGroup.addRenderGroup(container.renderGroup, instructionSet);\n } else {\n for (let i = 0; i < container.effects.length; i++) {\n const effect = container.effects[i];\n const pipe = renderPipes[effect.pipe];\n pipe.push(effect, container, instructionSet);\n }\n const renderPipeId = container.renderPipeId;\n if (renderPipeId) {\n renderPipes.blendMode.setBlendMode(container, container.groupBlendMode, instructionSet);\n container.didViewUpdate = false;\n const pipe = renderPipes[renderPipeId];\n pipe.addRenderable(container, instructionSet);\n }\n const children = container.children;\n if (children.length) {\n for (let i = 0; i < children.length; i++) {\n collectAllRenderables(children[i], instructionSet, renderPipes);\n }\n }\n for (let i = container.effects.length - 1; i >= 0; i--) {\n const effect = container.effects[i];\n const pipe = renderPipes[effect.pipe];\n pipe.pop(effect, container, instructionSet);\n }\n }\n}\n\nexport { buildInstructions, collectAllRenderables };\n//# sourceMappingURL=buildInstructions.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { FilterEffect } from '../../../filters/FilterEffect.mjs';\nimport { MaskFilter } from '../../../filters/mask/MaskFilter.mjs';\nimport { Bounds } from '../../../scene/container/bounds/Bounds.mjs';\nimport { getGlobalBounds } from '../../../scene/container/bounds/getGlobalBounds.mjs';\nimport { collectAllRenderables } from '../../../scene/container/utils/buildInstructions.mjs';\nimport { Sprite } from '../../../scene/sprite/Sprite.mjs';\nimport { BigPool } from '../../../utils/pool/PoolGroup.mjs';\nimport { Texture } from '../../renderers/shared/texture/Texture.mjs';\nimport { TexturePool } from '../../renderers/shared/texture/TexturePool.mjs';\nimport { RendererType } from '../../renderers/types.mjs';\n\n\"use strict\";\nconst tempBounds = new Bounds();\nclass AlphaMaskEffect extends FilterEffect {\n constructor() {\n super();\n this.filters = [new MaskFilter({\n sprite: new Sprite(Texture.EMPTY),\n resolution: \"inherit\",\n antialias: \"inherit\"\n })];\n }\n get sprite() {\n return this.filters[0].sprite;\n }\n set sprite(value) {\n this.filters[0].sprite = value;\n }\n}\nclass AlphaMaskPipe {\n constructor(renderer) {\n this._activeMaskStage = [];\n this._renderer = renderer;\n }\n push(mask, maskedContainer, instructionSet) {\n const renderer = this._renderer;\n renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"alphaMask\",\n action: \"pushMaskBegin\",\n mask,\n canBundle: false,\n maskedContainer\n });\n if (mask.renderMaskToTexture) {\n const maskContainer = mask.mask;\n maskContainer.includeInBuild = true;\n collectAllRenderables(\n maskContainer,\n instructionSet,\n renderer.renderPipes\n );\n maskContainer.includeInBuild = false;\n }\n renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"alphaMask\",\n action: \"pushMaskEnd\",\n mask,\n maskedContainer,\n canBundle: false\n });\n }\n pop(mask, _maskedContainer, instructionSet) {\n const renderer = this._renderer;\n renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"alphaMask\",\n action: \"popMaskEnd\",\n mask,\n canBundle: false\n });\n }\n execute(instruction) {\n const renderer = this._renderer;\n const renderMask = instruction.mask.renderMaskToTexture;\n if (instruction.action === \"pushMaskBegin\") {\n const filterEffect = BigPool.get(AlphaMaskEffect);\n if (renderMask) {\n instruction.mask.mask.measurable = true;\n const bounds = getGlobalBounds(instruction.mask.mask, true, tempBounds);\n instruction.mask.mask.measurable = false;\n bounds.ceil();\n const colorTextureSource = renderer.renderTarget.renderTarget.colorTexture.source;\n const filterTexture = TexturePool.getOptimalTexture(\n bounds.width,\n bounds.height,\n colorTextureSource._resolution,\n colorTextureSource.antialias\n );\n renderer.renderTarget.push(filterTexture, true);\n renderer.globalUniforms.push({\n offset: bounds,\n worldColor: 4294967295\n });\n const sprite = filterEffect.sprite;\n sprite.texture = filterTexture;\n sprite.worldTransform.tx = bounds.minX;\n sprite.worldTransform.ty = bounds.minY;\n this._activeMaskStage.push({\n filterEffect,\n maskedContainer: instruction.maskedContainer,\n filterTexture\n });\n } else {\n filterEffect.sprite = instruction.mask.mask;\n this._activeMaskStage.push({\n filterEffect,\n maskedContainer: instruction.maskedContainer\n });\n }\n } else if (instruction.action === \"pushMaskEnd\") {\n const maskData = this._activeMaskStage[this._activeMaskStage.length - 1];\n if (renderMask) {\n if (renderer.type === RendererType.WEBGL) {\n renderer.renderTarget.finishRenderPass();\n }\n renderer.renderTarget.pop();\n renderer.globalUniforms.pop();\n }\n renderer.filter.push({\n renderPipeId: \"filter\",\n action: \"pushFilter\",\n container: maskData.maskedContainer,\n filterEffect: maskData.filterEffect,\n canBundle: false\n });\n } else if (instruction.action === \"popMaskEnd\") {\n renderer.filter.pop();\n const maskData = this._activeMaskStage.pop();\n if (renderMask) {\n TexturePool.returnTexture(maskData.filterTexture);\n }\n BigPool.return(maskData.filterEffect);\n }\n }\n destroy() {\n this._renderer = null;\n this._activeMaskStage = null;\n }\n}\n/** @ignore */\nAlphaMaskPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"alphaMask\"\n};\n\nexport { AlphaMaskPipe };\n//# sourceMappingURL=AlphaMaskPipe.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass ColorMaskPipe {\n constructor(renderer) {\n this._colorStack = [];\n this._colorStackIndex = 0;\n this._currentColor = 0;\n this._renderer = renderer;\n }\n buildStart() {\n this._colorStack[0] = 15;\n this._colorStackIndex = 1;\n this._currentColor = 15;\n }\n push(mask, _container, instructionSet) {\n const renderer = this._renderer;\n renderer.renderPipes.batch.break(instructionSet);\n const colorStack = this._colorStack;\n colorStack[this._colorStackIndex] = colorStack[this._colorStackIndex - 1] & mask.mask;\n const currentColor = this._colorStack[this._colorStackIndex];\n if (currentColor !== this._currentColor) {\n this._currentColor = currentColor;\n instructionSet.add({\n renderPipeId: \"colorMask\",\n colorMask: currentColor,\n canBundle: false\n });\n }\n this._colorStackIndex++;\n }\n pop(_mask, _container, instructionSet) {\n const renderer = this._renderer;\n renderer.renderPipes.batch.break(instructionSet);\n const colorStack = this._colorStack;\n this._colorStackIndex--;\n const currentColor = colorStack[this._colorStackIndex - 1];\n if (currentColor !== this._currentColor) {\n this._currentColor = currentColor;\n instructionSet.add({\n renderPipeId: \"colorMask\",\n colorMask: currentColor,\n canBundle: false\n });\n }\n }\n execute(instruction) {\n const renderer = this._renderer;\n renderer.colorMask.setMask(instruction.colorMask);\n }\n destroy() {\n this._colorStack = null;\n }\n}\n/** @ignore */\nColorMaskPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"colorMask\"\n};\n\nexport { ColorMaskPipe };\n//# sourceMappingURL=ColorMaskPipe.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { collectAllRenderables } from '../../../scene/container/utils/buildInstructions.mjs';\nimport { CLEAR } from '../../renderers/gl/const.mjs';\nimport { STENCIL_MODES } from '../../renderers/shared/state/const.mjs';\n\n\"use strict\";\nclass StencilMaskPipe {\n constructor(renderer) {\n // used when building and also when executing..\n this._maskStackHash = {};\n this._maskHash = /* @__PURE__ */ new WeakMap();\n this._renderer = renderer;\n }\n push(mask, _container, instructionSet) {\n var _a;\n const effect = mask;\n const renderer = this._renderer;\n renderer.renderPipes.batch.break(instructionSet);\n renderer.renderPipes.blendMode.setBlendMode(effect.mask, \"none\", instructionSet);\n instructionSet.add({\n renderPipeId: \"stencilMask\",\n action: \"pushMaskBegin\",\n mask,\n canBundle: false\n });\n const maskContainer = effect.mask;\n maskContainer.includeInBuild = true;\n if (!this._maskHash.has(effect)) {\n this._maskHash.set(effect, {\n instructionsStart: 0,\n instructionsLength: 0\n });\n }\n const maskData = this._maskHash.get(effect);\n maskData.instructionsStart = instructionSet.instructionSize;\n collectAllRenderables(\n maskContainer,\n instructionSet,\n renderer.renderPipes\n );\n maskContainer.includeInBuild = false;\n renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"stencilMask\",\n action: \"pushMaskEnd\",\n mask,\n canBundle: false\n });\n const instructionsLength = instructionSet.instructionSize - maskData.instructionsStart - 1;\n maskData.instructionsLength = instructionsLength;\n const renderTargetUid = renderer.renderTarget.renderTarget.uid;\n (_a = this._maskStackHash)[renderTargetUid] ?? (_a[renderTargetUid] = 0);\n }\n pop(mask, _container, instructionSet) {\n const effect = mask;\n const renderer = this._renderer;\n renderer.renderPipes.batch.break(instructionSet);\n renderer.renderPipes.blendMode.setBlendMode(effect.mask, \"none\", instructionSet);\n instructionSet.add({\n renderPipeId: \"stencilMask\",\n action: \"popMaskBegin\",\n canBundle: false\n });\n const maskData = this._maskHash.get(mask);\n for (let i = 0; i < maskData.instructionsLength; i++) {\n instructionSet.instructions[instructionSet.instructionSize++] = instructionSet.instructions[maskData.instructionsStart++];\n }\n instructionSet.add({\n renderPipeId: \"stencilMask\",\n action: \"popMaskEnd\",\n canBundle: false\n });\n }\n execute(instruction) {\n var _a;\n const renderer = this._renderer;\n const renderTargetUid = renderer.renderTarget.renderTarget.uid;\n let maskStackIndex = (_a = this._maskStackHash)[renderTargetUid] ?? (_a[renderTargetUid] = 0);\n if (instruction.action === \"pushMaskBegin\") {\n renderer.renderTarget.ensureDepthStencil();\n renderer.stencil.setStencilMode(STENCIL_MODES.RENDERING_MASK_ADD, maskStackIndex);\n maskStackIndex++;\n renderer.colorMask.setMask(0);\n } else if (instruction.action === \"pushMaskEnd\") {\n renderer.stencil.setStencilMode(STENCIL_MODES.MASK_ACTIVE, maskStackIndex);\n renderer.colorMask.setMask(15);\n } else if (instruction.action === \"popMaskBegin\") {\n renderer.colorMask.setMask(0);\n if (maskStackIndex !== 0) {\n renderer.stencil.setStencilMode(STENCIL_MODES.RENDERING_MASK_REMOVE, maskStackIndex);\n } else {\n renderer.renderTarget.clear(null, CLEAR.STENCIL);\n renderer.stencil.setStencilMode(STENCIL_MODES.DISABLED, maskStackIndex);\n }\n maskStackIndex--;\n } else if (instruction.action === \"popMaskEnd\") {\n renderer.stencil.setStencilMode(STENCIL_MODES.MASK_ACTIVE, maskStackIndex);\n renderer.colorMask.setMask(15);\n }\n this._maskStackHash[renderTargetUid] = maskStackIndex;\n }\n destroy() {\n this._renderer = null;\n this._maskStackHash = null;\n this._maskHash = null;\n }\n}\nStencilMaskPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"stencilMask\"\n};\n\nexport { StencilMaskPipe };\n//# sourceMappingURL=StencilMaskPipe.mjs.map\n","\"use strict\";\nvar BUFFER_TYPE = /* @__PURE__ */ ((BUFFER_TYPE2) => {\n BUFFER_TYPE2[BUFFER_TYPE2[\"ELEMENT_ARRAY_BUFFER\"] = 34963] = \"ELEMENT_ARRAY_BUFFER\";\n BUFFER_TYPE2[BUFFER_TYPE2[\"ARRAY_BUFFER\"] = 34962] = \"ARRAY_BUFFER\";\n BUFFER_TYPE2[BUFFER_TYPE2[\"UNIFORM_BUFFER\"] = 35345] = \"UNIFORM_BUFFER\";\n return BUFFER_TYPE2;\n})(BUFFER_TYPE || {});\n\nexport { BUFFER_TYPE };\n//# sourceMappingURL=const.mjs.map\n","\"use strict\";\nclass GlBuffer {\n constructor(buffer, type) {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.type = type;\n }\n}\n\nexport { GlBuffer };\n//# sourceMappingURL=GlBuffer.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { BufferUsage } from '../../shared/buffer/const.mjs';\nimport { BUFFER_TYPE } from './const.mjs';\nimport { GlBuffer } from './GlBuffer.mjs';\n\n\"use strict\";\nclass GlBufferSystem {\n /**\n * @param {Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer) {\n this._gpuBuffers = /* @__PURE__ */ Object.create(null);\n /** Cache keeping track of the base bound buffer bases */\n this._boundBufferBases = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n /**\n * @ignore\n */\n destroy() {\n this._renderer = null;\n this._gl = null;\n this._gpuBuffers = null;\n this._boundBufferBases = null;\n }\n /** Sets up the renderer context and necessary buffers. */\n contextChange() {\n this._gpuBuffers = /* @__PURE__ */ Object.create(null);\n this._gl = this._renderer.gl;\n }\n getGlBuffer(buffer) {\n return this._gpuBuffers[buffer.uid] || this.createGLBuffer(buffer);\n }\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer) {\n const { _gl: gl } = this;\n const glBuffer = this.getGlBuffer(buffer);\n gl.bindBuffer(glBuffer.type, glBuffer.buffer);\n }\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer, index) {\n const { _gl: gl } = this;\n if (this._boundBufferBases[index] !== buffer) {\n const glBuffer = this.getGlBuffer(buffer);\n this._boundBufferBases[index] = buffer;\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer, index, offset) {\n const { _gl: gl } = this;\n offset = offset || 0;\n const glBuffer = this.getGlBuffer(buffer);\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {Buffer} buffer - the buffer to update\n */\n updateBuffer(buffer) {\n const { _gl: gl } = this;\n const glBuffer = this.getGlBuffer(buffer);\n if (buffer._updateID === glBuffer.updateID) {\n return glBuffer;\n }\n glBuffer.updateID = buffer._updateID;\n gl.bindBuffer(glBuffer.type, glBuffer.buffer);\n const data = buffer.data;\n if (glBuffer.byteLength >= buffer.data.byteLength) {\n gl.bufferSubData(glBuffer.type, 0, data, 0, buffer._updateSize / data.BYTES_PER_ELEMENT);\n } else {\n const drawType = buffer.descriptor.usage & BufferUsage.STATIC ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n glBuffer.byteLength = data.byteLength;\n gl.bufferData(glBuffer.type, data, drawType);\n }\n return glBuffer;\n }\n /** dispose all WebGL resources of all managed buffers */\n destroyAll() {\n const gl = this._gl;\n for (const id in this._gpuBuffers) {\n gl.deleteBuffer(this._gpuBuffers[id].buffer);\n }\n this._gpuBuffers = /* @__PURE__ */ Object.create(null);\n }\n /**\n * Disposes buffer\n * @param {Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n onBufferDestroy(buffer, contextLost) {\n const glBuffer = this._gpuBuffers[buffer.uid];\n const gl = this._gl;\n if (!contextLost) {\n gl.deleteBuffer(glBuffer.buffer);\n }\n this._gpuBuffers[buffer.uid] = null;\n }\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n createGLBuffer(buffer) {\n const { _gl: gl } = this;\n let type = BUFFER_TYPE.ARRAY_BUFFER;\n if (buffer.descriptor.usage & BufferUsage.INDEX) {\n type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n } else if (buffer.descriptor.usage & BufferUsage.UNIFORM) {\n type = BUFFER_TYPE.UNIFORM_BUFFER;\n }\n const glBuffer = new GlBuffer(gl.createBuffer(), type);\n this._gpuBuffers[buffer.uid] = glBuffer;\n buffer.on(\"destroy\", this.onBufferDestroy, this);\n return glBuffer;\n }\n}\n/** @ignore */\nGlBufferSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"buffer\"\n};\n\nexport { GlBufferSystem };\n//# sourceMappingURL=GlBufferSystem.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { warn } from '../../../../utils/logging/warn.mjs';\n\n\"use strict\";\nconst _GlContextSystem = class _GlContextSystem {\n /** @param renderer - The renderer this System works for. */\n constructor(renderer) {\n /**\n * Features supported by current renderer.\n * @type {object}\n * @readonly\n */\n this.supports = {\n /** Support for 32-bit indices buffer. */\n uint32Indices: true,\n /** Support for UniformBufferObjects */\n uniformBufferObject: true,\n /** Support for VertexArrayObjects */\n vertexArrayObject: true,\n /** Support for SRGB texture format */\n srgbTextures: true,\n /** Support for wrapping modes if a texture is non-power of two */\n nonPowOf2wrapping: true,\n /** Support for MSAA (antialiasing of dynamic textures) */\n msaa: true,\n /** Support for mipmaps if a texture is non-power of two */\n nonPowOf2mipmaps: true\n };\n this._renderer = renderer;\n this.extensions = /* @__PURE__ */ Object.create(null);\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n }\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost() {\n return !this.gl || this.gl.isContextLost();\n }\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n contextChange(gl) {\n this.gl = gl;\n this._renderer.gl = gl;\n }\n init(options) {\n options = { ..._GlContextSystem.defaultOptions, ...options };\n if (options.context) {\n this.initFromContext(options.context);\n } else {\n const alpha = this._renderer.background.alpha < 1;\n const premultipliedAlpha = options.premultipliedAlpha ?? true;\n const antialias = options.antialias && !this._renderer.backBuffer.useBackBuffer;\n this.createContext(options.preferWebGLVersion, {\n alpha,\n premultipliedAlpha,\n antialias,\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: options.powerPreference ?? \"default\"\n });\n }\n }\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl) {\n this.gl = gl;\n this.webGLVersion = gl instanceof DOMAdapter.get().getWebGLRenderingContext() ? 1 : 2;\n this.getExtensions();\n this.validateContext(gl);\n this._renderer.runners.contextChange.emit(gl);\n const element = this._renderer.view.canvas;\n element.addEventListener(\"webglcontextlost\", this.handleContextLost, false);\n element.addEventListener(\"webglcontextrestored\", this.handleContextRestored, false);\n }\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param preferWebGLVersion\n * @param {object} options - context attributes\n */\n createContext(preferWebGLVersion, options) {\n let gl;\n const canvas = this._renderer.view.canvas;\n if (preferWebGLVersion === 2) {\n gl = canvas.getContext(\"webgl2\", options);\n }\n if (!gl) {\n gl = canvas.getContext(\"webgl\", options);\n if (!gl) {\n throw new Error(\"This browser does not support WebGL. Try using the canvas renderer\");\n }\n }\n this.gl = gl;\n this.initFromContext(this.gl);\n }\n /** Auto-populate the {@link GlContextSystem.extensions extensions}. */\n getExtensions() {\n const { gl } = this;\n const common = {\n anisotropicFiltering: gl.getExtension(\"EXT_texture_filter_anisotropic\"),\n floatTextureLinear: gl.getExtension(\"OES_texture_float_linear\"),\n s3tc: gl.getExtension(\"WEBGL_compressed_texture_s3tc\"),\n s3tc_sRGB: gl.getExtension(\"WEBGL_compressed_texture_s3tc_srgb\"),\n // eslint-disable-line camelcase\n etc: gl.getExtension(\"WEBGL_compressed_texture_etc\"),\n etc1: gl.getExtension(\"WEBGL_compressed_texture_etc1\"),\n pvrtc: gl.getExtension(\"WEBGL_compressed_texture_pvrtc\") || gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\"),\n atc: gl.getExtension(\"WEBGL_compressed_texture_atc\"),\n astc: gl.getExtension(\"WEBGL_compressed_texture_astc\"),\n bptc: gl.getExtension(\"EXT_texture_compression_bptc\"),\n rgtc: gl.getExtension(\"EXT_texture_compression_rgtc\"),\n loseContext: gl.getExtension(\"WEBGL_lose_context\")\n };\n if (this.webGLVersion === 1) {\n this.extensions = {\n ...common,\n drawBuffers: gl.getExtension(\"WEBGL_draw_buffers\"),\n depthTexture: gl.getExtension(\"WEBGL_depth_texture\"),\n vertexArrayObject: gl.getExtension(\"OES_vertex_array_object\") || gl.getExtension(\"MOZ_OES_vertex_array_object\") || gl.getExtension(\"WEBKIT_OES_vertex_array_object\"),\n uint32ElementIndex: gl.getExtension(\"OES_element_index_uint\"),\n // Floats and half-floats\n floatTexture: gl.getExtension(\"OES_texture_float\"),\n floatTextureLinear: gl.getExtension(\"OES_texture_float_linear\"),\n textureHalfFloat: gl.getExtension(\"OES_texture_half_float\"),\n textureHalfFloatLinear: gl.getExtension(\"OES_texture_half_float_linear\"),\n vertexAttribDivisorANGLE: gl.getExtension(\"ANGLE_instanced_arrays\"),\n srgb: gl.getExtension(\"EXT_sRGB\")\n };\n } else {\n this.extensions = {\n ...common,\n colorBufferFloat: gl.getExtension(\"EXT_color_buffer_float\")\n };\n const provokeExt = gl.getExtension(\"WEBGL_provoking_vertex\");\n if (provokeExt) {\n provokeExt.provokingVertexWEBGL(provokeExt.FIRST_VERTEX_CONVENTION_WEBGL);\n }\n }\n }\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n handleContextLost(event) {\n event.preventDefault();\n if (this._contextLossForced) {\n this._contextLossForced = false;\n setTimeout(() => {\n if (this.gl.isContextLost()) {\n this.extensions.loseContext?.restoreContext();\n }\n }, 0);\n }\n }\n /** Handles a restored webgl context. */\n handleContextRestored() {\n this._renderer.runners.contextChange.emit(this.gl);\n }\n destroy() {\n const element = this._renderer.view.canvas;\n this._renderer = null;\n element.removeEventListener(\"webglcontextlost\", this.handleContextLost);\n element.removeEventListener(\"webglcontextrestored\", this.handleContextRestored);\n this.gl.useProgram(null);\n this.extensions.loseContext?.loseContext();\n }\n /**\n * this function can be called to force a webGL context loss\n * this will release all resources on the GPU.\n * Useful if you need to put Pixi to sleep, and save some GPU memory\n *\n * As soon as render is called - all resources will be created again.\n */\n forceContextLoss() {\n this.extensions.loseContext?.loseContext();\n this._contextLossForced = true;\n }\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n validateContext(gl) {\n const attributes = gl.getContextAttributes();\n if (attributes && !attributes.stencil) {\n warn(\"Provided WebGL context does not have a stencil buffer, masks may not render correctly\");\n }\n const supports = this.supports;\n const isWebGl2 = this.webGLVersion === 2;\n const extensions = this.extensions;\n supports.uint32Indices = isWebGl2 || !!extensions.uint32ElementIndex;\n supports.uniformBufferObject = isWebGl2;\n supports.vertexArrayObject = isWebGl2 || !!extensions.vertexArrayObject;\n supports.srgbTextures = isWebGl2 || !!extensions.srgb;\n supports.nonPowOf2wrapping = isWebGl2;\n supports.nonPowOf2mipmaps = isWebGl2;\n supports.msaa = isWebGl2;\n if (!supports.uint32Indices) {\n warn(\"Provided WebGL context does not support 32 index buffer, large scenes may not render correctly\");\n }\n }\n};\n/** @ignore */\n_GlContextSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"context\"\n};\n/** The default options for the system. */\n_GlContextSystem.defaultOptions = {\n /**\n * {@link WebGLOptions.context}\n * @default null\n */\n context: null,\n /**\n * {@link WebGLOptions.premultipliedAlpha}\n * @default true\n */\n premultipliedAlpha: true,\n /**\n * {@link WebGLOptions.preserveDrawingBuffer}\n * @default false\n */\n preserveDrawingBuffer: false,\n /**\n * {@link WebGLOptions.powerPreference}\n * @default default\n */\n powerPreference: void 0,\n /**\n * {@link WebGLOptions.webGLVersion}\n * @default 2\n */\n preferWebGLVersion: 2\n};\nlet GlContextSystem = _GlContextSystem;\n\nexport { GlContextSystem };\n//# sourceMappingURL=GlContextSystem.mjs.map\n","import { warn } from '../../../../../utils/logging/warn.mjs';\nimport { getAttributeInfoFromFormat } from '../../../shared/geometry/utils/getAttributeInfoFromFormat.mjs';\n\n\"use strict\";\nfunction ensureAttributes(geometry, extractedData) {\n for (const i in geometry.attributes) {\n const attribute = geometry.attributes[i];\n const attributeData = extractedData[i];\n if (attributeData) {\n attribute.location ?? (attribute.location = attributeData.location);\n attribute.format ?? (attribute.format = attributeData.format);\n attribute.offset ?? (attribute.offset = attributeData.offset);\n attribute.instance ?? (attribute.instance = attributeData.instance);\n } else {\n warn(`Attribute ${i} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`);\n }\n }\n ensureStartAndStride(geometry);\n}\nfunction ensureStartAndStride(geometry) {\n const { buffers, attributes } = geometry;\n const tempStride = {};\n const tempStart = {};\n for (const j in buffers) {\n const buffer = buffers[j];\n tempStride[buffer.uid] = 0;\n tempStart[buffer.uid] = 0;\n }\n for (const j in attributes) {\n const attribute = attributes[j];\n tempStride[attribute.buffer.uid] += getAttributeInfoFromFormat(attribute.format).stride;\n }\n for (const j in attributes) {\n const attribute = attributes[j];\n attribute.stride ?? (attribute.stride = tempStride[attribute.buffer.uid]);\n attribute.start ?? (attribute.start = tempStart[attribute.buffer.uid]);\n tempStart[attribute.buffer.uid] += getAttributeInfoFromFormat(attribute.format).stride;\n }\n}\n\nexport { ensureAttributes };\n//# sourceMappingURL=ensureAttributes.mjs.map\n","\"use strict\";\nvar GL_FORMATS = /* @__PURE__ */ ((GL_FORMATS2) => {\n GL_FORMATS2[GL_FORMATS2[\"RGBA\"] = 6408] = \"RGBA\";\n GL_FORMATS2[GL_FORMATS2[\"RGB\"] = 6407] = \"RGB\";\n GL_FORMATS2[GL_FORMATS2[\"RG\"] = 33319] = \"RG\";\n GL_FORMATS2[GL_FORMATS2[\"RED\"] = 6403] = \"RED\";\n GL_FORMATS2[GL_FORMATS2[\"RGBA_INTEGER\"] = 36249] = \"RGBA_INTEGER\";\n GL_FORMATS2[GL_FORMATS2[\"RGB_INTEGER\"] = 36248] = \"RGB_INTEGER\";\n GL_FORMATS2[GL_FORMATS2[\"RG_INTEGER\"] = 33320] = \"RG_INTEGER\";\n GL_FORMATS2[GL_FORMATS2[\"RED_INTEGER\"] = 36244] = \"RED_INTEGER\";\n GL_FORMATS2[GL_FORMATS2[\"ALPHA\"] = 6406] = \"ALPHA\";\n GL_FORMATS2[GL_FORMATS2[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n GL_FORMATS2[GL_FORMATS2[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n GL_FORMATS2[GL_FORMATS2[\"DEPTH_COMPONENT\"] = 6402] = \"DEPTH_COMPONENT\";\n GL_FORMATS2[GL_FORMATS2[\"DEPTH_STENCIL\"] = 34041] = \"DEPTH_STENCIL\";\n return GL_FORMATS2;\n})(GL_FORMATS || {});\nvar GL_TARGETS = /* @__PURE__ */ ((GL_TARGETS2) => {\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_2D\"] = 3553] = \"TEXTURE_2D\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP\"] = 34067] = \"TEXTURE_CUBE_MAP\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_2D_ARRAY\"] = 35866] = \"TEXTURE_2D_ARRAY\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP_POSITIVE_X\"] = 34069] = \"TEXTURE_CUBE_MAP_POSITIVE_X\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP_NEGATIVE_X\"] = 34070] = \"TEXTURE_CUBE_MAP_NEGATIVE_X\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP_POSITIVE_Y\"] = 34071] = \"TEXTURE_CUBE_MAP_POSITIVE_Y\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP_NEGATIVE_Y\"] = 34072] = \"TEXTURE_CUBE_MAP_NEGATIVE_Y\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP_POSITIVE_Z\"] = 34073] = \"TEXTURE_CUBE_MAP_POSITIVE_Z\";\n GL_TARGETS2[GL_TARGETS2[\"TEXTURE_CUBE_MAP_NEGATIVE_Z\"] = 34074] = \"TEXTURE_CUBE_MAP_NEGATIVE_Z\";\n return GL_TARGETS2;\n})(GL_TARGETS || {});\nvar GL_WRAP_MODES = /* @__PURE__ */ ((GL_WRAP_MODES2) => {\n GL_WRAP_MODES2[GL_WRAP_MODES2[\"CLAMP\"] = 33071] = \"CLAMP\";\n GL_WRAP_MODES2[GL_WRAP_MODES2[\"REPEAT\"] = 10497] = \"REPEAT\";\n GL_WRAP_MODES2[GL_WRAP_MODES2[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n return GL_WRAP_MODES2;\n})(GL_WRAP_MODES || {});\nvar GL_TYPES = /* @__PURE__ */ ((GL_TYPES2) => {\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_SHORT_5_6_5\"] = 33635] = \"UNSIGNED_SHORT_5_6_5\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_SHORT_4_4_4_4\"] = 32819] = \"UNSIGNED_SHORT_4_4_4_4\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_SHORT_5_5_5_1\"] = 32820] = \"UNSIGNED_SHORT_5_5_5_1\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_INT\"] = 5125] = \"UNSIGNED_INT\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_INT_10F_11F_11F_REV\"] = 35899] = \"UNSIGNED_INT_10F_11F_11F_REV\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_INT_2_10_10_10_REV\"] = 33640] = \"UNSIGNED_INT_2_10_10_10_REV\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_INT_24_8\"] = 34042] = \"UNSIGNED_INT_24_8\";\n GL_TYPES2[GL_TYPES2[\"UNSIGNED_INT_5_9_9_9_REV\"] = 35902] = \"UNSIGNED_INT_5_9_9_9_REV\";\n GL_TYPES2[GL_TYPES2[\"BYTE\"] = 5120] = \"BYTE\";\n GL_TYPES2[GL_TYPES2[\"SHORT\"] = 5122] = \"SHORT\";\n GL_TYPES2[GL_TYPES2[\"INT\"] = 5124] = \"INT\";\n GL_TYPES2[GL_TYPES2[\"FLOAT\"] = 5126] = \"FLOAT\";\n GL_TYPES2[GL_TYPES2[\"FLOAT_32_UNSIGNED_INT_24_8_REV\"] = 36269] = \"FLOAT_32_UNSIGNED_INT_24_8_REV\";\n GL_TYPES2[GL_TYPES2[\"HALF_FLOAT\"] = 36193] = \"HALF_FLOAT\";\n return GL_TYPES2;\n})(GL_TYPES || {});\n\nexport { GL_FORMATS, GL_TARGETS, GL_TYPES, GL_WRAP_MODES };\n//# sourceMappingURL=const.mjs.map\n","import { GL_TYPES } from '../../texture/const.mjs';\n\n\"use strict\";\nconst infoMap = {\n uint8x2: GL_TYPES.UNSIGNED_BYTE,\n uint8x4: GL_TYPES.UNSIGNED_BYTE,\n sint8x2: GL_TYPES.BYTE,\n sint8x4: GL_TYPES.BYTE,\n unorm8x2: GL_TYPES.UNSIGNED_BYTE,\n unorm8x4: GL_TYPES.UNSIGNED_BYTE,\n snorm8x2: GL_TYPES.BYTE,\n snorm8x4: GL_TYPES.BYTE,\n uint16x2: GL_TYPES.UNSIGNED_SHORT,\n uint16x4: GL_TYPES.UNSIGNED_SHORT,\n sint16x2: GL_TYPES.SHORT,\n sint16x4: GL_TYPES.SHORT,\n unorm16x2: GL_TYPES.UNSIGNED_SHORT,\n unorm16x4: GL_TYPES.UNSIGNED_SHORT,\n snorm16x2: GL_TYPES.SHORT,\n snorm16x4: GL_TYPES.SHORT,\n float16x2: GL_TYPES.HALF_FLOAT,\n float16x4: GL_TYPES.HALF_FLOAT,\n float32: GL_TYPES.FLOAT,\n float32x2: GL_TYPES.FLOAT,\n float32x3: GL_TYPES.FLOAT,\n float32x4: GL_TYPES.FLOAT,\n uint32: GL_TYPES.UNSIGNED_INT,\n uint32x2: GL_TYPES.UNSIGNED_INT,\n uint32x3: GL_TYPES.UNSIGNED_INT,\n uint32x4: GL_TYPES.UNSIGNED_INT,\n sint32: GL_TYPES.INT,\n sint32x2: GL_TYPES.INT,\n sint32x3: GL_TYPES.INT,\n sint32x4: GL_TYPES.INT\n};\nfunction getGlTypeFromFormat(format) {\n return infoMap[format] ?? infoMap.float32;\n}\n\nexport { getGlTypeFromFormat };\n//# sourceMappingURL=getGlTypeFromFormat.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { getAttributeInfoFromFormat } from '../../shared/geometry/utils/getAttributeInfoFromFormat.mjs';\nimport { ensureAttributes } from '../shader/program/ensureAttributes.mjs';\nimport { getGlTypeFromFormat } from './utils/getGlTypeFromFormat.mjs';\n\n\"use strict\";\nconst topologyToGlMap = {\n \"point-list\": 0,\n \"line-list\": 1,\n \"line-strip\": 3,\n \"triangle-list\": 4,\n \"triangle-strip\": 5\n};\nclass GlGeometrySystem {\n /** @param renderer - The renderer this System works for. */\n constructor(renderer) {\n this._geometryVaoHash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n this.hasVao = true;\n this.hasInstance = true;\n }\n /** Sets up the renderer context and necessary buffers. */\n contextChange() {\n const gl = this.gl = this._renderer.gl;\n if (!this._renderer.context.supports.vertexArrayObject) {\n throw new Error(\"[PixiJS] Vertex Array Objects are not supported on this device\");\n }\n const nativeVaoExtension = this._renderer.context.extensions.vertexArrayObject;\n if (nativeVaoExtension) {\n gl.createVertexArray = () => nativeVaoExtension.createVertexArrayOES();\n gl.bindVertexArray = (vao) => nativeVaoExtension.bindVertexArrayOES(vao);\n gl.deleteVertexArray = (vao) => nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n const nativeInstancedExtension = this._renderer.context.extensions.vertexAttribDivisorANGLE;\n if (nativeInstancedExtension) {\n gl.drawArraysInstanced = (a, b, c, d) => {\n nativeInstancedExtension.drawArraysInstancedANGLE(a, b, c, d);\n };\n gl.drawElementsInstanced = (a, b, c, d, e) => {\n nativeInstancedExtension.drawElementsInstancedANGLE(a, b, c, d, e);\n };\n gl.vertexAttribDivisor = (a, b) => nativeInstancedExtension.vertexAttribDivisorANGLE(a, b);\n }\n this._activeGeometry = null;\n this._activeVao = null;\n this._geometryVaoHash = /* @__PURE__ */ Object.create(null);\n }\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param program - Instance of program to use vao for.\n */\n bind(geometry, program) {\n const gl = this.gl;\n this._activeGeometry = geometry;\n const vao = this.getVao(geometry, program);\n if (this._activeVao !== vao) {\n this._activeVao = vao;\n gl.bindVertexArray(vao);\n }\n this.updateBuffers();\n }\n /** Reset and unbind any active VAO and geometry. */\n reset() {\n this.unbind();\n }\n /** Update buffers of the currently bound geometry. */\n updateBuffers() {\n const geometry = this._activeGeometry;\n const bufferSystem = this._renderer.buffer;\n for (let i = 0; i < geometry.buffers.length; i++) {\n const buffer = geometry.buffers[i];\n bufferSystem.updateBuffer(buffer);\n }\n }\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n checkCompatibility(geometry, program) {\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program._attributeData;\n for (const j in shaderAttributes) {\n if (!geometryAttributes[j]) {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n getSignature(geometry, program) {\n const attribs = geometry.attributes;\n const shaderAttributes = program._attributeData;\n const strings = [\"g\", geometry.uid];\n for (const i in attribs) {\n if (shaderAttributes[i]) {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n return strings.join(\"-\");\n }\n getVao(geometry, program) {\n return this._geometryVaoHash[geometry.uid]?.[program._key] || this.initGeometryVao(geometry, program);\n }\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param program\n * @param _incRefCount - Increment refCount of all geometry buffers.\n */\n initGeometryVao(geometry, program, _incRefCount = true) {\n const gl = this._renderer.gl;\n const bufferSystem = this._renderer.buffer;\n this._renderer.shader._getProgramData(program);\n this.checkCompatibility(geometry, program);\n const signature = this.getSignature(geometry, program);\n if (!this._geometryVaoHash[geometry.uid]) {\n this._geometryVaoHash[geometry.uid] = /* @__PURE__ */ Object.create(null);\n geometry.on(\"destroy\", this.onGeometryDestroy, this);\n }\n const vaoObjectHash = this._geometryVaoHash[geometry.uid];\n let vao = vaoObjectHash[signature];\n if (vao) {\n vaoObjectHash[program._key] = vao;\n return vao;\n }\n ensureAttributes(geometry, program._attributeData);\n const buffers = geometry.buffers;\n vao = gl.createVertexArray();\n gl.bindVertexArray(vao);\n for (let i = 0; i < buffers.length; i++) {\n const buffer = buffers[i];\n bufferSystem.bind(buffer);\n }\n this.activateVao(geometry, program);\n vaoObjectHash[program._key] = vao;\n vaoObjectHash[signature] = vao;\n gl.bindVertexArray(null);\n return vao;\n }\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n onGeometryDestroy(geometry, contextLost) {\n const vaoObjectHash = this._geometryVaoHash[geometry.uid];\n const gl = this.gl;\n if (vaoObjectHash) {\n if (contextLost) {\n for (const i in vaoObjectHash) {\n if (this._activeVao !== vaoObjectHash[i]) {\n this.unbind();\n }\n gl.deleteVertexArray(vaoObjectHash[i]);\n }\n }\n this._geometryVaoHash[geometry.uid] = null;\n }\n }\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n destroyAll(contextLost = false) {\n const gl = this.gl;\n for (const i in this._geometryVaoHash) {\n if (contextLost) {\n for (const j in this._geometryVaoHash[i]) {\n const vaoObjectHash = this._geometryVaoHash[i];\n if (this._activeVao !== vaoObjectHash) {\n this.unbind();\n }\n gl.deleteVertexArray(vaoObjectHash[j]);\n }\n }\n this._geometryVaoHash[i] = null;\n }\n }\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n activateVao(geometry, program) {\n const gl = this._renderer.gl;\n const bufferSystem = this._renderer.buffer;\n const attributes = geometry.attributes;\n if (geometry.indexBuffer) {\n bufferSystem.bind(geometry.indexBuffer);\n }\n let lastBuffer = null;\n for (const j in attributes) {\n const attribute = attributes[j];\n const buffer = attribute.buffer;\n const glBuffer = bufferSystem.getGlBuffer(buffer);\n const programAttrib = program._attributeData[j];\n if (programAttrib) {\n if (lastBuffer !== glBuffer) {\n bufferSystem.bind(buffer);\n lastBuffer = glBuffer;\n }\n const location = attribute.location;\n gl.enableVertexAttribArray(location);\n const attributeInfo = getAttributeInfoFromFormat(attribute.format);\n const type = getGlTypeFromFormat(attribute.format);\n if (programAttrib.format?.substring(1, 4) === \"int\") {\n gl.vertexAttribIPointer(\n location,\n attributeInfo.size,\n type,\n attribute.stride,\n attribute.offset\n );\n } else {\n gl.vertexAttribPointer(\n location,\n attributeInfo.size,\n type,\n attributeInfo.normalised,\n attribute.stride,\n attribute.offset\n );\n }\n if (attribute.instance) {\n if (this.hasInstance) {\n const divisor = attribute.divisor ?? 1;\n gl.vertexAttribDivisor(location, divisor);\n } else {\n throw new Error(\"geometry error, GPU Instancing is not supported on this device\");\n }\n }\n }\n }\n }\n /**\n * Draws the currently bound geometry.\n * @param topology - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(topology, size, start, instanceCount) {\n const { gl } = this._renderer;\n const geometry = this._activeGeometry;\n const glTopology = topologyToGlMap[geometry.topology || topology];\n instanceCount || (instanceCount = geometry.instanceCount);\n if (geometry.indexBuffer) {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n if (instanceCount > 1) {\n gl.drawElementsInstanced(glTopology, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount);\n } else {\n gl.drawElements(glTopology, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n }\n } else if (instanceCount > 1) {\n gl.drawArraysInstanced(glTopology, start || 0, size || geometry.getSize(), instanceCount);\n } else {\n gl.drawArrays(glTopology, start || 0, size || geometry.getSize());\n }\n return this;\n }\n /** Unbind/reset everything. */\n unbind() {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n destroy() {\n this._renderer = null;\n this.gl = null;\n this._activeVao = null;\n this._activeGeometry = null;\n }\n}\n/** @ignore */\nGlGeometrySystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"geometry\"\n};\n\nexport { GlGeometrySystem };\n//# sourceMappingURL=GlGeometrySystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\nimport { Geometry } from '../shared/geometry/Geometry.mjs';\nimport { Shader } from '../shared/shader/Shader.mjs';\nimport { State } from '../shared/state/State.mjs';\nimport { TextureSource } from '../shared/texture/sources/TextureSource.mjs';\nimport { Texture } from '../shared/texture/Texture.mjs';\nimport { GlProgram } from './shader/GlProgram.mjs';\n\n\"use strict\";\nconst bigTriangleGeometry = new Geometry({\n attributes: {\n aPosition: [\n -1,\n -1,\n // Bottom left corner\n 3,\n -1,\n // Bottom right corner, extending beyond right edge\n -1,\n 3\n // Top left corner, extending beyond top edge\n ]\n }\n});\nconst _GlBackBufferSystem = class _GlBackBufferSystem {\n constructor(renderer) {\n /** if true, the back buffer is used */\n this.useBackBuffer = false;\n this._useBackBufferThisRender = false;\n this._renderer = renderer;\n }\n init(options = {}) {\n const { useBackBuffer, antialias } = { ..._GlBackBufferSystem.defaultOptions, ...options };\n this.useBackBuffer = useBackBuffer;\n this._antialias = antialias;\n if (!this._renderer.context.supports.msaa) {\n warn(\"antialiasing, is not supported on when using the back buffer\");\n this._antialias = false;\n }\n this._state = State.for2d();\n const bigTriangleProgram = new GlProgram({\n vertex: `\n attribute vec2 aPosition;\n out vec2 vUv;\n\n void main() {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n\n vUv = (aPosition + 1.0) / 2.0;\n\n // flip dem UVs\n vUv.y = 1.0 - vUv.y;\n }`,\n fragment: `\n in vec2 vUv;\n out vec4 finalColor;\n\n uniform sampler2D uTexture;\n\n void main() {\n finalColor = texture(uTexture, vUv);\n }`,\n name: \"big-triangle\"\n });\n this._bigTriangleShader = new Shader({\n glProgram: bigTriangleProgram,\n resources: {\n uTexture: Texture.WHITE.source\n }\n });\n }\n /**\n * This is called before the RenderTargetSystem is started. This is where\n * we replace the target with the back buffer if required.\n * @param options - The options for this render.\n */\n renderStart(options) {\n const renderTarget = this._renderer.renderTarget.getRenderTarget(options.target);\n this._useBackBufferThisRender = this.useBackBuffer && !!renderTarget.isRoot;\n if (this._useBackBufferThisRender) {\n const renderTarget2 = this._renderer.renderTarget.getRenderTarget(options.target);\n this._targetTexture = renderTarget2.colorTexture;\n options.target = this._getBackBufferTexture(renderTarget2.colorTexture);\n }\n }\n renderEnd() {\n this._presentBackBuffer();\n }\n _presentBackBuffer() {\n const renderer = this._renderer;\n renderer.renderTarget.finishRenderPass();\n if (!this._useBackBufferThisRender)\n return;\n renderer.renderTarget.bind(this._targetTexture, false);\n this._bigTriangleShader.resources.uTexture = this._backBufferTexture.source;\n renderer.encoder.draw({\n geometry: bigTriangleGeometry,\n shader: this._bigTriangleShader,\n state: this._state\n });\n }\n _getBackBufferTexture(targetSourceTexture) {\n this._backBufferTexture = this._backBufferTexture || new Texture({\n source: new TextureSource({\n width: targetSourceTexture.width,\n height: targetSourceTexture.height,\n resolution: targetSourceTexture._resolution,\n antialias: this._antialias\n })\n });\n this._backBufferTexture.source.resize(\n targetSourceTexture.width,\n targetSourceTexture.height,\n targetSourceTexture._resolution\n );\n return this._backBufferTexture;\n }\n /** destroys the back buffer */\n destroy() {\n if (this._backBufferTexture) {\n this._backBufferTexture.destroy();\n this._backBufferTexture = null;\n }\n }\n};\n/** @ignore */\n_GlBackBufferSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"backBuffer\",\n priority: 1\n};\n/** default options for the back buffer system */\n_GlBackBufferSystem.defaultOptions = {\n /** if true will use the back buffer where required */\n useBackBuffer: false\n};\nlet GlBackBufferSystem = _GlBackBufferSystem;\n\nexport { GlBackBufferSystem };\n//# sourceMappingURL=GlBackBufferSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GlColorMaskSystem {\n constructor(renderer) {\n this._colorMaskCache = 15;\n this._renderer = renderer;\n }\n setMask(colorMask) {\n if (this._colorMaskCache === colorMask)\n return;\n this._colorMaskCache = colorMask;\n this._renderer.gl.colorMask(\n !!(colorMask & 8),\n !!(colorMask & 4),\n !!(colorMask & 2),\n !!(colorMask & 1)\n );\n }\n}\n/** @ignore */\nGlColorMaskSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"colorMask\"\n};\n\nexport { GlColorMaskSystem };\n//# sourceMappingURL=GlColorMaskSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GlEncoderSystem {\n constructor(renderer) {\n this.commandFinished = Promise.resolve();\n this._renderer = renderer;\n }\n setGeometry(geometry, shader) {\n this._renderer.geometry.bind(geometry, shader.glProgram);\n }\n finishRenderPass() {\n }\n draw(options) {\n const renderer = this._renderer;\n const { geometry, shader, state, skipSync, topology: type, size, start, instanceCount } = options;\n renderer.shader.bind(shader, skipSync);\n renderer.geometry.bind(geometry, renderer.shader._activeProgram);\n if (state) {\n renderer.state.set(state);\n }\n renderer.geometry.draw(type, size, start, instanceCount ?? geometry.instanceCount);\n }\n destroy() {\n this._renderer = null;\n }\n}\n/** @ignore */\nGlEncoderSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"encoder\"\n};\n\nexport { GlEncoderSystem };\n//# sourceMappingURL=GlEncoderSystem.mjs.map\n","\"use strict\";\nclass GlRenderTarget {\n constructor() {\n this.width = -1;\n this.height = -1;\n this.msaa = false;\n this.msaaRenderBuffer = [];\n }\n}\n\nexport { GlRenderTarget };\n//# sourceMappingURL=GlRenderTarget.mjs.map\n","import { STENCIL_MODES } from '../../shared/state/const.mjs';\n\n\"use strict\";\nconst GpuStencilModesToPixi = [];\nGpuStencilModesToPixi[STENCIL_MODES.NONE] = void 0;\nGpuStencilModesToPixi[STENCIL_MODES.DISABLED] = {\n stencilWriteMask: 0,\n stencilReadMask: 0\n};\nGpuStencilModesToPixi[STENCIL_MODES.RENDERING_MASK_ADD] = {\n stencilFront: {\n compare: \"equal\",\n passOp: \"increment-clamp\"\n },\n stencilBack: {\n compare: \"equal\",\n passOp: \"increment-clamp\"\n }\n};\nGpuStencilModesToPixi[STENCIL_MODES.RENDERING_MASK_REMOVE] = {\n stencilFront: {\n compare: \"equal\",\n passOp: \"decrement-clamp\"\n },\n stencilBack: {\n compare: \"equal\",\n passOp: \"decrement-clamp\"\n }\n};\nGpuStencilModesToPixi[STENCIL_MODES.MASK_ACTIVE] = {\n stencilWriteMask: 0,\n stencilFront: {\n compare: \"equal\",\n passOp: \"keep\"\n },\n stencilBack: {\n compare: \"equal\",\n passOp: \"keep\"\n }\n};\n\nexport { GpuStencilModesToPixi };\n//# sourceMappingURL=GpuStencilModesToPixi.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { GpuStencilModesToPixi } from '../gpu/state/GpuStencilModesToPixi.mjs';\nimport { STENCIL_MODES } from '../shared/state/const.mjs';\n\n\"use strict\";\nclass GlStencilSystem {\n constructor(renderer) {\n this._stencilCache = {\n enabled: false,\n stencilReference: 0,\n stencilMode: STENCIL_MODES.NONE\n };\n this._renderTargetStencilState = /* @__PURE__ */ Object.create(null);\n renderer.renderTarget.onRenderTargetChange.add(this);\n }\n contextChange(gl) {\n this._gl = gl;\n this._comparisonFuncMapping = {\n always: gl.ALWAYS,\n never: gl.NEVER,\n equal: gl.EQUAL,\n \"not-equal\": gl.NOTEQUAL,\n less: gl.LESS,\n \"less-equal\": gl.LEQUAL,\n greater: gl.GREATER,\n \"greater-equal\": gl.GEQUAL\n };\n this._stencilOpsMapping = {\n keep: gl.KEEP,\n zero: gl.ZERO,\n replace: gl.REPLACE,\n invert: gl.INVERT,\n \"increment-clamp\": gl.INCR,\n \"decrement-clamp\": gl.DECR,\n \"increment-wrap\": gl.INCR_WRAP,\n \"decrement-wrap\": gl.DECR_WRAP\n };\n this._stencilCache.enabled = false;\n this._stencilCache.stencilMode = STENCIL_MODES.NONE;\n this._stencilCache.stencilReference = 0;\n }\n onRenderTargetChange(renderTarget) {\n if (this._activeRenderTarget === renderTarget)\n return;\n this._activeRenderTarget = renderTarget;\n let stencilState = this._renderTargetStencilState[renderTarget.uid];\n if (!stencilState) {\n stencilState = this._renderTargetStencilState[renderTarget.uid] = {\n stencilMode: STENCIL_MODES.DISABLED,\n stencilReference: 0\n };\n }\n this.setStencilMode(stencilState.stencilMode, stencilState.stencilReference);\n }\n setStencilMode(stencilMode, stencilReference) {\n const stencilState = this._renderTargetStencilState[this._activeRenderTarget.uid];\n const gl = this._gl;\n const mode = GpuStencilModesToPixi[stencilMode];\n const _stencilCache = this._stencilCache;\n stencilState.stencilMode = stencilMode;\n stencilState.stencilReference = stencilReference;\n if (stencilMode === STENCIL_MODES.DISABLED) {\n if (this._stencilCache.enabled) {\n this._stencilCache.enabled = false;\n gl.disable(gl.STENCIL_TEST);\n }\n return;\n }\n if (!this._stencilCache.enabled) {\n this._stencilCache.enabled = true;\n gl.enable(gl.STENCIL_TEST);\n }\n if (stencilMode !== _stencilCache.stencilMode || _stencilCache.stencilReference !== stencilReference) {\n _stencilCache.stencilMode = stencilMode;\n _stencilCache.stencilReference = stencilReference;\n gl.stencilFunc(this._comparisonFuncMapping[mode.stencilBack.compare], stencilReference, 255);\n gl.stencilOp(gl.KEEP, gl.KEEP, this._stencilOpsMapping[mode.stencilBack.passOp]);\n }\n }\n}\n/** @ignore */\nGlStencilSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"stencil\"\n};\n\nexport { GlStencilSystem };\n//# sourceMappingURL=GlStencilSystem.mjs.map\n","import { unsafeEvalSupported } from '../../../../utils/browser/unsafeEvalSupported.mjs';\nimport { Buffer } from '../buffer/Buffer.mjs';\nimport { BufferUsage } from '../buffer/const.mjs';\n\n\"use strict\";\nclass UboSystem {\n constructor(adaptor) {\n /** Cache of uniform buffer layouts and sync functions, so we don't have to re-create them */\n this._syncFunctionHash = /* @__PURE__ */ Object.create(null);\n this._adaptor = adaptor;\n this._systemCheck();\n }\n /**\n * Overridable function by `pixi.js/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n _systemCheck() {\n if (!unsafeEvalSupported()) {\n throw new Error(\"Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.\");\n }\n }\n ensureUniformGroup(uniformGroup) {\n const uniformData = this.getUniformGroupData(uniformGroup);\n uniformGroup.buffer || (uniformGroup.buffer = new Buffer({\n data: new Float32Array(uniformData.layout.size / 4),\n usage: BufferUsage.UNIFORM | BufferUsage.COPY_DST\n }));\n }\n getUniformGroupData(uniformGroup) {\n return this._syncFunctionHash[uniformGroup._signature] || this._initUniformGroup(uniformGroup);\n }\n _initUniformGroup(uniformGroup) {\n const uniformGroupSignature = uniformGroup._signature;\n let uniformData = this._syncFunctionHash[uniformGroupSignature];\n if (!uniformData) {\n const elements = Object.keys(uniformGroup.uniformStructures).map((i) => uniformGroup.uniformStructures[i]);\n const layout = this._adaptor.createUboElements(elements);\n const syncFunction = this._generateUboSync(layout.uboElements);\n uniformData = this._syncFunctionHash[uniformGroupSignature] = {\n layout,\n syncFunction\n };\n }\n return this._syncFunctionHash[uniformGroupSignature];\n }\n _generateUboSync(uboElements) {\n return this._adaptor.generateUboSync(uboElements);\n }\n syncUniformGroup(uniformGroup, data, offset) {\n const uniformGroupData = this.getUniformGroupData(uniformGroup);\n uniformGroup.buffer || (uniformGroup.buffer = new Buffer({\n data: new Float32Array(uniformGroupData.layout.size / 4),\n usage: BufferUsage.UNIFORM | BufferUsage.COPY_DST\n }));\n data || (data = uniformGroup.buffer.data);\n offset || (offset = 0);\n uniformGroupData.syncFunction(uniformGroup.uniforms, data, offset);\n return true;\n }\n updateUniformGroup(uniformGroup) {\n if (uniformGroup.isStatic && !uniformGroup._dirtyId)\n return false;\n uniformGroup._dirtyId = 0;\n const synced = this.syncUniformGroup(uniformGroup);\n uniformGroup.buffer.update();\n return synced;\n }\n destroy() {\n this._syncFunctionHash = null;\n }\n}\n\nexport { UboSystem };\n//# sourceMappingURL=UboSystem.mjs.map\n","\"use strict\";\nconst WGSL_TO_STD40_SIZE = {\n f32: 4,\n \"vec2\": 8,\n \"vec3\": 12,\n \"vec4\": 16,\n \"mat2x2\": 16 * 2,\n \"mat3x3\": 16 * 3,\n \"mat4x4\": 16 * 4\n // TODO - not essential for now but support these in the future\n // int: 4,\n // ivec2: 8,\n // ivec3: 12,\n // ivec4: 16,\n // uint: 4,\n // uvec2: 8,\n // uvec3: 12,\n // uvec4: 16,\n // bool: 4,\n // bvec2: 8,\n // bvec3: 12,\n // bvec4: 16,\n // mat2: 16 * 2,\n // mat3: 16 * 3,\n // mat4: 16 * 4,\n};\nfunction createUboElementsSTD40(uniformData) {\n const uboElements = uniformData.map((data) => ({\n data,\n offset: 0,\n size: 0\n }));\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n for (let i = 0; i < uboElements.length; i++) {\n const uboElement = uboElements[i];\n size = WGSL_TO_STD40_SIZE[uboElement.data.type];\n if (!size) {\n throw new Error(`Unknown type ${uboElement.data.type}`);\n }\n if (uboElement.data.size > 1) {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n uboElement.size = size;\n if (chunkSize % size !== 0 && chunkSize < 16) {\n const lineUpValue = chunkSize % size % 16;\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n if (chunkSize + size > 16) {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n } else {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n offset = Math.ceil(offset / 16) * 16;\n return { uboElements, size: offset };\n}\n\nexport { WGSL_TO_STD40_SIZE, createUboElementsSTD40 };\n//# sourceMappingURL=createUboElementsSTD40.mjs.map\n","\"use strict\";\nconst uniformParsers = [\n // uploading pixi matrix object to mat3\n {\n type: \"mat3x3\",\n test: (data) => {\n const value = data.value;\n return value.a !== void 0;\n },\n ubo: `\n var matrix = uv[name].toArray(true);\n data[offset] = matrix[0];\n data[offset + 1] = matrix[1];\n data[offset + 2] = matrix[2];\n data[offset + 4] = matrix[3];\n data[offset + 5] = matrix[4];\n data[offset + 6] = matrix[5];\n data[offset + 8] = matrix[6];\n data[offset + 9] = matrix[7];\n data[offset + 10] = matrix[8];\n `,\n uniform: `\n gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));\n `\n },\n // uploading a pixi rectangle as a vec4\n {\n type: \"vec4\",\n test: (data) => data.type === \"vec4\" && data.size === 1 && data.value.width !== void 0,\n ubo: `\n v = uv[name];\n data[offset] = v.x;\n data[offset + 1] = v.y;\n data[offset + 2] = v.width;\n data[offset + 3] = v.height;\n `,\n uniform: `\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);\n }\n `\n },\n // uploading a pixi point as a vec2\n {\n type: \"vec2\",\n test: (data) => data.type === \"vec2\" && data.size === 1 && data.value.x !== void 0,\n ubo: `\n v = uv[name];\n data[offset] = v.x;\n data[offset + 1] = v.y;\n `,\n uniform: `\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.x || cv[1] !== v.y) {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[name].location, v.x, v.y);\n }\n `\n },\n // uploading a pixi color as a vec4\n {\n type: \"vec4\",\n test: (data) => data.type === \"vec4\" && data.size === 1 && data.value.red !== void 0,\n ubo: `\n v = uv[name];\n data[offset] = v.red;\n data[offset + 1] = v.green;\n data[offset + 2] = v.blue;\n data[offset + 3] = v.alpha;\n `,\n uniform: `\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);\n }\n `\n },\n // uploading a pixi color as a vec3\n {\n type: \"vec3\",\n test: (data) => data.type === \"vec3\" && data.size === 1 && data.value.red !== void 0,\n ubo: `\n v = uv[name];\n data[offset] = v.red;\n data[offset + 1] = v.green;\n data[offset + 2] = v.blue;\n `,\n uniform: `\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n gl.uniform3f(ud[name].location, v.red, v.green, v.blue);\n }\n `\n }\n];\n\nexport { uniformParsers };\n//# sourceMappingURL=uniformParsers.mjs.map\n","import { uniformParsers } from './uniformParsers.mjs';\n\n\"use strict\";\nfunction createUboSyncFunction(uboElements, parserCode, arrayGenerationFunction, singleSettersMap) {\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var t = 0;\n var index = 0;\n var name = null;\n var arrayOffset = null;\n `];\n let prev = 0;\n for (let i = 0; i < uboElements.length; i++) {\n const uboElement = uboElements[i];\n const name = uboElement.data.name;\n let parsed = false;\n let offset = 0;\n for (let j = 0; j < uniformParsers.length; j++) {\n const uniformParser = uniformParsers[j];\n if (uniformParser.test(uboElement.data)) {\n offset = uboElement.offset / 4;\n funcFragments.push(\n `name = \"${name}\";`,\n `offset += ${offset - prev};`,\n uniformParsers[j][parserCode] || uniformParsers[j].ubo\n );\n parsed = true;\n break;\n }\n }\n if (!parsed) {\n if (uboElement.data.size > 1) {\n offset = uboElement.offset / 4;\n funcFragments.push(arrayGenerationFunction(uboElement, offset - prev));\n } else {\n const template = singleSettersMap[uboElement.data.type];\n offset = uboElement.offset / 4;\n funcFragments.push(\n /* wgsl */\n `\n v = uv.${name};\n offset += ${offset - prev};\n ${template};\n `\n );\n }\n }\n prev = offset;\n }\n const fragmentSrc = funcFragments.join(\"\\n\");\n return new Function(\n \"uv\",\n \"data\",\n \"offset\",\n fragmentSrc\n );\n}\n\nexport { createUboSyncFunction };\n//# sourceMappingURL=createUboSyncFunction.mjs.map\n","\"use strict\";\nfunction loopMatrix(col, row) {\n const total = col * row;\n return `\n for (let i = 0; i < ${total}; i++) {\n data[offset + (((i / ${col})|0) * 4) + (i % ${col})] = v[i];\n }\n `;\n}\nconst uboSyncFunctionsSTD40 = {\n f32: `\n data[offset] = v;`,\n i32: `\n data[offset] = v;`,\n \"vec2\": `\n data[offset] = v[0];\n data[offset + 1] = v[1];`,\n \"vec3\": `\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];`,\n \"vec4\": `\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 3] = v[3];`,\n \"mat2x2\": `\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 4] = v[2];\n data[offset + 5] = v[3];`,\n \"mat3x3\": `\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];`,\n \"mat4x4\": `\n for (let i = 0; i < 16; i++) {\n data[offset + i] = v[i];\n }`,\n \"mat3x2\": loopMatrix(3, 2),\n \"mat4x2\": loopMatrix(4, 2),\n \"mat2x3\": loopMatrix(2, 3),\n \"mat4x3\": loopMatrix(4, 3),\n \"mat2x4\": loopMatrix(2, 4),\n \"mat3x4\": loopMatrix(3, 4)\n};\nconst uboSyncFunctionsWGSL = {\n ...uboSyncFunctionsSTD40,\n \"mat2x2\": `\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 3] = v[3];\n `\n};\n\nexport { uboSyncFunctionsSTD40, uboSyncFunctionsWGSL };\n//# sourceMappingURL=uboSyncFunctions.mjs.map\n","import { WGSL_TO_STD40_SIZE } from './createUboElementsSTD40.mjs';\n\n\"use strict\";\nfunction generateArraySyncSTD40(uboElement, offsetToAdd) {\n const rowSize = Math.max(WGSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = uboElement.data.value.length / uboElement.data.size;\n const remainder = (4 - elementSize % 4) % 4;\n return `\n v = uv.${uboElement.data.name};\n offset += ${offsetToAdd};\n\n arrayOffset = offset;\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[arrayOffset++] = v[t++];\n }\n ${remainder !== 0 ? `arrayOffset += ${remainder};` : \"\"}\n }\n `;\n}\n\nexport { generateArraySyncSTD40 };\n//# sourceMappingURL=generateArraySyncSTD40.mjs.map\n","import { createUboSyncFunction } from '../../../shared/shader/utils/createUboSyncFunction.mjs';\nimport { uboSyncFunctionsSTD40 } from '../../../shared/shader/utils/uboSyncFunctions.mjs';\nimport { generateArraySyncSTD40 } from './generateArraySyncSTD40.mjs';\n\n\"use strict\";\nfunction createUboSyncFunctionSTD40(uboElements) {\n return createUboSyncFunction(\n uboElements,\n \"uboStd40\",\n generateArraySyncSTD40,\n uboSyncFunctionsSTD40\n );\n}\n\nexport { createUboSyncFunctionSTD40 };\n//# sourceMappingURL=createUboSyncSTD40.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { UboSystem } from '../shared/shader/UboSystem.mjs';\nimport { createUboElementsSTD40 } from './shader/utils/createUboElementsSTD40.mjs';\nimport { createUboSyncFunctionSTD40 } from './shader/utils/createUboSyncSTD40.mjs';\n\n\"use strict\";\nclass GlUboSystem extends UboSystem {\n constructor() {\n super({\n createUboElements: createUboElementsSTD40,\n generateUboSync: createUboSyncFunctionSTD40\n });\n }\n}\n/** @ignore */\nGlUboSystem.extension = {\n type: [ExtensionType.WebGLSystem],\n name: \"ubo\"\n};\n\nexport { GlUboSystem };\n//# sourceMappingURL=GlUboSystem.mjs.map\n","import { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { warn } from '../../../../utils/logging/warn.mjs';\nimport { CLEAR } from '../const.mjs';\nimport { GlRenderTarget } from '../GlRenderTarget.mjs';\n\n\"use strict\";\nclass GlRenderTargetAdaptor {\n constructor() {\n this._clearColorCache = [0, 0, 0, 0];\n this._viewPortCache = new Rectangle();\n }\n init(renderer, renderTargetSystem) {\n this._renderer = renderer;\n this._renderTargetSystem = renderTargetSystem;\n renderer.runners.contextChange.add(this);\n }\n contextChange() {\n this._clearColorCache = [0, 0, 0, 0];\n this._viewPortCache = new Rectangle();\n }\n copyToTexture(sourceRenderSurfaceTexture, destinationTexture, originSrc, size, originDest) {\n const renderTargetSystem = this._renderTargetSystem;\n const renderer = this._renderer;\n const glRenderTarget = renderTargetSystem.getGpuRenderTarget(sourceRenderSurfaceTexture);\n const gl = renderer.gl;\n this.finishRenderPass(sourceRenderSurfaceTexture);\n gl.bindFramebuffer(gl.FRAMEBUFFER, glRenderTarget.resolveTargetFramebuffer);\n renderer.texture.bind(destinationTexture, 0);\n gl.copyTexSubImage2D(\n gl.TEXTURE_2D,\n 0,\n originDest.x,\n originDest.y,\n originSrc.x,\n originSrc.y,\n size.width,\n size.height\n );\n return destinationTexture;\n }\n startRenderPass(renderTarget, clear = true, clearColor, viewport) {\n const renderTargetSystem = this._renderTargetSystem;\n const source = renderTarget.colorTexture;\n const gpuRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n let viewPortY = viewport.y;\n if (renderTarget.isRoot) {\n viewPortY = source.pixelHeight - viewport.height;\n }\n renderTarget.colorTextures.forEach((texture) => {\n this._renderer.texture.unbind(texture);\n });\n const gl = this._renderer.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, gpuRenderTarget.framebuffer);\n const viewPortCache = this._viewPortCache;\n if (viewPortCache.x !== viewport.x || viewPortCache.y !== viewPortY || viewPortCache.width !== viewport.width || viewPortCache.height !== viewport.height) {\n viewPortCache.x = viewport.x;\n viewPortCache.y = viewPortY;\n viewPortCache.width = viewport.width;\n viewPortCache.height = viewport.height;\n gl.viewport(\n viewport.x,\n viewPortY,\n viewport.width,\n viewport.height\n );\n }\n if (!gpuRenderTarget.depthStencilRenderBuffer && (renderTarget.stencil || renderTarget.depth)) {\n this._initStencil(gpuRenderTarget);\n }\n this.clear(renderTarget, clear, clearColor);\n }\n finishRenderPass(renderTarget) {\n const renderTargetSystem = this._renderTargetSystem;\n const glRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n if (!glRenderTarget.msaa)\n return;\n const gl = this._renderer.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, glRenderTarget.resolveTargetFramebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, glRenderTarget.framebuffer);\n gl.blitFramebuffer(\n 0,\n 0,\n glRenderTarget.width,\n glRenderTarget.height,\n 0,\n 0,\n glRenderTarget.width,\n glRenderTarget.height,\n gl.COLOR_BUFFER_BIT,\n gl.NEAREST\n );\n gl.bindFramebuffer(gl.FRAMEBUFFER, glRenderTarget.framebuffer);\n }\n initGpuRenderTarget(renderTarget) {\n const renderer = this._renderer;\n const gl = renderer.gl;\n const glRenderTarget = new GlRenderTarget();\n if (renderTarget.colorTexture.resource === renderer.gl.canvas) {\n glRenderTarget.framebuffer = null;\n return glRenderTarget;\n }\n this._initColor(renderTarget, glRenderTarget);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n return glRenderTarget;\n }\n destroyGpuRenderTarget(gpuRenderTarget) {\n const gl = this._renderer.gl;\n if (gpuRenderTarget.framebuffer) {\n gl.deleteFramebuffer(gpuRenderTarget.framebuffer);\n gpuRenderTarget.framebuffer = null;\n }\n if (gpuRenderTarget.resolveTargetFramebuffer) {\n gl.deleteFramebuffer(gpuRenderTarget.resolveTargetFramebuffer);\n gpuRenderTarget.resolveTargetFramebuffer = null;\n }\n if (gpuRenderTarget.depthStencilRenderBuffer) {\n gl.deleteRenderbuffer(gpuRenderTarget.depthStencilRenderBuffer);\n gpuRenderTarget.depthStencilRenderBuffer = null;\n }\n gpuRenderTarget.msaaRenderBuffer.forEach((renderBuffer) => {\n gl.deleteRenderbuffer(renderBuffer);\n });\n gpuRenderTarget.msaaRenderBuffer = null;\n }\n clear(_renderTarget, clear, clearColor) {\n if (!clear)\n return;\n const renderTargetSystem = this._renderTargetSystem;\n if (typeof clear === \"boolean\") {\n clear = clear ? CLEAR.ALL : CLEAR.NONE;\n }\n const gl = this._renderer.gl;\n if (clear & CLEAR.COLOR) {\n clearColor ?? (clearColor = renderTargetSystem.defaultClearColor);\n const clearColorCache = this._clearColorCache;\n const clearColorArray = clearColor;\n if (clearColorCache[0] !== clearColorArray[0] || clearColorCache[1] !== clearColorArray[1] || clearColorCache[2] !== clearColorArray[2] || clearColorCache[3] !== clearColorArray[3]) {\n clearColorCache[0] = clearColorArray[0];\n clearColorCache[1] = clearColorArray[1];\n clearColorCache[2] = clearColorArray[2];\n clearColorCache[3] = clearColorArray[3];\n gl.clearColor(clearColorArray[0], clearColorArray[1], clearColorArray[2], clearColorArray[3]);\n }\n }\n gl.clear(clear);\n }\n resizeGpuRenderTarget(renderTarget) {\n if (renderTarget.isRoot)\n return;\n const renderTargetSystem = this._renderTargetSystem;\n const glRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n this._resizeColor(renderTarget, glRenderTarget);\n if (renderTarget.stencil || renderTarget.depth) {\n this._resizeStencil(glRenderTarget);\n }\n }\n _initColor(renderTarget, glRenderTarget) {\n const renderer = this._renderer;\n const gl = renderer.gl;\n const resolveTargetFramebuffer = gl.createFramebuffer();\n glRenderTarget.resolveTargetFramebuffer = resolveTargetFramebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, resolveTargetFramebuffer);\n glRenderTarget.width = renderTarget.colorTexture.source.pixelWidth;\n glRenderTarget.height = renderTarget.colorTexture.source.pixelHeight;\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n const source = colorTexture.source;\n if (source.antialias) {\n if (renderer.context.supports.msaa) {\n glRenderTarget.msaa = true;\n } else {\n warn(\"[RenderTexture] Antialiasing on textures is not supported in WebGL1\");\n }\n }\n renderer.texture.bindSource(source, 0);\n const glSource = renderer.texture.getGlSource(source);\n const glTexture = glSource.texture;\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n 3553,\n // texture.target,\n glTexture,\n 0\n );\n });\n if (glRenderTarget.msaa) {\n const viewFramebuffer = gl.createFramebuffer();\n glRenderTarget.framebuffer = viewFramebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, viewFramebuffer);\n renderTarget.colorTextures.forEach((_, i) => {\n const msaaRenderBuffer = gl.createRenderbuffer();\n glRenderTarget.msaaRenderBuffer[i] = msaaRenderBuffer;\n });\n } else {\n glRenderTarget.framebuffer = resolveTargetFramebuffer;\n }\n this._resizeColor(renderTarget, glRenderTarget);\n }\n _resizeColor(renderTarget, glRenderTarget) {\n const source = renderTarget.colorTexture.source;\n glRenderTarget.width = source.pixelWidth;\n glRenderTarget.height = source.pixelHeight;\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n if (i === 0)\n return;\n colorTexture.source.resize(source.width, source.height, source._resolution);\n });\n if (glRenderTarget.msaa) {\n const renderer = this._renderer;\n const gl = renderer.gl;\n const viewFramebuffer = glRenderTarget.framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, viewFramebuffer);\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n const source2 = colorTexture.source;\n renderer.texture.bindSource(source2, 0);\n const glSource = renderer.texture.getGlSource(source2);\n const glInternalFormat = glSource.internalFormat;\n const msaaRenderBuffer = glRenderTarget.msaaRenderBuffer[i];\n gl.bindRenderbuffer(\n gl.RENDERBUFFER,\n msaaRenderBuffer\n );\n gl.renderbufferStorageMultisample(\n gl.RENDERBUFFER,\n 4,\n glInternalFormat,\n source2.pixelWidth,\n source2.pixelHeight\n );\n gl.framebufferRenderbuffer(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n gl.RENDERBUFFER,\n msaaRenderBuffer\n );\n });\n }\n }\n _initStencil(glRenderTarget) {\n if (glRenderTarget.framebuffer === null)\n return;\n const gl = this._renderer.gl;\n const depthStencilRenderBuffer = gl.createRenderbuffer();\n glRenderTarget.depthStencilRenderBuffer = depthStencilRenderBuffer;\n gl.bindRenderbuffer(\n gl.RENDERBUFFER,\n depthStencilRenderBuffer\n );\n gl.framebufferRenderbuffer(\n gl.FRAMEBUFFER,\n gl.DEPTH_STENCIL_ATTACHMENT,\n gl.RENDERBUFFER,\n depthStencilRenderBuffer\n );\n this._resizeStencil(glRenderTarget);\n }\n _resizeStencil(glRenderTarget) {\n const gl = this._renderer.gl;\n gl.bindRenderbuffer(\n gl.RENDERBUFFER,\n glRenderTarget.depthStencilRenderBuffer\n );\n if (glRenderTarget.msaa) {\n gl.renderbufferStorageMultisample(\n gl.RENDERBUFFER,\n 4,\n gl.DEPTH24_STENCIL8,\n glRenderTarget.width,\n glRenderTarget.height\n );\n } else {\n gl.renderbufferStorage(\n gl.RENDERBUFFER,\n this._renderer.context.webGLVersion === 2 ? gl.DEPTH24_STENCIL8 : gl.DEPTH_STENCIL,\n glRenderTarget.width,\n glRenderTarget.height\n );\n }\n }\n}\n\nexport { GlRenderTargetAdaptor };\n//# sourceMappingURL=GlRenderTargetAdaptor.mjs.map\n","import { CanvasSource } from '../sources/CanvasSource.mjs';\nimport { Texture } from '../Texture.mjs';\n\n\"use strict\";\nconst canvasCache = /* @__PURE__ */ new Map();\nfunction getCanvasTexture(canvas, options) {\n if (!canvasCache.has(canvas)) {\n const texture = new Texture({\n source: new CanvasSource({\n resource: canvas,\n ...options\n })\n });\n const onDestroy = () => {\n if (canvasCache.get(canvas) === texture) {\n canvasCache.delete(canvas);\n }\n };\n texture.once(\"destroy\", onDestroy);\n texture.source.once(\"destroy\", onDestroy);\n canvasCache.set(canvas, texture);\n }\n return canvasCache.get(canvas);\n}\nfunction hasCachedCanvasTexture(canvas) {\n return canvasCache.has(canvas);\n}\n\nexport { getCanvasTexture, hasCachedCanvasTexture };\n//# sourceMappingURL=getCanvasTexture.mjs.map\n","import { uid } from '../../../../utils/data/uid.mjs';\nimport { TextureSource } from '../texture/sources/TextureSource.mjs';\nimport { Texture } from '../texture/Texture.mjs';\n\n\"use strict\";\nconst _RenderTarget = class _RenderTarget {\n /**\n * @param [descriptor] - Options for creating a render target.\n */\n constructor(descriptor = {}) {\n /** unique id for this render target */\n this.uid = uid(\"renderTarget\");\n /**\n * An array of textures that can be written to by the GPU - mostly this has one texture in Pixi, but you could\n * write to multiple if required! (eg deferred lighting)\n */\n this.colorTextures = [];\n this.dirtyId = 0;\n this.isRoot = false;\n this._size = new Float32Array(2);\n /** if true, then when the render target is destroyed, it will destroy all the textures that were created for it. */\n this._managedColorTextures = false;\n descriptor = { ..._RenderTarget.defaultOptions, ...descriptor };\n this.stencil = descriptor.stencil;\n this.depth = descriptor.depth;\n this.isRoot = descriptor.isRoot;\n if (typeof descriptor.colorTextures === \"number\") {\n this._managedColorTextures = true;\n for (let i = 0; i < descriptor.colorTextures; i++) {\n this.colorTextures.push(\n new TextureSource({\n width: descriptor.width,\n height: descriptor.height,\n resolution: descriptor.resolution,\n antialias: descriptor.antialias\n })\n );\n }\n } else {\n this.colorTextures = [...descriptor.colorTextures.map((texture) => texture.source)];\n const colorSource = this.colorTexture.source;\n this.resize(colorSource.width, colorSource.height, colorSource._resolution);\n }\n this.colorTexture.source.on(\"resize\", this.onSourceResize, this);\n if (descriptor.depthStencilTexture || this.stencil) {\n if (descriptor.depthStencilTexture instanceof Texture || descriptor.depthStencilTexture instanceof TextureSource) {\n this.depthStencilTexture = descriptor.depthStencilTexture.source;\n } else {\n this.ensureDepthStencilTexture();\n }\n }\n }\n get size() {\n const _size = this._size;\n _size[0] = this.pixelWidth;\n _size[1] = this.pixelHeight;\n return _size;\n }\n get width() {\n return this.colorTexture.source.width;\n }\n get height() {\n return this.colorTexture.source.height;\n }\n get pixelWidth() {\n return this.colorTexture.source.pixelWidth;\n }\n get pixelHeight() {\n return this.colorTexture.source.pixelHeight;\n }\n get resolution() {\n return this.colorTexture.source._resolution;\n }\n get colorTexture() {\n return this.colorTextures[0];\n }\n onSourceResize(source) {\n this.resize(source.width, source.height, source._resolution, true);\n }\n /**\n * This will ensure a depthStencil texture is created for this render target.\n * Most likely called by the mask system to make sure we have stencil buffer added.\n * @internal\n * @ignore\n */\n ensureDepthStencilTexture() {\n if (!this.depthStencilTexture) {\n this.depthStencilTexture = new TextureSource({\n width: this.width,\n height: this.height,\n resolution: this.resolution,\n format: \"depth24plus-stencil8\",\n autoGenerateMipmaps: false,\n antialias: false,\n mipLevelCount: 1\n // sampleCount: handled by the render target system..\n });\n }\n }\n resize(width, height, resolution = this.resolution, skipColorTexture = false) {\n this.dirtyId++;\n this.colorTextures.forEach((colorTexture, i) => {\n if (skipColorTexture && i === 0)\n return;\n colorTexture.source.resize(width, height, resolution);\n });\n if (this.depthStencilTexture) {\n this.depthStencilTexture.source.resize(width, height, resolution);\n }\n }\n destroy() {\n this.colorTexture.source.off(\"resize\", this.onSourceResize, this);\n if (this._managedColorTextures) {\n this.colorTextures.forEach((texture) => {\n texture.destroy();\n });\n }\n if (this.depthStencilTexture) {\n this.depthStencilTexture.destroy();\n delete this.depthStencilTexture;\n }\n }\n};\n/** The default options for a render target */\n_RenderTarget.defaultOptions = {\n /** the width of the RenderTarget */\n width: 0,\n /** the height of the RenderTarget */\n height: 0,\n /** the resolution of the RenderTarget */\n resolution: 1,\n /** an array of textures, or a number indicating how many color textures there should be */\n colorTextures: 1,\n /** should this render target have a stencil buffer? */\n stencil: false,\n /** should this render target have a depth buffer? */\n depth: false,\n /** should this render target be antialiased? */\n antialias: false,\n // save on perf by default!\n /** is this a root element, true if this is gl context owners render target */\n isRoot: false\n};\nlet RenderTarget = _RenderTarget;\n\nexport { RenderTarget };\n//# sourceMappingURL=RenderTarget.mjs.map\n","import { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { CLEAR } from '../../gl/const.mjs';\nimport { calculateProjection } from '../../gpu/renderTarget/calculateProjection.mjs';\nimport { SystemRunner } from '../system/SystemRunner.mjs';\nimport { CanvasSource } from '../texture/sources/CanvasSource.mjs';\nimport { TextureSource } from '../texture/sources/TextureSource.mjs';\nimport { Texture } from '../texture/Texture.mjs';\nimport { getCanvasTexture } from '../texture/utils/getCanvasTexture.mjs';\nimport { isRenderingToScreen } from './isRenderingToScreen.mjs';\nimport { RenderTarget } from './RenderTarget.mjs';\n\n\"use strict\";\nclass RenderTargetSystem {\n constructor(renderer) {\n /** This is the root viewport for the render pass*/\n this.rootViewPort = new Rectangle();\n /** the current viewport that the gpu is using */\n this.viewport = new Rectangle();\n /**\n * a runner that lets systems know if the active render target has changed.\n * Eg the Stencil System needs to know so it can manage the stencil buffer\n */\n this.onRenderTargetChange = new SystemRunner(\"onRenderTargetChange\");\n /** the projection matrix that is used by the shaders based on the active render target and the viewport */\n this.projectionMatrix = new Matrix();\n /** the default clear color for render targets */\n this.defaultClearColor = [0, 0, 0, 0];\n /**\n * a hash that stores the render target for a given render surface. When you pass in a texture source,\n * a render target is created for it. This map stores and makes it easy to retrieve the render target\n */\n this._renderSurfaceToRenderTargetHash = /* @__PURE__ */ new Map();\n /** A hash that stores a gpu render target for a given render target. */\n this._gpuRenderTargetHash = /* @__PURE__ */ Object.create(null);\n /**\n * A stack that stores the render target and frame that is currently being rendered to.\n * When push is called, the current render target is stored in this stack.\n * When pop is called, the previous render target is restored.\n */\n this._renderTargetStack = [];\n this._renderer = renderer;\n }\n /** called when dev wants to finish a render pass */\n finishRenderPass() {\n this.adaptor.finishRenderPass(this.renderTarget);\n }\n /**\n * called when the renderer starts to render a scene.\n * @param options\n * @param options.target - the render target to render to\n * @param options.clear - the clear mode to use. Can be true or a CLEAR number 'COLOR | DEPTH | STENCIL' 0b111\n * @param options.clearColor - the color to clear to\n * @param options.frame - the frame to render to\n */\n renderStart({\n target,\n clear,\n clearColor,\n frame\n }) {\n this._renderTargetStack.length = 0;\n this.push(\n target,\n clear,\n clearColor,\n frame\n );\n this.rootViewPort.copyFrom(this.viewport);\n this.rootRenderTarget = this.renderTarget;\n this.renderingToScreen = isRenderingToScreen(this.rootRenderTarget);\n }\n /**\n * Binding a render surface! This is the main function of the render target system.\n * It will take the RenderSurface (which can be a texture, canvas, or render target) and bind it to the renderer.\n * Once bound all draw calls will be rendered to the render surface.\n *\n * If a frame is not provide and the render surface is a texture, the frame of the texture will be used.\n * @param renderSurface - the render surface to bind\n * @param clear - the clear mode to use. Can be true or a CLEAR number 'COLOR | DEPTH | STENCIL' 0b111\n * @param clearColor - the color to clear to\n * @param frame - the frame to render to\n * @returns the render target that was bound\n */\n bind(renderSurface, clear = true, clearColor, frame) {\n const renderTarget = this.getRenderTarget(renderSurface);\n const didChange = this.renderTarget !== renderTarget;\n this.renderTarget = renderTarget;\n this.renderSurface = renderSurface;\n const gpuRenderTarget = this.getGpuRenderTarget(renderTarget);\n if (renderTarget.pixelWidth !== gpuRenderTarget.width || renderTarget.pixelHeight !== gpuRenderTarget.height) {\n this.adaptor.resizeGpuRenderTarget(renderTarget);\n gpuRenderTarget.width = renderTarget.pixelWidth;\n gpuRenderTarget.height = renderTarget.pixelHeight;\n }\n const source = renderTarget.colorTexture;\n const viewport = this.viewport;\n const pixelWidth = source.pixelWidth;\n const pixelHeight = source.pixelHeight;\n if (!frame && renderSurface instanceof Texture) {\n frame = renderSurface.frame;\n }\n if (frame) {\n const resolution = source._resolution;\n viewport.x = frame.x * resolution + 0.5 | 0;\n viewport.y = frame.y * resolution + 0.5 | 0;\n viewport.width = frame.width * resolution + 0.5 | 0;\n viewport.height = frame.height * resolution + 0.5 | 0;\n } else {\n viewport.x = 0;\n viewport.y = 0;\n viewport.width = pixelWidth;\n viewport.height = pixelHeight;\n }\n calculateProjection(\n this.projectionMatrix,\n 0,\n 0,\n viewport.width / source.resolution,\n viewport.height / source.resolution,\n !renderTarget.isRoot\n );\n this.adaptor.startRenderPass(renderTarget, clear, clearColor, viewport);\n if (didChange) {\n this.onRenderTargetChange.emit(renderTarget);\n }\n return renderTarget;\n }\n clear(target, clear = CLEAR.ALL, clearColor) {\n if (!clear)\n return;\n if (target) {\n target = this.getRenderTarget(target);\n }\n this.adaptor.clear(\n target || this.renderTarget,\n clear,\n clearColor,\n this.viewport\n );\n }\n contextChange() {\n this._gpuRenderTargetHash = /* @__PURE__ */ Object.create(null);\n }\n /**\n * Push a render surface to the renderer. This will bind the render surface to the renderer,\n * @param renderSurface - the render surface to push\n * @param clear - the clear mode to use. Can be true or a CLEAR number 'COLOR | DEPTH | STENCIL' 0b111\n * @param clearColor - the color to clear to\n * @param frame - the frame to use when rendering to the render surface\n */\n push(renderSurface, clear = CLEAR.ALL, clearColor, frame) {\n const renderTarget = this.bind(renderSurface, clear, clearColor, frame);\n this._renderTargetStack.push({\n renderTarget,\n frame\n });\n return renderTarget;\n }\n /** Pops the current render target from the renderer and restores the previous render target. */\n pop() {\n this._renderTargetStack.pop();\n const currentRenderTargetData = this._renderTargetStack[this._renderTargetStack.length - 1];\n this.bind(currentRenderTargetData.renderTarget, false, null, currentRenderTargetData.frame);\n }\n /**\n * Gets the render target from the provide render surface. Eg if its a texture,\n * it will return the render target for the texture.\n * If its a render target, it will return the same render target.\n * @param renderSurface - the render surface to get the render target for\n * @returns the render target for the render surface\n */\n getRenderTarget(renderSurface) {\n if (renderSurface.isTexture) {\n renderSurface = renderSurface.source;\n }\n return this._renderSurfaceToRenderTargetHash.get(renderSurface) ?? this._initRenderTarget(renderSurface);\n }\n /**\n * Copies a render surface to another texture\n * @param sourceRenderSurfaceTexture - the render surface to copy from\n * @param destinationTexture - the texture to copy to\n * @param originSrc - the origin of the copy\n * @param originSrc.x - the x origin of the copy\n * @param originSrc.y - the y origin of the copy\n * @param size - the size of the copy\n * @param size.width - the width of the copy\n * @param size.height - the height of the copy\n * @param originDest - the destination origin (top left to paste from!)\n * @param originDest.x - the x origin of the paste\n * @param originDest.y - the y origin of the paste\n */\n copyToTexture(sourceRenderSurfaceTexture, destinationTexture, originSrc, size, originDest) {\n if (originSrc.x < 0) {\n size.width += originSrc.x;\n originDest.x -= originSrc.x;\n originSrc.x = 0;\n }\n if (originSrc.y < 0) {\n size.height += originSrc.y;\n originDest.y -= originSrc.y;\n originSrc.y = 0;\n }\n const { pixelWidth, pixelHeight } = sourceRenderSurfaceTexture;\n size.width = Math.min(size.width, pixelWidth - originSrc.x);\n size.height = Math.min(size.height, pixelHeight - originSrc.y);\n return this.adaptor.copyToTexture(\n sourceRenderSurfaceTexture,\n destinationTexture,\n originSrc,\n size,\n originDest\n );\n }\n /**\n * ensures that we have a depth stencil buffer available to render to\n * This is used by the mask system to make sure we have a stencil buffer.\n */\n ensureDepthStencil() {\n if (!this.renderTarget.stencil) {\n this.renderTarget.stencil = true;\n this.adaptor.startRenderPass(this.renderTarget, false, null, this.viewport);\n }\n }\n /** nukes the render target system */\n destroy() {\n this._renderer = null;\n this._renderSurfaceToRenderTargetHash.forEach((renderTarget, key) => {\n if (renderTarget !== key) {\n renderTarget.destroy();\n }\n });\n this._renderSurfaceToRenderTargetHash.clear();\n this._gpuRenderTargetHash = /* @__PURE__ */ Object.create(null);\n }\n _initRenderTarget(renderSurface) {\n let renderTarget = null;\n if (CanvasSource.test(renderSurface)) {\n renderSurface = getCanvasTexture(renderSurface).source;\n }\n if (renderSurface instanceof RenderTarget) {\n renderTarget = renderSurface;\n } else if (renderSurface instanceof TextureSource) {\n renderTarget = new RenderTarget({\n colorTextures: [renderSurface]\n });\n if (CanvasSource.test(renderSurface.source.resource)) {\n renderTarget.isRoot = true;\n }\n renderSurface.once(\"destroy\", () => {\n renderTarget.destroy();\n const gpuRenderTarget = this._gpuRenderTargetHash[renderTarget.uid];\n if (gpuRenderTarget) {\n this._gpuRenderTargetHash[renderTarget.uid] = null;\n this.adaptor.destroyGpuRenderTarget(gpuRenderTarget);\n }\n });\n }\n this._renderSurfaceToRenderTargetHash.set(renderSurface, renderTarget);\n return renderTarget;\n }\n getGpuRenderTarget(renderTarget) {\n return this._gpuRenderTargetHash[renderTarget.uid] || (this._gpuRenderTargetHash[renderTarget.uid] = this.adaptor.initGpuRenderTarget(renderTarget));\n }\n}\n\nexport { RenderTargetSystem };\n//# sourceMappingURL=RenderTargetSystem.mjs.map\n","\"use strict\";\nfunction isRenderingToScreen(renderTarget) {\n const resource = renderTarget.colorTexture.source.resource;\n return globalThis.HTMLCanvasElement && resource instanceof HTMLCanvasElement && document.body.contains(resource);\n}\n\nexport { isRenderingToScreen };\n//# sourceMappingURL=isRenderingToScreen.mjs.map\n","\"use strict\";\nfunction calculateProjection(pm, x, y, width, height, flipY) {\n const sign = flipY ? 1 : -1;\n pm.identity();\n pm.a = 1 / width * 2;\n pm.d = sign * (1 / height * 2);\n pm.tx = -1 - x * pm.a;\n pm.ty = -sign - y * pm.d;\n return pm;\n}\n\nexport { calculateProjection };\n//# sourceMappingURL=calculateProjection.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { RenderTargetSystem } from '../../shared/renderTarget/RenderTargetSystem.mjs';\nimport { GlRenderTargetAdaptor } from './GlRenderTargetAdaptor.mjs';\n\n\"use strict\";\nclass GlRenderTargetSystem extends RenderTargetSystem {\n constructor(renderer) {\n super(renderer);\n this.adaptor = new GlRenderTargetAdaptor();\n this.adaptor.init(renderer, this);\n }\n}\n/** @ignore */\nGlRenderTargetSystem.extension = {\n type: [ExtensionType.WebGLSystem],\n name: \"renderTarget\"\n};\n\nexport { GlRenderTargetSystem };\n//# sourceMappingURL=GlRenderTargetSystem.mjs.map\n","import EventEmitter from 'eventemitter3';\nimport { uid } from '../../../../utils/data/uid.mjs';\n\n\"use strict\";\nclass BufferResource extends EventEmitter {\n /**\n * Create a new Buffer Resource.\n * @param options - The options for the buffer resource\n * @param options.buffer - The underlying buffer that this resource is using\n * @param options.offset - The offset of the buffer this resource is using.\n * If not provided, then it will use the offset of the buffer.\n * @param options.size - The size of the buffer this resource is using.\n * If not provided, then it will use the size of the buffer.\n */\n constructor({ buffer, offset, size }) {\n super();\n /**\n * emits when the underlying buffer has changed shape (i.e. resized)\n * letting the renderer know that it needs to discard the old buffer on the GPU and create a new one\n * @event change\n */\n /** a unique id for this uniform group used through the renderer */\n this.uid = uid(\"buffer\");\n /**\n * a resource type, used to identify how to handle it when its in a bind group / shader resource\n * @internal\n * @ignore\n */\n this._resourceType = \"bufferResource\";\n /**\n * used internally to know if a uniform group was used in the last render pass\n * @internal\n * @ignore\n */\n this._touched = 0;\n /**\n * the resource id used internally by the renderer to build bind group keys\n * @internal\n * @ignore\n */\n this._resourceId = uid(\"resource\");\n /**\n * A cheeky hint to the GL renderer to let it know this is a BufferResource\n * @internal\n * @ignore\n */\n this._bufferResource = true;\n /**\n * Has the Buffer resource been destroyed?\n * @readonly\n */\n this.destroyed = false;\n this.buffer = buffer;\n this.offset = offset | 0;\n this.size = size;\n this.buffer.on(\"change\", this.onBufferChange, this);\n }\n onBufferChange() {\n this._resourceId = uid(\"resource\");\n this.emit(\"change\", this);\n }\n /**\n * Destroys this resource. Make sure the underlying buffer is not used anywhere else\n * if you want to destroy it as well, or code will explode\n * @param destroyBuffer - Should the underlying buffer be destroyed as well?\n */\n destroy(destroyBuffer = false) {\n this.destroyed = true;\n if (destroyBuffer) {\n this.buffer.destroy();\n }\n this.emit(\"change\", this);\n this.buffer = null;\n }\n}\n\nexport { BufferResource };\n//# sourceMappingURL=BufferResource.mjs.map\n","\"use strict\";\nclass IGLUniformData {\n}\nclass GlProgramData {\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program, uniformData) {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBlockBindings = {};\n }\n /** Destroys this program. */\n destroy() {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBlockBindings = null;\n this.program = null;\n }\n}\n\nexport { GlProgramData, IGLUniformData };\n//# sourceMappingURL=GlProgramData.mjs.map\n","\"use strict\";\nfunction compileShader(gl, type, src) {\n const shader = gl.createShader(type);\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n return shader;\n}\n\nexport { compileShader };\n//# sourceMappingURL=compileShader.mjs.map\n","\"use strict\";\nfunction booleanArray(size) {\n const array = new Array(size);\n for (let i = 0; i < array.length; i++) {\n array[i] = false;\n }\n return array;\n}\nfunction defaultValue(type, size) {\n switch (type) {\n case \"float\":\n return 0;\n case \"vec2\":\n return new Float32Array(2 * size);\n case \"vec3\":\n return new Float32Array(3 * size);\n case \"vec4\":\n return new Float32Array(4 * size);\n case \"int\":\n case \"uint\":\n case \"sampler2D\":\n case \"sampler2DArray\":\n return 0;\n case \"ivec2\":\n return new Int32Array(2 * size);\n case \"ivec3\":\n return new Int32Array(3 * size);\n case \"ivec4\":\n return new Int32Array(4 * size);\n case \"uvec2\":\n return new Uint32Array(2 * size);\n case \"uvec3\":\n return new Uint32Array(3 * size);\n case \"uvec4\":\n return new Uint32Array(4 * size);\n case \"bool\":\n return false;\n case \"bvec2\":\n return booleanArray(2 * size);\n case \"bvec3\":\n return booleanArray(3 * size);\n case \"bvec4\":\n return booleanArray(4 * size);\n case \"mat2\":\n return new Float32Array([\n 1,\n 0,\n 0,\n 1\n ]);\n case \"mat3\":\n return new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n ]);\n case \"mat4\":\n return new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n ]);\n }\n return null;\n}\n\nexport { defaultValue };\n//# sourceMappingURL=defaultValue.mjs.map\n","\"use strict\";\nlet GL_TABLE = null;\nconst GL_TO_GLSL_TYPES = {\n FLOAT: \"float\",\n FLOAT_VEC2: \"vec2\",\n FLOAT_VEC3: \"vec3\",\n FLOAT_VEC4: \"vec4\",\n INT: \"int\",\n INT_VEC2: \"ivec2\",\n INT_VEC3: \"ivec3\",\n INT_VEC4: \"ivec4\",\n UNSIGNED_INT: \"uint\",\n UNSIGNED_INT_VEC2: \"uvec2\",\n UNSIGNED_INT_VEC3: \"uvec3\",\n UNSIGNED_INT_VEC4: \"uvec4\",\n BOOL: \"bool\",\n BOOL_VEC2: \"bvec2\",\n BOOL_VEC3: \"bvec3\",\n BOOL_VEC4: \"bvec4\",\n FLOAT_MAT2: \"mat2\",\n FLOAT_MAT3: \"mat3\",\n FLOAT_MAT4: \"mat4\",\n SAMPLER_2D: \"sampler2D\",\n INT_SAMPLER_2D: \"sampler2D\",\n UNSIGNED_INT_SAMPLER_2D: \"sampler2D\",\n SAMPLER_CUBE: \"samplerCube\",\n INT_SAMPLER_CUBE: \"samplerCube\",\n UNSIGNED_INT_SAMPLER_CUBE: \"samplerCube\",\n SAMPLER_2D_ARRAY: \"sampler2DArray\",\n INT_SAMPLER_2D_ARRAY: \"sampler2DArray\",\n UNSIGNED_INT_SAMPLER_2D_ARRAY: \"sampler2DArray\"\n};\nconst GLSL_TO_VERTEX_TYPES = {\n float: \"float32\",\n vec2: \"float32x2\",\n vec3: \"float32x3\",\n vec4: \"float32x4\",\n int: \"sint32\",\n ivec2: \"sint32x2\",\n ivec3: \"sint32x3\",\n ivec4: \"sint32x4\",\n uint: \"uint32\",\n uvec2: \"uint32x2\",\n uvec3: \"uint32x3\",\n uvec4: \"uint32x4\",\n bool: \"uint32\",\n bvec2: \"uint32x2\",\n bvec3: \"uint32x3\",\n bvec4: \"uint32x4\"\n};\nfunction mapType(gl, type) {\n if (!GL_TABLE) {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n GL_TABLE = {};\n for (let i = 0; i < typeNames.length; ++i) {\n const tn = typeNames[i];\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n return GL_TABLE[type];\n}\nfunction mapGlToVertexFormat(gl, type) {\n const typeValue = mapType(gl, type);\n return GLSL_TO_VERTEX_TYPES[typeValue] || \"float32\";\n}\n\nexport { mapGlToVertexFormat, mapType };\n//# sourceMappingURL=mapType.mjs.map\n","\"use strict\";\nfunction logPrettyShaderError(gl, shader) {\n const shaderSrc = gl.getShaderSource(shader).split(\"\\n\").map((line, index) => `${index}: ${line}`);\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split(\"\\n\");\n const dedupe = {};\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, \"$1\"))).filter((n) => {\n if (n && !dedupe[n]) {\n dedupe[n] = true;\n return true;\n }\n return false;\n });\n const logArgs = [\"\"];\n lineNumbers.forEach((number) => {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push(\"background: #FF0000; color:#FFFFFF; font-size: 10px\", \"font-size: 10px\");\n });\n const fragmentSourceToLog = shaderSrc.join(\"\\n\");\n logArgs[0] = fragmentSourceToLog;\n console.error(shaderLog);\n console.groupCollapsed(\"click to view full shader code\");\n console.warn(...logArgs);\n console.groupEnd();\n}\nfunction logProgramError(gl, program, vertexShader, fragmentShader) {\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n logPrettyShaderError(gl, vertexShader);\n }\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n logPrettyShaderError(gl, fragmentShader);\n }\n console.error(\"PixiJS Error: Could not initialize shader.\");\n if (gl.getProgramInfoLog(program) !== \"\") {\n console.warn(\"PixiJS Warning: gl.getProgramInfoLog()\", gl.getProgramInfoLog(program));\n }\n }\n}\n\nexport { logProgramError };\n//# sourceMappingURL=logProgramError.mjs.map\n","import { warn } from '../../../../../utils/logging/warn.mjs';\nimport { GlProgramData } from '../GlProgramData.mjs';\nimport { compileShader } from './compileShader.mjs';\nimport { defaultValue } from './defaultValue.mjs';\nimport { extractAttributesFromGlProgram } from './extractAttributesFromGlProgram.mjs';\nimport { getUboData } from './getUboData.mjs';\nimport { getUniformData } from './getUniformData.mjs';\nimport { logProgramError } from './logProgramError.mjs';\n\n\"use strict\";\nfunction generateProgram(gl, program) {\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertex);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragment);\n const webGLProgram = gl.createProgram();\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n const transformFeedbackVaryings = program.transformFeedbackVaryings;\n if (transformFeedbackVaryings) {\n if (typeof gl.transformFeedbackVaryings !== \"function\") {\n warn(`TransformFeedback is not supported but TransformFeedbackVaryings are given.`);\n } else {\n gl.transformFeedbackVaryings(\n webGLProgram,\n transformFeedbackVaryings.names,\n transformFeedbackVaryings.bufferMode === \"separate\" ? gl.SEPARATE_ATTRIBS : gl.INTERLEAVED_ATTRIBS\n );\n }\n }\n gl.linkProgram(webGLProgram);\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS)) {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n program._attributeData = extractAttributesFromGlProgram(\n webGLProgram,\n gl,\n !/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m.test(program.vertex)\n );\n program._uniformData = getUniformData(webGLProgram, gl);\n program._uniformBlockData = getUboData(webGLProgram, gl);\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n const uniformData = {};\n for (const i in program._uniformData) {\n const data = program._uniformData[i];\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size)\n };\n }\n const glProgram = new GlProgramData(webGLProgram, uniformData);\n return glProgram;\n}\n\nexport { generateProgram };\n//# sourceMappingURL=generateProgram.mjs.map\n","import { getAttributeInfoFromFormat } from '../../../shared/geometry/utils/getAttributeInfoFromFormat.mjs';\nimport { mapGlToVertexFormat } from './mapType.mjs';\n\n\"use strict\";\nfunction extractAttributesFromGlProgram(program, gl, sortAttributes = false) {\n const attributes = {};\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n for (let i = 0; i < totalAttributes; i++) {\n const attribData = gl.getActiveAttrib(program, i);\n if (attribData.name.startsWith(\"gl_\")) {\n continue;\n }\n const format = mapGlToVertexFormat(gl, attribData.type);\n attributes[attribData.name] = {\n location: 0,\n // set further down..\n format,\n stride: getAttributeInfoFromFormat(format).stride,\n offset: 0,\n instance: false,\n start: 0\n };\n }\n const keys = Object.keys(attributes);\n if (sortAttributes) {\n keys.sort((a, b) => a > b ? 1 : -1);\n for (let i = 0; i < keys.length; i++) {\n attributes[keys[i]].location = i;\n gl.bindAttribLocation(program, i, keys[i]);\n }\n gl.linkProgram(program);\n } else {\n for (let i = 0; i < keys.length; i++) {\n attributes[keys[i]].location = gl.getAttribLocation(program, keys[i]);\n }\n }\n return attributes;\n}\n\nexport { extractAttributesFromGlProgram };\n//# sourceMappingURL=extractAttributesFromGlProgram.mjs.map\n","import { defaultValue } from './defaultValue.mjs';\nimport { mapType } from './mapType.mjs';\n\n\"use strict\";\nfunction getUniformData(program, gl) {\n const uniforms = {};\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n for (let i = 0; i < totalUniforms; i++) {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, \"\");\n const isArray = !!uniformData.name.match(/\\[.*?\\]$/);\n const type = mapType(gl, uniformData.type);\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size)\n };\n }\n return uniforms;\n}\n\nexport { getUniformData };\n//# sourceMappingURL=getUniformData.mjs.map\n","\"use strict\";\nfunction getUboData(program, gl) {\n if (!gl.ACTIVE_UNIFORM_BLOCKS)\n return {};\n const uniformBlocks = {};\n const totalUniformsBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);\n for (let i = 0; i < totalUniformsBlocks; i++) {\n const name = gl.getActiveUniformBlockName(program, i);\n const uniformBlockIndex = gl.getUniformBlockIndex(program, name);\n const size = gl.getActiveUniformBlockParameter(program, i, gl.UNIFORM_BLOCK_DATA_SIZE);\n uniformBlocks[name] = {\n name,\n index: uniformBlockIndex,\n size\n };\n }\n return uniformBlocks;\n}\n\nexport { getUboData };\n//# sourceMappingURL=getUboData.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { generateShaderSyncCode } from './GenerateShaderSyncCode.mjs';\nimport { generateProgram } from './program/generateProgram.mjs';\n\n\"use strict\";\nconst defaultSyncData = {\n textureCount: 0,\n blockIndex: 0\n};\nclass GlShaderSystem {\n constructor(renderer) {\n /**\n * @internal\n * @private\n */\n this._activeProgram = null;\n this._programDataHash = /* @__PURE__ */ Object.create(null);\n this._nextIndex = 0;\n this._boundUniformsIdsToIndexHash = /* @__PURE__ */ Object.create(null);\n this._boundIndexToUniformsHash = /* @__PURE__ */ Object.create(null);\n this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n contextChange(gl) {\n this._gl = gl;\n this._maxBindings = gl.MAX_UNIFORM_BUFFER_BINDINGS ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0;\n this._programDataHash = /* @__PURE__ */ Object.create(null);\n this._boundUniformsIdsToIndexHash = /* @__PURE__ */ Object.create(null);\n this._boundIndexToUniformsHash = /* @__PURE__ */ Object.create(null);\n this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null);\n this._activeProgram = null;\n }\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param skipSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader, skipSync) {\n this._setProgram(shader.glProgram);\n if (skipSync)\n return;\n defaultSyncData.textureCount = 0;\n defaultSyncData.blockIndex = 0;\n let syncFunction = this._shaderSyncFunctions[shader.glProgram._key];\n if (!syncFunction) {\n syncFunction = this._shaderSyncFunctions[shader.glProgram._key] = this._generateShaderSync(shader, this);\n }\n syncFunction(this._renderer, shader, defaultSyncData);\n }\n /**\n * Updates the uniform group.\n * @param uniformGroup - the uniform group to update\n */\n updateUniformGroup(uniformGroup) {\n this._renderer.uniformGroup.updateUniformGroup(uniformGroup, this._activeProgram, defaultSyncData);\n }\n /**\n * Binds a uniform block to the shader.\n * @param uniformGroup - the uniform group to bind\n * @param name - the name of the uniform block\n * @param index - the index of the uniform block\n */\n bindUniformBlock(uniformGroup, name, index = 0) {\n const bufferSystem = this._renderer.buffer;\n const programData = this._getProgramData(this._activeProgram);\n const isBufferResource = uniformGroup._bufferResource;\n if (isBufferResource) {\n this._renderer.ubo.updateUniformGroup(uniformGroup);\n }\n bufferSystem.updateBuffer(uniformGroup.buffer);\n let boundIndex = this._boundUniformsIdsToIndexHash[uniformGroup.uid];\n if (boundIndex === void 0) {\n const nextIndex = this._nextIndex++ % this._maxBindings;\n const currentBoundUniformGroup = this._boundIndexToUniformsHash[nextIndex];\n if (currentBoundUniformGroup) {\n this._boundUniformsIdsToIndexHash[currentBoundUniformGroup.uid] = void 0;\n }\n boundIndex = this._boundUniformsIdsToIndexHash[uniformGroup.uid] = nextIndex;\n this._boundIndexToUniformsHash[nextIndex] = uniformGroup;\n if (isBufferResource) {\n bufferSystem.bindBufferRange(uniformGroup.buffer, nextIndex, uniformGroup.offset);\n } else {\n bufferSystem.bindBufferBase(uniformGroup.buffer, nextIndex);\n }\n }\n const gl = this._gl;\n const uniformBlockIndex = this._activeProgram._uniformBlockData[name].index;\n if (programData.uniformBlockBindings[index] === boundIndex)\n return;\n programData.uniformBlockBindings[index] = boundIndex;\n gl.uniformBlockBinding(programData.program, uniformBlockIndex, boundIndex);\n }\n _setProgram(program) {\n if (this._activeProgram === program)\n return;\n this._activeProgram = program;\n const programData = this._getProgramData(program);\n this._gl.useProgram(programData.program);\n }\n /**\n * @param program - the program to get the data for\n * @internal\n * @private\n */\n _getProgramData(program) {\n return this._programDataHash[program._key] || this._createProgramData(program);\n }\n _createProgramData(program) {\n const key = program._key;\n this._programDataHash[key] = generateProgram(this._gl, program);\n return this._programDataHash[key];\n }\n destroy() {\n for (const key of Object.keys(this._programDataHash)) {\n const programData = this._programDataHash[key];\n programData.destroy();\n this._programDataHash[key] = null;\n }\n this._programDataHash = null;\n this._boundUniformsIdsToIndexHash = null;\n }\n /**\n * Creates a function that can be executed that will sync the shader as efficiently as possible.\n * Overridden by the unsafe eval package if you don't want eval used in your project.\n * @param shader - the shader to generate the sync function for\n * @param shaderSystem - the shader system to use\n * @returns - the generated sync function\n * @ignore\n */\n _generateShaderSync(shader, shaderSystem) {\n return generateShaderSyncCode(shader, shaderSystem);\n }\n}\n/** @ignore */\nGlShaderSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"shader\"\n};\n\nexport { GlShaderSystem };\n//# sourceMappingURL=GlShaderSystem.mjs.map\n","import { BufferResource } from '../../shared/buffer/BufferResource.mjs';\nimport { UniformGroup } from '../../shared/shader/UniformGroup.mjs';\nimport { TextureSource } from '../../shared/texture/sources/TextureSource.mjs';\n\n\"use strict\";\nfunction generateShaderSyncCode(shader, shaderSystem) {\n const funcFragments = [];\n const headerFragments = [`\n var g = s.groups;\n var sS = r.shader;\n var p = s.glProgram;\n var ugS = r.uniformGroup;\n var resources;\n `];\n let addedTextreSystem = false;\n let blockIndex = 0;\n let textureCount = 0;\n const programData = shaderSystem._getProgramData(shader.glProgram);\n for (const i in shader.groups) {\n const group = shader.groups[i];\n funcFragments.push(`\n resources = g[${i}].resources;\n `);\n for (const j in group.resources) {\n const resource = group.resources[j];\n if (resource instanceof UniformGroup) {\n if (resource.ubo) {\n funcFragments.push(`\n sS.bindUniformBlock(\n resources[${j}],\n sS._uniformBindMap[${i}[${j}],\n ${blockIndex++}\n );\n `);\n } else {\n funcFragments.push(`\n ugS.updateUniformGroup(resources[${j}], p, sD);\n `);\n }\n } else if (resource instanceof BufferResource) {\n funcFragments.push(`\n sS.bindUniformBlock(\n resources[${j}],\n sS._uniformBindMap[${i}[${j}],\n ${blockIndex++}\n );\n `);\n } else if (resource instanceof TextureSource) {\n const uniformName = shader._uniformBindMap[i][j];\n const uniformData = programData.uniformData[uniformName];\n if (uniformData) {\n if (!addedTextreSystem) {\n addedTextreSystem = true;\n headerFragments.push(`\n var tS = r.texture;\n `);\n }\n shaderSystem._gl.uniform1i(uniformData.location, textureCount);\n funcFragments.push(`\n tS.bind(resources[${j}], ${textureCount});\n `);\n textureCount++;\n }\n }\n }\n }\n const functionSource = [...headerFragments, ...funcFragments].join(\"\\n\");\n return new Function(\"r\", \"s\", \"sD\", functionSource);\n}\n\nexport { generateShaderSyncCode };\n//# sourceMappingURL=GenerateShaderSyncCode.mjs.map\n","\"use strict\";\nconst UNIFORM_TO_SINGLE_SETTERS = {\n f32: `if (cv !== v) {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n \"vec2\": `if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1]);\n }`,\n \"vec3\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3f(location, v[0], v[1], v[2]);\n }`,\n \"vec4\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n i32: `if (cv !== v) {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n \"vec2\": `if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2i(location, v[0], v[1]);\n }`,\n \"vec3\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n \"vec4\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n u32: `if (cv !== v) {\n cu.value = v;\n gl.uniform1ui(location, v);\n }`,\n \"vec2\": `if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n \"vec3\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n \"vec4\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n bool: `if (cv !== v) {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n \"vec2\": `if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2i(location, v[0], v[1]);\n }`,\n \"vec3\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n \"vec4\": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n \"mat2x2\": `gl.uniformMatrix2fv(location, false, v);`,\n \"mat3x3\": `gl.uniformMatrix3fv(location, false, v);`,\n \"mat4x4\": `gl.uniformMatrix4fv(location, false, v);`\n};\nconst UNIFORM_TO_ARRAY_SETTERS = {\n f32: `gl.uniform1fv(location, v);`,\n \"vec2\": `gl.uniform2fv(location, v);`,\n \"vec3\": `gl.uniform3fv(location, v);`,\n \"vec4\": `gl.uniform4fv(location, v);`,\n \"mat2x2\": `gl.uniformMatrix2fv(location, false, v);`,\n \"mat3x3\": `gl.uniformMatrix3fv(location, false, v);`,\n \"mat4x4\": `gl.uniformMatrix4fv(location, false, v);`,\n i32: `gl.uniform1iv(location, v);`,\n \"vec2\": `gl.uniform2iv(location, v);`,\n \"vec3\": `gl.uniform3iv(location, v);`,\n \"vec4\": `gl.uniform4iv(location, v);`,\n u32: `gl.uniform1iv(location, v);`,\n \"vec2\": `gl.uniform2iv(location, v);`,\n \"vec3\": `gl.uniform3iv(location, v);`,\n \"vec4\": `gl.uniform4iv(location, v);`,\n bool: `gl.uniform1iv(location, v);`,\n \"vec2\": `gl.uniform2iv(location, v);`,\n \"vec3\": `gl.uniform3iv(location, v);`,\n \"vec4\": `gl.uniform4iv(location, v);`\n};\n\nexport { UNIFORM_TO_ARRAY_SETTERS, UNIFORM_TO_SINGLE_SETTERS };\n//# sourceMappingURL=generateUniformsSyncTypes.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { generateUniformsSync } from './utils/generateUniformsSync.mjs';\n\n\"use strict\";\nclass GlUniformGroupSystem {\n /** @param renderer - The renderer this System works for. */\n constructor(renderer) {\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n this._cache = {};\n this._uniformGroupSyncHash = {};\n this._renderer = renderer;\n this.gl = null;\n this._cache = {};\n }\n contextChange(gl) {\n this.gl = gl;\n }\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param group - the uniforms values that be applied to the current shader\n * @param program\n * @param syncData\n * @param syncData.textureCount\n */\n updateUniformGroup(group, program, syncData) {\n const programData = this._renderer.shader._getProgramData(program);\n if (!group.isStatic || group._dirtyId !== programData.uniformDirtyGroups[group.uid]) {\n programData.uniformDirtyGroups[group.uid] = group._dirtyId;\n const syncFunc = this._getUniformSyncFunction(group, program);\n syncFunc(programData.uniformData, group.uniforms, this._renderer, syncData);\n }\n }\n /**\n * Overridable by the pixi.js/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param program\n */\n _getUniformSyncFunction(group, program) {\n return this._uniformGroupSyncHash[group._signature]?.[program._key] || this._createUniformSyncFunction(group, program);\n }\n _createUniformSyncFunction(group, program) {\n const uniformGroupSyncHash = this._uniformGroupSyncHash[group._signature] || (this._uniformGroupSyncHash[group._signature] = {});\n const id = this._getSignature(group, program._uniformData, \"u\");\n if (!this._cache[id]) {\n this._cache[id] = this._generateUniformsSync(group, program._uniformData);\n }\n uniformGroupSyncHash[program._key] = this._cache[id];\n return uniformGroupSyncHash[program._key];\n }\n _generateUniformsSync(group, uniformData) {\n return generateUniformsSync(group, uniformData);\n }\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n _getSignature(group, uniformData, preFix) {\n const uniforms = group.uniforms;\n const strings = [`${preFix}-`];\n for (const i in uniforms) {\n strings.push(i);\n if (uniformData[i]) {\n strings.push(uniformData[i].type);\n }\n }\n return strings.join(\"-\");\n }\n /** Destroys this System and removes all its textures. */\n destroy() {\n this._renderer = null;\n this._cache = null;\n }\n}\n/** @ignore */\nGlUniformGroupSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"uniformGroup\"\n};\n\nexport { GlUniformGroupSystem };\n//# sourceMappingURL=GlUniformGroupSystem.mjs.map\n","import { BufferResource } from '../../../shared/buffer/BufferResource.mjs';\nimport { UniformGroup } from '../../../shared/shader/UniformGroup.mjs';\nimport { uniformParsers } from '../../../shared/shader/utils/uniformParsers.mjs';\nimport { UNIFORM_TO_SINGLE_SETTERS, UNIFORM_TO_ARRAY_SETTERS } from './generateUniformsSyncTypes.mjs';\n\n\"use strict\";\nfunction generateUniformsSync(group, uniformData) {\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n var name = null;\n `];\n for (const i in group.uniforms) {\n if (!uniformData[i]) {\n if (group.uniforms[i] instanceof UniformGroup) {\n if (group.uniforms[i].ubo) {\n funcFragments.push(`\n renderer.shader.bindUniformBlock(uv.${i}, \"${i}\");\n `);\n } else {\n funcFragments.push(`\n renderer.shader.updateUniformGroup(uv.${i});\n `);\n }\n } else if (group.uniforms[i] instanceof BufferResource) {\n funcFragments.push(`\n renderer.shader.bindBufferResource(uv.${i}, \"${i}\");\n `);\n }\n continue;\n }\n const uniform = group.uniformStructures[i];\n let parsed = false;\n for (let j = 0; j < uniformParsers.length; j++) {\n const parser = uniformParsers[j];\n if (uniform.type === parser.type && parser.test(uniform)) {\n funcFragments.push(`name = \"${i}\";`, uniformParsers[j].uniform);\n parsed = true;\n break;\n }\n }\n if (!parsed) {\n const templateType = uniform.size === 1 ? UNIFORM_TO_SINGLE_SETTERS : UNIFORM_TO_ARRAY_SETTERS;\n const template = templateType[uniform.type].replace(\"location\", `ud[\"${i}\"].location`);\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n return new Function(\"ud\", \"uv\", \"renderer\", \"syncData\", funcFragments.join(\"\\n\"));\n}\n\nexport { generateUniformsSync };\n//# sourceMappingURL=generateUniformsSync.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { State } from '../../shared/state/State.mjs';\nimport { mapWebGLBlendModesToPixi } from './mapWebGLBlendModesToPixi.mjs';\n\n\"use strict\";\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\nconst _GlStateSystem = class _GlStateSystem {\n constructor() {\n this.gl = null;\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = \"none\";\n this._blendEq = false;\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n this.checks = [];\n this.defaultState = State.for2d();\n }\n contextChange(gl) {\n this.gl = gl;\n this.blendModesMap = mapWebGLBlendModesToPixi(gl);\n this.reset();\n }\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state) {\n state = state || this.defaultState;\n if (this.stateId !== state.data) {\n let diff = this.stateId ^ state.data;\n let i = 0;\n while (diff) {\n if (diff & 1) {\n this.map[i].call(this, !!(state.data & 1 << i));\n }\n diff = diff >> 1;\n i++;\n }\n this.stateId = state.data;\n }\n for (let i = 0; i < this.checks.length; i++) {\n this.checks[i](this, state);\n }\n }\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state) {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++) {\n this.map[i].call(this, !!(state.data & 1 << i));\n }\n for (let i = 0; i < this.checks.length; i++) {\n this.checks[i](this, state);\n }\n this.stateId = state.data;\n }\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value) {\n this._updateCheck(_GlStateSystem._checkBlendMode, value);\n this.gl[value ? \"enable\" : \"disable\"](this.gl.BLEND);\n }\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value) {\n this._updateCheck(_GlStateSystem._checkPolygonOffset, value);\n this.gl[value ? \"enable\" : \"disable\"](this.gl.POLYGON_OFFSET_FILL);\n }\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value) {\n this.gl[value ? \"enable\" : \"disable\"](this.gl.DEPTH_TEST);\n }\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value) {\n this.gl.depthMask(value);\n }\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value) {\n this.gl[value ? \"enable\" : \"disable\"](this.gl.CULL_FACE);\n }\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value) {\n this.gl.frontFace(this.gl[value ? \"CW\" : \"CCW\"]);\n }\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value) {\n if (!this.blendModesMap[value]) {\n value = \"normal\";\n }\n if (value === this.blendMode) {\n return;\n }\n this.blendMode = value;\n const mode = this.blendModesMap[value];\n const gl = this.gl;\n if (mode.length === 2) {\n gl.blendFunc(mode[0], mode[1]);\n } else {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6) {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n } else if (this._blendEq) {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value, scale) {\n this.gl.polygonOffset(value, scale);\n }\n // used\n /** Resets all the logic and disables the VAOs. */\n reset() {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n this.forceState(this.defaultState);\n this._blendEq = true;\n this.blendMode = \"\";\n this.setBlendMode(\"normal\");\n }\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n _updateCheck(func, value) {\n const index = this.checks.indexOf(func);\n if (value && index === -1) {\n this.checks.push(func);\n } else if (!value && index !== -1) {\n this.checks.splice(index, 1);\n }\n }\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n static _checkBlendMode(system, state) {\n system.setBlendMode(state.blendMode);\n }\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n static _checkPolygonOffset(system, state) {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n /**\n * @ignore\n */\n destroy() {\n this.gl = null;\n this.checks.length = 0;\n }\n};\n/** @ignore */\n_GlStateSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"state\"\n};\nlet GlStateSystem = _GlStateSystem;\n\nexport { GlStateSystem };\n//# sourceMappingURL=GlStateSystem.mjs.map\n","\"use strict\";\nfunction mapWebGLBlendModesToPixi(gl) {\n const blendMap = {};\n blendMap.normal = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n blendMap.add = [gl.ONE, gl.ONE];\n blendMap.multiply = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n blendMap.screen = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n blendMap.none = [0, 0];\n blendMap[\"normal-npm\"] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n blendMap[\"add-npm\"] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n blendMap[\"screen-npm\"] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n blendMap.erase = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n return blendMap;\n}\n\nexport { mapWebGLBlendModesToPixi };\n//# sourceMappingURL=mapWebGLBlendModesToPixi.mjs.map\n","import { GL_TARGETS, GL_TYPES, GL_FORMATS } from './const.mjs';\n\n\"use strict\";\nclass GlTexture {\n constructor(texture) {\n this.target = GL_TARGETS.TEXTURE_2D;\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.type = GL_TYPES.UNSIGNED_BYTE;\n this.internalFormat = GL_FORMATS.RGBA;\n this.format = GL_FORMATS.RGBA;\n this.samplerType = 0;\n }\n}\n\nexport { GlTexture };\n//# sourceMappingURL=GlTexture.mjs.map\n","\"use strict\";\nconst glUploadBufferImageResource = {\n id: \"buffer\",\n upload(source, glTexture, gl) {\n if (glTexture.width === source.width || glTexture.height === source.height) {\n gl.texSubImage2D(\n gl.TEXTURE_2D,\n 0,\n 0,\n 0,\n source.width,\n source.height,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n } else {\n gl.texImage2D(\n glTexture.target,\n 0,\n glTexture.internalFormat,\n source.width,\n source.height,\n 0,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n }\n glTexture.width = source.width;\n glTexture.height = source.height;\n }\n};\n\nexport { glUploadBufferImageResource };\n//# sourceMappingURL=glUploadBufferImageResource.mjs.map\n","\"use strict\";\nconst compressedFormatMap = {\n \"bc1-rgba-unorm\": true,\n \"bc1-rgba-unorm-srgb\": true,\n \"bc2-rgba-unorm\": true,\n \"bc2-rgba-unorm-srgb\": true,\n \"bc3-rgba-unorm\": true,\n \"bc3-rgba-unorm-srgb\": true,\n \"bc4-r-unorm\": true,\n \"bc4-r-snorm\": true,\n \"bc5-rg-unorm\": true,\n \"bc5-rg-snorm\": true,\n \"bc6h-rgb-ufloat\": true,\n \"bc6h-rgb-float\": true,\n \"bc7-rgba-unorm\": true,\n \"bc7-rgba-unorm-srgb\": true,\n // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\n // supported by the device/user agent and enabled in requestDevice.\n \"etc2-rgb8unorm\": true,\n \"etc2-rgb8unorm-srgb\": true,\n \"etc2-rgb8a1unorm\": true,\n \"etc2-rgb8a1unorm-srgb\": true,\n \"etc2-rgba8unorm\": true,\n \"etc2-rgba8unorm-srgb\": true,\n \"eac-r11unorm\": true,\n \"eac-r11snorm\": true,\n \"eac-rg11unorm\": true,\n \"eac-rg11snorm\": true,\n // ASTC compressed formats usable if \"texture-compression-astc\" is both\n // supported by the device/user agent and enabled in requestDevice.\n \"astc-4x4-unorm\": true,\n \"astc-4x4-unorm-srgb\": true,\n \"astc-5x4-unorm\": true,\n \"astc-5x4-unorm-srgb\": true,\n \"astc-5x5-unorm\": true,\n \"astc-5x5-unorm-srgb\": true,\n \"astc-6x5-unorm\": true,\n \"astc-6x5-unorm-srgb\": true,\n \"astc-6x6-unorm\": true,\n \"astc-6x6-unorm-srgb\": true,\n \"astc-8x5-unorm\": true,\n \"astc-8x5-unorm-srgb\": true,\n \"astc-8x6-unorm\": true,\n \"astc-8x6-unorm-srgb\": true,\n \"astc-8x8-unorm\": true,\n \"astc-8x8-unorm-srgb\": true,\n \"astc-10x5-unorm\": true,\n \"astc-10x5-unorm-srgb\": true,\n \"astc-10x6-unorm\": true,\n \"astc-10x6-unorm-srgb\": true,\n \"astc-10x8-unorm\": true,\n \"astc-10x8-unorm-srgb\": true,\n \"astc-10x10-unorm\": true,\n \"astc-10x10-unorm-srgb\": true,\n \"astc-12x10-unorm\": true,\n \"astc-12x10-unorm-srgb\": true,\n \"astc-12x12-unorm\": true,\n \"astc-12x12-unorm-srgb\": true\n};\nconst glUploadCompressedTextureResource = {\n id: \"compressed\",\n upload(source, glTexture, gl) {\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);\n let mipWidth = source.pixelWidth;\n let mipHeight = source.pixelHeight;\n const compressed = !!compressedFormatMap[source.format];\n for (let i = 0; i < source.resource.length; i++) {\n const levelBuffer = source.resource[i];\n if (compressed) {\n gl.compressedTexImage2D(\n gl.TEXTURE_2D,\n i,\n glTexture.internalFormat,\n mipWidth,\n mipHeight,\n 0,\n levelBuffer\n );\n } else {\n gl.texImage2D(\n gl.TEXTURE_2D,\n i,\n glTexture.internalFormat,\n mipWidth,\n mipHeight,\n 0,\n glTexture.format,\n glTexture.type,\n levelBuffer\n );\n }\n mipWidth = Math.max(mipWidth >> 1, 1);\n mipHeight = Math.max(mipHeight >> 1, 1);\n }\n }\n};\n\nexport { glUploadCompressedTextureResource };\n//# sourceMappingURL=glUploadCompressedTextureResource.mjs.map\n","\"use strict\";\nconst glUploadImageResource = {\n id: \"image\",\n upload(source, glTexture, gl, webGLVersion) {\n const premultipliedAlpha = source.alphaMode === \"premultiply-alpha-on-upload\";\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultipliedAlpha);\n const glWidth = glTexture.width;\n const glHeight = glTexture.height;\n const textureWidth = source.pixelWidth;\n const textureHeight = source.pixelHeight;\n const resourceWidth = source.resourceWidth;\n const resourceHeight = source.resourceHeight;\n if (resourceWidth < textureWidth || resourceHeight < textureHeight) {\n if (glWidth !== textureWidth || glHeight !== textureHeight) {\n gl.texImage2D(\n glTexture.target,\n 0,\n glTexture.internalFormat,\n textureWidth,\n textureHeight,\n 0,\n glTexture.format,\n glTexture.type,\n null\n );\n }\n if (webGLVersion === 2) {\n gl.texSubImage2D(\n gl.TEXTURE_2D,\n 0,\n 0,\n 0,\n resourceWidth,\n resourceHeight,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n } else {\n gl.texSubImage2D(\n gl.TEXTURE_2D,\n 0,\n 0,\n 0,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n }\n } else if (glWidth === textureWidth || glHeight === textureHeight) {\n gl.texSubImage2D(\n gl.TEXTURE_2D,\n 0,\n 0,\n 0,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n } else if (webGLVersion === 2) {\n gl.texImage2D(\n glTexture.target,\n 0,\n glTexture.internalFormat,\n textureWidth,\n textureHeight,\n 0,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n } else {\n gl.texImage2D(\n glTexture.target,\n 0,\n glTexture.internalFormat,\n glTexture.format,\n glTexture.type,\n source.resource\n );\n }\n glTexture.width = textureWidth;\n glTexture.height = textureHeight;\n }\n};\n\nexport { glUploadImageResource };\n//# sourceMappingURL=glUploadImageResource.mjs.map\n","import { glUploadImageResource } from './glUploadImageResource.mjs';\n\n\"use strict\";\nconst glUploadVideoResource = {\n id: \"video\",\n upload(source, glTexture, gl, webGLVersion) {\n if (!source.isValid) {\n gl.texImage2D(\n glTexture.target,\n 0,\n glTexture.internalFormat,\n 1,\n 1,\n 0,\n glTexture.format,\n glTexture.type,\n null\n );\n return;\n }\n glUploadImageResource.upload(source, glTexture, gl, webGLVersion);\n }\n};\n\nexport { glUploadVideoResource };\n//# sourceMappingURL=glUploadVideoResource.mjs.map\n","\"use strict\";\nconst scaleModeToGlFilter = {\n linear: 9729,\n nearest: 9728\n};\nconst mipmapScaleModeToGlFilter = {\n linear: {\n linear: 9987,\n nearest: 9985\n },\n nearest: {\n linear: 9986,\n nearest: 9984\n }\n};\nconst wrapModeToGlAddress = {\n \"clamp-to-edge\": 33071,\n repeat: 10497,\n \"mirror-repeat\": 33648\n};\nconst compareModeToGlCompare = {\n never: 512,\n less: 513,\n equal: 514,\n \"less-equal\": 515,\n greater: 516,\n \"not-equal\": 517,\n \"greater-equal\": 518,\n always: 519\n};\n\nexport { compareModeToGlCompare, mipmapScaleModeToGlFilter, scaleModeToGlFilter, wrapModeToGlAddress };\n//# sourceMappingURL=pixiToGlMaps.mjs.map\n","import { wrapModeToGlAddress, scaleModeToGlFilter, mipmapScaleModeToGlFilter, compareModeToGlCompare } from './pixiToGlMaps.mjs';\n\n\"use strict\";\nfunction applyStyleParams(style, gl, mipmaps, anisotropicExt, glFunctionName, firstParam, forceClamp, firstCreation) {\n const castParam = firstParam;\n if (!firstCreation || style.addressModeU !== \"repeat\" || style.addressModeV !== \"repeat\" || style.addressModeW !== \"repeat\") {\n const wrapModeS = wrapModeToGlAddress[forceClamp ? \"clamp-to-edge\" : style.addressModeU];\n const wrapModeT = wrapModeToGlAddress[forceClamp ? \"clamp-to-edge\" : style.addressModeV];\n const wrapModeR = wrapModeToGlAddress[forceClamp ? \"clamp-to-edge\" : style.addressModeW];\n gl[glFunctionName](castParam, gl.TEXTURE_WRAP_S, wrapModeS);\n gl[glFunctionName](castParam, gl.TEXTURE_WRAP_T, wrapModeT);\n if (gl.TEXTURE_WRAP_R)\n gl[glFunctionName](castParam, gl.TEXTURE_WRAP_R, wrapModeR);\n }\n if (!firstCreation || style.magFilter !== \"linear\") {\n gl[glFunctionName](castParam, gl.TEXTURE_MAG_FILTER, scaleModeToGlFilter[style.magFilter]);\n }\n if (mipmaps) {\n if (!firstCreation || style.mipmapFilter !== \"linear\") {\n const glFilterMode = mipmapScaleModeToGlFilter[style.minFilter][style.mipmapFilter];\n gl[glFunctionName](castParam, gl.TEXTURE_MIN_FILTER, glFilterMode);\n }\n } else {\n gl[glFunctionName](castParam, gl.TEXTURE_MIN_FILTER, scaleModeToGlFilter[style.minFilter]);\n }\n if (anisotropicExt && style.maxAnisotropy > 1) {\n const level = Math.min(style.maxAnisotropy, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n gl[glFunctionName](castParam, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n if (style.compare) {\n gl[glFunctionName](castParam, gl.TEXTURE_COMPARE_FUNC, compareModeToGlCompare[style.compare]);\n }\n}\n\nexport { applyStyleParams };\n//# sourceMappingURL=applyStyleParams.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { Texture } from '../../shared/texture/Texture.mjs';\nimport { GlTexture } from './GlTexture.mjs';\nimport { glUploadBufferImageResource } from './uploaders/glUploadBufferImageResource.mjs';\nimport { glUploadCompressedTextureResource } from './uploaders/glUploadCompressedTextureResource.mjs';\nimport { glUploadImageResource } from './uploaders/glUploadImageResource.mjs';\nimport { glUploadVideoResource } from './uploaders/glUploadVideoResource.mjs';\nimport { applyStyleParams } from './utils/applyStyleParams.mjs';\nimport { mapFormatToGlFormat } from './utils/mapFormatToGlFormat.mjs';\nimport { mapFormatToGlInternalFormat } from './utils/mapFormatToGlInternalFormat.mjs';\nimport { mapFormatToGlType } from './utils/mapFormatToGlType.mjs';\nimport './utils/unpremultiplyAlpha.mjs';\n\n\"use strict\";\nconst BYTES_PER_PIXEL = 4;\nclass GlTextureSystem {\n constructor(renderer) {\n this.managedTextures = [];\n this._glTextures = /* @__PURE__ */ Object.create(null);\n this._glSamplers = /* @__PURE__ */ Object.create(null);\n this._boundTextures = [];\n this._activeTextureLocation = -1;\n this._boundSamplers = /* @__PURE__ */ Object.create(null);\n this._uploads = {\n image: glUploadImageResource,\n buffer: glUploadBufferImageResource,\n video: glUploadVideoResource,\n compressed: glUploadCompressedTextureResource\n };\n // TODO - separate samplers will be a cool thing to add, but not right now!\n this._useSeparateSamplers = false;\n this._renderer = renderer;\n }\n contextChange(gl) {\n this._gl = gl;\n if (!this._mapFormatToInternalFormat) {\n this._mapFormatToInternalFormat = mapFormatToGlInternalFormat(gl, this._renderer.context.extensions);\n this._mapFormatToType = mapFormatToGlType(gl);\n this._mapFormatToFormat = mapFormatToGlFormat(gl);\n }\n this._glTextures = /* @__PURE__ */ Object.create(null);\n this._glSamplers = /* @__PURE__ */ Object.create(null);\n this._boundSamplers = /* @__PURE__ */ Object.create(null);\n for (let i = 0; i < 16; i++) {\n this.bind(Texture.EMPTY, i);\n }\n }\n initSource(source) {\n this.bind(source);\n }\n bind(texture, location = 0) {\n const source = texture.source;\n if (texture) {\n this.bindSource(source, location);\n if (this._useSeparateSamplers) {\n this._bindSampler(source.style, location);\n }\n } else {\n this.bindSource(null, location);\n if (this._useSeparateSamplers) {\n this._bindSampler(null, location);\n }\n }\n }\n bindSource(source, location = 0) {\n const gl = this._gl;\n source._touched = this._renderer.textureGC.count;\n if (this._boundTextures[location] !== source) {\n this._boundTextures[location] = source;\n this._activateLocation(location);\n source = source || Texture.EMPTY.source;\n const glTexture = this.getGlSource(source);\n gl.bindTexture(glTexture.target, glTexture.texture);\n }\n }\n _bindSampler(style, location = 0) {\n const gl = this._gl;\n if (!style) {\n this._boundSamplers[location] = null;\n gl.bindSampler(location, null);\n return;\n }\n const sampler = this._getGlSampler(style);\n if (this._boundSamplers[location] !== sampler) {\n this._boundSamplers[location] = sampler;\n gl.bindSampler(location, sampler);\n }\n }\n unbind(texture) {\n const source = texture.source;\n const boundTextures = this._boundTextures;\n const gl = this._gl;\n for (let i = 0; i < boundTextures.length; i++) {\n if (boundTextures[i] === source) {\n this._activateLocation(i);\n const glTexture = this.getGlSource(source);\n gl.bindTexture(glTexture.target, null);\n boundTextures[i] = null;\n }\n }\n }\n _activateLocation(location) {\n if (this._activeTextureLocation !== location) {\n this._activeTextureLocation = location;\n this._gl.activeTexture(this._gl.TEXTURE0 + location);\n }\n }\n _initSource(source) {\n const gl = this._gl;\n const glTexture = new GlTexture(gl.createTexture());\n glTexture.type = this._mapFormatToType[source.format];\n glTexture.internalFormat = this._mapFormatToInternalFormat[source.format];\n glTexture.format = this._mapFormatToFormat[source.format];\n if (source.autoGenerateMipmaps && (this._renderer.context.supports.nonPowOf2mipmaps || source.isPowerOfTwo)) {\n const biggestDimension = Math.max(source.width, source.height);\n source.mipLevelCount = Math.floor(Math.log2(biggestDimension)) + 1;\n }\n this._glTextures[source.uid] = glTexture;\n if (!this.managedTextures.includes(source)) {\n source.on(\"update\", this.onSourceUpdate, this);\n source.on(\"resize\", this.onSourceUpdate, this);\n source.on(\"styleChange\", this.onStyleChange, this);\n source.on(\"destroy\", this.onSourceDestroy, this);\n source.on(\"unload\", this.onSourceUnload, this);\n source.on(\"updateMipmaps\", this.onUpdateMipmaps, this);\n this.managedTextures.push(source);\n }\n this.onSourceUpdate(source);\n this.updateStyle(source, false);\n return glTexture;\n }\n onStyleChange(source) {\n this.updateStyle(source, false);\n }\n updateStyle(source, firstCreation) {\n const gl = this._gl;\n const glTexture = this.getGlSource(source);\n gl.bindTexture(gl.TEXTURE_2D, glTexture.texture);\n this._boundTextures[this._activeTextureLocation] = source;\n applyStyleParams(\n source.style,\n gl,\n source.mipLevelCount > 1,\n this._renderer.context.extensions.anisotropicFiltering,\n \"texParameteri\",\n gl.TEXTURE_2D,\n // will force a clamp to edge if the texture is not a power of two\n !this._renderer.context.supports.nonPowOf2wrapping && !source.isPowerOfTwo,\n firstCreation\n );\n }\n onSourceUnload(source) {\n const glTexture = this._glTextures[source.uid];\n if (!glTexture)\n return;\n this.unbind(source);\n this._glTextures[source.uid] = null;\n this._gl.deleteTexture(glTexture.texture);\n }\n onSourceUpdate(source) {\n const gl = this._gl;\n const glTexture = this.getGlSource(source);\n gl.bindTexture(gl.TEXTURE_2D, glTexture.texture);\n this._boundTextures[this._activeTextureLocation] = source;\n if (this._uploads[source.uploadMethodId]) {\n this._uploads[source.uploadMethodId].upload(source, glTexture, gl, this._renderer.context.webGLVersion);\n } else {\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, source.pixelWidth, source.pixelHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n if (source.autoGenerateMipmaps && source.mipLevelCount > 1) {\n this.onUpdateMipmaps(source, false);\n }\n }\n onUpdateMipmaps(source, bind = true) {\n if (bind)\n this.bindSource(source, 0);\n const glTexture = this.getGlSource(source);\n this._gl.generateMipmap(glTexture.target);\n }\n onSourceDestroy(source) {\n source.off(\"destroy\", this.onSourceDestroy, this);\n source.off(\"update\", this.onSourceUpdate, this);\n source.off(\"resize\", this.onSourceUpdate, this);\n source.off(\"unload\", this.onSourceUnload, this);\n source.off(\"styleChange\", this.onStyleChange, this);\n source.off(\"updateMipmaps\", this.onUpdateMipmaps, this);\n this.managedTextures.splice(this.managedTextures.indexOf(source), 1);\n this.onSourceUnload(source);\n }\n _initSampler(style) {\n const gl = this._gl;\n const glSampler = this._gl.createSampler();\n this._glSamplers[style._resourceId] = glSampler;\n applyStyleParams(\n style,\n gl,\n this._boundTextures[this._activeTextureLocation].mipLevelCount > 1,\n this._renderer.context.extensions.anisotropicFiltering,\n \"samplerParameteri\",\n glSampler,\n false,\n true\n );\n return this._glSamplers[style._resourceId];\n }\n _getGlSampler(sampler) {\n return this._glSamplers[sampler._resourceId] || this._initSampler(sampler);\n }\n getGlSource(source) {\n return this._glTextures[source.uid] || this._initSource(source);\n }\n generateCanvas(texture) {\n const { pixels, width, height } = this.getPixels(texture);\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n const imageData = ctx.createImageData(width, height);\n imageData.data.set(pixels);\n ctx.putImageData(imageData, 0, 0);\n }\n return canvas;\n }\n getPixels(texture) {\n const resolution = texture.source.resolution;\n const frame = texture.frame;\n const width = Math.max(Math.round(frame.width * resolution), 1);\n const height = Math.max(Math.round(frame.height * resolution), 1);\n const pixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n const renderer = this._renderer;\n const renderTarget = renderer.renderTarget.getRenderTarget(texture);\n const glRenterTarget = renderer.renderTarget.getGpuRenderTarget(renderTarget);\n const gl = renderer.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, glRenterTarget.resolveTargetFramebuffer);\n gl.readPixels(\n Math.round(frame.x * resolution),\n Math.round(frame.y * resolution),\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n pixels\n );\n if (false) {\n unpremultiplyAlpha(pixels);\n }\n return { pixels: new Uint8ClampedArray(pixels.buffer), width, height };\n }\n destroy() {\n this.managedTextures.slice().forEach((source) => this.onSourceDestroy(source));\n this.managedTextures = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nGlTextureSystem.extension = {\n type: [\n ExtensionType.WebGLSystem\n ],\n name: \"texture\"\n};\n\nexport { GlTextureSystem };\n//# sourceMappingURL=GlTextureSystem.mjs.map\n","import { DOMAdapter } from '../../../../../environment/adapter.mjs';\n\n\"use strict\";\nfunction mapFormatToGlInternalFormat(gl, extensions) {\n let srgb = {};\n let bgra8unorm = gl.RGBA;\n if (!(gl instanceof DOMAdapter.get().getWebGLRenderingContext())) {\n srgb = {\n \"rgba8unorm-srgb\": gl.SRGB8_ALPHA8,\n \"bgra8unorm-srgb\": gl.SRGB8_ALPHA8\n };\n bgra8unorm = gl.RGBA8;\n } else if (extensions.srgb) {\n srgb = {\n \"rgba8unorm-srgb\": extensions.srgb.SRGB8_ALPHA8_EXT,\n \"bgra8unorm-srgb\": extensions.srgb.SRGB8_ALPHA8_EXT\n };\n }\n return {\n // 8-bit formats\n r8unorm: gl.R8,\n r8snorm: gl.R8_SNORM,\n r8uint: gl.R8UI,\n r8sint: gl.R8I,\n // 16-bit formats\n r16uint: gl.R16UI,\n r16sint: gl.R16I,\n r16float: gl.R16F,\n rg8unorm: gl.RG8,\n rg8snorm: gl.RG8_SNORM,\n rg8uint: gl.RG8UI,\n rg8sint: gl.RG8I,\n // 32-bit formats\n r32uint: gl.R32UI,\n r32sint: gl.R32I,\n r32float: gl.R32F,\n rg16uint: gl.RG16UI,\n rg16sint: gl.RG16I,\n rg16float: gl.RG16F,\n rgba8unorm: gl.RGBA,\n ...srgb,\n // Packed 32-bit formats\n rgba8snorm: gl.RGBA8_SNORM,\n rgba8uint: gl.RGBA8UI,\n rgba8sint: gl.RGBA8I,\n bgra8unorm,\n rgb9e5ufloat: gl.RGB9_E5,\n rgb10a2unorm: gl.RGB10_A2,\n rg11b10ufloat: gl.R11F_G11F_B10F,\n // 64-bit formats\n rg32uint: gl.RG32UI,\n rg32sint: gl.RG32I,\n rg32float: gl.RG32F,\n rgba16uint: gl.RGBA16UI,\n rgba16sint: gl.RGBA16I,\n rgba16float: gl.RGBA16F,\n // 128-bit formats\n rgba32uint: gl.RGBA32UI,\n rgba32sint: gl.RGBA32I,\n rgba32float: gl.RGBA32F,\n // Depth/stencil formats\n stencil8: gl.STENCIL_INDEX8,\n depth16unorm: gl.DEPTH_COMPONENT16,\n depth24plus: gl.DEPTH_COMPONENT24,\n \"depth24plus-stencil8\": gl.DEPTH24_STENCIL8,\n depth32float: gl.DEPTH_COMPONENT32F,\n \"depth32float-stencil8\": gl.DEPTH32F_STENCIL8,\n // Compressed formats\n ...extensions.s3tc ? {\n \"bc1-rgba-unorm\": extensions.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,\n \"bc2-rgba-unorm\": extensions.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,\n \"bc3-rgba-unorm\": extensions.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT\n } : {},\n ...extensions.s3tc_sRGB ? {\n \"bc1-rgba-unorm-srgb\": extensions.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,\n \"bc2-rgba-unorm-srgb\": extensions.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,\n \"bc3-rgba-unorm-srgb\": extensions.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT\n } : {},\n ...extensions.rgtc ? {\n \"bc4-r-unorm\": extensions.rgtc.COMPRESSED_RED_RGTC1_EXT,\n \"bc4-r-snorm\": extensions.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,\n \"bc5-rg-unorm\": extensions.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,\n \"bc5-rg-snorm\": extensions.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT\n } : {},\n ...extensions.bptc ? {\n \"bc6h-rgb-float\": extensions.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,\n \"bc6h-rgb-ufloat\": extensions.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,\n \"bc7-rgba-unorm\": extensions.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,\n \"bc7-rgba-unorm-srgb\": extensions.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT\n } : {},\n ...extensions.etc ? {\n \"etc2-rgb8unorm\": extensions.etc.COMPRESSED_RGB8_ETC2,\n \"etc2-rgb8unorm-srgb\": extensions.etc.COMPRESSED_SRGB8_ETC2,\n \"etc2-rgb8a1unorm\": extensions.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n \"etc2-rgb8a1unorm-srgb\": extensions.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,\n \"etc2-rgba8unorm\": extensions.etc.COMPRESSED_RGBA8_ETC2_EAC,\n \"etc2-rgba8unorm-srgb\": extensions.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,\n \"eac-r11unorm\": extensions.etc.COMPRESSED_R11_EAC,\n // 'eac-r11snorm'\n \"eac-rg11unorm\": extensions.etc.COMPRESSED_SIGNED_RG11_EAC\n // 'eac-rg11snorm'\n } : {},\n ...extensions.astc ? {\n \"astc-4x4-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,\n \"astc-4x4-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,\n \"astc-5x4-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,\n \"astc-5x4-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,\n \"astc-5x5-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,\n \"astc-5x5-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,\n \"astc-6x5-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,\n \"astc-6x5-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,\n \"astc-6x6-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,\n \"astc-6x6-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,\n \"astc-8x5-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,\n \"astc-8x5-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,\n \"astc-8x6-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,\n \"astc-8x6-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,\n \"astc-8x8-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,\n \"astc-8x8-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,\n \"astc-10x5-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,\n \"astc-10x5-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,\n \"astc-10x6-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,\n \"astc-10x6-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,\n \"astc-10x8-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,\n \"astc-10x8-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,\n \"astc-10x10-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,\n \"astc-10x10-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,\n \"astc-12x10-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,\n \"astc-12x10-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,\n \"astc-12x12-unorm\": extensions.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,\n \"astc-12x12-unorm-srgb\": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR\n } : {}\n };\n}\n\nexport { mapFormatToGlInternalFormat };\n//# sourceMappingURL=mapFormatToGlInternalFormat.mjs.map\n","\"use strict\";\nfunction mapFormatToGlType(gl) {\n return {\n // 8-bit formats\n r8unorm: gl.UNSIGNED_BYTE,\n r8snorm: gl.BYTE,\n r8uint: gl.UNSIGNED_BYTE,\n r8sint: gl.BYTE,\n // 16-bit formats\n r16uint: gl.UNSIGNED_SHORT,\n r16sint: gl.SHORT,\n r16float: gl.HALF_FLOAT,\n rg8unorm: gl.UNSIGNED_BYTE,\n rg8snorm: gl.BYTE,\n rg8uint: gl.UNSIGNED_BYTE,\n rg8sint: gl.BYTE,\n // 32-bit formats\n r32uint: gl.UNSIGNED_INT,\n r32sint: gl.INT,\n r32float: gl.FLOAT,\n rg16uint: gl.UNSIGNED_SHORT,\n rg16sint: gl.SHORT,\n rg16float: gl.HALF_FLOAT,\n rgba8unorm: gl.UNSIGNED_BYTE,\n \"rgba8unorm-srgb\": gl.UNSIGNED_BYTE,\n // Packed 32-bit formats\n rgba8snorm: gl.BYTE,\n rgba8uint: gl.UNSIGNED_BYTE,\n rgba8sint: gl.BYTE,\n bgra8unorm: gl.UNSIGNED_BYTE,\n \"bgra8unorm-srgb\": gl.UNSIGNED_BYTE,\n rgb9e5ufloat: gl.UNSIGNED_INT_5_9_9_9_REV,\n rgb10a2unorm: gl.UNSIGNED_INT_2_10_10_10_REV,\n rg11b10ufloat: gl.UNSIGNED_INT_10F_11F_11F_REV,\n // 64-bit formats\n rg32uint: gl.UNSIGNED_INT,\n rg32sint: gl.INT,\n rg32float: gl.FLOAT,\n rgba16uint: gl.UNSIGNED_SHORT,\n rgba16sint: gl.SHORT,\n rgba16float: gl.HALF_FLOAT,\n // 128-bit formats\n rgba32uint: gl.UNSIGNED_INT,\n rgba32sint: gl.INT,\n rgba32float: gl.FLOAT,\n // Depth/stencil formats\n stencil8: gl.UNSIGNED_BYTE,\n depth16unorm: gl.UNSIGNED_SHORT,\n depth24plus: gl.UNSIGNED_INT,\n \"depth24plus-stencil8\": gl.UNSIGNED_INT_24_8,\n depth32float: gl.FLOAT,\n \"depth32float-stencil8\": gl.FLOAT_32_UNSIGNED_INT_24_8_REV\n };\n}\n\nexport { mapFormatToGlType };\n//# sourceMappingURL=mapFormatToGlType.mjs.map\n","\"use strict\";\nfunction mapFormatToGlFormat(gl) {\n return {\n // 8-bit formats\n r8unorm: gl.RED,\n r8snorm: gl.RED,\n r8uint: gl.RED,\n r8sint: gl.RED,\n // 16-bit formats\n r16uint: gl.RED,\n r16sint: gl.RED,\n r16float: gl.RED,\n rg8unorm: gl.RG,\n rg8snorm: gl.RG,\n rg8uint: gl.RG,\n rg8sint: gl.RG,\n // 32-bit formats\n r32uint: gl.RED,\n r32sint: gl.RED,\n r32float: gl.RED,\n rg16uint: gl.RG,\n rg16sint: gl.RG,\n rg16float: gl.RG,\n rgba8unorm: gl.RGBA,\n \"rgba8unorm-srgb\": gl.RGBA,\n // Packed 32-bit formats\n rgba8snorm: gl.RGBA,\n rgba8uint: gl.RGBA,\n rgba8sint: gl.RGBA,\n bgra8unorm: gl.RGBA,\n \"bgra8unorm-srgb\": gl.RGBA,\n rgb9e5ufloat: gl.RGB,\n rgb10a2unorm: gl.RGBA,\n rg11b10ufloat: gl.RGB,\n // 64-bit formats\n rg32uint: gl.RG,\n rg32sint: gl.RG,\n rg32float: gl.RG,\n rgba16uint: gl.RGBA,\n rgba16sint: gl.RGBA,\n rgba16float: gl.RGBA,\n // 128-bit formats\n rgba32uint: gl.RGBA,\n rgba32sint: gl.RGBA,\n rgba32float: gl.RGBA,\n // Depth/stencil formats\n stencil8: gl.STENCIL_INDEX8,\n depth16unorm: gl.DEPTH_COMPONENT,\n depth24plus: gl.DEPTH_COMPONENT,\n \"depth24plus-stencil8\": gl.DEPTH_STENCIL,\n depth32float: gl.DEPTH_COMPONENT,\n \"depth32float-stencil8\": gl.DEPTH_STENCIL\n };\n}\n\nexport { mapFormatToGlFormat };\n//# sourceMappingURL=mapFormatToGlFormat.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { getMaxTexturesPerBatch } from '../../../rendering/batcher/gl/utils/maxRecommendedTextures.mjs';\nimport { compileHighShaderGlProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { colorBitGl } from '../../../rendering/high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBitGl } from '../../../rendering/high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { localUniformBitGl } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBitGl } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { getBatchSamplersUniformGroup } from '../../../rendering/renderers/gl/shader/getBatchSamplersUniformGroup.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';\n\n\"use strict\";\nclass GlGraphicsAdaptor {\n init() {\n const uniforms = new UniformGroup({\n uColor: { value: new Float32Array([1, 1, 1, 1]), type: \"vec4\" },\n uTransformMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uRound: { value: 0, type: \"f32\" }\n });\n const maxTextures = getMaxTexturesPerBatch();\n const glProgram = compileHighShaderGlProgram({\n name: \"graphics\",\n bits: [\n colorBitGl,\n generateTextureBatchBitGl(maxTextures),\n localUniformBitGl,\n roundPixelsBitGl\n ]\n });\n this.shader = new Shader({\n glProgram,\n resources: {\n localUniforms: uniforms,\n batchSamplers: getBatchSamplersUniformGroup(maxTextures)\n }\n });\n }\n execute(graphicsPipe, renderable) {\n const context = renderable.context;\n const shader = context.customShader || this.shader;\n const renderer = graphicsPipe.renderer;\n const contextSystem = renderer.graphicsContext;\n const {\n geometry,\n instructions\n } = contextSystem.getContextRenderData(context);\n shader.groups[0] = renderer.globalUniforms.bindGroup;\n renderer.state.set(graphicsPipe.state);\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader.glProgram);\n const batches = instructions.instructions;\n for (let i = 0; i < instructions.instructionSize; i++) {\n const batch = batches[i];\n if (batch.size) {\n for (let j = 0; j < batch.textures.count; j++) {\n renderer.texture.bind(batch.textures.textures[j], j);\n }\n renderer.geometry.draw(\"triangle-list\", batch.size, batch.start);\n }\n }\n }\n destroy() {\n this.shader.destroy(true);\n this.shader = null;\n }\n}\n/** @ignore */\nGlGraphicsAdaptor.extension = {\n type: [\n ExtensionType.WebGLPipesAdaptor\n ],\n name: \"graphics\"\n};\n\nexport { GlGraphicsAdaptor };\n//# sourceMappingURL=GlGraphicsAdaptor.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { compileHighShaderGlProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { localUniformBitGl } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBitGl } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { textureBitGl } from '../../../rendering/high-shader/shader-bits/textureBit.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\n\n\"use strict\";\nclass GlMeshAdaptor {\n init() {\n const glProgram = compileHighShaderGlProgram({\n name: \"mesh\",\n bits: [\n localUniformBitGl,\n textureBitGl,\n roundPixelsBitGl\n ]\n });\n this._shader = new Shader({\n glProgram,\n resources: {\n uTexture: Texture.EMPTY.source,\n textureUniforms: {\n uTextureMatrix: { type: \"mat3x3\", value: new Matrix() }\n }\n }\n });\n }\n execute(meshPipe, mesh) {\n const renderer = meshPipe.renderer;\n let shader = mesh._shader;\n if (!shader) {\n shader = this._shader;\n const texture = mesh.texture;\n const source = texture.source;\n shader.resources.uTexture = source;\n shader.resources.uSampler = source.style;\n shader.resources.textureUniforms.uniforms.uTextureMatrix = texture.textureMatrix.mapCoord;\n } else if (!shader.glProgram) {\n warn(\"Mesh shader has no glProgram\", mesh.shader);\n return;\n }\n shader.groups[100] = renderer.globalUniforms.bindGroup;\n shader.groups[101] = meshPipe.localUniformsBindGroup;\n renderer.encoder.draw({\n geometry: mesh._geometry,\n shader,\n state: mesh.state\n });\n }\n destroy() {\n this._shader.destroy(true);\n this._shader = null;\n }\n}\nGlMeshAdaptor.extension = {\n type: [\n ExtensionType.WebGLPipesAdaptor\n ],\n name: \"mesh\"\n};\n\nexport { GlMeshAdaptor };\n//# sourceMappingURL=GlMeshAdaptor.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass CustomRenderPipe {\n constructor(renderer) {\n this._renderer = renderer;\n }\n addRenderable(container, instructionSet) {\n this._renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add(container);\n }\n execute(container) {\n if (!container.isRenderable)\n return;\n container.render(this._renderer);\n }\n destroy() {\n this._renderer = null;\n }\n}\nCustomRenderPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"customRender\"\n};\n\nexport { CustomRenderPipe };\n//# sourceMappingURL=CustomRenderPipe.mjs.map\n","\"use strict\";\nfunction executeInstructions(renderGroup, renderer) {\n const instructionSet = renderGroup.instructionSet;\n const instructions = instructionSet.instructions;\n for (let i = 0; i < instructionSet.instructionSize; i++) {\n const instruction = instructions[i];\n renderer[instruction.renderPipeId].execute(instruction);\n }\n}\n\nexport { executeInstructions };\n//# sourceMappingURL=executeInstructions.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { executeInstructions } from './utils/executeInstructions.mjs';\n\n\"use strict\";\nclass RenderGroupPipe {\n constructor(renderer) {\n this._renderer = renderer;\n }\n addRenderGroup(renderGroup, instructionSet) {\n this._renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add(renderGroup);\n }\n execute(renderGroup) {\n if (!renderGroup.isRenderable)\n return;\n this._renderer.globalUniforms.push({\n worldTransformMatrix: renderGroup.worldTransform,\n worldColor: renderGroup.worldColorAlpha\n });\n executeInstructions(renderGroup, this._renderer.renderPipes);\n this._renderer.globalUniforms.pop();\n }\n destroy() {\n this._renderer = null;\n }\n}\nRenderGroupPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"renderGroup\"\n};\n\nexport { RenderGroupPipe };\n//# sourceMappingURL=RenderGroupPipe.mjs.map\n","\"use strict\";\nfunction clearList(list, index) {\n index || (index = 0);\n for (let j = index; j < list.length; j++) {\n if (list[j]) {\n list[j] = null;\n } else {\n break;\n }\n }\n}\n\nexport { clearList };\n//# sourceMappingURL=clearList.mjs.map\n","\"use strict\";\nfunction collectRenderGroups(renderGroup, out = []) {\n out.push(renderGroup);\n for (let i = 0; i < renderGroup.renderGroupChildren.length; i++) {\n collectRenderGroups(renderGroup.renderGroupChildren[i], out);\n }\n return out;\n}\n\nexport { collectRenderGroups };\n//# sourceMappingURL=collectRenderGroups.mjs.map\n","import { mixHexColors } from './mixHexColors.mjs';\n\n\"use strict\";\nconst WHITE_BGR = 16777215;\nfunction mixColors(localBGRColor, parentBGRColor) {\n if (localBGRColor === WHITE_BGR || parentBGRColor === WHITE_BGR) {\n return localBGRColor + parentBGRColor - WHITE_BGR;\n }\n return mixHexColors(localBGRColor, parentBGRColor, 0.5);\n}\nfunction mixStandardAnd32BitColors(localColorRGB, localAlpha, parentColor) {\n const parentAlpha = (parentColor >> 24 & 255) / 255;\n const globalAlpha = localAlpha * parentAlpha * 255;\n const localBGRColor = ((localColorRGB & 255) << 16) + (localColorRGB & 65280) + (localColorRGB >> 16 & 255);\n const parentBGRColor = parentColor & 16777215;\n let sharedBGRColor;\n if (localBGRColor === WHITE_BGR || parentBGRColor === WHITE_BGR) {\n sharedBGRColor = localBGRColor + parentBGRColor - WHITE_BGR;\n } else {\n sharedBGRColor = mixHexColors(localBGRColor, parentBGRColor, 0.5);\n }\n return sharedBGRColor + (globalAlpha << 24);\n}\n\nexport { mixColors, mixStandardAnd32BitColors };\n//# sourceMappingURL=mixColors.mjs.map\n","\"use strict\";\nfunction mixHexColors(color1, color2, ratio) {\n const r1 = color1 >> 16 & 255;\n const g1 = color1 >> 8 & 255;\n const b1 = color1 & 255;\n const r2 = color2 >> 16 & 255;\n const g2 = color2 >> 8 & 255;\n const b2 = color2 & 255;\n const r = r1 + (r2 - r1) * ratio;\n const g = g1 + (g2 - g1) * ratio;\n const b = b1 + (b2 - b1) * ratio;\n return (r << 16) + (g << 8) + b;\n}\n\nexport { mixHexColors };\n//# sourceMappingURL=mixHexColors.mjs.map\n","import { Container, UPDATE_VISIBLE, UPDATE_COLOR, UPDATE_BLEND } from '../Container.mjs';\nimport { clearList } from './clearList.mjs';\nimport { mixColors } from './mixColors.mjs';\n\n\"use strict\";\nconst tempContainer = new Container();\nconst UPDATE_BLEND_COLOR_VISIBLE = UPDATE_VISIBLE | UPDATE_COLOR | UPDATE_BLEND;\nfunction updateRenderGroupTransforms(renderGroup, updateChildRenderGroups = false) {\n updateRenderGroupTransform(renderGroup);\n const childrenToUpdate = renderGroup.childrenToUpdate;\n const updateTick = renderGroup.updateTick++;\n for (const j in childrenToUpdate) {\n const renderGroupDepth = Number(j);\n const childrenAtDepth = childrenToUpdate[j];\n const list = childrenAtDepth.list;\n const index = childrenAtDepth.index;\n for (let i = 0; i < index; i++) {\n const child = list[i];\n if (child.parentRenderGroup === renderGroup && child.relativeRenderGroupDepth === renderGroupDepth) {\n updateTransformAndChildren(child, updateTick, 0);\n }\n }\n clearList(list, index);\n childrenAtDepth.index = 0;\n }\n if (updateChildRenderGroups) {\n for (let i = 0; i < renderGroup.renderGroupChildren.length; i++) {\n updateRenderGroupTransforms(renderGroup.renderGroupChildren[i], updateChildRenderGroups);\n }\n }\n}\nfunction updateRenderGroupTransform(renderGroup) {\n const root = renderGroup.root;\n let worldAlpha;\n if (renderGroup.renderGroupParent) {\n const renderGroupParent = renderGroup.renderGroupParent;\n renderGroup.worldTransform.appendFrom(\n root.relativeGroupTransform,\n renderGroupParent.worldTransform\n );\n renderGroup.worldColor = mixColors(\n root.groupColor,\n renderGroupParent.worldColor\n );\n worldAlpha = root.groupAlpha * renderGroupParent.worldAlpha;\n } else {\n renderGroup.worldTransform.copyFrom(root.localTransform);\n renderGroup.worldColor = root.localColor;\n worldAlpha = root.localAlpha;\n }\n worldAlpha = worldAlpha < 0 ? 0 : worldAlpha > 1 ? 1 : worldAlpha;\n renderGroup.worldAlpha = worldAlpha;\n renderGroup.worldColorAlpha = renderGroup.worldColor + ((worldAlpha * 255 | 0) << 24);\n}\nfunction updateTransformAndChildren(container, updateTick, updateFlags) {\n if (updateTick === container.updateTick)\n return;\n container.updateTick = updateTick;\n container.didChange = false;\n const localTransform = container.localTransform;\n container.updateLocalTransform();\n const parent = container.parent;\n if (parent && !parent.renderGroup) {\n updateFlags = updateFlags | container._updateFlags;\n container.relativeGroupTransform.appendFrom(\n localTransform,\n parent.relativeGroupTransform\n );\n if (updateFlags & UPDATE_BLEND_COLOR_VISIBLE) {\n updateColorBlendVisibility(container, parent, updateFlags);\n }\n } else {\n updateFlags = container._updateFlags;\n container.relativeGroupTransform.copyFrom(localTransform);\n if (updateFlags & UPDATE_BLEND_COLOR_VISIBLE) {\n updateColorBlendVisibility(container, tempContainer, updateFlags);\n }\n }\n if (!container.renderGroup) {\n const children = container.children;\n const length = children.length;\n for (let i = 0; i < length; i++) {\n updateTransformAndChildren(children[i], updateTick, updateFlags);\n }\n const renderGroup = container.parentRenderGroup;\n if (container.renderPipeId && !renderGroup.structureDidChange) {\n renderGroup.updateRenderable(container);\n }\n }\n}\nfunction updateColorBlendVisibility(container, parent, updateFlags) {\n if (updateFlags & UPDATE_COLOR) {\n container.groupColor = mixColors(\n container.localColor,\n parent.groupColor\n );\n let groupAlpha = container.localAlpha * parent.groupAlpha;\n groupAlpha = groupAlpha < 0 ? 0 : groupAlpha > 1 ? 1 : groupAlpha;\n container.groupAlpha = groupAlpha;\n container.groupColorAlpha = container.groupColor + ((groupAlpha * 255 | 0) << 24);\n }\n if (updateFlags & UPDATE_BLEND) {\n container.groupBlendMode = container.localBlendMode === \"inherit\" ? parent.groupBlendMode : container.localBlendMode;\n }\n if (updateFlags & UPDATE_VISIBLE) {\n container.globalDisplayStatus = container.localDisplayStatus & parent.globalDisplayStatus;\n }\n container._updateFlags = 0;\n}\n\nexport { updateRenderGroupTransform, updateRenderGroupTransforms, updateTransformAndChildren };\n//# sourceMappingURL=updateRenderGroupTransforms.mjs.map\n","\"use strict\";\nfunction validateRenderables(renderGroup, renderPipes) {\n const { list, index } = renderGroup.childrenRenderablesToUpdate;\n let rebuildRequired = false;\n for (let i = 0; i < index; i++) {\n const container = list[i];\n const renderable = container;\n const pipe = renderPipes[renderable.renderPipeId];\n rebuildRequired = pipe.validateRenderable(container);\n if (rebuildRequired) {\n break;\n }\n }\n renderGroup.structureDidChange = rebuildRequired;\n return rebuildRequired;\n}\n\nexport { validateRenderables };\n//# sourceMappingURL=validateRenderables.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { Matrix } from '../../maths/matrix/Matrix.mjs';\nimport { buildInstructions } from './utils/buildInstructions.mjs';\nimport { clearList } from './utils/clearList.mjs';\nimport { collectRenderGroups } from './utils/collectRenderGroups.mjs';\nimport { executeInstructions } from './utils/executeInstructions.mjs';\nimport { updateRenderGroupTransforms } from './utils/updateRenderGroupTransforms.mjs';\nimport { validateRenderables } from './utils/validateRenderables.mjs';\n\n\"use strict\";\nconst tempMatrix = new Matrix();\nclass RenderGroupSystem {\n constructor(renderer) {\n this._renderer = renderer;\n }\n render({ container, transform }) {\n container.isRenderGroup = true;\n const parent = container.parent;\n const renderGroupParent = container.renderGroup.renderGroupParent;\n container.parent = null;\n container.renderGroup.renderGroupParent = null;\n const renderer = this._renderer;\n const renderGroups = collectRenderGroups(container.renderGroup, []);\n let originalLocalTransform = tempMatrix;\n if (transform) {\n originalLocalTransform = originalLocalTransform.copyFrom(container.renderGroup.localTransform);\n container.renderGroup.localTransform.copyFrom(transform);\n }\n const renderPipes = renderer.renderPipes;\n for (let i = 0; i < renderGroups.length; i++) {\n const renderGroup = renderGroups[i];\n renderGroup.runOnRender();\n renderGroup.instructionSet.renderPipes = renderPipes;\n if (!renderGroup.structureDidChange) {\n validateRenderables(renderGroup, renderPipes);\n } else {\n clearList(renderGroup.childrenRenderablesToUpdate.list, 0);\n }\n updateRenderGroupTransforms(renderGroup);\n if (renderGroup.structureDidChange) {\n renderGroup.structureDidChange = false;\n buildInstructions(renderGroup, renderPipes);\n } else {\n updateRenderables(renderGroup);\n }\n renderGroup.childrenRenderablesToUpdate.index = 0;\n renderer.renderPipes.batch.upload(renderGroup.instructionSet);\n }\n renderer.globalUniforms.start({\n worldTransformMatrix: transform ? container.renderGroup.localTransform : container.renderGroup.worldTransform,\n worldColor: container.renderGroup.worldColorAlpha\n });\n executeInstructions(container.renderGroup, renderPipes);\n if (renderPipes.uniformBatch) {\n renderPipes.uniformBatch.renderEnd();\n }\n if (transform) {\n container.renderGroup.localTransform.copyFrom(originalLocalTransform);\n }\n container.parent = parent;\n container.renderGroup.renderGroupParent = renderGroupParent;\n }\n destroy() {\n this._renderer = null;\n }\n}\n/** @ignore */\nRenderGroupSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"renderGroup\"\n};\nfunction updateRenderables(renderGroup) {\n const { list, index } = renderGroup.childrenRenderablesToUpdate;\n for (let i = 0; i < index; i++) {\n const container = list[i];\n if (container.didViewUpdate) {\n renderGroup.updateRenderable(container);\n }\n }\n clearList(list, index);\n}\n\nexport { RenderGroupSystem };\n//# sourceMappingURL=RenderGroupSystem.mjs.map\n","\"use strict\";\nclass BatchableSprite {\n constructor() {\n // batch specific..\n this.vertexSize = 4;\n this.indexSize = 6;\n this.location = 0;\n // location in the buffer\n this.batcher = null;\n this.batch = null;\n this.roundPixels = 0;\n }\n get blendMode() {\n return this.renderable.groupBlendMode;\n }\n packAttributes(float32View, uint32View, index, textureId) {\n const sprite = this.renderable;\n const texture = this.texture;\n const wt = sprite.groupTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const bounds = this.bounds;\n const w0 = bounds.maxX;\n const w1 = bounds.minX;\n const h0 = bounds.maxY;\n const h1 = bounds.minY;\n const uvs = texture.uvs;\n const argb = sprite.groupColorAlpha;\n const textureIdAndRound = textureId << 16 | this.roundPixels & 65535;\n float32View[index + 0] = a * w1 + c * h1 + tx;\n float32View[index + 1] = d * h1 + b * w1 + ty;\n float32View[index + 2] = uvs.x0;\n float32View[index + 3] = uvs.y0;\n uint32View[index + 4] = argb;\n uint32View[index + 5] = textureIdAndRound;\n float32View[index + 6] = a * w0 + c * h1 + tx;\n float32View[index + 7] = d * h1 + b * w0 + ty;\n float32View[index + 8] = uvs.x1;\n float32View[index + 9] = uvs.y1;\n uint32View[index + 10] = argb;\n uint32View[index + 11] = textureIdAndRound;\n float32View[index + 12] = a * w0 + c * h0 + tx;\n float32View[index + 13] = d * h0 + b * w0 + ty;\n float32View[index + 14] = uvs.x2;\n float32View[index + 15] = uvs.y2;\n uint32View[index + 16] = argb;\n uint32View[index + 17] = textureIdAndRound;\n float32View[index + 18] = a * w1 + c * h0 + tx;\n float32View[index + 19] = d * h0 + b * w1 + ty;\n float32View[index + 20] = uvs.x3;\n float32View[index + 21] = uvs.y3;\n uint32View[index + 22] = argb;\n uint32View[index + 23] = textureIdAndRound;\n }\n packIndex(indexBuffer, index, indicesOffset) {\n indexBuffer[index] = indicesOffset + 0;\n indexBuffer[index + 1] = indicesOffset + 1;\n indexBuffer[index + 2] = indicesOffset + 2;\n indexBuffer[index + 3] = indicesOffset + 0;\n indexBuffer[index + 4] = indicesOffset + 2;\n indexBuffer[index + 5] = indicesOffset + 3;\n }\n reset() {\n this.renderable = null;\n this.texture = null;\n this.batcher = null;\n this.batch = null;\n this.bounds = null;\n }\n}\n\nexport { BatchableSprite };\n//# sourceMappingURL=BatchableSprite.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\nimport { BatchableSprite } from './BatchableSprite.mjs';\n\n\"use strict\";\nclass SpritePipe {\n constructor(renderer) {\n this._gpuSpriteHash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n addRenderable(sprite, _instructionSet) {\n const gpuSprite = this._getGpuSprite(sprite);\n if (sprite._didSpriteUpdate)\n this._updateBatchableSprite(sprite, gpuSprite);\n this._renderer.renderPipes.batch.addToBatch(gpuSprite);\n }\n updateRenderable(sprite) {\n const gpuSprite = this._gpuSpriteHash[sprite.uid];\n if (sprite._didSpriteUpdate)\n this._updateBatchableSprite(sprite, gpuSprite);\n gpuSprite.batcher.updateElement(gpuSprite);\n }\n validateRenderable(sprite) {\n const texture = sprite._texture;\n const gpuSprite = this._getGpuSprite(sprite);\n if (gpuSprite.texture._source !== texture._source) {\n return !gpuSprite.batcher.checkAndUpdateTexture(gpuSprite, texture);\n }\n return false;\n }\n destroyRenderable(sprite) {\n const batchableSprite = this._gpuSpriteHash[sprite.uid];\n BigPool.return(batchableSprite);\n this._gpuSpriteHash[sprite.uid] = null;\n }\n _updateBatchableSprite(sprite, batchableSprite) {\n sprite._didSpriteUpdate = false;\n batchableSprite.bounds = sprite.bounds;\n batchableSprite.texture = sprite._texture;\n }\n _getGpuSprite(sprite) {\n return this._gpuSpriteHash[sprite.uid] || this._initGPUSprite(sprite);\n }\n _initGPUSprite(sprite) {\n const batchableSprite = BigPool.get(BatchableSprite);\n batchableSprite.renderable = sprite;\n batchableSprite.texture = sprite._texture;\n batchableSprite.bounds = sprite.bounds;\n batchableSprite.roundPixels = this._renderer._roundPixels | sprite._roundPixels;\n this._gpuSpriteHash[sprite.uid] = batchableSprite;\n sprite._didSpriteUpdate = false;\n sprite.on(\"destroyed\", () => {\n this.destroyRenderable(sprite);\n });\n return batchableSprite;\n }\n destroy() {\n for (const i in this._gpuSpriteHash) {\n BigPool.return(this._gpuSpriteHash[i]);\n }\n this._gpuSpriteHash = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nSpritePipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"sprite\"\n};\n\nexport { SpritePipe };\n//# sourceMappingURL=SpritePipe.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nconst _BackgroundSystem = class _BackgroundSystem {\n constructor() {\n this.clearBeforeRender = true;\n this._backgroundColor = new Color(0);\n this.color = this._backgroundColor;\n this.alpha = 1;\n }\n /**\n * initiates the background system\n * @param options - the options for the background colors\n */\n init(options) {\n options = { ..._BackgroundSystem.defaultOptions, ...options };\n this.clearBeforeRender = options.clearBeforeRender;\n this.color = options.background || options.backgroundColor || this._backgroundColor;\n this.alpha = options.backgroundAlpha;\n this._backgroundColor.setAlpha(options.backgroundAlpha);\n }\n /** The background color to fill if not transparent */\n get color() {\n return this._backgroundColor;\n }\n set color(value) {\n this._backgroundColor.setValue(value);\n }\n /** The background color alpha. Setting this to 0 will make the canvas transparent. */\n get alpha() {\n return this._backgroundColor.alpha;\n }\n set alpha(value) {\n this._backgroundColor.setAlpha(value);\n }\n /** The background color as an [R, G, B, A] array. */\n get colorRgba() {\n return this._backgroundColor.toArray();\n }\n /**\n * destroys the background system\n * @internal\n * @ignore\n */\n destroy() {\n }\n};\n/** @ignore */\n_BackgroundSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"background\",\n priority: 0\n};\n/** default options used by the system */\n_BackgroundSystem.defaultOptions = {\n /**\n * {@link WebGLOptions.backgroundAlpha}\n * @default 1\n */\n backgroundAlpha: 1,\n /**\n * {@link WebGLOptions.backgroundColor}\n * @default 0x000000\n */\n backgroundColor: 0,\n /**\n * {@link WebGLOptions.clearBeforeRender}\n * @default true\n */\n clearBeforeRender: true\n};\nlet BackgroundSystem = _BackgroundSystem;\n\nexport { BackgroundSystem };\n//# sourceMappingURL=BackgroundSystem.mjs.map\n","import { extensions, ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { FilterEffect } from '../../../../filters/FilterEffect.mjs';\nimport { warn } from '../../../../utils/logging/warn.mjs';\n\n\"use strict\";\nconst BLEND_MODE_FILTERS = {};\nextensions.handle(ExtensionType.BlendMode, (value) => {\n if (!value.name) {\n throw new Error(\"BlendMode extension must have a name property\");\n }\n BLEND_MODE_FILTERS[value.name] = value.ref;\n}, (value) => {\n delete BLEND_MODE_FILTERS[value.name];\n});\nclass BlendModePipe {\n constructor(renderer) {\n this._isAdvanced = false;\n this._filterHash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n /**\n * This ensures that a blendMode switch is added to the instruction set if the blend mode has changed.\n * @param renderable - The renderable we are adding to the instruction set\n * @param blendMode - The blend mode of the renderable\n * @param instructionSet - The instruction set we are adding to\n */\n setBlendMode(renderable, blendMode, instructionSet) {\n if (this._activeBlendMode === blendMode) {\n if (this._isAdvanced)\n this._renderableList.push(renderable);\n return;\n }\n this._activeBlendMode = blendMode;\n if (this._isAdvanced) {\n this._endAdvancedBlendMode(instructionSet);\n }\n this._isAdvanced = !!BLEND_MODE_FILTERS[blendMode];\n if (this._isAdvanced) {\n this._beginAdvancedBlendMode(instructionSet);\n this._renderableList.push(renderable);\n }\n }\n _beginAdvancedBlendMode(instructionSet) {\n this._renderer.renderPipes.batch.break(instructionSet);\n const blendMode = this._activeBlendMode;\n if (!BLEND_MODE_FILTERS[blendMode]) {\n warn(`Unable to assign BlendMode: '${blendMode}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);\n return;\n }\n let filterEffect = this._filterHash[blendMode];\n if (!filterEffect) {\n filterEffect = this._filterHash[blendMode] = new FilterEffect();\n filterEffect.filters = [new BLEND_MODE_FILTERS[blendMode]()];\n }\n const instruction = {\n renderPipeId: \"filter\",\n action: \"pushFilter\",\n renderables: [],\n filterEffect,\n canBundle: false\n };\n this._renderableList = instruction.renderables;\n instructionSet.add(instruction);\n }\n _endAdvancedBlendMode(instructionSet) {\n this._renderableList = null;\n this._renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add({\n renderPipeId: \"filter\",\n action: \"popFilter\",\n canBundle: false\n });\n }\n /**\n * called when the instruction build process is starting this will reset internally to the default blend mode\n * @internal\n * @ignore\n */\n buildStart() {\n this._isAdvanced = false;\n }\n /**\n * called when the instruction build process is finished, ensuring that if there is an advanced blend mode\n * active, we add the final render instructions added to the instruction set\n * @param instructionSet - The instruction set we are adding to\n * @internal\n * @ignore\n */\n buildEnd(instructionSet) {\n if (this._isAdvanced) {\n this._endAdvancedBlendMode(instructionSet);\n }\n }\n /**\n * @internal\n * @ignore\n */\n destroy() {\n this._renderer = null;\n this._renderableList = null;\n for (const i in this._filterHash) {\n this._filterHash[i].destroy();\n }\n this._filterHash = null;\n }\n}\n/** @ignore */\nBlendModePipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"blendMode\"\n};\n\nexport { BlendModePipe };\n//# sourceMappingURL=BlendModePipe.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { Container } from '../../../../scene/container/Container.mjs';\nimport { Texture } from '../texture/Texture.mjs';\n\n\"use strict\";\nconst imageTypes = {\n png: \"image/png\",\n jpg: \"image/jpeg\",\n webp: \"image/webp\"\n};\nconst _ExtractSystem = class _ExtractSystem {\n /** @param renderer - The renderer this System works for. */\n constructor(renderer) {\n this._renderer = renderer;\n }\n _normalizeOptions(options, defaults = {}) {\n if (options instanceof Container || options instanceof Texture) {\n return {\n target: options,\n ...defaults\n };\n }\n return {\n ...defaults,\n ...options\n };\n }\n /**\n * Will return a HTML Image of the target\n * @param options - The options for creating the image, or the target to extract\n * @returns - HTML Image of the target\n */\n async image(options) {\n const image = new Image();\n image.src = await this.base64(options);\n return image;\n }\n /**\n * Will return a base64 encoded string of this target. It works by calling\n * `Extract.canvas` and then running toDataURL on that.\n * @param options - The options for creating the image, or the target to extract\n */\n async base64(options) {\n options = this._normalizeOptions(\n options,\n _ExtractSystem.defaultImageOptions\n );\n const { format, quality } = options;\n const canvas = this.canvas(options);\n if (canvas.toBlob !== void 0) {\n return new Promise((resolve, reject) => {\n canvas.toBlob((blob) => {\n if (!blob) {\n reject(new Error(\"ICanvas.toBlob failed!\"));\n return;\n }\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n }, imageTypes[format], quality);\n });\n }\n if (canvas.toDataURL !== void 0) {\n return canvas.toDataURL(imageTypes[format], quality);\n }\n if (canvas.convertToBlob !== void 0) {\n const blob = await canvas.convertToBlob({ type: imageTypes[format], quality });\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n });\n }\n throw new Error(\"Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented\");\n }\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n * @param options - The options for creating the canvas, or the target to extract\n * @returns - A Canvas element with the texture rendered on.\n */\n canvas(options) {\n options = this._normalizeOptions(options);\n const target = options.target;\n const renderer = this._renderer;\n if (target instanceof Texture) {\n return renderer.texture.generateCanvas(target);\n }\n const texture = renderer.textureGenerator.generateTexture(options);\n const canvas = renderer.texture.generateCanvas(texture);\n texture.destroy();\n return canvas;\n }\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n * @param options - The options for extracting the image, or the target to extract\n * @returns - One-dimensional array containing the pixel data of the entire texture\n */\n pixels(options) {\n options = this._normalizeOptions(options);\n const target = options.target;\n const renderer = this._renderer;\n const texture = target instanceof Texture ? target : renderer.textureGenerator.generateTexture(options);\n const pixelInfo = renderer.texture.getPixels(texture);\n if (target instanceof Container) {\n texture.destroy();\n }\n return pixelInfo;\n }\n /**\n * Will return a texture of the target\n * @param options - The options for creating the texture, or the target to extract\n * @returns - A texture of the target\n */\n texture(options) {\n options = this._normalizeOptions(options);\n if (options.target instanceof Texture)\n return options.target;\n return this._renderer.textureGenerator.generateTexture(options);\n }\n /**\n * Will extract a HTMLImage of the target and download it\n * @param options - The options for downloading and extracting the image, or the target to extract\n */\n download(options) {\n options = this._normalizeOptions(options);\n const canvas = this.canvas(options);\n const link = document.createElement(\"a\");\n link.download = options.filename ?? \"image.png\";\n link.href = canvas.toDataURL(\"image/png\");\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n }\n /**\n * Logs the target to the console as an image. This is a useful way to debug what's happening in the renderer.\n * @param options - The options for logging the image, or the target to log\n */\n log(options) {\n const width = options.width ?? 200;\n options = this._normalizeOptions(options);\n const canvas = this.canvas(options);\n const base64 = canvas.toDataURL();\n console.log(`[Pixi Texture] ${canvas.width}px ${canvas.height}px`);\n const style = [\n \"font-size: 1px;\",\n `padding: ${width}px ${300}px;`,\n `background: url(${base64}) no-repeat;`,\n \"background-size: contain;\"\n ].join(\" \");\n console.log(\"%c \", style);\n }\n destroy() {\n this._renderer = null;\n }\n};\n/** @ignore */\n_ExtractSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem\n ],\n name: \"extract\"\n};\n/** Default options for creating an image. */\n_ExtractSystem.defaultImageOptions = {\n /** The format of the image. */\n format: \"png\",\n /** The quality of the image. */\n quality: 1\n};\nlet ExtractSystem = _ExtractSystem;\n\nexport { ExtractSystem };\n//# sourceMappingURL=ExtractSystem.mjs.map\n","import { TextureSource } from './sources/TextureSource.mjs';\nimport { Texture } from './Texture.mjs';\n\n\"use strict\";\nclass RenderTexture extends Texture {\n static create(options) {\n return new Texture({\n source: new TextureSource(options)\n });\n }\n /**\n * Resizes the render texture.\n * @param width - The new width of the render texture.\n * @param height - The new height of the render texture.\n * @param resolution - The new resolution of the render texture.\n * @returns This texture.\n */\n resize(width, height, resolution) {\n this.source.resize(width, height, resolution);\n return this;\n }\n}\n\nexport { RenderTexture };\n//# sourceMappingURL=RenderTexture.mjs.map\n","import { Color } from '../../../../color/Color.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { Bounds } from '../../../../scene/container/bounds/Bounds.mjs';\nimport { getLocalBounds } from '../../../../scene/container/bounds/getLocalBounds.mjs';\nimport { Container } from '../../../../scene/container/Container.mjs';\nimport { RenderTexture } from '../texture/RenderTexture.mjs';\n\n\"use strict\";\nconst tempRect = new Rectangle();\nconst tempBounds = new Bounds();\nconst noColor = [0, 0, 0, 0];\nclass GenerateTextureSystem {\n constructor(renderer) {\n this._renderer = renderer;\n }\n /**\n * A Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your container is complicated and needs to be reused multiple times.\n * @param {GenerateTextureOptions | Container} options - Generate texture options.\n * @param {Container} [options.container] - If not given, the renderer's resolution is used.\n * @param {Rectangle} options.region - The region of the container, that shall be rendered,\n * @param {number} [options.resolution] - The resolution of the texture being generated.\n * if no region is specified, defaults to the local bounds of the container.\n * @param {GenerateTextureSourceOptions} [options.textureSourceOptions] - Texture options for GPU.\n * @returns a shiny new texture of the container passed in\n */\n generateTexture(options) {\n if (options instanceof Container) {\n options = {\n target: options,\n frame: void 0,\n textureSourceOptions: {},\n resolution: void 0\n };\n }\n const resolution = options.resolution || this._renderer.resolution;\n const antialias = options.antialias || this._renderer.view.antialias;\n const container = options.target;\n let clearColor = options.clearColor;\n if (clearColor) {\n const isRGBAArray = Array.isArray(clearColor) && clearColor.length === 4;\n clearColor = isRGBAArray ? clearColor : Color.shared.setValue(clearColor).toArray();\n } else {\n clearColor = noColor;\n }\n const region = options.frame?.copyTo(tempRect) || getLocalBounds(container, tempBounds).rectangle;\n region.width = Math.max(region.width, 1 / resolution) | 0;\n region.height = Math.max(region.height, 1 / resolution) | 0;\n const target = RenderTexture.create({\n ...options.textureSourceOptions,\n width: region.width,\n height: region.height,\n resolution,\n antialias\n });\n const transform = Matrix.shared.translate(-region.x, -region.y);\n this._renderer.render({\n container,\n transform,\n target,\n clearColor\n });\n target.source.updateMipmaps();\n return target;\n }\n destroy() {\n this._renderer = null;\n }\n}\n/** @ignore */\nGenerateTextureSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem\n ],\n name: \"textureGenerator\"\n};\n\nexport { GenerateTextureSystem };\n//# sourceMappingURL=GenerateTextureSystem.mjs.map\n","\"use strict\";\nfunction colorToUniform(rgb, alpha, out, offset) {\n out[offset++] = (rgb >> 16 & 255) / 255;\n out[offset++] = (rgb >> 8 & 255) / 255;\n out[offset++] = (rgb & 255) / 255;\n out[offset++] = alpha;\n}\nfunction color32BitToUniform(abgr, out, offset) {\n const alpha = (abgr >> 24 & 255) / 255;\n out[offset++] = (abgr & 255) / 255 * alpha;\n out[offset++] = (abgr >> 8 & 255) / 255 * alpha;\n out[offset++] = (abgr >> 16 & 255) / 255 * alpha;\n out[offset++] = alpha;\n}\n\nexport { color32BitToUniform, colorToUniform };\n//# sourceMappingURL=colorToUniform.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../../maths/matrix/Matrix.mjs';\nimport { Point } from '../../../../maths/point/Point.mjs';\nimport { color32BitToUniform } from '../../../../scene/graphics/gpu/colorToUniform.mjs';\nimport { BindGroup } from '../../gpu/shader/BindGroup.mjs';\nimport { RendererType } from '../../types.mjs';\nimport { UniformGroup } from '../shader/UniformGroup.mjs';\n\n\"use strict\";\nclass GlobalUniformSystem {\n constructor(renderer) {\n this._stackIndex = 0;\n this._globalUniformDataStack = [];\n this._uniformsPool = [];\n this._activeUniforms = [];\n this._bindGroupPool = [];\n this._activeBindGroups = [];\n this._renderer = renderer;\n }\n reset() {\n this._stackIndex = 0;\n for (let i = 0; i < this._activeUniforms.length; i++) {\n this._uniformsPool.push(this._activeUniforms[i]);\n }\n for (let i = 0; i < this._activeBindGroups.length; i++) {\n this._bindGroupPool.push(this._activeBindGroups[i]);\n }\n this._activeUniforms.length = 0;\n this._activeBindGroups.length = 0;\n }\n start(options) {\n this.reset();\n this.push(options);\n }\n bind({\n size,\n projectionMatrix,\n worldTransformMatrix,\n worldColor,\n offset\n }) {\n const renderTarget = this._renderer.renderTarget.renderTarget;\n const currentGlobalUniformData = this._stackIndex ? this._globalUniformDataStack[this._stackIndex - 1] : {\n projectionData: renderTarget,\n worldTransformMatrix: new Matrix(),\n worldColor: 4294967295,\n offset: new Point()\n };\n const globalUniformData = {\n projectionMatrix: projectionMatrix || this._renderer.renderTarget.projectionMatrix,\n resolution: size || renderTarget.size,\n worldTransformMatrix: worldTransformMatrix || currentGlobalUniformData.worldTransformMatrix,\n worldColor: worldColor || currentGlobalUniformData.worldColor,\n offset: offset || currentGlobalUniformData.offset,\n bindGroup: null\n };\n const uniformGroup = this._uniformsPool.pop() || this._createUniforms();\n this._activeUniforms.push(uniformGroup);\n const uniforms = uniformGroup.uniforms;\n uniforms.uProjectionMatrix = globalUniformData.projectionMatrix;\n uniforms.uResolution = globalUniformData.resolution;\n uniforms.uWorldTransformMatrix.copyFrom(globalUniformData.worldTransformMatrix);\n uniforms.uWorldTransformMatrix.tx -= globalUniformData.offset.x;\n uniforms.uWorldTransformMatrix.ty -= globalUniformData.offset.y;\n color32BitToUniform(\n globalUniformData.worldColor,\n uniforms.uWorldColorAlpha,\n 0\n );\n uniformGroup.update();\n let bindGroup;\n if (this._renderer.renderPipes.uniformBatch) {\n bindGroup = this._renderer.renderPipes.uniformBatch.getUniformBindGroup(uniformGroup, false);\n } else {\n bindGroup = this._bindGroupPool.pop() || new BindGroup();\n this._activeBindGroups.push(bindGroup);\n bindGroup.setResource(uniformGroup, 0);\n }\n globalUniformData.bindGroup = bindGroup;\n this._currentGlobalUniformData = globalUniformData;\n }\n push(options) {\n this.bind(options);\n this._globalUniformDataStack[this._stackIndex++] = this._currentGlobalUniformData;\n }\n pop() {\n this._currentGlobalUniformData = this._globalUniformDataStack[--this._stackIndex - 1];\n if (this._renderer.type === RendererType.WEBGL) {\n this._currentGlobalUniformData.bindGroup.resources[0].update();\n }\n }\n get bindGroup() {\n return this._currentGlobalUniformData.bindGroup;\n }\n get uniformGroup() {\n return this._currentGlobalUniformData.bindGroup.resources[0];\n }\n _createUniforms() {\n const globalUniforms = new UniformGroup({\n uProjectionMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uWorldTransformMatrix: { value: new Matrix(), type: \"mat3x3\" },\n // TODO - someone smart - set this to be a unorm8x4 rather than a vec4\n uWorldColorAlpha: { value: new Float32Array(4), type: \"vec4\" },\n uResolution: { value: [0, 0], type: \"vec2\" }\n }, {\n isStatic: true\n });\n return globalUniforms;\n }\n destroy() {\n this._renderer = null;\n }\n}\n/** @ignore */\nGlobalUniformSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"globalUniforms\"\n};\n\nexport { GlobalUniformSystem };\n//# sourceMappingURL=GlobalUniformSystem.mjs.map\n","import { DOMAdapter } from '../environment/adapter.mjs';\n\n\"use strict\";\nlet saidHello = false;\nconst VERSION = \"8.2.6\";\nfunction sayHello(type) {\n if (saidHello) {\n return;\n }\n if (DOMAdapter.get().getNavigator().userAgent.toLowerCase().indexOf(\"chrome\") > -1) {\n const args = [\n `%c %c %c %c %c PixiJS %c v${VERSION} (${type}) http://www.pixijs.com/\n\n`,\n \"background: #E72264; padding:5px 0;\",\n \"background: #6CA2EA; padding:5px 0;\",\n \"background: #B5D33D; padding:5px 0;\",\n \"background: #FED23F; padding:5px 0;\",\n \"color: #FFFFFF; background: #E72264; padding:5px 0;\",\n \"color: #E72264; background: #FFFFFF; padding:5px 0;\"\n ];\n globalThis.console.log(...args);\n } else if (globalThis.console) {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n saidHello = true;\n}\n\nexport { VERSION, sayHello };\n//# sourceMappingURL=sayHello.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { sayHello } from '../../../../utils/sayHello.mjs';\nimport { RendererType } from '../../types.mjs';\n\n\"use strict\";\nclass HelloSystem {\n constructor(renderer) {\n this._renderer = renderer;\n }\n /**\n * It all starts here! This initiates every system, passing in the options for any system by name.\n * @param options - the config for the renderer and all its systems\n */\n init(options) {\n if (options.hello) {\n let name = this._renderer.name;\n if (this._renderer.type === RendererType.WEBGL) {\n name += ` ${this._renderer.context.webGLVersion}`;\n }\n sayHello(name);\n }\n }\n}\n/** @ignore */\nHelloSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"hello\",\n priority: -2\n};\n/** The default options for the system. */\nHelloSystem.defaultOptions = {\n /** {@link WebGLOptions.hello} */\n hello: false\n};\n\nexport { HelloSystem };\n//# sourceMappingURL=HelloSystem.mjs.map\n","import { ExtensionType, extensions } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nconst _TextureGCSystem = class _TextureGCSystem {\n /** @param renderer - The renderer this System works for. */\n constructor(renderer) {\n this._renderer = renderer;\n this.count = 0;\n this.checkCount = 0;\n }\n init(options) {\n options = { ..._TextureGCSystem.defaultOptions, ...options };\n this.checkCountMax = options.textureGCCheckCountMax;\n this.maxIdle = options.textureGCAMaxIdle;\n this.active = options.textureGCActive;\n }\n /**\n * Checks to see when the last time a texture was used.\n * If the texture has not been used for a specified amount of time, it will be removed from the GPU.\n */\n postrender() {\n if (!this._renderer.renderingToScreen) {\n return;\n }\n this.count++;\n if (!this.active)\n return;\n this.checkCount++;\n if (this.checkCount > this.checkCountMax) {\n this.checkCount = 0;\n this.run();\n }\n }\n /**\n * Checks to see when the last time a texture was used.\n * If the texture has not been used for a specified amount of time, it will be removed from the GPU.\n */\n run() {\n const managedTextures = this._renderer.texture.managedTextures;\n for (let i = 0; i < managedTextures.length; i++) {\n const texture = managedTextures[i];\n if (texture.autoGarbageCollect && texture.resource && texture._touched > -1 && this.count - texture._touched > this.maxIdle) {\n texture._touched = -1;\n texture.unload();\n }\n }\n }\n destroy() {\n this._renderer = null;\n }\n};\n/** @ignore */\n_TextureGCSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem\n ],\n name: \"textureGC\"\n};\n/** default options for the TextureGCSystem */\n_TextureGCSystem.defaultOptions = {\n /**\n * If set to true, this will enable the garbage collector on the GPU.\n * @default true\n */\n textureGCActive: true,\n /**\n * The maximum idle frames before a texture is destroyed by garbage collection.\n * @default 60 * 60\n */\n textureGCAMaxIdle: 60 * 60,\n /**\n * Frames between two garbage collections.\n * @default 600\n */\n textureGCCheckCountMax: 600\n};\nlet TextureGCSystem = _TextureGCSystem;\nextensions.add(TextureGCSystem);\n\nexport { TextureGCSystem };\n//# sourceMappingURL=TextureGCSystem.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';\nimport { deprecation, v8_0_0 } from '../../../../utils/logging/deprecation.mjs';\nimport { RenderTarget } from '../renderTarget/RenderTarget.mjs';\nimport { getCanvasTexture } from '../texture/utils/getCanvasTexture.mjs';\n\n\"use strict\";\nconst _ViewSystem = class _ViewSystem {\n /** The resolution / device pixel ratio of the renderer. */\n get resolution() {\n return this.texture.source._resolution;\n }\n set resolution(value) {\n this.texture.source.resize(\n this.texture.source.width,\n this.texture.source.height,\n value\n );\n }\n /**\n * initiates the view system\n * @param options - the options for the view\n */\n init(options) {\n options = {\n ..._ViewSystem.defaultOptions,\n ...options\n };\n if (options.view) {\n deprecation(v8_0_0, \"ViewSystem.view has been renamed to ViewSystem.canvas\");\n options.canvas = options.view;\n }\n this.screen = new Rectangle(0, 0, options.width, options.height);\n this.canvas = options.canvas || DOMAdapter.get().createCanvas();\n this.antialias = !!options.antialias;\n this.texture = getCanvasTexture(this.canvas, options);\n this.renderTarget = new RenderTarget({\n colorTextures: [this.texture],\n depth: !!options.depth,\n isRoot: true\n });\n this.texture.source.transparent = options.backgroundAlpha < 1;\n this.multiView = !!options.multiView;\n if (this.autoDensity) {\n this.canvas.style.width = `${this.texture.width}px`;\n this.canvas.style.height = `${this.texture.height}px`;\n }\n this.resolution = options.resolution;\n }\n /**\n * Resizes the screen and canvas to the specified dimensions.\n * @param desiredScreenWidth - The new width of the screen.\n * @param desiredScreenHeight - The new height of the screen.\n * @param resolution\n */\n resize(desiredScreenWidth, desiredScreenHeight, resolution) {\n this.texture.source.resize(desiredScreenWidth, desiredScreenHeight, resolution);\n this.screen.width = this.texture.frame.width;\n this.screen.height = this.texture.frame.height;\n if (this.autoDensity) {\n this.canvas.style.width = `${desiredScreenWidth}px`;\n this.canvas.style.height = `${desiredScreenHeight}px`;\n }\n }\n /**\n * Destroys this System and optionally removes the canvas from the dom.\n * @param {options | false} options - The options for destroying the view, or \"false\".\n * @param options.removeView - Whether to remove the view element from the DOM. Defaults to `false`.\n */\n destroy(options = false) {\n const removeView = typeof options === \"boolean\" ? options : !!options?.removeView;\n if (removeView && this.canvas.parentNode) {\n this.canvas.parentNode.removeChild(this.canvas);\n }\n }\n};\n/** @ignore */\n_ViewSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"view\",\n priority: 0\n};\n/** The default options for the view system. */\n_ViewSystem.defaultOptions = {\n /**\n * {@link WebGLOptions.width}\n * @default 800\n */\n width: 800,\n /**\n * {@link WebGLOptions.height}\n * @default 600\n */\n height: 600,\n /**\n * {@link WebGLOptions.autoDensity}\n * @default false\n */\n autoDensity: false,\n /**\n * {@link WebGLOptions.antialias}\n * @default false\n */\n antialias: false\n};\nlet ViewSystem = _ViewSystem;\n\nexport { ViewSystem };\n//# sourceMappingURL=ViewSystem.mjs.map\n","import { CustomRenderPipe } from '../../../../scene/container/CustomRenderPipe.mjs';\nimport { RenderGroupPipe } from '../../../../scene/container/RenderGroupPipe.mjs';\nimport { RenderGroupSystem } from '../../../../scene/container/RenderGroupSystem.mjs';\nimport { SpritePipe } from '../../../../scene/sprite/SpritePipe.mjs';\nimport { RendererInitHook } from '../../../../utils/global/globalHooks.mjs';\nimport { BatcherPipe } from '../../../batcher/shared/BatcherPipe.mjs';\nimport { AlphaMaskPipe } from '../../../mask/alpha/AlphaMaskPipe.mjs';\nimport { ColorMaskPipe } from '../../../mask/color/ColorMaskPipe.mjs';\nimport { StencilMaskPipe } from '../../../mask/stencil/StencilMaskPipe.mjs';\nimport { BackgroundSystem } from '../background/BackgroundSystem.mjs';\nimport { BlendModePipe } from '../blendModes/BlendModePipe.mjs';\nimport { ExtractSystem } from '../extract/ExtractSystem.mjs';\nimport { GenerateTextureSystem } from '../extract/GenerateTextureSystem.mjs';\nimport { GlobalUniformSystem } from '../renderTarget/GlobalUniformSystem.mjs';\nimport { HelloSystem } from '../startup/HelloSystem.mjs';\nimport { TextureGCSystem } from '../texture/TextureGCSystem.mjs';\nimport { ViewSystem } from '../view/ViewSystem.mjs';\n\n\"use strict\";\nconst SharedSystems = [\n BackgroundSystem,\n GlobalUniformSystem,\n HelloSystem,\n ViewSystem,\n RenderGroupSystem,\n TextureGCSystem,\n GenerateTextureSystem,\n ExtractSystem,\n RendererInitHook\n];\nconst SharedRenderPipes = [\n BlendModePipe,\n BatcherPipe,\n SpritePipe,\n RenderGroupPipe,\n AlphaMaskPipe,\n StencilMaskPipe,\n ColorMaskPipe,\n CustomRenderPipe\n];\n\nexport { SharedRenderPipes, SharedSystems };\n//# sourceMappingURL=SharedSystems.mjs.map\n","import { extensions, ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { GlGraphicsAdaptor } from '../../../scene/graphics/gl/GlGraphicsAdaptor.mjs';\nimport { GlMeshAdaptor } from '../../../scene/mesh/gl/GlMeshAdaptor.mjs';\nimport { GlBatchAdaptor } from '../../batcher/gl/GlBatchAdaptor.mjs';\nimport { AbstractRenderer } from '../shared/system/AbstractRenderer.mjs';\nimport { SharedSystems, SharedRenderPipes } from '../shared/system/SharedSystems.mjs';\nimport { RendererType } from '../types.mjs';\nimport { GlBufferSystem } from './buffer/GlBufferSystem.mjs';\nimport { GlContextSystem } from './context/GlContextSystem.mjs';\nimport { GlGeometrySystem } from './geometry/GlGeometrySystem.mjs';\nimport { GlBackBufferSystem } from './GlBackBufferSystem.mjs';\nimport { GlColorMaskSystem } from './GlColorMaskSystem.mjs';\nimport { GlEncoderSystem } from './GlEncoderSystem.mjs';\nimport { GlStencilSystem } from './GlStencilSystem.mjs';\nimport { GlUboSystem } from './GlUboSystem.mjs';\nimport { GlRenderTargetSystem } from './renderTarget/GlRenderTargetSystem.mjs';\nimport { GlShaderSystem } from './shader/GlShaderSystem.mjs';\nimport { GlUniformGroupSystem } from './shader/GlUniformGroupSystem.mjs';\nimport { GlStateSystem } from './state/GlStateSystem.mjs';\nimport { GlTextureSystem } from './texture/GlTextureSystem.mjs';\n\n\"use strict\";\nconst DefaultWebGLSystems = [\n ...SharedSystems,\n GlUboSystem,\n GlBackBufferSystem,\n GlContextSystem,\n GlBufferSystem,\n GlTextureSystem,\n GlRenderTargetSystem,\n GlGeometrySystem,\n GlUniformGroupSystem,\n GlShaderSystem,\n GlEncoderSystem,\n GlStateSystem,\n GlStencilSystem,\n GlColorMaskSystem\n];\nconst DefaultWebGLPipes = [...SharedRenderPipes];\nconst DefaultWebGLAdapters = [GlBatchAdaptor, GlMeshAdaptor, GlGraphicsAdaptor];\nconst systems = [];\nconst renderPipes = [];\nconst renderPipeAdaptors = [];\nextensions.handleByNamedList(ExtensionType.WebGLSystem, systems);\nextensions.handleByNamedList(ExtensionType.WebGLPipes, renderPipes);\nextensions.handleByNamedList(ExtensionType.WebGLPipesAdaptor, renderPipeAdaptors);\nextensions.add(...DefaultWebGLSystems, ...DefaultWebGLPipes, ...DefaultWebGLAdapters);\nclass WebGLRenderer extends AbstractRenderer {\n constructor() {\n const systemConfig = {\n name: \"webgl\",\n type: RendererType.WEBGL,\n systems,\n renderPipes,\n renderPipeAdaptors\n };\n super(systemConfig);\n }\n}\n\nexport { WebGLRenderer };\n//# sourceMappingURL=WebGLRenderer.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass BindGroupSystem {\n constructor(renderer) {\n this._hash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n getBindGroup(bindGroup, program, groupIndex) {\n bindGroup._updateKey();\n const gpuBindGroup = this._hash[bindGroup._key] || this._createBindGroup(bindGroup, program, groupIndex);\n return gpuBindGroup;\n }\n _createBindGroup(group, program, groupIndex) {\n const device = this._gpu.device;\n const groupLayout = program.layout[groupIndex];\n const entries = [];\n const renderer = this._renderer;\n for (const j in groupLayout) {\n const resource = group.resources[j] ?? group.resources[groupLayout[j]];\n let gpuResource;\n if (resource._resourceType === \"uniformGroup\") {\n const uniformGroup = resource;\n renderer.ubo.updateUniformGroup(uniformGroup);\n const buffer = uniformGroup.buffer;\n gpuResource = {\n buffer: renderer.buffer.getGPUBuffer(buffer),\n offset: 0,\n size: buffer.descriptor.size\n };\n } else if (resource._resourceType === \"buffer\") {\n const buffer = resource;\n gpuResource = {\n buffer: renderer.buffer.getGPUBuffer(buffer),\n offset: 0,\n size: buffer.descriptor.size\n };\n } else if (resource._resourceType === \"bufferResource\") {\n const bufferResource = resource;\n gpuResource = {\n buffer: renderer.buffer.getGPUBuffer(bufferResource.buffer),\n offset: bufferResource.offset,\n size: bufferResource.size\n };\n } else if (resource._resourceType === \"textureSampler\") {\n const sampler = resource;\n gpuResource = renderer.texture.getGpuSampler(sampler);\n } else if (resource._resourceType === \"textureSource\") {\n const texture = resource;\n gpuResource = renderer.texture.getGpuSource(texture).createView({});\n }\n entries.push({\n binding: groupLayout[j],\n resource: gpuResource\n });\n }\n const layout = renderer.shader.getProgramData(program).bindGroups[groupIndex];\n const gpuBindGroup = device.createBindGroup({\n layout,\n entries\n });\n this._hash[group._key] = gpuBindGroup;\n return gpuBindGroup;\n }\n destroy() {\n for (const key of Object.keys(this._hash)) {\n this._hash[key] = null;\n }\n this._hash = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nBindGroupSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"bindGroup\"\n};\n\nexport { BindGroupSystem };\n//# sourceMappingURL=BindGroupSystem.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { fastCopy } from '../../shared/buffer/utils/fastCopy.mjs';\n\n\"use strict\";\nclass GpuBufferSystem {\n constructor() {\n this._gpuBuffers = /* @__PURE__ */ Object.create(null);\n this._managedBuffers = [];\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n getGPUBuffer(buffer) {\n return this._gpuBuffers[buffer.uid] || this.createGPUBuffer(buffer);\n }\n updateBuffer(buffer) {\n const gpuBuffer = this._gpuBuffers[buffer.uid] || this.createGPUBuffer(buffer);\n const data = buffer.data;\n if (buffer._updateID && data) {\n buffer._updateID = 0;\n this._gpu.device.queue.writeBuffer(\n gpuBuffer,\n 0,\n data.buffer,\n 0,\n // round to the nearest 4 bytes\n (buffer._updateSize || data.byteLength) + 3 & ~3\n );\n }\n return gpuBuffer;\n }\n /** dispose all WebGL resources of all managed buffers */\n destroyAll() {\n for (const id in this._gpuBuffers) {\n this._gpuBuffers[id].destroy();\n }\n this._gpuBuffers = {};\n }\n createGPUBuffer(buffer) {\n if (!this._gpuBuffers[buffer.uid]) {\n buffer.on(\"update\", this.updateBuffer, this);\n buffer.on(\"change\", this.onBufferChange, this);\n buffer.on(\"destroy\", this.onBufferDestroy, this);\n this._managedBuffers.push(buffer);\n }\n const gpuBuffer = this._gpu.device.createBuffer(buffer.descriptor);\n buffer._updateID = 0;\n if (buffer.data) {\n fastCopy(buffer.data.buffer, gpuBuffer.getMappedRange());\n gpuBuffer.unmap();\n }\n this._gpuBuffers[buffer.uid] = gpuBuffer;\n return gpuBuffer;\n }\n onBufferChange(buffer) {\n const gpuBuffer = this._gpuBuffers[buffer.uid];\n gpuBuffer.destroy();\n buffer._updateID = 0;\n this._gpuBuffers[buffer.uid] = this.createGPUBuffer(buffer);\n }\n /**\n * Disposes buffer\n * @param buffer - buffer with data\n */\n onBufferDestroy(buffer) {\n this._managedBuffers.splice(this._managedBuffers.indexOf(buffer), 1);\n this._destroyBuffer(buffer);\n }\n destroy() {\n this._managedBuffers.forEach((buffer) => this._destroyBuffer(buffer));\n this._managedBuffers = null;\n this._gpuBuffers = null;\n }\n _destroyBuffer(buffer) {\n const gpuBuffer = this._gpuBuffers[buffer.uid];\n gpuBuffer.destroy();\n buffer.off(\"update\", this.updateBuffer, this);\n buffer.off(\"change\", this.onBufferChange, this);\n buffer.off(\"destroy\", this.onBufferDestroy, this);\n this._gpuBuffers[buffer.uid] = null;\n }\n}\n/** @ignore */\nGpuBufferSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"buffer\"\n};\n\nexport { GpuBufferSystem };\n//# sourceMappingURL=GpuBufferSystem.mjs.map\n","\"use strict\";\nclass UboBatch {\n constructor({ minUniformOffsetAlignment }) {\n this._minUniformOffsetAlignment = 256;\n this.byteIndex = 0;\n this._minUniformOffsetAlignment = minUniformOffsetAlignment;\n this.data = new Float32Array(65535);\n }\n clear() {\n this.byteIndex = 0;\n }\n addEmptyGroup(size) {\n if (size > this._minUniformOffsetAlignment / 4) {\n throw new Error(`UniformBufferBatch: array is too large: ${size * 4}`);\n }\n const start = this.byteIndex;\n let newSize = start + size * 4;\n newSize = Math.ceil(newSize / this._minUniformOffsetAlignment) * this._minUniformOffsetAlignment;\n if (newSize > this.data.length * 4) {\n throw new Error(\"UniformBufferBatch: ubo batch got too big\");\n }\n this.byteIndex = newSize;\n return start;\n }\n addGroup(array) {\n const offset = this.addEmptyGroup(array.length);\n for (let i = 0; i < array.length; i++) {\n this.data[offset / 4 + i] = array[i];\n }\n return offset;\n }\n destroy() {\n this._buffer.destroy();\n this._buffer = null;\n this.data = null;\n }\n}\n\nexport { UboBatch };\n//# sourceMappingURL=UboBatch.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuColorMaskSystem {\n constructor(renderer) {\n this._colorMaskCache = 15;\n this._renderer = renderer;\n }\n setMask(colorMask) {\n if (this._colorMaskCache === colorMask)\n return;\n this._colorMaskCache = colorMask;\n this._renderer.pipeline.setColorMask(colorMask);\n }\n destroy() {\n this._renderer = null;\n this._colorMaskCache = null;\n }\n}\n/** @ignore */\nGpuColorMaskSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"colorMask\"\n};\n\nexport { GpuColorMaskSystem };\n//# sourceMappingURL=GpuColorMaskSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuDeviceSystem {\n /**\n * @param {WebGPURenderer} renderer - The renderer this System works for.\n */\n constructor(renderer) {\n this._renderer = renderer;\n }\n async init(options) {\n if (this._initPromise)\n return this._initPromise;\n this._initPromise = this._createDeviceAndAdaptor(options).then((gpu) => {\n this.gpu = gpu;\n this._renderer.runners.contextChange.emit(this.gpu);\n });\n return this._initPromise;\n }\n /**\n * Handle the context change event\n * @param gpu\n */\n contextChange(gpu) {\n this._renderer.gpu = gpu;\n }\n /**\n * Helper class to create a WebGL Context\n * @param {object} options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n async _createDeviceAndAdaptor(options) {\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: options.powerPreference,\n forceFallbackAdapter: options.forceFallbackAdapter\n });\n const requiredFeatures = [\n \"texture-compression-bc\",\n \"texture-compression-astc\",\n \"texture-compression-etc2\"\n ].filter((feature) => adapter.features.has(feature));\n const device = await adapter.requestDevice({\n requiredFeatures\n });\n return { adapter, device };\n }\n destroy() {\n this.gpu = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nGpuDeviceSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"device\"\n};\n/** The default options for the GpuDeviceSystem. */\nGpuDeviceSystem.defaultOptions = {\n /**\n * {@link WebGPUOptions.powerPreference}\n * @default default\n */\n powerPreference: void 0,\n /**\n * Force the use of the fallback adapter\n * @default false\n */\n forceFallbackAdapter: false\n};\n\nexport { GpuDeviceSystem };\n//# sourceMappingURL=GpuDeviceSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuEncoderSystem {\n constructor(renderer) {\n this._boundBindGroup = /* @__PURE__ */ Object.create(null);\n this._boundVertexBuffer = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n renderStart() {\n this.commandFinished = new Promise((resolve) => {\n this._resolveCommandFinished = resolve;\n });\n this.commandEncoder = this._renderer.gpu.device.createCommandEncoder();\n }\n beginRenderPass(gpuRenderTarget) {\n this.endRenderPass();\n this._clearCache();\n this.renderPassEncoder = this.commandEncoder.beginRenderPass(gpuRenderTarget.descriptor);\n }\n endRenderPass() {\n if (this.renderPassEncoder) {\n this.renderPassEncoder.end();\n }\n this.renderPassEncoder = null;\n }\n setViewport(viewport) {\n this.renderPassEncoder.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, 0, 1);\n }\n setPipelineFromGeometryProgramAndState(geometry, program, state, topology) {\n const pipeline = this._renderer.pipeline.getPipeline(geometry, program, state, topology);\n this.setPipeline(pipeline);\n }\n setPipeline(pipeline) {\n if (this._boundPipeline === pipeline)\n return;\n this._boundPipeline = pipeline;\n this.renderPassEncoder.setPipeline(pipeline);\n }\n _setVertexBuffer(index, buffer) {\n if (this._boundVertexBuffer[index] === buffer)\n return;\n this._boundVertexBuffer[index] = buffer;\n this.renderPassEncoder.setVertexBuffer(index, this._renderer.buffer.updateBuffer(buffer));\n }\n _setIndexBuffer(buffer) {\n if (this._boundIndexBuffer === buffer)\n return;\n this._boundIndexBuffer = buffer;\n const indexFormat = buffer.data.BYTES_PER_ELEMENT === 2 ? \"uint16\" : \"uint32\";\n this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(buffer), indexFormat);\n }\n resetBindGroup(index) {\n this._boundBindGroup[index] = null;\n }\n setBindGroup(index, bindGroup, program) {\n if (this._boundBindGroup[index] === bindGroup)\n return;\n this._boundBindGroup[index] = bindGroup;\n bindGroup._touch(this._renderer.textureGC.count);\n const gpuBindGroup = this._renderer.bindGroup.getBindGroup(bindGroup, program, index);\n this.renderPassEncoder.setBindGroup(index, gpuBindGroup);\n }\n setGeometry(geometry) {\n for (const i in geometry.attributes) {\n const attribute = geometry.attributes[i];\n this._setVertexBuffer(attribute.location, attribute.buffer);\n }\n if (geometry.indexBuffer) {\n this._setIndexBuffer(geometry.indexBuffer);\n }\n }\n _setShaderBindGroups(shader, skipSync) {\n for (const i in shader.groups) {\n const bindGroup = shader.groups[i];\n if (!skipSync) {\n this._syncBindGroup(bindGroup);\n }\n this.setBindGroup(i, bindGroup, shader.gpuProgram);\n }\n }\n _syncBindGroup(bindGroup) {\n for (const j in bindGroup.resources) {\n const resource = bindGroup.resources[j];\n if (resource.isUniformGroup) {\n this._renderer.ubo.updateUniformGroup(resource);\n }\n }\n }\n draw(options) {\n const { geometry, shader, state, topology, size, start, instanceCount, skipSync } = options;\n this.setPipelineFromGeometryProgramAndState(geometry, shader.gpuProgram, state, topology);\n this.setGeometry(geometry);\n this._setShaderBindGroups(shader, skipSync);\n if (geometry.indexBuffer) {\n this.renderPassEncoder.drawIndexed(\n size || geometry.indexBuffer.data.length,\n instanceCount || geometry.instanceCount,\n start || 0\n );\n } else {\n this.renderPassEncoder.draw(size || geometry.getSize(), instanceCount || geometry.instanceCount, start || 0);\n }\n }\n finishRenderPass() {\n if (this.renderPassEncoder) {\n this.renderPassEncoder.end();\n this.renderPassEncoder = null;\n }\n }\n postrender() {\n this.finishRenderPass();\n this._gpu.device.queue.submit([this.commandEncoder.finish()]);\n this._resolveCommandFinished();\n this.commandEncoder = null;\n }\n // restores a render pass if finishRenderPass was called\n // not optimised as really used for debugging!\n // used when we want to stop drawing and log a texture..\n restoreRenderPass() {\n const descriptor = this._renderer.renderTarget.adaptor.getDescriptor(\n this._renderer.renderTarget.renderTarget,\n false,\n [0, 0, 0, 1]\n );\n this.renderPassEncoder = this.commandEncoder.beginRenderPass(descriptor);\n const boundPipeline = this._boundPipeline;\n const boundVertexBuffer = { ...this._boundVertexBuffer };\n const boundIndexBuffer = this._boundIndexBuffer;\n const boundBindGroup = { ...this._boundBindGroup };\n this._clearCache();\n const viewport = this._renderer.renderTarget.viewport;\n this.renderPassEncoder.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, 0, 1);\n this.setPipeline(boundPipeline);\n for (const i in boundVertexBuffer) {\n this._setVertexBuffer(i, boundVertexBuffer[i]);\n }\n for (const i in boundBindGroup) {\n this.setBindGroup(i, boundBindGroup[i], null);\n }\n this._setIndexBuffer(boundIndexBuffer);\n }\n _clearCache() {\n for (let i = 0; i < 16; i++) {\n this._boundBindGroup[i] = null;\n this._boundVertexBuffer[i] = null;\n }\n this._boundIndexBuffer = null;\n this._boundPipeline = null;\n }\n destroy() {\n this._renderer = null;\n this._gpu = null;\n this._boundBindGroup = null;\n this._boundVertexBuffer = null;\n this._boundIndexBuffer = null;\n this._boundPipeline = null;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n}\n/** @ignore */\nGpuEncoderSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"encoder\",\n priority: 1\n};\n\nexport { GpuEncoderSystem };\n//# sourceMappingURL=GpuEncoderSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { STENCIL_MODES } from '../shared/state/const.mjs';\n\n\"use strict\";\nclass GpuStencilSystem {\n constructor(renderer) {\n this._renderTargetStencilState = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n renderer.renderTarget.onRenderTargetChange.add(this);\n }\n onRenderTargetChange(renderTarget) {\n let stencilState = this._renderTargetStencilState[renderTarget.uid];\n if (!stencilState) {\n stencilState = this._renderTargetStencilState[renderTarget.uid] = {\n stencilMode: STENCIL_MODES.DISABLED,\n stencilReference: 0\n };\n }\n this._activeRenderTarget = renderTarget;\n this.setStencilMode(stencilState.stencilMode, stencilState.stencilReference);\n }\n setStencilMode(stencilMode, stencilReference) {\n const stencilState = this._renderTargetStencilState[this._activeRenderTarget.uid];\n stencilState.stencilMode = stencilMode;\n stencilState.stencilReference = stencilReference;\n const renderer = this._renderer;\n renderer.pipeline.setStencilMode(stencilMode);\n renderer.encoder.renderPassEncoder.setStencilReference(stencilReference);\n }\n destroy() {\n this._renderer.renderTarget.onRenderTargetChange.remove(this);\n this._renderer = null;\n this._activeRenderTarget = null;\n this._renderTargetStencilState = null;\n }\n}\n/** @ignore */\nGpuStencilSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"stencil\"\n};\n\nexport { GpuStencilSystem };\n//# sourceMappingURL=GpuStencilSystem.mjs.map\n","\"use strict\";\nconst WGSL_ALIGN_SIZE_DATA = {\n i32: { align: 4, size: 4 },\n u32: { align: 4, size: 4 },\n f32: { align: 4, size: 4 },\n f16: { align: 2, size: 2 },\n \"vec2\": { align: 8, size: 8 },\n \"vec2\": { align: 8, size: 8 },\n \"vec2\": { align: 8, size: 8 },\n \"vec2\": { align: 4, size: 4 },\n \"vec3\": { align: 16, size: 12 },\n \"vec3\": { align: 16, size: 12 },\n \"vec3\": { align: 16, size: 12 },\n \"vec3\": { align: 8, size: 6 },\n \"vec4\": { align: 16, size: 16 },\n \"vec4\": { align: 16, size: 16 },\n \"vec4\": { align: 16, size: 16 },\n \"vec4\": { align: 8, size: 8 },\n \"mat2x2\": { align: 8, size: 16 },\n \"mat2x2\": { align: 4, size: 8 },\n \"mat3x2\": { align: 8, size: 24 },\n \"mat3x2\": { align: 4, size: 12 },\n \"mat4x2\": { align: 8, size: 32 },\n \"mat4x2\": { align: 4, size: 16 },\n \"mat2x3\": { align: 16, size: 32 },\n \"mat2x3\": { align: 8, size: 16 },\n \"mat3x3\": { align: 16, size: 48 },\n \"mat3x3\": { align: 8, size: 24 },\n \"mat4x3\": { align: 16, size: 64 },\n \"mat4x3\": { align: 8, size: 32 },\n \"mat2x4\": { align: 16, size: 32 },\n \"mat2x4\": { align: 8, size: 16 },\n \"mat3x4\": { align: 16, size: 48 },\n \"mat3x4\": { align: 8, size: 24 },\n \"mat4x4\": { align: 16, size: 64 },\n \"mat4x4\": { align: 8, size: 32 }\n};\nfunction createUboElementsWGSL(uniformData) {\n const uboElements = uniformData.map((data) => ({\n data,\n offset: 0,\n size: 0\n }));\n let offset = 0;\n for (let i = 0; i < uboElements.length; i++) {\n const uboElement = uboElements[i];\n let size = WGSL_ALIGN_SIZE_DATA[uboElement.data.type].size;\n const align = WGSL_ALIGN_SIZE_DATA[uboElement.data.type].align;\n if (!WGSL_ALIGN_SIZE_DATA[uboElement.data.type]) {\n throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${uboElement.data.type}`);\n }\n if (uboElement.data.size > 1) {\n size = Math.max(size, align) * uboElement.data.size;\n }\n offset = Math.ceil(offset / align) * align;\n uboElement.size = size;\n uboElement.offset = offset;\n offset += size;\n }\n offset = Math.ceil(offset / 16) * 16;\n return { uboElements, size: offset };\n}\n\nexport { WGSL_ALIGN_SIZE_DATA, createUboElementsWGSL };\n//# sourceMappingURL=createUboElementsWGSL.mjs.map\n","import { WGSL_ALIGN_SIZE_DATA } from './createUboElementsWGSL.mjs';\n\n\"use strict\";\nfunction generateArraySyncWGSL(uboElement, offsetToAdd) {\n const { size, align } = WGSL_ALIGN_SIZE_DATA[uboElement.data.type];\n const remainder = (align - size) / 4;\n return `\n v = uv.${uboElement.data.name};\n ${offsetToAdd !== 0 ? `offset += ${offsetToAdd};` : \"\"}\n\n arrayOffset = offset;\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * (size / 4)}; i++)\n {\n for(var j = 0; j < ${size / 4}; j++)\n {\n data[arrayOffset++] = v[t++];\n }\n ${remainder !== 0 ? `arrayOffset += ${remainder};` : \"\"}\n }\n `;\n}\n\nexport { generateArraySyncWGSL };\n//# sourceMappingURL=generateArraySyncWGSL.mjs.map\n","import { createUboSyncFunction } from '../../../shared/shader/utils/createUboSyncFunction.mjs';\nimport { uboSyncFunctionsWGSL } from '../../../shared/shader/utils/uboSyncFunctions.mjs';\nimport { generateArraySyncWGSL } from './generateArraySyncWGSL.mjs';\n\n\"use strict\";\nfunction createUboSyncFunctionWGSL(uboElements) {\n return createUboSyncFunction(\n uboElements,\n \"uboWgsl\",\n generateArraySyncWGSL,\n uboSyncFunctionsWGSL\n );\n}\n\nexport { createUboSyncFunctionWGSL };\n//# sourceMappingURL=createUboSyncFunctionWGSL.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { UboSystem } from '../shared/shader/UboSystem.mjs';\nimport { createUboElementsWGSL } from './shader/utils/createUboElementsWGSL.mjs';\nimport { createUboSyncFunctionWGSL } from './shader/utils/createUboSyncFunctionWGSL.mjs';\n\n\"use strict\";\nclass GpuUboSystem extends UboSystem {\n constructor() {\n super({\n createUboElements: createUboElementsWGSL,\n generateUboSync: createUboSyncFunctionWGSL\n });\n }\n}\n/** @ignore */\nGpuUboSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"ubo\"\n};\n\nexport { GpuUboSystem };\n//# sourceMappingURL=GpuUboSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Buffer } from '../shared/buffer/Buffer.mjs';\nimport { BufferResource } from '../shared/buffer/BufferResource.mjs';\nimport { BufferUsage } from '../shared/buffer/const.mjs';\nimport { UboBatch } from './buffer/UboBatch.mjs';\nimport { BindGroup } from './shader/BindGroup.mjs';\n\n\"use strict\";\nconst minUniformOffsetAlignment = 128;\nclass GpuUniformBatchPipe {\n constructor(renderer) {\n this._bindGroupHash = /* @__PURE__ */ Object.create(null);\n // number of buffers..\n this._buffers = [];\n this._bindGroups = [];\n this._bufferResources = [];\n this._renderer = renderer;\n this._batchBuffer = new UboBatch({ minUniformOffsetAlignment });\n const totalBuffers = 256 / minUniformOffsetAlignment;\n for (let i = 0; i < totalBuffers; i++) {\n let usage = BufferUsage.UNIFORM | BufferUsage.COPY_DST;\n if (i === 0)\n usage |= BufferUsage.COPY_SRC;\n this._buffers.push(new Buffer({\n data: this._batchBuffer.data,\n usage\n }));\n }\n }\n renderEnd() {\n this._uploadBindGroups();\n this._resetBindGroups();\n }\n _resetBindGroups() {\n for (const i in this._bindGroupHash) {\n this._bindGroupHash[i] = null;\n }\n this._batchBuffer.clear();\n }\n // just works for single bind groups for now\n getUniformBindGroup(group, duplicate) {\n if (!duplicate && this._bindGroupHash[group.uid]) {\n return this._bindGroupHash[group.uid];\n }\n this._renderer.ubo.ensureUniformGroup(group);\n const data = group.buffer.data;\n const offset = this._batchBuffer.addEmptyGroup(data.length);\n this._renderer.ubo.syncUniformGroup(group, this._batchBuffer.data, offset / 4);\n this._bindGroupHash[group.uid] = this._getBindGroup(offset / minUniformOffsetAlignment);\n return this._bindGroupHash[group.uid];\n }\n getUboResource(group) {\n this._renderer.ubo.updateUniformGroup(group);\n const data = group.buffer.data;\n const offset = this._batchBuffer.addGroup(data);\n return this._getBufferResource(offset / minUniformOffsetAlignment);\n }\n getArrayBindGroup(data) {\n const offset = this._batchBuffer.addGroup(data);\n return this._getBindGroup(offset / minUniformOffsetAlignment);\n }\n getArrayBufferResource(data) {\n const offset = this._batchBuffer.addGroup(data);\n const index = offset / minUniformOffsetAlignment;\n return this._getBufferResource(index);\n }\n _getBufferResource(index) {\n if (!this._bufferResources[index]) {\n const buffer = this._buffers[index % 2];\n this._bufferResources[index] = new BufferResource({\n buffer,\n offset: (index / 2 | 0) * 256,\n size: minUniformOffsetAlignment\n });\n }\n return this._bufferResources[index];\n }\n _getBindGroup(index) {\n if (!this._bindGroups[index]) {\n const bindGroup = new BindGroup({\n 0: this._getBufferResource(index)\n });\n this._bindGroups[index] = bindGroup;\n }\n return this._bindGroups[index];\n }\n _uploadBindGroups() {\n const bufferSystem = this._renderer.buffer;\n const firstBuffer = this._buffers[0];\n firstBuffer.update(this._batchBuffer.byteIndex);\n bufferSystem.updateBuffer(firstBuffer);\n const commandEncoder = this._renderer.gpu.device.createCommandEncoder();\n for (let i = 1; i < this._buffers.length; i++) {\n const buffer = this._buffers[i];\n commandEncoder.copyBufferToBuffer(\n bufferSystem.getGPUBuffer(firstBuffer),\n minUniformOffsetAlignment,\n bufferSystem.getGPUBuffer(buffer),\n 0,\n this._batchBuffer.byteIndex\n );\n }\n this._renderer.gpu.device.queue.submit([commandEncoder.finish()]);\n }\n destroy() {\n for (let i = 0; i < this._bindGroups.length; i++) {\n this._bindGroups[i].destroy();\n }\n this._bindGroups = null;\n this._bindGroupHash = null;\n for (let i = 0; i < this._buffers.length; i++) {\n this._buffers[i].destroy();\n }\n this._buffers = null;\n for (let i = 0; i < this._bufferResources.length; i++) {\n this._bufferResources[i].destroy();\n }\n this._bufferResources = null;\n this._batchBuffer.destroy();\n this._bindGroupHash = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nGpuUniformBatchPipe.extension = {\n type: [\n ExtensionType.WebGPUPipes\n ],\n name: \"uniformBatch\"\n};\n\nexport { GpuUniformBatchPipe };\n//# sourceMappingURL=GpuUniformBatchPipe.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { warn } from '../../../../utils/logging/warn.mjs';\nimport { ensureAttributes } from '../../gl/shader/program/ensureAttributes.mjs';\nimport { STENCIL_MODES } from '../../shared/state/const.mjs';\nimport { createIdFromString } from '../../shared/utils/createIdFromString.mjs';\nimport { GpuStencilModesToPixi } from '../state/GpuStencilModesToPixi.mjs';\n\n\"use strict\";\nconst topologyStringToId = {\n \"point-list\": 0,\n \"line-list\": 1,\n \"line-strip\": 2,\n \"triangle-list\": 3,\n \"triangle-strip\": 4\n};\nfunction getGraphicsStateKey(geometryLayout, shaderKey, state, blendMode, topology) {\n return geometryLayout << 24 | shaderKey << 16 | state << 10 | blendMode << 5 | topology;\n}\nfunction getGlobalStateKey(stencilStateId, multiSampleCount, colorMask, renderTarget) {\n return colorMask << 6 | stencilStateId << 3 | renderTarget << 1 | multiSampleCount;\n}\nclass PipelineSystem {\n constructor(renderer) {\n this._moduleCache = /* @__PURE__ */ Object.create(null);\n this._bufferLayoutsCache = /* @__PURE__ */ Object.create(null);\n this._pipeCache = /* @__PURE__ */ Object.create(null);\n this._pipeStateCaches = /* @__PURE__ */ Object.create(null);\n this._colorMask = 15;\n this._multisampleCount = 1;\n this._renderer = renderer;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n this.setStencilMode(STENCIL_MODES.DISABLED);\n this._updatePipeHash();\n }\n setMultisampleCount(multisampleCount) {\n if (this._multisampleCount === multisampleCount)\n return;\n this._multisampleCount = multisampleCount;\n this._updatePipeHash();\n }\n setRenderTarget(renderTarget) {\n this._multisampleCount = renderTarget.msaaSamples;\n this._depthStencilAttachment = renderTarget.descriptor.depthStencilAttachment ? 1 : 0;\n this._updatePipeHash();\n }\n setColorMask(colorMask) {\n if (this._colorMask === colorMask)\n return;\n this._colorMask = colorMask;\n this._updatePipeHash();\n }\n setStencilMode(stencilMode) {\n if (this._stencilMode === stencilMode)\n return;\n this._stencilMode = stencilMode;\n this._stencilState = GpuStencilModesToPixi[stencilMode];\n this._updatePipeHash();\n }\n setPipeline(geometry, program, state, passEncoder) {\n const pipeline = this.getPipeline(geometry, program, state);\n passEncoder.setPipeline(pipeline);\n }\n getPipeline(geometry, program, state, topology) {\n if (!geometry._layoutKey) {\n ensureAttributes(geometry, program.attributeData);\n this._generateBufferKey(geometry);\n }\n topology = topology || geometry.topology;\n const key = getGraphicsStateKey(\n geometry._layoutKey,\n program._layoutKey,\n state.data,\n state._blendModeId,\n topologyStringToId[topology]\n );\n if (this._pipeCache[key])\n return this._pipeCache[key];\n this._pipeCache[key] = this._createPipeline(geometry, program, state, topology);\n return this._pipeCache[key];\n }\n _createPipeline(geometry, program, state, topology) {\n const device = this._gpu.device;\n const buffers = this._createVertexBufferLayouts(geometry);\n const blendModes = this._renderer.state.getColorTargets(state);\n blendModes[0].writeMask = this._stencilMode === STENCIL_MODES.RENDERING_MASK_ADD ? 0 : this._colorMask;\n const layout = this._renderer.shader.getProgramData(program).pipeline;\n const descriptor = {\n // TODO later check if its helpful to create..\n // layout,\n vertex: {\n module: this._getModule(program.vertex.source),\n entryPoint: program.vertex.entryPoint,\n // geometry..\n buffers\n },\n fragment: {\n module: this._getModule(program.fragment.source),\n entryPoint: program.fragment.entryPoint,\n targets: blendModes\n },\n primitive: {\n topology,\n cullMode: state.cullMode\n },\n layout,\n multisample: {\n count: this._multisampleCount\n },\n // depthStencil,\n label: `PIXI Pipeline`\n };\n if (this._depthStencilAttachment) {\n descriptor.depthStencil = {\n ...this._stencilState,\n format: \"depth24plus-stencil8\",\n depthWriteEnabled: state.depthTest,\n depthCompare: state.depthTest ? \"less\" : \"always\"\n };\n }\n const pipeline = device.createRenderPipeline(descriptor);\n return pipeline;\n }\n _getModule(code) {\n return this._moduleCache[code] || this._createModule(code);\n }\n _createModule(code) {\n const device = this._gpu.device;\n this._moduleCache[code] = device.createShaderModule({\n code\n });\n return this._moduleCache[code];\n }\n _generateBufferKey(geometry) {\n const keyGen = [];\n let index = 0;\n const attributeKeys = Object.keys(geometry.attributes).sort();\n for (let i = 0; i < attributeKeys.length; i++) {\n const attribute = geometry.attributes[attributeKeys[i]];\n keyGen[index++] = attribute.location;\n keyGen[index++] = attribute.offset;\n keyGen[index++] = attribute.format;\n keyGen[index++] = attribute.stride;\n }\n const stringKey = keyGen.join(\"\");\n geometry._layoutKey = createIdFromString(stringKey, \"geometry\");\n return geometry._layoutKey;\n }\n _createVertexBufferLayouts(geometry) {\n if (this._bufferLayoutsCache[geometry._layoutKey]) {\n return this._bufferLayoutsCache[geometry._layoutKey];\n }\n const vertexBuffersLayout = [];\n geometry.buffers.forEach((buffer) => {\n const bufferEntry = {\n arrayStride: 0,\n stepMode: \"vertex\",\n attributes: []\n };\n const bufferEntryAttributes = bufferEntry.attributes;\n for (const i in geometry.attributes) {\n const attribute = geometry.attributes[i];\n if ((attribute.divisor ?? 1) !== 1) {\n warn(`Attribute ${i} has an invalid divisor value of '${attribute.divisor}'. WebGPU only supports a divisor value of 1`);\n }\n if (attribute.buffer === buffer) {\n bufferEntry.arrayStride = attribute.stride;\n bufferEntry.stepMode = attribute.instance ? \"instance\" : \"vertex\";\n bufferEntryAttributes.push({\n shaderLocation: attribute.location,\n offset: attribute.offset,\n format: attribute.format\n });\n }\n }\n if (bufferEntryAttributes.length) {\n vertexBuffersLayout.push(bufferEntry);\n }\n });\n this._bufferLayoutsCache[geometry._layoutKey] = vertexBuffersLayout;\n return vertexBuffersLayout;\n }\n _updatePipeHash() {\n const key = getGlobalStateKey(\n this._stencilMode,\n this._multisampleCount,\n this._colorMask,\n this._depthStencilAttachment\n );\n if (!this._pipeStateCaches[key]) {\n this._pipeStateCaches[key] = /* @__PURE__ */ Object.create(null);\n }\n this._pipeCache = this._pipeStateCaches[key];\n }\n destroy() {\n this._renderer = null;\n this._bufferLayoutsCache = null;\n }\n}\n/** @ignore */\nPipelineSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"pipeline\"\n};\n\nexport { PipelineSystem };\n//# sourceMappingURL=PipelineSystem.mjs.map\n","\"use strict\";\nclass GpuRenderTarget {\n constructor() {\n this.contexts = [];\n this.msaaTextures = [];\n this.msaaSamples = 1;\n }\n}\n\nexport { GpuRenderTarget };\n//# sourceMappingURL=GpuRenderTarget.mjs.map\n","import { CLEAR } from '../../gl/const.mjs';\nimport { CanvasSource } from '../../shared/texture/sources/CanvasSource.mjs';\nimport { TextureSource } from '../../shared/texture/sources/TextureSource.mjs';\nimport { GpuRenderTarget } from './GpuRenderTarget.mjs';\n\n\"use strict\";\nclass GpuRenderTargetAdaptor {\n init(renderer, renderTargetSystem) {\n this._renderer = renderer;\n this._renderTargetSystem = renderTargetSystem;\n }\n copyToTexture(sourceRenderSurfaceTexture, destinationTexture, originSrc, size, originDest) {\n const renderer = this._renderer;\n const baseGpuTexture = this._getGpuColorTexture(\n sourceRenderSurfaceTexture\n );\n const backGpuTexture = renderer.texture.getGpuSource(\n destinationTexture.source\n );\n renderer.encoder.commandEncoder.copyTextureToTexture(\n {\n texture: baseGpuTexture,\n origin: originSrc\n },\n {\n texture: backGpuTexture,\n origin: originDest\n },\n size\n );\n return destinationTexture;\n }\n startRenderPass(renderTarget, clear = true, clearColor, viewport) {\n const renderTargetSystem = this._renderTargetSystem;\n const gpuRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n const descriptor = this.getDescriptor(renderTarget, clear, clearColor);\n gpuRenderTarget.descriptor = descriptor;\n this._renderer.pipeline.setRenderTarget(gpuRenderTarget);\n this._renderer.encoder.beginRenderPass(gpuRenderTarget);\n this._renderer.encoder.setViewport(viewport);\n }\n finishRenderPass() {\n this._renderer.encoder.endRenderPass();\n }\n /**\n * returns the gpu texture for the first color texture in the render target\n * mainly used by the filter manager to get copy the texture for blending\n * @param renderTarget\n * @returns a gpu texture\n */\n _getGpuColorTexture(renderTarget) {\n const gpuRenderTarget = this._renderTargetSystem.getGpuRenderTarget(renderTarget);\n if (gpuRenderTarget.contexts[0]) {\n return gpuRenderTarget.contexts[0].getCurrentTexture();\n }\n return this._renderer.texture.getGpuSource(\n renderTarget.colorTextures[0].source\n );\n }\n getDescriptor(renderTarget, clear, clearValue) {\n if (typeof clear === \"boolean\") {\n clear = clear ? CLEAR.ALL : CLEAR.NONE;\n }\n const renderTargetSystem = this._renderTargetSystem;\n const gpuRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);\n const colorAttachments = renderTarget.colorTextures.map(\n (texture, i) => {\n const context = gpuRenderTarget.contexts[i];\n let view;\n let resolveTarget;\n if (context) {\n const currentTexture = context.getCurrentTexture();\n const canvasTextureView = currentTexture.createView();\n view = canvasTextureView;\n } else {\n view = this._renderer.texture.getGpuSource(texture).createView({\n mipLevelCount: 1\n });\n }\n if (gpuRenderTarget.msaaTextures[i]) {\n resolveTarget = view;\n view = this._renderer.texture.getTextureView(\n gpuRenderTarget.msaaTextures[i]\n );\n }\n const loadOp = clear & CLEAR.COLOR ? \"clear\" : \"load\";\n clearValue ?? (clearValue = renderTargetSystem.defaultClearColor);\n return {\n view,\n resolveTarget,\n clearValue,\n storeOp: \"store\",\n loadOp\n };\n }\n );\n let depthStencilAttachment;\n if ((renderTarget.stencil || renderTarget.depth) && !renderTarget.depthStencilTexture) {\n renderTarget.ensureDepthStencilTexture();\n renderTarget.depthStencilTexture.source.sampleCount = gpuRenderTarget.msaa ? 4 : 1;\n }\n if (renderTarget.depthStencilTexture) {\n const stencilLoadOp = clear & CLEAR.STENCIL ? \"clear\" : \"load\";\n const depthLoadOp = clear & CLEAR.DEPTH ? \"clear\" : \"load\";\n depthStencilAttachment = {\n view: this._renderer.texture.getGpuSource(renderTarget.depthStencilTexture.source).createView(),\n stencilStoreOp: \"store\",\n stencilLoadOp,\n depthClearValue: 1,\n depthLoadOp,\n depthStoreOp: \"store\"\n };\n }\n const descriptor = {\n colorAttachments,\n depthStencilAttachment\n };\n return descriptor;\n }\n clear(renderTarget, clear = true, clearColor, viewport) {\n if (!clear)\n return;\n const { gpu, encoder } = this._renderer;\n const device = gpu.device;\n const standAlone = encoder.commandEncoder === null;\n if (standAlone) {\n const commandEncoder = device.createCommandEncoder();\n const renderPassDescriptor = this.getDescriptor(renderTarget, clear, clearColor);\n const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);\n passEncoder.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, 0, 1);\n passEncoder.end();\n const gpuCommands = commandEncoder.finish();\n device.queue.submit([gpuCommands]);\n } else {\n this.startRenderPass(renderTarget, clear, clearColor, viewport);\n }\n }\n initGpuRenderTarget(renderTarget) {\n renderTarget.isRoot = true;\n const gpuRenderTarget = new GpuRenderTarget();\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n if (CanvasSource.test(colorTexture.resource)) {\n const context = colorTexture.resource.getContext(\n \"webgpu\"\n );\n const alphaMode = colorTexture.transparent ? \"premultiplied\" : \"opaque\";\n try {\n context.configure({\n device: this._renderer.gpu.device,\n // eslint-disable-next-line max-len\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,\n format: \"bgra8unorm\",\n alphaMode\n });\n } catch (e) {\n console.error(e);\n }\n gpuRenderTarget.contexts[i] = context;\n }\n gpuRenderTarget.msaa = colorTexture.source.antialias;\n if (colorTexture.source.antialias) {\n const msaaTexture = new TextureSource({\n width: 0,\n height: 0,\n sampleCount: 4\n });\n gpuRenderTarget.msaaTextures[i] = msaaTexture;\n }\n });\n if (gpuRenderTarget.msaa) {\n gpuRenderTarget.msaaSamples = 4;\n if (renderTarget.depthStencilTexture) {\n renderTarget.depthStencilTexture.source.sampleCount = 4;\n }\n }\n return gpuRenderTarget;\n }\n destroyGpuRenderTarget(gpuRenderTarget) {\n gpuRenderTarget.contexts.forEach((context) => {\n context.unconfigure();\n });\n gpuRenderTarget.msaaTextures.forEach((texture) => {\n texture.destroy();\n });\n gpuRenderTarget.msaaTextures.length = 0;\n gpuRenderTarget.contexts.length = 0;\n }\n ensureDepthStencilTexture(renderTarget) {\n const gpuRenderTarget = this._renderTargetSystem.getGpuRenderTarget(renderTarget);\n if (renderTarget.depthStencilTexture && gpuRenderTarget.msaa) {\n renderTarget.depthStencilTexture.source.sampleCount = 4;\n }\n }\n resizeGpuRenderTarget(renderTarget) {\n const gpuRenderTarget = this._renderTargetSystem.getGpuRenderTarget(renderTarget);\n gpuRenderTarget.width = renderTarget.width;\n gpuRenderTarget.height = renderTarget.height;\n if (gpuRenderTarget.msaa) {\n renderTarget.colorTextures.forEach((colorTexture, i) => {\n const msaaTexture = gpuRenderTarget.msaaTextures[i];\n msaaTexture?.resize(\n colorTexture.source.width,\n colorTexture.source.height,\n colorTexture.source._resolution\n );\n });\n }\n }\n}\n\nexport { GpuRenderTargetAdaptor };\n//# sourceMappingURL=GpuRenderTargetAdaptor.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { RenderTargetSystem } from '../../shared/renderTarget/RenderTargetSystem.mjs';\nimport { GpuRenderTargetAdaptor } from './GpuRenderTargetAdaptor.mjs';\n\n\"use strict\";\nclass GpuRenderTargetSystem extends RenderTargetSystem {\n constructor(renderer) {\n super(renderer);\n this.adaptor = new GpuRenderTargetAdaptor();\n this.adaptor.init(renderer, this);\n }\n}\n/** @ignore */\nGpuRenderTargetSystem.extension = {\n type: [ExtensionType.WebGPUSystem],\n name: \"renderTarget\"\n};\n\nexport { GpuRenderTargetSystem };\n//# sourceMappingURL=GpuRenderTargetSystem.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\n\n\"use strict\";\nclass GpuShaderSystem {\n constructor() {\n this._gpuProgramData = /* @__PURE__ */ Object.create(null);\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n getProgramData(program) {\n return this._gpuProgramData[program._layoutKey] || this._createGPUProgramData(program);\n }\n _createGPUProgramData(program) {\n const device = this._gpu.device;\n const bindGroups = program.gpuLayout.map((group) => device.createBindGroupLayout({ entries: group }));\n const pipelineLayoutDesc = { bindGroupLayouts: bindGroups };\n this._gpuProgramData[program._layoutKey] = {\n bindGroups,\n pipeline: device.createPipelineLayout(pipelineLayoutDesc)\n };\n return this._gpuProgramData[program._layoutKey];\n }\n destroy() {\n this._gpu = null;\n this._gpuProgramData = null;\n }\n}\n/** @ignore */\nGpuShaderSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"shader\"\n};\n\nexport { GpuShaderSystem };\n//# sourceMappingURL=GpuShaderSystem.mjs.map\n","\"use strict\";\nconst GpuBlendModesToPixi = {};\nGpuBlendModesToPixi.normal = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.add = {\n alpha: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.multiply = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"dst\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.screen = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.overlay = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.none = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"zero\",\n dstFactor: \"zero\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi[\"normal-npm\"] = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi[\"add-npm\"] = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi[\"screen-npm\"] = {\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\nGpuBlendModesToPixi.erase = {\n alpha: {\n srcFactor: \"zero\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\"\n },\n color: {\n srcFactor: \"zero\",\n dstFactor: \"one-minus-src\",\n operation: \"add\"\n }\n};\n\nexport { GpuBlendModesToPixi };\n//# sourceMappingURL=GpuBlendModesToPixi.mjs.map\n","import { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { State } from '../../shared/state/State.mjs';\nimport { GpuBlendModesToPixi } from './GpuBlendModesToPixi.mjs';\n\n\"use strict\";\nclass GpuStateSystem {\n constructor() {\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n contextChange(gpu) {\n this.gpu = gpu;\n }\n /**\n * Gets the blend mode data for the current state\n * @param state - The state to get the blend mode from\n */\n getColorTargets(state) {\n const blend = GpuBlendModesToPixi[state.blendMode] || GpuBlendModesToPixi.normal;\n return [\n {\n format: \"bgra8unorm\",\n writeMask: 0,\n blend\n }\n ];\n }\n destroy() {\n this.gpu = null;\n }\n}\n/** @ignore */\nGpuStateSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"state\"\n};\n\nexport { GpuStateSystem };\n//# sourceMappingURL=GpuStateSystem.mjs.map\n","\"use strict\";\nconst gpuUploadBufferImageResource = {\n type: \"image\",\n upload(source, gpuTexture, gpu) {\n const resource = source.resource;\n const total = (source.pixelWidth | 0) * (source.pixelHeight | 0);\n const bytesPerPixel = resource.byteLength / total;\n gpu.device.queue.writeTexture(\n { texture: gpuTexture },\n resource,\n {\n offset: 0,\n rowsPerImage: source.pixelHeight,\n bytesPerRow: source.pixelHeight * bytesPerPixel\n },\n {\n width: source.pixelWidth,\n height: source.pixelHeight,\n depthOrArrayLayers: 1\n }\n );\n }\n};\n\nexport { gpuUploadBufferImageResource };\n//# sourceMappingURL=gpuUploadBufferImageResource.mjs.map\n","\"use strict\";\nconst blockDataMap = {\n \"bc1-rgba-unorm\": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n \"bc2-rgba-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"bc3-rgba-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"bc7-rgba-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"etc1-rgb-unorm\": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n \"etc2-rgba8unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n \"astc-4x4-unorm\": { blockBytes: 16, blockWidth: 4, blockHeight: 4 }\n};\nconst defaultBlockData = { blockBytes: 4, blockWidth: 1, blockHeight: 1 };\nconst gpuUploadCompressedTextureResource = {\n type: \"compressed\",\n upload(source, gpuTexture, gpu) {\n let mipWidth = source.pixelWidth;\n let mipHeight = source.pixelHeight;\n const blockData = blockDataMap[source.format] || defaultBlockData;\n for (let i = 0; i < source.resource.length; i++) {\n const levelBuffer = source.resource[i];\n const bytesPerRow = Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockBytes;\n gpu.device.queue.writeTexture(\n {\n texture: gpuTexture,\n mipLevel: i\n },\n levelBuffer,\n {\n offset: 0,\n bytesPerRow\n },\n {\n width: Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockWidth,\n height: Math.ceil(mipHeight / blockData.blockHeight) * blockData.blockHeight,\n depthOrArrayLayers: 1\n }\n );\n mipWidth = Math.max(mipWidth >> 1, 1);\n mipHeight = Math.max(mipHeight >> 1, 1);\n }\n }\n};\n\nexport { blockDataMap, gpuUploadCompressedTextureResource };\n//# sourceMappingURL=gpuUploadCompressedTextureResource.mjs.map\n","\"use strict\";\nconst gpuUploadImageResource = {\n type: \"image\",\n upload(source, gpuTexture, gpu) {\n const resource = source.resource;\n if (!resource)\n return;\n const width = Math.min(gpuTexture.width, source.resourceWidth || source.pixelWidth);\n const height = Math.min(gpuTexture.height, source.resourceHeight || source.pixelHeight);\n const premultipliedAlpha = source.alphaMode === \"premultiply-alpha-on-upload\";\n gpu.device.queue.copyExternalImageToTexture(\n { source: resource },\n { texture: gpuTexture, premultipliedAlpha },\n {\n width,\n height\n }\n );\n }\n};\n\nexport { gpuUploadImageResource };\n//# sourceMappingURL=gpuUploadImageSource.mjs.map\n","import { gpuUploadImageResource } from './gpuUploadImageSource.mjs';\n\n\"use strict\";\nconst gpuUploadVideoResource = {\n type: \"video\",\n upload(source, gpuTexture, gpu) {\n gpuUploadImageResource.upload(source, gpuTexture, gpu);\n }\n};\n\nexport { gpuUploadVideoResource };\n//# sourceMappingURL=gpuUploadVideoSource.mjs.map\n","\"use strict\";\nclass GpuMipmapGenerator {\n constructor(device) {\n this.device = device;\n this.sampler = device.createSampler({ minFilter: \"linear\" });\n this.pipelines = {};\n }\n _getMipmapPipeline(format) {\n let pipeline = this.pipelines[format];\n if (!pipeline) {\n if (!this.mipmapShaderModule) {\n this.mipmapShaderModule = this.device.createShaderModule({\n code: (\n /* wgsl */\n `\n var pos : array, 3> = array, 3>(\n vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0));\n\n struct VertexOutput {\n @builtin(position) position : vec4,\n @location(0) texCoord : vec2,\n };\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {\n var output : VertexOutput;\n output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5);\n output.position = vec4(pos[vertexIndex], 0.0, 1.0);\n return output;\n }\n\n @group(0) @binding(0) var imgSampler : sampler;\n @group(0) @binding(1) var img : texture_2d;\n\n @fragment\n fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 {\n return textureSample(img, imgSampler, texCoord);\n }\n `\n )\n });\n }\n pipeline = this.device.createRenderPipeline({\n layout: \"auto\",\n vertex: {\n module: this.mipmapShaderModule,\n entryPoint: \"vertexMain\"\n },\n fragment: {\n module: this.mipmapShaderModule,\n entryPoint: \"fragmentMain\",\n targets: [{ format }]\n }\n });\n this.pipelines[format] = pipeline;\n }\n return pipeline;\n }\n /**\n * Generates mipmaps for the given GPUTexture from the data in level 0.\n * @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.\n * @returns {module:External.GPUTexture} - The originally passed texture\n */\n generateMipmap(texture) {\n const pipeline = this._getMipmapPipeline(texture.format);\n if (texture.dimension === \"3d\" || texture.dimension === \"1d\") {\n throw new Error(\"Generating mipmaps for non-2d textures is currently unsupported!\");\n }\n let mipTexture = texture;\n const arrayLayerCount = texture.depthOrArrayLayers || 1;\n const renderToSource = texture.usage & GPUTextureUsage.RENDER_ATTACHMENT;\n if (!renderToSource) {\n const mipTextureDescriptor = {\n size: {\n width: Math.ceil(texture.width / 2),\n height: Math.ceil(texture.height / 2),\n depthOrArrayLayers: arrayLayerCount\n },\n format: texture.format,\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,\n mipLevelCount: texture.mipLevelCount - 1\n };\n mipTexture = this.device.createTexture(mipTextureDescriptor);\n }\n const commandEncoder = this.device.createCommandEncoder({});\n const bindGroupLayout = pipeline.getBindGroupLayout(0);\n for (let arrayLayer = 0; arrayLayer < arrayLayerCount; ++arrayLayer) {\n let srcView = texture.createView({\n baseMipLevel: 0,\n mipLevelCount: 1,\n dimension: \"2d\",\n baseArrayLayer: arrayLayer,\n arrayLayerCount: 1\n });\n let dstMipLevel = renderToSource ? 1 : 0;\n for (let i = 1; i < texture.mipLevelCount; ++i) {\n const dstView = mipTexture.createView({\n baseMipLevel: dstMipLevel++,\n mipLevelCount: 1,\n dimension: \"2d\",\n baseArrayLayer: arrayLayer,\n arrayLayerCount: 1\n });\n const passEncoder = commandEncoder.beginRenderPass({\n colorAttachments: [{\n view: dstView,\n storeOp: \"store\",\n loadOp: \"clear\",\n clearValue: { r: 0, g: 0, b: 0, a: 0 }\n }]\n });\n const bindGroup = this.device.createBindGroup({\n layout: bindGroupLayout,\n entries: [{\n binding: 0,\n resource: this.sampler\n }, {\n binding: 1,\n resource: srcView\n }]\n });\n passEncoder.setPipeline(pipeline);\n passEncoder.setBindGroup(0, bindGroup);\n passEncoder.draw(3, 1, 0, 0);\n passEncoder.end();\n srcView = dstView;\n }\n }\n if (!renderToSource) {\n const mipLevelSize = {\n width: Math.ceil(texture.width / 2),\n height: Math.ceil(texture.height / 2),\n depthOrArrayLayers: arrayLayerCount\n };\n for (let i = 1; i < texture.mipLevelCount; ++i) {\n commandEncoder.copyTextureToTexture({\n texture: mipTexture,\n mipLevel: i - 1\n }, {\n texture,\n mipLevel: i\n }, mipLevelSize);\n mipLevelSize.width = Math.ceil(mipLevelSize.width / 2);\n mipLevelSize.height = Math.ceil(mipLevelSize.height / 2);\n }\n }\n this.device.queue.submit([commandEncoder.finish()]);\n if (!renderToSource) {\n mipTexture.destroy();\n }\n return texture;\n }\n}\n\nexport { GpuMipmapGenerator };\n//# sourceMappingURL=GpuMipmapGenerator.mjs.map\n","import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { ExtensionType } from '../../../../extensions/Extensions.mjs';\nimport { CanvasPool } from '../../shared/texture/CanvasPool.mjs';\nimport { BindGroup } from '../shader/BindGroup.mjs';\nimport { gpuUploadBufferImageResource } from './uploaders/gpuUploadBufferImageResource.mjs';\nimport { gpuUploadCompressedTextureResource, blockDataMap } from './uploaders/gpuUploadCompressedTextureResource.mjs';\nimport { gpuUploadImageResource } from './uploaders/gpuUploadImageSource.mjs';\nimport { gpuUploadVideoResource } from './uploaders/gpuUploadVideoSource.mjs';\nimport { GpuMipmapGenerator } from './utils/GpuMipmapGenerator.mjs';\n\n\"use strict\";\nclass GpuTextureSystem {\n constructor(renderer) {\n this.managedTextures = [];\n this._gpuSources = /* @__PURE__ */ Object.create(null);\n this._gpuSamplers = /* @__PURE__ */ Object.create(null);\n this._bindGroupHash = /* @__PURE__ */ Object.create(null);\n this._textureViewHash = /* @__PURE__ */ Object.create(null);\n this._uploads = {\n image: gpuUploadImageResource,\n buffer: gpuUploadBufferImageResource,\n video: gpuUploadVideoResource,\n compressed: gpuUploadCompressedTextureResource\n };\n this._renderer = renderer;\n }\n contextChange(gpu) {\n this._gpu = gpu;\n }\n initSource(source) {\n if (source.autoGenerateMipmaps) {\n const biggestDimension = Math.max(source.pixelWidth, source.pixelHeight);\n source.mipLevelCount = Math.floor(Math.log2(biggestDimension)) + 1;\n }\n let usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;\n if (source.uploadMethodId !== \"compressed\") {\n usage |= GPUTextureUsage.RENDER_ATTACHMENT;\n usage |= GPUTextureUsage.COPY_SRC;\n }\n const blockData = blockDataMap[source.format] || { blockBytes: 4, blockWidth: 1, blockHeight: 1 };\n const width = Math.ceil(source.pixelWidth / blockData.blockWidth) * blockData.blockWidth;\n const height = Math.ceil(source.pixelHeight / blockData.blockHeight) * blockData.blockHeight;\n const textureDescriptor = {\n label: source.label,\n size: { width, height },\n format: source.format,\n sampleCount: source.sampleCount,\n mipLevelCount: source.mipLevelCount,\n dimension: source.dimension,\n usage\n };\n const gpuTexture = this._gpu.device.createTexture(textureDescriptor);\n this._gpuSources[source.uid] = gpuTexture;\n if (!this.managedTextures.includes(source)) {\n source.on(\"update\", this.onSourceUpdate, this);\n source.on(\"resize\", this.onSourceResize, this);\n source.on(\"destroy\", this.onSourceDestroy, this);\n source.on(\"unload\", this.onSourceUnload, this);\n source.on(\"updateMipmaps\", this.onUpdateMipmaps, this);\n this.managedTextures.push(source);\n }\n this.onSourceUpdate(source);\n return gpuTexture;\n }\n onSourceUpdate(source) {\n const gpuTexture = this.getGpuSource(source);\n if (!gpuTexture)\n return;\n if (this._uploads[source.uploadMethodId]) {\n this._uploads[source.uploadMethodId].upload(source, gpuTexture, this._gpu);\n }\n if (source.autoGenerateMipmaps && source.mipLevelCount > 1) {\n this.onUpdateMipmaps(source);\n }\n }\n onSourceUnload(source) {\n const gpuTexture = this._gpuSources[source.uid];\n if (gpuTexture) {\n this._gpuSources[source.uid] = null;\n gpuTexture.destroy();\n }\n }\n onUpdateMipmaps(source) {\n if (!this._mipmapGenerator) {\n this._mipmapGenerator = new GpuMipmapGenerator(this._gpu.device);\n }\n const gpuTexture = this.getGpuSource(source);\n this._mipmapGenerator.generateMipmap(gpuTexture);\n }\n onSourceDestroy(source) {\n source.off(\"update\", this.onSourceUpdate, this);\n source.off(\"unload\", this.onSourceUnload, this);\n source.off(\"destroy\", this.onSourceDestroy, this);\n source.off(\"resize\", this.onSourceResize, this);\n source.off(\"updateMipmaps\", this.onUpdateMipmaps, this);\n this.managedTextures.splice(this.managedTextures.indexOf(source), 1);\n this.onSourceUnload(source);\n }\n onSourceResize(source) {\n const gpuTexture = this._gpuSources[source.uid];\n if (!gpuTexture) {\n this.initSource(source);\n } else if (gpuTexture.width !== source.pixelWidth || gpuTexture.height !== source.pixelHeight) {\n this._textureViewHash[source.uid] = null;\n this._bindGroupHash[source.uid] = null;\n this.onSourceUnload(source);\n this.initSource(source);\n }\n }\n _initSampler(sampler) {\n this._gpuSamplers[sampler._resourceId] = this._gpu.device.createSampler(sampler);\n return this._gpuSamplers[sampler._resourceId];\n }\n getGpuSampler(sampler) {\n return this._gpuSamplers[sampler._resourceId] || this._initSampler(sampler);\n }\n getGpuSource(source) {\n return this._gpuSources[source.uid] || this.initSource(source);\n }\n getTextureBindGroup(texture) {\n return this._bindGroupHash[texture.uid] ?? this._createTextureBindGroup(texture);\n }\n _createTextureBindGroup(texture) {\n const source = texture.source;\n const bindGroupId = source.uid;\n this._bindGroupHash[bindGroupId] = new BindGroup({\n 0: source,\n 1: source.style\n });\n return this._bindGroupHash[bindGroupId];\n }\n getTextureView(texture) {\n const source = texture.source;\n return this._textureViewHash[source.uid] ?? this._createTextureView(source);\n }\n _createTextureView(texture) {\n this._textureViewHash[texture.uid] = this.getGpuSource(texture).createView();\n return this._textureViewHash[texture.uid];\n }\n generateCanvas(texture) {\n const renderer = this._renderer;\n const commandEncoder = renderer.gpu.device.createCommandEncoder();\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = texture.source.pixelWidth;\n canvas.height = texture.source.pixelHeight;\n const context = canvas.getContext(\"webgpu\");\n context.configure({\n device: renderer.gpu.device,\n // eslint-disable-next-line max-len\n usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,\n format: navigator.gpu.getPreferredCanvasFormat(),\n alphaMode: \"premultiplied\"\n });\n commandEncoder.copyTextureToTexture({\n texture: renderer.texture.getGpuSource(texture.source),\n origin: {\n x: 0,\n y: 0\n }\n }, {\n texture: context.getCurrentTexture()\n }, {\n width: canvas.width,\n height: canvas.height\n });\n renderer.gpu.device.queue.submit([commandEncoder.finish()]);\n return canvas;\n }\n getPixels(texture) {\n const webGPUCanvas = this.generateCanvas(texture);\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(webGPUCanvas.width, webGPUCanvas.height);\n const context = canvasAndContext.context;\n context.drawImage(webGPUCanvas, 0, 0);\n const { width, height } = webGPUCanvas;\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = new Uint8ClampedArray(imageData.data.buffer);\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n return { pixels, width, height };\n }\n destroy() {\n this.managedTextures.slice().forEach((source) => this.onSourceDestroy(source));\n this.managedTextures = null;\n for (const k of Object.keys(this._bindGroupHash)) {\n const key = Number(k);\n const bindGroup = this._bindGroupHash[key];\n bindGroup?.destroy();\n this._bindGroupHash[key] = null;\n }\n this._gpu = null;\n this._mipmapGenerator = null;\n this._gpuSources = null;\n this._bindGroupHash = null;\n this._textureViewHash = null;\n this._gpuSamplers = null;\n }\n}\n/** @ignore */\nGpuTextureSystem.extension = {\n type: [\n ExtensionType.WebGPUSystem\n ],\n name: \"texture\"\n};\n\nexport { GpuTextureSystem };\n//# sourceMappingURL=GpuTextureSystem.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { getMaxTexturesPerBatch } from '../../../rendering/batcher/gl/utils/maxRecommendedTextures.mjs';\nimport { getTextureBatchBindGroup } from '../../../rendering/batcher/gpu/getTextureBatchBindGroup.mjs';\nimport { compileHighShaderGpuProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { colorBit } from '../../../rendering/high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBit } from '../../../rendering/high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { localUniformBitGroup2 } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBit } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';\n\n\"use strict\";\nclass GpuGraphicsAdaptor {\n init() {\n const localUniforms = new UniformGroup({\n uTransformMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uColor: { value: new Float32Array([1, 1, 1, 1]), type: \"vec4\" },\n uRound: { value: 0, type: \"f32\" }\n });\n const gpuProgram = compileHighShaderGpuProgram({\n name: \"graphics\",\n bits: [\n colorBit,\n generateTextureBatchBit(getMaxTexturesPerBatch()),\n localUniformBitGroup2,\n roundPixelsBit\n ]\n });\n this.shader = new Shader({\n gpuProgram,\n resources: {\n // added on the fly!\n localUniforms\n }\n });\n }\n execute(graphicsPipe, renderable) {\n const context = renderable.context;\n const shader = context.customShader || this.shader;\n const renderer = graphicsPipe.renderer;\n const contextSystem = renderer.graphicsContext;\n const {\n geometry,\n instructions\n } = contextSystem.getContextRenderData(context);\n const encoder = renderer.encoder;\n encoder.setPipelineFromGeometryProgramAndState(\n geometry,\n shader.gpuProgram,\n graphicsPipe.state\n );\n encoder.setGeometry(geometry);\n const globalUniformsBindGroup = renderer.globalUniforms.bindGroup;\n encoder.setBindGroup(0, globalUniformsBindGroup, shader.gpuProgram);\n const localBindGroup = renderer.renderPipes.uniformBatch.getUniformBindGroup(shader.resources.localUniforms, true);\n encoder.setBindGroup(2, localBindGroup, shader.gpuProgram);\n const batches = instructions.instructions;\n for (let i = 0; i < instructions.instructionSize; i++) {\n const batch = batches[i];\n shader.groups[1] = batch.bindGroup;\n if (!batch.gpuBindGroup) {\n const textureBatch = batch.textures;\n batch.bindGroup = getTextureBatchBindGroup(textureBatch.textures, textureBatch.count);\n batch.gpuBindGroup = renderer.bindGroup.getBindGroup(\n batch.bindGroup,\n shader.gpuProgram,\n 1\n );\n }\n encoder.setBindGroup(1, batch.bindGroup, shader.gpuProgram);\n encoder.renderPassEncoder.drawIndexed(batch.size, 1, batch.start);\n }\n }\n destroy() {\n this.shader.destroy(true);\n this.shader = null;\n }\n}\n/** @ignore */\nGpuGraphicsAdaptor.extension = {\n type: [\n ExtensionType.WebGPUPipesAdaptor\n ],\n name: \"graphics\"\n};\n\nexport { GpuGraphicsAdaptor };\n//# sourceMappingURL=GpuGraphicsAdaptor.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { compileHighShaderGpuProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { localUniformBit } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBit } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { textureBit } from '../../../rendering/high-shader/shader-bits/textureBit.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { warn } from '../../../utils/logging/warn.mjs';\n\n\"use strict\";\nclass GpuMeshAdapter {\n init() {\n const gpuProgram = compileHighShaderGpuProgram({\n name: \"mesh\",\n bits: [\n localUniformBit,\n textureBit,\n roundPixelsBit\n ]\n });\n this._shader = new Shader({\n gpuProgram,\n resources: {\n uTexture: Texture.EMPTY._source,\n uSampler: Texture.EMPTY._source.style,\n textureUniforms: {\n uTextureMatrix: { type: \"mat3x3\", value: new Matrix() }\n }\n }\n });\n }\n execute(meshPipe, mesh) {\n const renderer = meshPipe.renderer;\n let shader = mesh._shader;\n if (!shader) {\n shader = this._shader;\n shader.resources.uTexture = mesh.texture.source;\n shader.resources.uSampler = mesh.texture.source.style;\n shader.resources.textureUniforms.uniforms.uTextureMatrix = mesh.texture.textureMatrix.mapCoord;\n } else if (!shader.gpuProgram) {\n warn(\"Mesh shader has no gpuProgram\", mesh.shader);\n return;\n }\n const gpuProgram = shader.gpuProgram;\n if (gpuProgram.autoAssignGlobalUniforms) {\n shader.groups[0] = renderer.globalUniforms.bindGroup;\n }\n if (gpuProgram.autoAssignLocalUniforms) {\n const localUniforms = meshPipe.localUniforms;\n shader.groups[1] = renderer.renderPipes.uniformBatch.getUniformBindGroup(localUniforms, true);\n }\n renderer.encoder.draw({\n geometry: mesh._geometry,\n shader,\n state: mesh.state\n });\n }\n destroy() {\n this._shader.destroy(true);\n this._shader = null;\n }\n}\n/** @ignore */\nGpuMeshAdapter.extension = {\n type: [\n ExtensionType.WebGPUPipesAdaptor\n ],\n name: \"mesh\"\n};\n\nexport { GpuMeshAdapter };\n//# sourceMappingURL=GpuMeshAdapter.mjs.map\n","import { extensions, ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { GpuGraphicsAdaptor } from '../../../scene/graphics/gpu/GpuGraphicsAdaptor.mjs';\nimport { GpuMeshAdapter } from '../../../scene/mesh/gpu/GpuMeshAdapter.mjs';\nimport { GpuBatchAdaptor } from '../../batcher/gpu/GpuBatchAdaptor.mjs';\nimport { AbstractRenderer } from '../shared/system/AbstractRenderer.mjs';\nimport { SharedSystems, SharedRenderPipes } from '../shared/system/SharedSystems.mjs';\nimport { RendererType } from '../types.mjs';\nimport { BindGroupSystem } from './BindGroupSystem.mjs';\nimport { GpuBufferSystem } from './buffer/GpuBufferSystem.mjs';\nimport { GpuColorMaskSystem } from './GpuColorMaskSystem.mjs';\nimport { GpuDeviceSystem } from './GpuDeviceSystem.mjs';\nimport { GpuEncoderSystem } from './GpuEncoderSystem.mjs';\nimport { GpuStencilSystem } from './GpuStencilSystem.mjs';\nimport { GpuUboSystem } from './GpuUboSystem.mjs';\nimport { GpuUniformBatchPipe } from './GpuUniformBatchPipe.mjs';\nimport { PipelineSystem } from './pipeline/PipelineSystem.mjs';\nimport { GpuRenderTargetSystem } from './renderTarget/GpuRenderTargetSystem.mjs';\nimport { GpuShaderSystem } from './shader/GpuShaderSystem.mjs';\nimport { GpuStateSystem } from './state/GpuStateSystem.mjs';\nimport { GpuTextureSystem } from './texture/GpuTextureSystem.mjs';\n\n\"use strict\";\nconst DefaultWebGPUSystems = [\n ...SharedSystems,\n GpuUboSystem,\n GpuEncoderSystem,\n GpuDeviceSystem,\n GpuBufferSystem,\n GpuTextureSystem,\n GpuRenderTargetSystem,\n GpuShaderSystem,\n GpuStateSystem,\n PipelineSystem,\n GpuColorMaskSystem,\n GpuStencilSystem,\n BindGroupSystem\n];\nconst DefaultWebGPUPipes = [...SharedRenderPipes, GpuUniformBatchPipe];\nconst DefaultWebGPUAdapters = [GpuBatchAdaptor, GpuMeshAdapter, GpuGraphicsAdaptor];\nconst systems = [];\nconst renderPipes = [];\nconst renderPipeAdaptors = [];\nextensions.handleByNamedList(ExtensionType.WebGPUSystem, systems);\nextensions.handleByNamedList(ExtensionType.WebGPUPipes, renderPipes);\nextensions.handleByNamedList(ExtensionType.WebGPUPipesAdaptor, renderPipeAdaptors);\nextensions.add(...DefaultWebGPUSystems, ...DefaultWebGPUPipes, ...DefaultWebGPUAdapters);\nclass WebGPURenderer extends AbstractRenderer {\n constructor() {\n const systemConfig = {\n name: \"webgpu\",\n type: RendererType.WEBGPU,\n systems,\n renderPipes,\n renderPipeAdaptors\n };\n super(systemConfig);\n }\n}\n\nexport { WebGPURenderer };\n//# sourceMappingURL=WebGPURenderer.mjs.map\n","import { deprecation, v8_0_0 } from '../../../../utils/logging/deprecation.mjs';\n\n\"use strict\";\nvar MSAA_QUALITY = /* @__PURE__ */ ((MSAA_QUALITY2) => {\n MSAA_QUALITY2[MSAA_QUALITY2[\"NONE\"] = 0] = \"NONE\";\n MSAA_QUALITY2[MSAA_QUALITY2[\"LOW\"] = 2] = \"LOW\";\n MSAA_QUALITY2[MSAA_QUALITY2[\"MEDIUM\"] = 4] = \"MEDIUM\";\n MSAA_QUALITY2[MSAA_QUALITY2[\"HIGH\"] = 8] = \"HIGH\";\n return MSAA_QUALITY2;\n})(MSAA_QUALITY || {});\nvar DEPRECATED_WRAP_MODES = /* @__PURE__ */ ((DEPRECATED_WRAP_MODES2) => {\n DEPRECATED_WRAP_MODES2[\"CLAMP\"] = \"clamp-to-edge\";\n DEPRECATED_WRAP_MODES2[\"REPEAT\"] = \"repeat\";\n DEPRECATED_WRAP_MODES2[\"MIRRORED_REPEAT\"] = \"mirror-repeat\";\n return DEPRECATED_WRAP_MODES2;\n})(DEPRECATED_WRAP_MODES || {});\nconst WRAP_MODES = new Proxy(DEPRECATED_WRAP_MODES, {\n get(target, prop) {\n deprecation(v8_0_0, `DRAW_MODES.${prop} is deprecated, use '${DEPRECATED_WRAP_MODES[prop]}' instead`);\n return target[prop];\n }\n});\nvar DEPRECATED_SCALE_MODES = /* @__PURE__ */ ((DEPRECATED_SCALE_MODES2) => {\n DEPRECATED_SCALE_MODES2[\"NEAREST\"] = \"nearest\";\n DEPRECATED_SCALE_MODES2[\"LINEAR\"] = \"linear\";\n return DEPRECATED_SCALE_MODES2;\n})(DEPRECATED_SCALE_MODES || {});\nconst SCALE_MODES = new Proxy(DEPRECATED_SCALE_MODES, {\n get(target, prop) {\n deprecation(v8_0_0, `DRAW_MODES.${prop} is deprecated, use '${DEPRECATED_SCALE_MODES[prop]}' instead`);\n return target[prop];\n }\n});\n\nexport { DEPRECATED_SCALE_MODES, DEPRECATED_WRAP_MODES, MSAA_QUALITY, SCALE_MODES, WRAP_MODES };\n//# sourceMappingURL=const.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { State } from '../../../rendering/renderers/shared/state/State.mjs';\nimport { BigPool } from '../../../utils/pool/PoolGroup.mjs';\nimport { color32BitToUniform } from '../gpu/colorToUniform.mjs';\nimport { BatchableGraphics } from './BatchableGraphics.mjs';\n\n\"use strict\";\nclass GraphicsPipe {\n constructor(renderer, adaptor) {\n this.state = State.for2d();\n // batchable graphics list, used to render batches\n this._graphicsBatchesHash = /* @__PURE__ */ Object.create(null);\n this.renderer = renderer;\n this._adaptor = adaptor;\n this._adaptor.init();\n }\n validateRenderable(graphics) {\n const context = graphics.context;\n const wasBatched = !!this._graphicsBatchesHash[graphics.uid];\n const gpuContext = this.renderer.graphicsContext.updateGpuContext(context);\n if (gpuContext.isBatchable || wasBatched !== gpuContext.isBatchable) {\n return true;\n }\n return false;\n }\n addRenderable(graphics, instructionSet) {\n const gpuContext = this.renderer.graphicsContext.updateGpuContext(graphics.context);\n if (graphics._didGraphicsUpdate) {\n graphics._didGraphicsUpdate = false;\n this._rebuild(graphics);\n }\n if (gpuContext.isBatchable) {\n this._addToBatcher(graphics);\n } else {\n this.renderer.renderPipes.batch.break(instructionSet);\n instructionSet.add(graphics);\n }\n }\n updateRenderable(graphics) {\n const batches = this._graphicsBatchesHash[graphics.uid];\n if (batches) {\n for (let i = 0; i < batches.length; i++) {\n const batch = batches[i];\n batch.batcher.updateElement(batch);\n }\n }\n }\n destroyRenderable(graphics) {\n if (this._graphicsBatchesHash[graphics.uid]) {\n this._removeBatchForRenderable(graphics.uid);\n }\n }\n execute(graphics) {\n if (!graphics.isRenderable)\n return;\n const renderer = this.renderer;\n const context = graphics.context;\n const contextSystem = renderer.graphicsContext;\n if (!contextSystem.getGpuContext(context).batches.length) {\n return;\n }\n const shader = context.customShader || this._adaptor.shader;\n this.state.blendMode = graphics.groupBlendMode;\n const localUniforms = shader.resources.localUniforms.uniforms;\n localUniforms.uTransformMatrix = graphics.groupTransform;\n localUniforms.uRound = renderer._roundPixels | graphics._roundPixels;\n color32BitToUniform(\n graphics.groupColorAlpha,\n localUniforms.uColor,\n 0\n );\n this._adaptor.execute(this, graphics);\n }\n _rebuild(graphics) {\n const wasBatched = !!this._graphicsBatchesHash[graphics.uid];\n const gpuContext = this.renderer.graphicsContext.updateGpuContext(graphics.context);\n if (wasBatched) {\n this._removeBatchForRenderable(graphics.uid);\n }\n if (gpuContext.isBatchable) {\n this._initBatchesForRenderable(graphics);\n }\n graphics.batched = gpuContext.isBatchable;\n }\n _addToBatcher(graphics) {\n const batchPipe = this.renderer.renderPipes.batch;\n const batches = this._getBatchesForRenderable(graphics);\n for (let i = 0; i < batches.length; i++) {\n const batch = batches[i];\n batchPipe.addToBatch(batch);\n }\n }\n _getBatchesForRenderable(graphics) {\n return this._graphicsBatchesHash[graphics.uid] || this._initBatchesForRenderable(graphics);\n }\n _initBatchesForRenderable(graphics) {\n const context = graphics.context;\n const gpuContext = this.renderer.graphicsContext.getGpuContext(context);\n const roundPixels = this.renderer._roundPixels | graphics._roundPixels;\n const batches = gpuContext.batches.map((batch) => {\n const batchClone = BigPool.get(BatchableGraphics);\n batch.copyTo(batchClone);\n batchClone.renderable = graphics;\n batchClone.roundPixels = roundPixels;\n return batchClone;\n });\n if (this._graphicsBatchesHash[graphics.uid] === void 0) {\n graphics.on(\"destroyed\", () => {\n this.destroyRenderable(graphics);\n });\n }\n this._graphicsBatchesHash[graphics.uid] = batches;\n return batches;\n }\n _removeBatchForRenderable(graphicsUid) {\n this._graphicsBatchesHash[graphicsUid].forEach((batch) => {\n BigPool.return(batch);\n });\n this._graphicsBatchesHash[graphicsUid] = null;\n }\n destroy() {\n this.renderer = null;\n this._adaptor.destroy();\n this._adaptor = null;\n this.state = null;\n for (const i in this._graphicsBatchesHash) {\n this._removeBatchForRenderable(i);\n }\n this._graphicsBatchesHash = null;\n }\n}\n/** @ignore */\nGraphicsPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"graphics\"\n};\n\nexport { GraphicsPipe };\n//# sourceMappingURL=GraphicsPipe.mjs.map\n","import { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';\nimport { MeshGeometry } from '../mesh/shared/MeshGeometry.mjs';\n\n\"use strict\";\nconst _PlaneGeometry = class _PlaneGeometry extends MeshGeometry {\n constructor(...args) {\n super({});\n let options = args[0] ?? {};\n if (typeof options === \"number\") {\n deprecation(v8_0_0, \"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead\");\n options = {\n width: options,\n height: args[1],\n verticesX: args[2],\n verticesY: args[3]\n };\n }\n this.build(options);\n }\n /**\n * Refreshes plane coordinates\n * @param options - Options to be applied to plane geometry\n */\n build(options) {\n options = { ..._PlaneGeometry.defaultOptions, ...options };\n this.verticesX = this.verticesX ?? options.verticesX;\n this.verticesY = this.verticesY ?? options.verticesY;\n this.width = this.width ?? options.width;\n this.height = this.height ?? options.height;\n const total = this.verticesX * this.verticesY;\n const verts = [];\n const uvs = [];\n const indices = [];\n const verticesX = this.verticesX - 1;\n const verticesY = this.verticesY - 1;\n const sizeX = this.width / verticesX;\n const sizeY = this.height / verticesY;\n for (let i = 0; i < total; i++) {\n const x = i % this.verticesX;\n const y = i / this.verticesX | 0;\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / verticesX, y / verticesY);\n }\n const totalSub = verticesX * verticesY;\n for (let i = 0; i < totalSub; i++) {\n const xpos = i % verticesX;\n const ypos = i / verticesX | 0;\n const value = ypos * this.verticesX + xpos;\n const value2 = ypos * this.verticesX + xpos + 1;\n const value3 = (ypos + 1) * this.verticesX + xpos;\n const value4 = (ypos + 1) * this.verticesX + xpos + 1;\n indices.push(\n value,\n value2,\n value3,\n value2,\n value4,\n value3\n );\n }\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint32Array(indices);\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n }\n};\n_PlaneGeometry.defaultOptions = {\n width: 100,\n height: 100,\n verticesX: 10,\n verticesY: 10\n};\nlet PlaneGeometry = _PlaneGeometry;\n\nexport { PlaneGeometry };\n//# sourceMappingURL=PlaneGeometry.mjs.map\n","\"use strict\";\nclass BatchableMesh {\n constructor() {\n this.batcher = null;\n this.batch = null;\n this.roundPixels = 0;\n this._uvUpdateId = -1;\n this._textureMatrixUpdateId = -1;\n }\n get blendMode() {\n return this.mesh.groupBlendMode;\n }\n reset() {\n this.mesh = null;\n this.texture = null;\n this.batcher = null;\n this.batch = null;\n }\n packIndex(indexBuffer, index, indicesOffset) {\n const indices = this.geometry.indices;\n for (let i = 0; i < indices.length; i++) {\n indexBuffer[index++] = indices[i] + indicesOffset;\n }\n }\n packAttributes(float32View, uint32View, index, textureId) {\n const mesh = this.mesh;\n const geometry = this.geometry;\n const wt = mesh.groupTransform;\n const textureIdAndRound = textureId << 16 | this.roundPixels & 65535;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const positions = geometry.positions;\n const uvBuffer = geometry.getBuffer(\"aUV\");\n const uvs = uvBuffer.data;\n let transformedUvs = uvs;\n const textureMatrix = this.texture.textureMatrix;\n if (!textureMatrix.isSimple) {\n transformedUvs = this._transformedUvs;\n if (this._textureMatrixUpdateId !== textureMatrix._updateID || this._uvUpdateId !== uvBuffer._updateID) {\n if (!transformedUvs || transformedUvs.length < uvs.length) {\n transformedUvs = this._transformedUvs = new Float32Array(uvs.length);\n }\n this._textureMatrixUpdateId = textureMatrix._updateID;\n this._uvUpdateId = uvBuffer._updateID;\n textureMatrix.multiplyUvs(uvs, transformedUvs);\n }\n }\n const abgr = mesh.groupColorAlpha;\n for (let i = 0; i < positions.length; i += 2) {\n const x = positions[i];\n const y = positions[i + 1];\n float32View[index] = a * x + c * y + tx;\n float32View[index + 1] = b * x + d * y + ty;\n float32View[index + 2] = transformedUvs[i];\n float32View[index + 3] = transformedUvs[i + 1];\n uint32View[index + 4] = abgr;\n uint32View[index + 5] = textureIdAndRound;\n index += 6;\n }\n }\n get vertexSize() {\n return this.geometry.positions.length / 2;\n }\n get indexSize() {\n return this.geometry.indices.length;\n }\n}\n\nexport { BatchableMesh };\n//# sourceMappingURL=BatchableMesh.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { BindGroup } from '../../../rendering/renderers/gpu/shader/BindGroup.mjs';\nimport { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';\nimport { getAdjustedBlendModeBlend } from '../../../rendering/renderers/shared/state/getAdjustedBlendModeBlend.mjs';\nimport { BigPool } from '../../../utils/pool/PoolGroup.mjs';\nimport { color32BitToUniform } from '../../graphics/gpu/colorToUniform.mjs';\nimport { BatchableMesh } from './BatchableMesh.mjs';\n\n\"use strict\";\nclass MeshPipe {\n constructor(renderer, adaptor) {\n this.localUniforms = new UniformGroup({\n uTransformMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uColor: { value: new Float32Array([1, 1, 1, 1]), type: \"vec4\" },\n uRound: { value: 0, type: \"f32\" }\n });\n this.localUniformsBindGroup = new BindGroup({\n 0: this.localUniforms\n });\n this._meshDataHash = /* @__PURE__ */ Object.create(null);\n this._gpuBatchableMeshHash = /* @__PURE__ */ Object.create(null);\n this.renderer = renderer;\n this._adaptor = adaptor;\n this._adaptor.init();\n }\n validateRenderable(mesh) {\n const meshData = this._getMeshData(mesh);\n const wasBatched = meshData.batched;\n const isBatched = mesh.batched;\n meshData.batched = isBatched;\n if (wasBatched !== isBatched) {\n return true;\n } else if (isBatched) {\n const geometry = mesh._geometry;\n if (geometry.indices.length !== meshData.indexSize || geometry.positions.length !== meshData.vertexSize) {\n meshData.indexSize = geometry.indices.length;\n meshData.vertexSize = geometry.positions.length;\n return true;\n }\n const batchableMesh = this._getBatchableMesh(mesh);\n const texture = mesh.texture;\n if (batchableMesh.texture._source !== texture._source) {\n if (batchableMesh.texture._source !== texture._source) {\n return !batchableMesh.batcher.checkAndUpdateTexture(batchableMesh, texture);\n }\n }\n }\n return false;\n }\n addRenderable(mesh, instructionSet) {\n const batcher = this.renderer.renderPipes.batch;\n const { batched } = this._getMeshData(mesh);\n if (batched) {\n const gpuBatchableMesh = this._getBatchableMesh(mesh);\n gpuBatchableMesh.texture = mesh._texture;\n gpuBatchableMesh.geometry = mesh._geometry;\n batcher.addToBatch(gpuBatchableMesh);\n } else {\n batcher.break(instructionSet);\n instructionSet.add(mesh);\n }\n }\n updateRenderable(mesh) {\n if (mesh.batched) {\n const gpuBatchableMesh = this._gpuBatchableMeshHash[mesh.uid];\n gpuBatchableMesh.texture = mesh._texture;\n gpuBatchableMesh.geometry = mesh._geometry;\n gpuBatchableMesh.batcher.updateElement(gpuBatchableMesh);\n }\n }\n destroyRenderable(mesh) {\n this._meshDataHash[mesh.uid] = null;\n const gpuMesh = this._gpuBatchableMeshHash[mesh.uid];\n if (gpuMesh) {\n BigPool.return(gpuMesh);\n this._gpuBatchableMeshHash[mesh.uid] = null;\n }\n }\n execute(mesh) {\n if (!mesh.isRenderable)\n return;\n mesh.state.blendMode = getAdjustedBlendModeBlend(mesh.groupBlendMode, mesh.texture._source);\n const localUniforms = this.localUniforms;\n localUniforms.uniforms.uTransformMatrix = mesh.groupTransform;\n localUniforms.uniforms.uRound = this.renderer._roundPixels | mesh._roundPixels;\n localUniforms.update();\n color32BitToUniform(\n mesh.groupColorAlpha,\n localUniforms.uniforms.uColor,\n 0\n );\n this._adaptor.execute(this, mesh);\n }\n _getMeshData(mesh) {\n return this._meshDataHash[mesh.uid] || this._initMeshData(mesh);\n }\n _initMeshData(mesh) {\n this._meshDataHash[mesh.uid] = {\n batched: mesh.batched,\n indexSize: mesh._geometry.indices?.length,\n vertexSize: mesh._geometry.positions?.length\n };\n mesh.on(\"destroyed\", () => {\n this.destroyRenderable(mesh);\n });\n return this._meshDataHash[mesh.uid];\n }\n _getBatchableMesh(mesh) {\n return this._gpuBatchableMeshHash[mesh.uid] || this._initBatchableMesh(mesh);\n }\n _initBatchableMesh(mesh) {\n const gpuMesh = BigPool.get(BatchableMesh);\n gpuMesh.mesh = mesh;\n gpuMesh.texture = mesh._texture;\n gpuMesh.roundPixels = this.renderer._roundPixels | mesh._roundPixels;\n this._gpuBatchableMeshHash[mesh.uid] = gpuMesh;\n gpuMesh.mesh = mesh;\n return gpuMesh;\n }\n destroy() {\n for (const i in this._gpuBatchableMeshHash) {\n if (this._gpuBatchableMeshHash[i]) {\n BigPool.return(this._gpuBatchableMeshHash[i]);\n }\n }\n this._gpuBatchableMeshHash = null;\n this._meshDataHash = null;\n this.localUniforms = null;\n this.localUniformsBindGroup = null;\n this._adaptor.destroy();\n this._adaptor = null;\n this.renderer = null;\n }\n}\n/** @ignore */\nMeshPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"mesh\"\n};\n\nexport { MeshPipe };\n//# sourceMappingURL=MeshPipe.mjs.map\n","import { PlaneGeometry } from '../mesh-plane/PlaneGeometry.mjs';\n\n\"use strict\";\nconst _NineSliceGeometry = class _NineSliceGeometry extends PlaneGeometry {\n constructor(options = {}) {\n options = { ..._NineSliceGeometry.defaultOptions, ...options };\n super({\n width: options.width,\n height: options.height,\n verticesX: 4,\n verticesY: 4\n });\n this.update(options);\n }\n /**\n * Updates the NineSliceGeometry with the options.\n * @param options - The options of the NineSliceGeometry.\n */\n update(options) {\n this.width = options.width ?? this.width;\n this.height = options.height ?? this.height;\n this._originalWidth = options.originalWidth ?? this._originalWidth;\n this._originalHeight = options.originalHeight ?? this._originalHeight;\n this._leftWidth = options.leftWidth ?? this._leftWidth;\n this._rightWidth = options.rightWidth ?? this._rightWidth;\n this._topHeight = options.topHeight ?? this._topHeight;\n this._bottomHeight = options.bottomHeight ?? this._bottomHeight;\n this.updateUvs();\n this.updatePositions();\n }\n /** Updates the positions of the vertices. */\n updatePositions() {\n const positions = this.positions;\n const w = this._leftWidth + this._rightWidth;\n const scaleW = this.width > w ? 1 : this.width / w;\n const h = this._topHeight + this._bottomHeight;\n const scaleH = this.height > h ? 1 : this.height / h;\n const scale = Math.min(scaleW, scaleH);\n positions[9] = positions[11] = positions[13] = positions[15] = this._topHeight * scale;\n positions[17] = positions[19] = positions[21] = positions[23] = this.height - this._bottomHeight * scale;\n positions[25] = positions[27] = positions[29] = positions[31] = this.height;\n positions[2] = positions[10] = positions[18] = positions[26] = this._leftWidth * scale;\n positions[4] = positions[12] = positions[20] = positions[28] = this.width - this._rightWidth * scale;\n positions[6] = positions[14] = positions[22] = positions[30] = this.width;\n this.getBuffer(\"aPosition\").update();\n }\n /** Updates the UVs of the vertices. */\n updateUvs() {\n const uvs = this.uvs;\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n const _uvw = 1 / this._originalWidth;\n const _uvh = 1 / this._originalHeight;\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - _uvw * this._rightWidth;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - _uvh * this._bottomHeight;\n this.getBuffer(\"aUV\").update();\n }\n};\n/** The default options for the NineSliceGeometry. */\n_NineSliceGeometry.defaultOptions = {\n /** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */\n width: 100,\n /** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */\n height: 100,\n /** The width of the left column. */\n leftWidth: 10,\n /** The height of the top row. */\n topHeight: 10,\n /** The width of the right column. */\n rightWidth: 10,\n /** The height of the bottom row. */\n bottomHeight: 10,\n /** The original width of the texture */\n originalWidth: 100,\n /** The original height of the texture */\n originalHeight: 100\n};\nlet NineSliceGeometry = _NineSliceGeometry;\n\nexport { NineSliceGeometry };\n//# sourceMappingURL=NineSliceGeometry.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\nimport { BatchableMesh } from '../mesh/shared/BatchableMesh.mjs';\nimport { NineSliceGeometry } from './NineSliceGeometry.mjs';\n\n\"use strict\";\nclass NineSliceSpritePipe {\n constructor(renderer) {\n this._gpuSpriteHash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n addRenderable(sprite, _instructionSet) {\n const gpuSprite = this._getGpuSprite(sprite);\n if (sprite._didSpriteUpdate)\n this._updateBatchableSprite(sprite, gpuSprite);\n this._renderer.renderPipes.batch.addToBatch(gpuSprite);\n }\n updateRenderable(sprite) {\n const gpuSprite = this._gpuSpriteHash[sprite.uid];\n if (sprite._didSpriteUpdate)\n this._updateBatchableSprite(sprite, gpuSprite);\n gpuSprite.batcher.updateElement(gpuSprite);\n }\n validateRenderable(sprite) {\n const texture = sprite._texture;\n const gpuSprite = this._getGpuSprite(sprite);\n if (gpuSprite.texture._source !== texture._source) {\n return !gpuSprite.batcher.checkAndUpdateTexture(gpuSprite, texture);\n }\n return false;\n }\n destroyRenderable(sprite) {\n const batchableSprite = this._gpuSpriteHash[sprite.uid];\n BigPool.return(batchableSprite);\n this._gpuSpriteHash[sprite.uid] = null;\n }\n _updateBatchableSprite(sprite, batchableSprite) {\n sprite._didSpriteUpdate = false;\n batchableSprite.geometry.update(sprite);\n batchableSprite.texture = sprite._texture;\n }\n _getGpuSprite(sprite) {\n return this._gpuSpriteHash[sprite.uid] || this._initGPUSprite(sprite);\n }\n _initGPUSprite(sprite) {\n const batchableMesh = new BatchableMesh();\n batchableMesh.geometry = new NineSliceGeometry();\n batchableMesh.mesh = sprite;\n batchableMesh.texture = sprite._texture;\n batchableMesh.roundPixels = this._renderer._roundPixels | sprite._roundPixels;\n this._gpuSpriteHash[sprite.uid] = batchableMesh;\n sprite.on(\"destroyed\", () => {\n this.destroyRenderable(sprite);\n });\n return batchableMesh;\n }\n destroy() {\n for (const i in this._gpuSpriteHash) {\n const batchableMesh = this._gpuSpriteHash[i];\n batchableMesh.geometry.destroy();\n }\n this._gpuSpriteHash = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nNineSliceSpritePipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"nineSliceSprite\"\n};\n\nexport { NineSliceSpritePipe };\n//# sourceMappingURL=NineSliceSpritePipe.mjs.map\n","\"use strict\";\nconst tilingBit = {\n name: \"tiling-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n struct TilingUniforms {\n uMapCoord:mat3x3,\n uClampFrame:vec4,\n uClampOffset:vec2,\n uTextureTransform:mat3x3,\n uSizeAnchor:vec4\n };\n\n @group(2) @binding(0) var tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d;\n @group(2) @binding(2) var uSampler: sampler;\n `\n ),\n main: (\n /* wgsl */\n `\n uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;\n\n position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;\n `\n )\n },\n fragment: {\n header: (\n /* wgsl */\n `\n struct TilingUniforms {\n uMapCoord:mat3x3,\n uClampFrame:vec4,\n uClampOffset:vec2,\n uTextureTransform:mat3x3,\n uSizeAnchor:vec4\n };\n\n @group(2) @binding(0) var tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d;\n @group(2) @binding(2) var uSampler: sampler;\n `\n ),\n main: (\n /* wgsl */\n `\n\n var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);\n coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;\n var unclamped = coord;\n coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);\n\n var bias = 0.;\n\n if(unclamped.x == coord.x && unclamped.y == coord.y)\n {\n bias = -32.;\n } \n\n outColor = textureSampleBias(uTexture, uSampler, coord, bias);\n `\n )\n }\n};\nconst tilingBitGl = {\n name: \"tiling-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n uniform mat3 uTextureTransform;\n uniform vec4 uSizeAnchor;\n \n `\n ),\n main: (\n /* glsl */\n `\n uv = (uTextureTransform * vec3(aUV, 1.0)).xy;\n\n position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;\n `\n )\n },\n fragment: {\n header: (\n /* glsl */\n `\n uniform sampler2D uTexture;\n uniform mat3 uMapCoord;\n uniform vec4 uClampFrame;\n uniform vec2 uClampOffset;\n `\n ),\n main: (\n /* glsl */\n `\n\n vec2 coord = vUV + ceil(uClampOffset - vUV);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n \n outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0\n \n `\n )\n }\n};\n\nexport { tilingBit, tilingBitGl };\n//# sourceMappingURL=tilingBit.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { compileHighShaderGpuProgram, compileHighShaderGlProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { localUniformBit, localUniformBitGl } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';\nimport { roundPixelsBit, roundPixelsBitGl } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';\nimport { tilingBit, tilingBitGl } from './tilingBit.mjs';\n\n\"use strict\";\nlet gpuProgram;\nlet glProgram;\nclass TilingSpriteShader extends Shader {\n constructor() {\n gpuProgram ?? (gpuProgram = compileHighShaderGpuProgram({\n name: \"tiling-sprite-shader\",\n bits: [\n localUniformBit,\n tilingBit,\n roundPixelsBit\n ]\n }));\n glProgram ?? (glProgram = compileHighShaderGlProgram({\n name: \"tiling-sprite-shader\",\n bits: [\n localUniformBitGl,\n tilingBitGl,\n roundPixelsBitGl\n ]\n }));\n const tilingUniforms = new UniformGroup({\n uMapCoord: { value: new Matrix(), type: \"mat3x3\" },\n uClampFrame: { value: new Float32Array([0, 0, 1, 1]), type: \"vec4\" },\n uClampOffset: { value: new Float32Array([0, 0]), type: \"vec2\" },\n uTextureTransform: { value: new Matrix(), type: \"mat3x3\" },\n uSizeAnchor: { value: new Float32Array([100, 100, 0.5, 0.5]), type: \"vec4\" }\n });\n super({\n glProgram,\n gpuProgram,\n resources: {\n localUniforms: new UniformGroup({\n uTransformMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uColor: { value: new Float32Array([1, 1, 1, 1]), type: \"vec4\" },\n uRound: { value: 0, type: \"f32\" }\n }),\n tilingUniforms,\n uTexture: Texture.EMPTY.source,\n uSampler: Texture.EMPTY.source.style\n }\n });\n }\n updateUniforms(width, height, matrix, anchorX, anchorY, texture) {\n const tilingUniforms = this.resources.tilingUniforms;\n const textureWidth = texture.width;\n const textureHeight = texture.height;\n const textureMatrix = texture.textureMatrix;\n const uTextureTransform = tilingUniforms.uniforms.uTextureTransform;\n uTextureTransform.set(\n matrix.a * textureWidth / width,\n matrix.b * textureWidth / height,\n matrix.c * textureHeight / width,\n matrix.d * textureHeight / height,\n matrix.tx / width,\n matrix.ty / height\n );\n uTextureTransform.invert();\n tilingUniforms.uniforms.uMapCoord = textureMatrix.mapCoord;\n tilingUniforms.uniforms.uClampFrame = textureMatrix.uClampFrame;\n tilingUniforms.uniforms.uClampOffset = textureMatrix.uClampOffset;\n tilingUniforms.uniforms.uTextureTransform = uTextureTransform;\n tilingUniforms.uniforms.uSizeAnchor[0] = width;\n tilingUniforms.uniforms.uSizeAnchor[1] = height;\n tilingUniforms.uniforms.uSizeAnchor[2] = anchorX;\n tilingUniforms.uniforms.uSizeAnchor[3] = anchorY;\n if (texture) {\n this.resources.uTexture = texture.source;\n this.resources.uSampler = texture.source.style;\n }\n }\n}\n\nexport { TilingSpriteShader };\n//# sourceMappingURL=TilingSpriteShader.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { getAdjustedBlendModeBlend } from '../../rendering/renderers/shared/state/getAdjustedBlendModeBlend.mjs';\nimport { State } from '../../rendering/renderers/shared/state/State.mjs';\nimport { RendererType } from '../../rendering/renderers/types.mjs';\nimport { color32BitToUniform } from '../graphics/gpu/colorToUniform.mjs';\nimport { BatchableMesh } from '../mesh/shared/BatchableMesh.mjs';\nimport { MeshGeometry } from '../mesh/shared/MeshGeometry.mjs';\nimport { TilingSpriteShader } from './shader/TilingSpriteShader.mjs';\nimport { QuadGeometry } from './utils/QuadGeometry.mjs';\nimport { setPositions } from './utils/setPositions.mjs';\nimport { setUvs } from './utils/setUvs.mjs';\n\n\"use strict\";\nconst sharedQuad = new QuadGeometry();\nclass TilingSpritePipe {\n constructor(renderer) {\n this._state = State.default2d;\n this._tilingSpriteDataHash = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n }\n validateRenderable(renderable) {\n const tilingSpriteData = this._getTilingSpriteData(renderable);\n const couldBatch = tilingSpriteData.canBatch;\n this._updateCanBatch(renderable);\n const canBatch = tilingSpriteData.canBatch;\n if (canBatch && canBatch === couldBatch) {\n const { batchableMesh } = tilingSpriteData;\n if (batchableMesh && batchableMesh.texture._source !== renderable.texture._source) {\n return !batchableMesh.batcher.checkAndUpdateTexture(batchableMesh, renderable.texture);\n }\n }\n return couldBatch !== canBatch;\n }\n addRenderable(tilingSprite, instructionSet) {\n const batcher = this._renderer.renderPipes.batch;\n this._updateCanBatch(tilingSprite);\n const tilingSpriteData = this._getTilingSpriteData(tilingSprite);\n const { geometry, canBatch } = tilingSpriteData;\n if (canBatch) {\n tilingSpriteData.batchableMesh || (tilingSpriteData.batchableMesh = new BatchableMesh());\n const batchableMesh = tilingSpriteData.batchableMesh;\n if (tilingSprite._didTilingSpriteUpdate) {\n tilingSprite._didTilingSpriteUpdate = false;\n this._updateBatchableMesh(tilingSprite);\n batchableMesh.geometry = geometry;\n batchableMesh.mesh = tilingSprite;\n batchableMesh.texture = tilingSprite._texture;\n }\n batchableMesh.roundPixels = this._renderer._roundPixels | tilingSprite._roundPixels;\n batcher.addToBatch(batchableMesh);\n } else {\n batcher.break(instructionSet);\n tilingSpriteData.shader || (tilingSpriteData.shader = new TilingSpriteShader());\n this.updateRenderable(tilingSprite);\n instructionSet.add(tilingSprite);\n }\n }\n execute(tilingSprite) {\n const { shader } = this._tilingSpriteDataHash[tilingSprite.uid];\n shader.groups[0] = this._renderer.globalUniforms.bindGroup;\n const localUniforms = shader.resources.localUniforms.uniforms;\n localUniforms.uTransformMatrix = tilingSprite.groupTransform;\n localUniforms.uRound = this._renderer._roundPixels | tilingSprite._roundPixels;\n color32BitToUniform(\n tilingSprite.groupColorAlpha,\n localUniforms.uColor,\n 0\n );\n this._state.blendMode = getAdjustedBlendModeBlend(tilingSprite.groupBlendMode, tilingSprite.texture._source);\n this._renderer.encoder.draw({\n geometry: sharedQuad,\n shader,\n state: this._state\n });\n }\n updateRenderable(tilingSprite) {\n const tilingSpriteData = this._getTilingSpriteData(tilingSprite);\n const { canBatch } = tilingSpriteData;\n if (canBatch) {\n const { batchableMesh } = tilingSpriteData;\n if (tilingSprite._didTilingSpriteUpdate)\n this._updateBatchableMesh(tilingSprite);\n batchableMesh.batcher.updateElement(batchableMesh);\n } else if (tilingSprite._didTilingSpriteUpdate) {\n const { shader } = tilingSpriteData;\n shader.updateUniforms(\n tilingSprite.width,\n tilingSprite.height,\n tilingSprite._tileTransform.matrix,\n tilingSprite.anchor.x,\n tilingSprite.anchor.y,\n tilingSprite.texture\n );\n }\n tilingSprite._didTilingSpriteUpdate = false;\n }\n destroyRenderable(tilingSprite) {\n const tilingSpriteData = this._getTilingSpriteData(tilingSprite);\n tilingSpriteData.batchableMesh = null;\n tilingSpriteData.shader?.destroy();\n this._tilingSpriteDataHash[tilingSprite.uid] = null;\n }\n _getTilingSpriteData(renderable) {\n return this._tilingSpriteDataHash[renderable.uid] || this._initTilingSpriteData(renderable);\n }\n _initTilingSpriteData(tilingSprite) {\n const geometry = new MeshGeometry({\n indices: sharedQuad.indices,\n positions: sharedQuad.positions.slice(),\n uvs: sharedQuad.uvs.slice()\n });\n this._tilingSpriteDataHash[tilingSprite.uid] = {\n canBatch: true,\n renderable: tilingSprite,\n geometry\n };\n tilingSprite.on(\"destroyed\", () => {\n this.destroyRenderable(tilingSprite);\n });\n return this._tilingSpriteDataHash[tilingSprite.uid];\n }\n _updateBatchableMesh(tilingSprite) {\n const renderableData = this._getTilingSpriteData(tilingSprite);\n const { geometry } = renderableData;\n const style = tilingSprite.texture.source.style;\n if (style.addressMode !== \"repeat\") {\n style.addressMode = \"repeat\";\n style.update();\n }\n setUvs(tilingSprite, geometry.uvs);\n setPositions(tilingSprite, geometry.positions);\n }\n destroy() {\n for (const i in this._tilingSpriteDataHash) {\n this.destroyRenderable(this._tilingSpriteDataHash[i].renderable);\n }\n this._tilingSpriteDataHash = null;\n this._renderer = null;\n }\n _updateCanBatch(tilingSprite) {\n const renderableData = this._getTilingSpriteData(tilingSprite);\n const texture = tilingSprite.texture;\n let _nonPowOf2wrapping = true;\n if (this._renderer.type === RendererType.WEBGL) {\n _nonPowOf2wrapping = this._renderer.context.supports.nonPowOf2wrapping;\n }\n renderableData.canBatch = texture.textureMatrix.isSimple && (_nonPowOf2wrapping || texture.source.isPowerOfTwo);\n return renderableData.canBatch;\n }\n}\n/** @ignore */\nTilingSpritePipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"tilingSprite\"\n};\n\nexport { TilingSpritePipe };\n//# sourceMappingURL=TilingSpritePipe.mjs.map\n","import { MeshGeometry } from '../../mesh/shared/MeshGeometry.mjs';\n\n\"use strict\";\nclass QuadGeometry extends MeshGeometry {\n constructor() {\n super({\n positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n indices: new Uint32Array([0, 1, 2, 0, 2, 3])\n });\n }\n}\n\nexport { QuadGeometry };\n//# sourceMappingURL=QuadGeometry.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { applyMatrix } from './applyMatrix.mjs';\n\n\"use strict\";\nfunction setUvs(tilingSprite, uvs) {\n const texture = tilingSprite.texture;\n const width = texture.frame.width;\n const height = texture.frame.height;\n let anchorX = 0;\n let anchorY = 0;\n if (tilingSprite._applyAnchorToTexture) {\n anchorX = tilingSprite.anchor.x;\n anchorY = tilingSprite.anchor.y;\n }\n uvs[0] = uvs[6] = -anchorX;\n uvs[2] = uvs[4] = 1 - anchorX;\n uvs[1] = uvs[3] = -anchorY;\n uvs[5] = uvs[7] = 1 - anchorY;\n const textureMatrix = Matrix.shared;\n textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);\n textureMatrix.tx /= tilingSprite.width;\n textureMatrix.ty /= tilingSprite.height;\n textureMatrix.invert();\n textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);\n applyMatrix(uvs, 2, 0, textureMatrix);\n}\n\nexport { setUvs };\n//# sourceMappingURL=setUvs.mjs.map\n","\"use strict\";\nfunction applyMatrix(array, stride, offset, matrix) {\n let index = 0;\n const size = array.length / (stride || 2);\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n offset *= stride;\n while (index < size) {\n const x = array[offset];\n const y = array[offset + 1];\n array[offset] = a * x + c * y + tx;\n array[offset + 1] = b * x + d * y + ty;\n offset += stride;\n index++;\n }\n}\n\nexport { applyMatrix };\n//# sourceMappingURL=applyMatrix.mjs.map\n","\"use strict\";\nfunction setPositions(tilingSprite, positions) {\n const anchorX = tilingSprite.anchor.x;\n const anchorY = tilingSprite.anchor.y;\n positions[0] = -anchorX * tilingSprite.width;\n positions[1] = -anchorY * tilingSprite.height;\n positions[2] = (1 - anchorX) * tilingSprite.width;\n positions[3] = -anchorY * tilingSprite.height;\n positions[4] = (1 - anchorX) * tilingSprite.width;\n positions[5] = (1 - anchorY) * tilingSprite.height;\n positions[6] = -anchorX * tilingSprite.width;\n positions[7] = (1 - anchorY) * tilingSprite.height;\n}\n\nexport { setPositions };\n//# sourceMappingURL=setPositions.mjs.map\n","\"use strict\";\nconst localUniformMSDFBit = {\n name: \"local-uniform-msdf-bit\",\n vertex: {\n header: (\n /* wgsl */\n `\n struct LocalUniforms {\n uColor:vec4,\n uTransformMatrix:mat3x3,\n uDistance: f32,\n uRound:f32,\n }\n\n @group(2) @binding(0) var localUniforms : LocalUniforms;\n `\n ),\n main: (\n /* wgsl */\n `\n vColor *= localUniforms.uColor;\n modelMatrix *= localUniforms.uTransformMatrix;\n `\n ),\n end: (\n /* wgsl */\n `\n if(localUniforms.uRound == 1)\n {\n vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n `\n )\n },\n fragment: {\n header: (\n /* wgsl */\n `\n struct LocalUniforms {\n uColor:vec4,\n uTransformMatrix:mat3x3,\n uDistance: f32\n }\n\n @group(2) @binding(0) var localUniforms : LocalUniforms;\n `\n ),\n main: (\n /* wgsl */\n ` \n outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));\n `\n )\n }\n};\nconst localUniformMSDFBitGl = {\n name: \"local-uniform-msdf-bit\",\n vertex: {\n header: (\n /* glsl */\n `\n uniform mat3 uTransformMatrix;\n uniform vec4 uColor;\n uniform float uRound;\n `\n ),\n main: (\n /* glsl */\n `\n vColor *= uColor;\n modelMatrix *= uTransformMatrix;\n `\n ),\n end: (\n /* glsl */\n `\n if(uRound == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n `\n )\n },\n fragment: {\n header: (\n /* glsl */\n `\n uniform float uDistance;\n `\n ),\n main: (\n /* glsl */\n ` \n outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));\n `\n )\n }\n};\n\nexport { localUniformMSDFBit, localUniformMSDFBitGl };\n//# sourceMappingURL=localUniformMSDFBit.mjs.map\n","\"use strict\";\nconst mSDFBit = {\n name: \"msdf-bit\",\n fragment: {\n header: (\n /* wgsl */\n `\n fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 {\n \n // MSDF\n var median = msdfColor.r + msdfColor.g + msdfColor.b -\n min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -\n max(msdfColor.r, max(msdfColor.g, msdfColor.b));\n \n // SDF\n median = min(median, msdfColor.a);\n\n var screenPxDistance = distance * (median - 0.5);\n var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\n if (median < 0.01) {\n alpha = 0.0;\n } else if (median > 0.99) {\n alpha = 1.0;\n }\n\n // Gamma correction for coverage-like alpha\n var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));\n var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);\n var coverage: f32 = pow(shapeColor.a * alpha, gamma);\n\n return coverage;\n \n }\n `\n )\n }\n};\nconst mSDFBitGl = {\n name: \"msdf-bit\",\n fragment: {\n header: (\n /* glsl */\n `\n float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {\n \n // MSDF\n float median = msdfColor.r + msdfColor.g + msdfColor.b -\n min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -\n max(msdfColor.r, max(msdfColor.g, msdfColor.b));\n \n // SDF\n median = min(median, msdfColor.a);\n \n float screenPxDistance = distance * (median - 0.5);\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\n \n if (median < 0.01) {\n alpha = 0.0;\n } else if (median > 0.99) {\n alpha = 1.0;\n }\n\n // Gamma correction for coverage-like alpha\n float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));\n float gamma = mix(1.0, 1.0 / 2.2, luma);\n float coverage = pow(shapeColor.a * alpha, gamma); \n \n return coverage;\n }\n `\n )\n }\n};\n\nexport { mSDFBit, mSDFBitGl };\n//# sourceMappingURL=mSDFBit.mjs.map\n","import { Matrix } from '../../../maths/matrix/Matrix.mjs';\nimport { getMaxTexturesPerBatch } from '../../../rendering/batcher/gl/utils/maxRecommendedTextures.mjs';\nimport { compileHighShaderGpuProgram, compileHighShaderGlProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';\nimport { colorBit, colorBitGl } from '../../../rendering/high-shader/shader-bits/colorBit.mjs';\nimport { generateTextureBatchBit, generateTextureBatchBitGl } from '../../../rendering/high-shader/shader-bits/generateTextureBatchBit.mjs';\nimport { roundPixelsBit, roundPixelsBitGl } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nimport { getBatchSamplersUniformGroup } from '../../../rendering/renderers/gl/shader/getBatchSamplersUniformGroup.mjs';\nimport { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';\nimport { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';\nimport { localUniformMSDFBit, localUniformMSDFBitGl } from './shader-bits/localUniformMSDFBit.mjs';\nimport { mSDFBit, mSDFBitGl } from './shader-bits/mSDFBit.mjs';\n\n\"use strict\";\nlet gpuProgram;\nlet glProgram;\nclass SdfShader extends Shader {\n constructor() {\n const uniforms = new UniformGroup({\n uColor: { value: new Float32Array([1, 1, 1, 1]), type: \"vec4\" },\n uTransformMatrix: { value: new Matrix(), type: \"mat3x3\" },\n uDistance: { value: 4, type: \"f32\" },\n uRound: { value: 0, type: \"f32\" }\n });\n const maxTextures = getMaxTexturesPerBatch();\n gpuProgram ?? (gpuProgram = compileHighShaderGpuProgram({\n name: \"sdf-shader\",\n bits: [\n colorBit,\n generateTextureBatchBit(maxTextures),\n localUniformMSDFBit,\n mSDFBit,\n roundPixelsBit\n ]\n }));\n glProgram ?? (glProgram = compileHighShaderGlProgram({\n name: \"sdf-shader\",\n bits: [\n colorBitGl,\n generateTextureBatchBitGl(maxTextures),\n localUniformMSDFBitGl,\n mSDFBitGl,\n roundPixelsBitGl\n ]\n }));\n super({\n glProgram,\n gpuProgram,\n resources: {\n localUniforms: uniforms,\n batchSamplers: getBatchSamplersUniformGroup(maxTextures)\n }\n });\n }\n}\n\nexport { SdfShader };\n//# sourceMappingURL=SdfShader.mjs.map\n","import { Cache } from '../../assets/cache/Cache.mjs';\nimport { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\nimport { Graphics } from '../graphics/shared/Graphics.mjs';\nimport { SdfShader } from '../text/sdfShader/SdfShader.mjs';\nimport { BitmapFontManager } from './BitmapFontManager.mjs';\nimport { getBitmapTextLayout } from './utils/getBitmapTextLayout.mjs';\n\n\"use strict\";\nclass BitmapTextPipe {\n // private _sdfShader: SdfShader;\n constructor(renderer) {\n this._gpuBitmapText = {};\n this._renderer = renderer;\n }\n validateRenderable(bitmapText) {\n const graphicsRenderable = this._getGpuBitmapText(bitmapText);\n if (bitmapText._didTextUpdate) {\n bitmapText._didTextUpdate = false;\n this._updateContext(bitmapText, graphicsRenderable);\n }\n return this._renderer.renderPipes.graphics.validateRenderable(graphicsRenderable);\n }\n addRenderable(bitmapText, instructionSet) {\n const graphicsRenderable = this._getGpuBitmapText(bitmapText);\n syncWithProxy(bitmapText, graphicsRenderable);\n if (bitmapText._didTextUpdate) {\n bitmapText._didTextUpdate = false;\n this._updateContext(bitmapText, graphicsRenderable);\n }\n this._renderer.renderPipes.graphics.addRenderable(graphicsRenderable, instructionSet);\n if (graphicsRenderable.context.customShader) {\n this._updateDistanceField(bitmapText);\n }\n }\n destroyRenderable(bitmapText) {\n this._destroyRenderableByUid(bitmapText.uid);\n }\n _destroyRenderableByUid(renderableUid) {\n const context = this._gpuBitmapText[renderableUid].context;\n if (context.customShader) {\n BigPool.return(context.customShader);\n context.customShader = null;\n }\n BigPool.return(this._gpuBitmapText[renderableUid]);\n this._gpuBitmapText[renderableUid] = null;\n }\n updateRenderable(bitmapText) {\n const graphicsRenderable = this._getGpuBitmapText(bitmapText);\n syncWithProxy(bitmapText, graphicsRenderable);\n this._renderer.renderPipes.graphics.updateRenderable(graphicsRenderable);\n if (graphicsRenderable.context.customShader) {\n this._updateDistanceField(bitmapText);\n }\n }\n _updateContext(bitmapText, proxyGraphics) {\n const { context } = proxyGraphics;\n const bitmapFont = BitmapFontManager.getFont(bitmapText.text, bitmapText._style);\n context.clear();\n if (bitmapFont.distanceField.type !== \"none\") {\n if (!context.customShader) {\n context.customShader = BigPool.get(SdfShader);\n }\n }\n const chars = Array.from(bitmapText.text);\n const style = bitmapText._style;\n let currentY = bitmapFont.baseLineOffset;\n const bitmapTextLayout = getBitmapTextLayout(chars, style, bitmapFont);\n let index = 0;\n const padding = style.padding;\n const scale = bitmapTextLayout.scale;\n let tx = bitmapTextLayout.width;\n let ty = bitmapTextLayout.height + bitmapTextLayout.offsetY;\n if (style._stroke) {\n tx += style._stroke.width / scale;\n ty += style._stroke.width / scale;\n }\n context.translate(-bitmapText._anchor._x * tx - padding, -bitmapText._anchor._y * ty - padding).scale(scale, scale);\n const tint = bitmapFont.applyFillAsTint ? style._fill.color : 16777215;\n for (let i = 0; i < bitmapTextLayout.lines.length; i++) {\n const line = bitmapTextLayout.lines[i];\n for (let j = 0; j < line.charPositions.length; j++) {\n const char = chars[index++];\n const charData = bitmapFont.chars[char];\n if (charData?.texture) {\n context.texture(\n charData.texture,\n tint ? tint : \"black\",\n Math.round(line.charPositions[j] + charData.xOffset),\n Math.round(currentY + charData.yOffset)\n );\n }\n }\n currentY += bitmapFont.lineHeight;\n }\n }\n _getGpuBitmapText(bitmapText) {\n return this._gpuBitmapText[bitmapText.uid] || this.initGpuText(bitmapText);\n }\n initGpuText(bitmapText) {\n const proxyRenderable = BigPool.get(Graphics);\n this._gpuBitmapText[bitmapText.uid] = proxyRenderable;\n this._updateContext(bitmapText, proxyRenderable);\n bitmapText.on(\"destroyed\", () => {\n this.destroyRenderable(bitmapText);\n });\n return this._gpuBitmapText[bitmapText.uid];\n }\n _updateDistanceField(bitmapText) {\n const context = this._getGpuBitmapText(bitmapText).context;\n const fontFamily = bitmapText._style.fontFamily;\n const dynamicFont = Cache.get(`${fontFamily}-bitmap`);\n const { a, b, c, d } = bitmapText.groupTransform;\n const dx = Math.sqrt(a * a + b * b);\n const dy = Math.sqrt(c * c + d * d);\n const worldScale = (Math.abs(dx) + Math.abs(dy)) / 2;\n const fontScale = dynamicFont.baseRenderedFontSize / bitmapText._style.fontSize;\n const distance = worldScale * dynamicFont.distanceField.range * (1 / fontScale);\n context.customShader.resources.localUniforms.uniforms.uDistance = distance;\n }\n destroy() {\n for (const uid in this._gpuBitmapText) {\n this._destroyRenderableByUid(uid);\n }\n this._gpuBitmapText = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nBitmapTextPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"bitmapText\"\n};\nfunction syncWithProxy(container, proxy) {\n proxy.groupTransform = container.groupTransform;\n proxy.groupColorAlpha = container.groupColorAlpha;\n proxy.groupColor = container.groupColor;\n proxy.groupBlendMode = container.groupBlendMode;\n proxy.globalDisplayStatus = container.globalDisplayStatus;\n proxy.groupTransform = container.groupTransform;\n proxy.localDisplayStatus = container.localDisplayStatus;\n proxy.groupAlpha = container.groupAlpha;\n proxy._roundPixels = container._roundPixels;\n}\n\nexport { BitmapTextPipe };\n//# sourceMappingURL=BitmapTextPipe.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { Texture } from '../../rendering/renderers/shared/texture/Texture.mjs';\nimport { updateQuadBounds } from '../../utils/data/updateQuadBounds.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\nimport { BatchableSprite } from '../sprite/BatchableSprite.mjs';\n\n\"use strict\";\nclass HTMLTextPipe {\n constructor(renderer) {\n this._gpuText = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n this._renderer.runners.resolutionChange.add(this);\n }\n resolutionChange() {\n for (const i in this._gpuText) {\n const gpuText = this._gpuText[i];\n const text = gpuText.batchableSprite.renderable;\n if (text._autoResolution) {\n text._resolution = this._renderer.resolution;\n text.onViewUpdate();\n }\n }\n }\n validateRenderable(htmlText) {\n const gpuText = this._getGpuText(htmlText);\n const newKey = htmlText._getKey();\n if (gpuText.textureNeedsUploading) {\n gpuText.textureNeedsUploading = false;\n return true;\n }\n if (gpuText.currentKey !== newKey) {\n return true;\n }\n return false;\n }\n addRenderable(htmlText, _instructionSet) {\n const gpuText = this._getGpuText(htmlText);\n const batchableSprite = gpuText.batchableSprite;\n if (htmlText._didTextUpdate) {\n this._updateText(htmlText);\n }\n this._renderer.renderPipes.batch.addToBatch(batchableSprite);\n }\n updateRenderable(htmlText) {\n const gpuText = this._getGpuText(htmlText);\n const batchableSprite = gpuText.batchableSprite;\n if (htmlText._didTextUpdate) {\n this._updateText(htmlText);\n }\n batchableSprite.batcher.updateElement(batchableSprite);\n }\n destroyRenderable(htmlText) {\n this._destroyRenderableById(htmlText.uid);\n }\n _destroyRenderableById(htmlTextUid) {\n const gpuText = this._gpuText[htmlTextUid];\n this._renderer.htmlText.decreaseReferenceCount(gpuText.currentKey);\n BigPool.return(gpuText.batchableSprite);\n this._gpuText[htmlTextUid] = null;\n }\n _updateText(htmlText) {\n const newKey = htmlText._getKey();\n const gpuText = this._getGpuText(htmlText);\n const batchableSprite = gpuText.batchableSprite;\n if (gpuText.currentKey !== newKey) {\n this._updateGpuText(htmlText).catch((e) => {\n console.error(e);\n });\n }\n htmlText._didTextUpdate = false;\n const padding = htmlText._style.padding;\n updateQuadBounds(batchableSprite.bounds, htmlText._anchor, batchableSprite.texture, padding);\n }\n async _updateGpuText(htmlText) {\n htmlText._didTextUpdate = false;\n const gpuText = this._getGpuText(htmlText);\n if (gpuText.generatingTexture)\n return;\n const newKey = htmlText._getKey();\n this._renderer.htmlText.decreaseReferenceCount(gpuText.currentKey);\n gpuText.generatingTexture = true;\n gpuText.currentKey = newKey;\n const resolution = htmlText.resolution ?? this._renderer.resolution;\n const texture = await this._renderer.htmlText.getManagedTexture(\n htmlText.text,\n resolution,\n htmlText._style,\n htmlText._getKey()\n );\n const batchableSprite = gpuText.batchableSprite;\n batchableSprite.texture = gpuText.texture = texture;\n gpuText.generatingTexture = false;\n gpuText.textureNeedsUploading = true;\n htmlText.onViewUpdate();\n const padding = htmlText._style.padding;\n updateQuadBounds(batchableSprite.bounds, htmlText._anchor, batchableSprite.texture, padding);\n }\n _getGpuText(htmlText) {\n return this._gpuText[htmlText.uid] || this.initGpuText(htmlText);\n }\n initGpuText(htmlText) {\n const gpuTextData = {\n texture: Texture.EMPTY,\n currentKey: \"--\",\n batchableSprite: BigPool.get(BatchableSprite),\n textureNeedsUploading: false,\n generatingTexture: false\n };\n const batchableSprite = gpuTextData.batchableSprite;\n batchableSprite.renderable = htmlText;\n batchableSprite.texture = Texture.EMPTY;\n batchableSprite.bounds = { minX: 0, maxX: 1, minY: 0, maxY: 0 };\n batchableSprite.roundPixels = this._renderer._roundPixels | htmlText._roundPixels;\n htmlText._resolution = htmlText._autoResolution ? this._renderer.resolution : htmlText.resolution;\n this._gpuText[htmlText.uid] = gpuTextData;\n htmlText.on(\"destroyed\", () => {\n this.destroyRenderable(htmlText);\n });\n return gpuTextData;\n }\n destroy() {\n for (const i in this._gpuText) {\n this._destroyRenderableById(i);\n }\n this._gpuText = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nHTMLTextPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"htmlText\"\n};\n\nexport { HTMLTextPipe };\n//# sourceMappingURL=HTMLTextPipe.mjs.map\n","import { TexturePool } from '../../../rendering/renderers/shared/texture/TexturePool.mjs';\nimport { Bounds } from '../../container/bounds/Bounds.mjs';\n\n\"use strict\";\nconst tempBounds = new Bounds();\nfunction getPo2TextureFromSource(image, width, height, resolution) {\n const bounds = tempBounds;\n bounds.minX = 0;\n bounds.minY = 0;\n bounds.maxX = image.width / resolution | 0;\n bounds.maxY = image.height / resolution | 0;\n const texture = TexturePool.getOptimalTexture(\n bounds.width,\n bounds.height,\n resolution,\n false\n );\n texture.source.uploadMethodId = \"image\";\n texture.source.resource = image;\n texture.source.alphaMode = \"premultiply-alpha-on-upload\";\n texture.frame.width = width / resolution;\n texture.frame.height = height / resolution;\n texture.source.emit(\"update\", texture.source);\n texture.updateUvs();\n return texture;\n}\n\nexport { getPo2TextureFromSource };\n//# sourceMappingURL=getPo2TextureFromSource.mjs.map\n","import { loadFontAsBase64 } from './loadFontAsBase64.mjs';\n\n\"use strict\";\nasync function loadFontCSS(style, url) {\n const dataSrc = await loadFontAsBase64(url);\n return `@font-face {\n font-family: \"${style.fontFamily}\";\n src: url('${dataSrc}');\n font-weight: ${style.fontWeight};\n font-style: ${style.fontStyle};\n }`;\n}\n\nexport { loadFontCSS };\n//# sourceMappingURL=loadFontCSS.mjs.map\n","import { DOMAdapter } from '../../../environment/adapter.mjs';\n\n\"use strict\";\nasync function loadFontAsBase64(url) {\n const response = await DOMAdapter.get().fetch(url);\n const blob = await response.blob();\n const reader = new FileReader();\n const dataSrc = await new Promise((resolve, reject) => {\n reader.onloadend = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n });\n return dataSrc;\n}\n\nexport { loadFontAsBase64 };\n//# sourceMappingURL=loadFontAsBase64.mjs.map\n","import { Cache } from '../../../assets/cache/Cache.mjs';\nimport { loadFontCSS } from './loadFontCSS.mjs';\n\n\"use strict\";\nconst FontStylePromiseCache = /* @__PURE__ */ new Map();\nasync function getFontCss(fontFamilies, style, defaultOptions) {\n const fontPromises = fontFamilies.filter((fontFamily) => Cache.has(`${fontFamily}-and-url`)).map((fontFamily, i) => {\n if (!FontStylePromiseCache.has(fontFamily)) {\n const { url } = Cache.get(`${fontFamily}-and-url`);\n if (i === 0) {\n FontStylePromiseCache.set(fontFamily, loadFontCSS({\n fontWeight: style.fontWeight,\n fontStyle: style.fontStyle,\n fontFamily\n }, url));\n } else {\n FontStylePromiseCache.set(fontFamily, loadFontCSS({\n fontWeight: defaultOptions.fontWeight,\n fontStyle: defaultOptions.fontStyle,\n fontFamily\n }, url));\n }\n }\n return FontStylePromiseCache.get(fontFamily);\n });\n return (await Promise.all(fontPromises)).join(\"\\n\");\n}\n\nexport { FontStylePromiseCache, getFontCss };\n//# sourceMappingURL=getFontCss.mjs.map\n","import { ExtensionType } from '../../extensions/Extensions.mjs';\nimport { TexturePool } from '../../rendering/renderers/shared/texture/TexturePool.mjs';\nimport { RendererType } from '../../rendering/renderers/types.mjs';\nimport { isSafari } from '../../utils/browser/isSafari.mjs';\nimport { warn } from '../../utils/logging/warn.mjs';\nimport { BigPool } from '../../utils/pool/PoolGroup.mjs';\nimport { getPo2TextureFromSource } from '../text/utils/getPo2TextureFromSource.mjs';\nimport { HTMLTextRenderData } from './HTMLTextRenderData.mjs';\nimport { HTMLTextStyle } from './HtmlTextStyle.mjs';\nimport { extractFontFamilies } from './utils/extractFontFamilies.mjs';\nimport { getFontCss } from './utils/getFontCss.mjs';\nimport { getSVGUrl } from './utils/getSVGUrl.mjs';\nimport { getTemporaryCanvasFromImage } from './utils/getTemporaryCanvasFromImage.mjs';\nimport { loadSVGImage } from './utils/loadSVGImage.mjs';\nimport { measureHtmlText } from './utils/measureHtmlText.mjs';\n\n\"use strict\";\nclass HTMLTextSystem {\n constructor(renderer) {\n this._activeTextures = {};\n this._renderer = renderer;\n this._createCanvas = renderer.type === RendererType.WEBGPU;\n }\n getTexture(options) {\n return this._buildTexturePromise(\n options.text,\n options.resolution,\n options.style\n );\n }\n getManagedTexture(text, resolution, style, textKey) {\n if (this._activeTextures[textKey]) {\n this._increaseReferenceCount(textKey);\n return this._activeTextures[textKey].promise;\n }\n const promise = this._buildTexturePromise(text, resolution, style).then((texture) => {\n this._activeTextures[textKey].texture = texture;\n return texture;\n });\n this._activeTextures[textKey] = {\n texture: null,\n promise,\n usageCount: 1\n };\n return promise;\n }\n async _buildTexturePromise(text, resolution, style) {\n const htmlTextData = BigPool.get(HTMLTextRenderData);\n const fontFamilies = extractFontFamilies(text, style);\n const fontCSS = await getFontCss(\n fontFamilies,\n style,\n HTMLTextStyle.defaultTextStyle\n );\n const measured = measureHtmlText(text, style, fontCSS, htmlTextData);\n const width = Math.ceil(Math.ceil(Math.max(1, measured.width) + style.padding * 2) * resolution);\n const height = Math.ceil(Math.ceil(Math.max(1, measured.height) + style.padding * 2) * resolution);\n const image = htmlTextData.image;\n const uvSafeOffset = 2;\n image.width = (width | 0) + uvSafeOffset;\n image.height = (height | 0) + uvSafeOffset;\n const svgURL = getSVGUrl(text, style, resolution, fontCSS, htmlTextData);\n await loadSVGImage(image, svgURL, isSafari() && fontFamilies.length > 0);\n let resource = image;\n if (this._createCanvas) {\n resource = getTemporaryCanvasFromImage(image, resolution);\n }\n const texture = getPo2TextureFromSource(\n resource,\n image.width - uvSafeOffset,\n image.height - uvSafeOffset,\n resolution\n );\n if (this._createCanvas) {\n this._renderer.texture.initSource(texture.source);\n }\n BigPool.return(htmlTextData);\n return texture;\n }\n _increaseReferenceCount(textKey) {\n this._activeTextures[textKey].usageCount++;\n }\n decreaseReferenceCount(textKey) {\n const activeTexture = this._activeTextures[textKey];\n if (!activeTexture)\n return;\n activeTexture.usageCount--;\n if (activeTexture.usageCount === 0) {\n if (activeTexture.texture) {\n this._cleanUp(activeTexture);\n } else {\n activeTexture.promise.then((texture) => {\n activeTexture.texture = texture;\n this._cleanUp(activeTexture);\n }).catch(() => {\n warn(\"HTMLTextSystem: Failed to clean texture\");\n });\n }\n this._activeTextures[textKey] = null;\n }\n }\n _cleanUp(activeTexture) {\n TexturePool.returnTexture(activeTexture.texture);\n activeTexture.texture.source.resource = null;\n activeTexture.texture.source.uploadMethodId = \"unknown\";\n }\n getReferenceCount(textKey) {\n return this._activeTextures[textKey].usageCount;\n }\n destroy() {\n this._activeTextures = null;\n }\n}\n/** @ignore */\nHTMLTextSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"htmlText\"\n};\nHTMLTextSystem.defaultFontOptions = {\n fontFamily: \"Arial\",\n fontStyle: \"normal\",\n fontWeight: \"normal\"\n};\n\nexport { HTMLTextSystem };\n//# sourceMappingURL=HTMLTextSystem.mjs.map\n","\"use strict\";\nfunction extractFontFamilies(text, style) {\n const fontFamily = style.fontFamily;\n const fontFamilies = [];\n const dedupe = {};\n const regex = /font-family:([^;\"\\s]+)/g;\n const matches = text.match(regex);\n function addFontFamily(fontFamily2) {\n if (!dedupe[fontFamily2]) {\n fontFamilies.push(fontFamily2);\n dedupe[fontFamily2] = true;\n }\n }\n if (Array.isArray(fontFamily)) {\n for (let i = 0; i < fontFamily.length; i++) {\n addFontFamily(fontFamily[i]);\n }\n } else {\n addFontFamily(fontFamily);\n }\n if (matches) {\n matches.forEach((match) => {\n const fontFamily2 = match.split(\":\")[1].trim();\n addFontFamily(fontFamily2);\n });\n }\n for (const i in style.tagStyles) {\n const fontFamily2 = style.tagStyles[i].fontFamily;\n addFontFamily(fontFamily2);\n }\n return fontFamilies;\n}\n\nexport { extractFontFamilies };\n//# sourceMappingURL=extractFontFamilies.mjs.map\n","\"use strict\";\nfunction getSVGUrl(text, style, resolution, fontCSS, htmlTextData) {\n const { domElement, styleElement, svgRoot } = htmlTextData;\n domElement.innerHTML = `
${text}
`;\n domElement.setAttribute(\"style\", `transform: scale(${resolution});transform-origin: top left; display: inline-block`);\n styleElement.textContent = fontCSS;\n const { width, height } = htmlTextData.image;\n svgRoot.setAttribute(\"width\", width.toString());\n svgRoot.setAttribute(\"height\", height.toString());\n return new XMLSerializer().serializeToString(svgRoot);\n}\n\nexport { getSVGUrl };\n//# sourceMappingURL=getSVGUrl.mjs.map\n","\"use strict\";\nfunction loadSVGImage(image, url, delay) {\n return new Promise(async (resolve) => {\n if (delay) {\n await new Promise((resolve2) => setTimeout(resolve2, 100));\n }\n image.onload = () => {\n resolve();\n };\n image.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(url)}`;\n image.crossOrigin = \"anonymous\";\n });\n}\n\nexport { loadSVGImage };\n//# sourceMappingURL=loadSVGImage.mjs.map\n","import { DOMAdapter } from '../../environment/adapter.mjs';\n\n\"use strict\";\nfunction isSafari() {\n const { userAgent } = DOMAdapter.get().getNavigator();\n return /^((?!chrome|android).)*safari/i.test(userAgent);\n}\n\nexport { isSafari };\n//# sourceMappingURL=isSafari.mjs.map\n","import { CanvasPool } from '../../../rendering/renderers/shared/texture/CanvasPool.mjs';\n\n\"use strict\";\nfunction getTemporaryCanvasFromImage(image, resolution) {\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(\n image.width,\n image.height,\n resolution\n );\n const { context } = canvasAndContext;\n context.clearRect(0, 0, image.width, image.height);\n context.drawImage(image, 0, 0);\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n return canvasAndContext.canvas;\n}\n\nexport { getTemporaryCanvasFromImage };\n//# sourceMappingURL=getTemporaryCanvasFromImage.mjs.map\n","import { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { updateQuadBounds } from '../../../utils/data/updateQuadBounds.mjs';\nimport { BigPool } from '../../../utils/pool/PoolGroup.mjs';\nimport { BatchableSprite } from '../../sprite/BatchableSprite.mjs';\n\n\"use strict\";\nclass CanvasTextPipe {\n constructor(renderer) {\n this._gpuText = /* @__PURE__ */ Object.create(null);\n this._renderer = renderer;\n this._renderer.runners.resolutionChange.add(this);\n }\n resolutionChange() {\n for (const i in this._gpuText) {\n const gpuText = this._gpuText[i];\n const text = gpuText.batchableSprite.renderable;\n if (text._autoResolution) {\n text._resolution = this._renderer.resolution;\n text.onViewUpdate();\n }\n }\n }\n validateRenderable(text) {\n const gpuText = this._getGpuText(text);\n const newKey = text._getKey();\n if (gpuText.currentKey !== newKey) {\n const { width, height } = this._renderer.canvasText.getTextureSize(\n text.text,\n text.resolution,\n text._style\n );\n if (\n // is only being used by this text:\n this._renderer.canvasText.getReferenceCount(gpuText.currentKey) === 1 && width === gpuText.texture._source.width && height === gpuText.texture._source.height\n ) {\n return false;\n }\n return true;\n }\n return false;\n }\n addRenderable(text, _instructionSet) {\n const gpuText = this._getGpuText(text);\n const batchableSprite = gpuText.batchableSprite;\n if (text._didTextUpdate) {\n this._updateText(text);\n }\n this._renderer.renderPipes.batch.addToBatch(batchableSprite);\n }\n updateRenderable(text) {\n const gpuText = this._getGpuText(text);\n const batchableSprite = gpuText.batchableSprite;\n if (text._didTextUpdate) {\n this._updateText(text);\n }\n batchableSprite.batcher.updateElement(batchableSprite);\n }\n destroyRenderable(text) {\n this._destroyRenderableById(text.uid);\n }\n _destroyRenderableById(textUid) {\n const gpuText = this._gpuText[textUid];\n this._renderer.canvasText.decreaseReferenceCount(gpuText.currentKey);\n BigPool.return(gpuText.batchableSprite);\n this._gpuText[textUid] = null;\n }\n _updateText(text) {\n const newKey = text._getKey();\n const gpuText = this._getGpuText(text);\n const batchableSprite = gpuText.batchableSprite;\n if (gpuText.currentKey !== newKey) {\n this._updateGpuText(text);\n }\n text._didTextUpdate = false;\n const padding = text._style.padding;\n updateQuadBounds(batchableSprite.bounds, text._anchor, batchableSprite.texture, padding);\n }\n _updateGpuText(text) {\n const gpuText = this._getGpuText(text);\n const batchableSprite = gpuText.batchableSprite;\n if (gpuText.texture) {\n this._renderer.canvasText.decreaseReferenceCount(gpuText.currentKey);\n }\n gpuText.texture = batchableSprite.texture = this._renderer.canvasText.getManagedTexture(text);\n gpuText.currentKey = text._getKey();\n batchableSprite.texture = gpuText.texture;\n }\n _getGpuText(text) {\n return this._gpuText[text.uid] || this.initGpuText(text);\n }\n initGpuText(text) {\n const gpuTextData = {\n texture: null,\n currentKey: \"--\",\n batchableSprite: BigPool.get(BatchableSprite)\n };\n gpuTextData.batchableSprite.renderable = text;\n gpuTextData.batchableSprite.bounds = { minX: 0, maxX: 1, minY: 0, maxY: 0 };\n gpuTextData.batchableSprite.roundPixels = this._renderer._roundPixels | text._roundPixels;\n this._gpuText[text.uid] = gpuTextData;\n text._resolution = text._autoResolution ? this._renderer.resolution : text.resolution;\n this._updateText(text);\n text.on(\"destroyed\", () => {\n this.destroyRenderable(text);\n });\n return gpuTextData;\n }\n destroy() {\n for (const i in this._gpuText) {\n this._destroyRenderableById(i);\n }\n this._gpuText = null;\n this._renderer = null;\n }\n}\n/** @ignore */\nCanvasTextPipe.extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes\n ],\n name: \"text\"\n};\n\nexport { CanvasTextPipe };\n//# sourceMappingURL=CanvasTextPipe.mjs.map\n","import { Rectangle } from '../../maths/shapes/Rectangle.mjs';\n\n\"use strict\";\nfunction checkRow(data, width, y) {\n for (let x = 0, index = 4 * y * width; x < width; ++x, index += 4) {\n if (data[index + 3] !== 0)\n return false;\n }\n return true;\n}\nfunction checkColumn(data, width, x, top, bottom) {\n const stride = 4 * width;\n for (let y = top, index = top * stride + 4 * x; y <= bottom; ++y, index += stride) {\n if (data[index + 3] !== 0)\n return false;\n }\n return true;\n}\nfunction getCanvasBoundingBox(canvas, resolution = 1) {\n const { width, height } = canvas;\n const context = canvas.getContext(\"2d\", {\n willReadFrequently: true\n });\n if (context === null) {\n throw new TypeError(\"Failed to get canvas 2D context\");\n }\n const imageData = context.getImageData(0, 0, width, height);\n const data = imageData.data;\n let left = 0;\n let top = 0;\n let right = width - 1;\n let bottom = height - 1;\n while (top < height && checkRow(data, width, top))\n ++top;\n if (top === height)\n return Rectangle.EMPTY;\n while (checkRow(data, width, bottom))\n --bottom;\n while (checkColumn(data, width, left, top, bottom))\n ++left;\n while (checkColumn(data, width, right, top, bottom))\n --right;\n ++right;\n ++bottom;\n return new Rectangle(left / resolution, top / resolution, (right - left) / resolution, (bottom - top) / resolution);\n}\n\nexport { getCanvasBoundingBox };\n//# sourceMappingURL=getCanvasBoundingBox.mjs.map\n","import { Color } from '../../../color/Color.mjs';\nimport { ExtensionType } from '../../../extensions/Extensions.mjs';\nimport { nextPow2 } from '../../../maths/misc/pow2.mjs';\nimport { CanvasPool } from '../../../rendering/renderers/shared/texture/CanvasPool.mjs';\nimport { TexturePool } from '../../../rendering/renderers/shared/texture/TexturePool.mjs';\nimport { getCanvasBoundingBox } from '../../../utils/canvas/getCanvasBoundingBox.mjs';\nimport { deprecation } from '../../../utils/logging/deprecation.mjs';\nimport { TextStyle } from '../TextStyle.mjs';\nimport { getPo2TextureFromSource } from '../utils/getPo2TextureFromSource.mjs';\nimport { CanvasTextMetrics } from './CanvasTextMetrics.mjs';\nimport { fontStringFromTextStyle } from './utils/fontStringFromTextStyle.mjs';\nimport { getCanvasFillStyle } from './utils/getCanvasFillStyle.mjs';\n\n\"use strict\";\nclass CanvasTextSystem {\n constructor(_renderer) {\n this._activeTextures = {};\n this._renderer = _renderer;\n }\n getTextureSize(text, resolution, style) {\n const measured = CanvasTextMetrics.measureText(text || \" \", style);\n let width = Math.ceil(Math.ceil(Math.max(1, measured.width) + style.padding * 2) * resolution);\n let height = Math.ceil(Math.ceil(Math.max(1, measured.height) + style.padding * 2) * resolution);\n width = Math.ceil(width - 1e-6);\n height = Math.ceil(height - 1e-6);\n width = nextPow2(width);\n height = nextPow2(height);\n return { width, height };\n }\n getTexture(options, resolution, style, _textKey) {\n if (typeof options === \"string\") {\n deprecation(\"8.0.0\", \"CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments\");\n options = {\n text: options,\n style,\n resolution\n };\n }\n if (!(options.style instanceof TextStyle)) {\n options.style = new TextStyle(options.style);\n }\n const { texture, canvasAndContext } = this.createTextureAndCanvas(\n options\n );\n this._renderer.texture.initSource(texture._source);\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n return texture;\n }\n createTextureAndCanvas(options) {\n const { text, style } = options;\n const resolution = options.resolution ?? this._renderer.resolution;\n const measured = CanvasTextMetrics.measureText(text || \" \", style);\n const width = Math.ceil(Math.ceil(Math.max(1, measured.width) + style.padding * 2) * resolution);\n const height = Math.ceil(Math.ceil(Math.max(1, measured.height) + style.padding * 2) * resolution);\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(width, height);\n const { canvas } = canvasAndContext;\n this.renderTextToCanvas(text, style, resolution, canvasAndContext);\n const texture = getPo2TextureFromSource(canvas, width, height, resolution);\n if (style.trim) {\n const trimmed = getCanvasBoundingBox(canvas, resolution);\n texture.frame.copyFrom(trimmed);\n texture.updateUvs();\n }\n return { texture, canvasAndContext };\n }\n getManagedTexture(text) {\n text._resolution = text._autoResolution ? this._renderer.resolution : text.resolution;\n const textKey = text._getKey();\n if (this._activeTextures[textKey]) {\n this._increaseReferenceCount(textKey);\n return this._activeTextures[textKey].texture;\n }\n const { texture, canvasAndContext } = this.createTextureAndCanvas(text);\n this._activeTextures[textKey] = {\n canvasAndContext,\n texture,\n usageCount: 1\n };\n return texture;\n }\n _increaseReferenceCount(textKey) {\n this._activeTextures[textKey].usageCount++;\n }\n decreaseReferenceCount(textKey) {\n const activeTexture = this._activeTextures[textKey];\n activeTexture.usageCount--;\n if (activeTexture.usageCount === 0) {\n CanvasPool.returnCanvasAndContext(activeTexture.canvasAndContext);\n TexturePool.returnTexture(activeTexture.texture);\n const source = activeTexture.texture.source;\n source.resource = null;\n source.uploadMethodId = \"unknown\";\n source.alphaMode = \"no-premultiply-alpha\";\n this._activeTextures[textKey] = null;\n }\n }\n getReferenceCount(textKey) {\n return this._activeTextures[textKey].usageCount;\n }\n /**\n * Renders text to its canvas, and updates its texture.\n *\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n * @param text\n * @param style\n * @param resolution\n * @param canvasAndContext\n */\n renderTextToCanvas(text, style, resolution, canvasAndContext) {\n const { canvas, context } = canvasAndContext;\n const font = fontStringFromTextStyle(style);\n const measured = CanvasTextMetrics.measureText(text || \" \", style);\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n const height = canvas.height;\n context.resetTransform();\n context.scale(resolution, resolution);\n const padding = style.padding * 2;\n context.clearRect(0, 0, measured.width + 4 + padding, measured.height + 4 + padding);\n if (style._stroke?.width) {\n const strokeStyle = style._stroke;\n context.lineWidth = strokeStyle.width;\n context.miterLimit = strokeStyle.miterLimit;\n context.lineJoin = strokeStyle.join;\n context.lineCap = strokeStyle.cap;\n }\n context.font = font;\n let linePositionX;\n let linePositionY;\n const passesCount = style.dropShadow ? 2 : 1;\n for (let i = 0; i < passesCount; ++i) {\n const isShadowPass = style.dropShadow && i === 0;\n const dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + style.padding * 2) : 0;\n const dsOffsetShadow = dsOffsetText * resolution;\n if (isShadowPass) {\n context.fillStyle = \"black\";\n context.strokeStyle = \"black\";\n const shadowOptions = style.dropShadow;\n const dropShadowColor = shadowOptions.color;\n const dropShadowAlpha = shadowOptions.alpha;\n context.shadowColor = Color.shared.setValue(dropShadowColor).setAlpha(dropShadowAlpha).toRgbaString();\n const dropShadowBlur = shadowOptions.blur * resolution;\n const dropShadowDistance = shadowOptions.distance * resolution;\n context.shadowBlur = dropShadowBlur;\n context.shadowOffsetX = Math.cos(shadowOptions.angle) * dropShadowDistance;\n context.shadowOffsetY = Math.sin(shadowOptions.angle) * dropShadowDistance + dsOffsetShadow;\n } else {\n context.globalAlpha = style._fill?.alpha ?? 1;\n context.fillStyle = style._fill ? getCanvasFillStyle(style._fill, context) : null;\n if (style._stroke?.width) {\n context.strokeStyle = getCanvasFillStyle(style._stroke, context);\n }\n context.shadowColor = \"black\";\n }\n let linePositionYShift = (lineHeight - fontProperties.fontSize) / 2;\n if (lineHeight - fontProperties.fontSize < 0) {\n linePositionYShift = 0;\n }\n const strokeWidth = style._stroke?.width ?? 0;\n for (let i2 = 0; i2 < lines.length; i2++) {\n linePositionX = strokeWidth / 2;\n linePositionY = strokeWidth / 2 + i2 * lineHeight + fontProperties.ascent + linePositionYShift;\n if (style.align === \"right\") {\n linePositionX += maxLineWidth - lineWidths[i2];\n } else if (style.align === \"center\") {\n linePositionX += (maxLineWidth - lineWidths[i2]) / 2;\n }\n if (style._stroke?.width) {\n this._drawLetterSpacing(\n lines[i2],\n style,\n canvasAndContext,\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n if (style._fill !== void 0) {\n this._drawLetterSpacing(\n lines[i2],\n style,\n canvasAndContext,\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n }\n /**\n * Render the text with letter-spacing.\n * @param text - The text to draw\n * @param style\n * @param canvasAndContext\n * @param x - Horizontal position to draw the text\n * @param y - Vertical position to draw the text\n * @param isStroke - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n */\n _drawLetterSpacing(text, style, canvasAndContext, x, y, isStroke = false) {\n const { context } = canvasAndContext;\n const letterSpacing = style.letterSpacing;\n let useExperimentalLetterSpacing = false;\n if (CanvasTextMetrics.experimentalLetterSpacingSupported) {\n if (CanvasTextMetrics.experimentalLetterSpacing) {\n context.letterSpacing = `${letterSpacing}px`;\n context.textLetterSpacing = `${letterSpacing}px`;\n useExperimentalLetterSpacing = true;\n } else {\n context.letterSpacing = \"0px\";\n context.textLetterSpacing = \"0px\";\n }\n }\n if (letterSpacing === 0 || useExperimentalLetterSpacing) {\n if (isStroke) {\n context.strokeText(text, x, y);\n } else {\n context.fillText(text, x, y);\n }\n return;\n }\n let currentPosition = x;\n const stringArray = CanvasTextMetrics.graphemeSegmenter(text);\n let previousWidth = context.measureText(text).width;\n let currentWidth = 0;\n for (let i = 0; i < stringArray.length; ++i) {\n const currentChar = stringArray[i];\n if (isStroke) {\n context.strokeText(currentChar, currentPosition, y);\n } else {\n context.fillText(currentChar, currentPosition, y);\n }\n let textStr = \"\";\n for (let j = i + 1; j < stringArray.length; ++j) {\n textStr += stringArray[j];\n }\n currentWidth = context.measureText(textStr).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n }\n destroy() {\n this._activeTextures = null;\n }\n}\n/** @ignore */\nCanvasTextSystem.extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem\n ],\n name: \"canvasText\"\n};\n\nexport { CanvasTextSystem };\n//# sourceMappingURL=CanvasTextSystem.mjs.map\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import { browserExt } from './environment-browser/browserExt.mjs';\nimport { webworkerExt } from './environment-webworker/webworkerExt.mjs';\nimport { extensions } from './extensions/Extensions.mjs';\nexport { ExtensionType, normalizeExtensionPriority } from './extensions/Extensions.mjs';\nimport './rendering/init.mjs';\nimport './spritesheet/init.mjs';\nimport './accessibility/index.mjs';\nimport './advanced-blend-modes/index.mjs';\nimport './app/index.mjs';\nimport './assets/index.mjs';\nimport './color/index.mjs';\nimport './compressed-textures/index.mjs';\nimport './culling/index.mjs';\nimport './environment/index.mjs';\nimport './environment-browser/index.mjs';\nimport './environment-webworker/index.mjs';\nimport './events/index.mjs';\nimport './extensions/index.mjs';\nimport './filters/index.mjs';\nimport './maths/index.mjs';\nimport './prepare/index.mjs';\nimport './rendering/index.mjs';\nimport './scene/index.mjs';\nimport './spritesheet/index.mjs';\nimport './ticker/index.mjs';\nimport './utils/index.mjs';\nexport { AccessibilitySystem } from './accessibility/AccessibilitySystem.mjs';\nexport { accessibilityTarget } from './accessibility/accessibilityTarget.mjs';\nexport { ColorBlend } from './advanced-blend-modes/ColorBlend.mjs';\nexport { ColorBurnBlend } from './advanced-blend-modes/ColorBurnBlend.mjs';\nexport { ColorDodgeBlend } from './advanced-blend-modes/ColorDodgeBlend.mjs';\nexport { DarkenBlend } from './advanced-blend-modes/DarkenBlend.mjs';\nexport { DifferenceBlend } from './advanced-blend-modes/DifferenceBlend.mjs';\nexport { DivideBlend } from './advanced-blend-modes/DivideBlend.mjs';\nexport { ExclusionBlend } from './advanced-blend-modes/ExclusionBlend.mjs';\nexport { HardLightBlend } from './advanced-blend-modes/HardLightBlend.mjs';\nexport { HardMixBlend } from './advanced-blend-modes/HardMixBlend.mjs';\nexport { LightenBlend } from './advanced-blend-modes/LightenBlend.mjs';\nexport { LinearBurnBlend } from './advanced-blend-modes/LinearBurnBlend.mjs';\nexport { LinearDodgeBlend } from './advanced-blend-modes/LinearDodgeBlend.mjs';\nexport { LinearLightBlend } from './advanced-blend-modes/LinearLightBlend.mjs';\nexport { LuminosityBlend } from './advanced-blend-modes/LuminosityBlend.mjs';\nexport { NegationBlend } from './advanced-blend-modes/NegationBlend.mjs';\nexport { OverlayBlend } from './advanced-blend-modes/OverlayBlend.mjs';\nexport { PinLightBlend } from './advanced-blend-modes/PinLightBlend.mjs';\nexport { SaturationBlend } from './advanced-blend-modes/SaturationBlend.mjs';\nexport { SoftLightBlend } from './advanced-blend-modes/SoftLightBlend.mjs';\nexport { SubtractBlend } from './advanced-blend-modes/SubtractBlend.mjs';\nexport { VividLightBlend } from './advanced-blend-modes/VividLightBlend.mjs';\nexport { Application } from './app/Application.mjs';\nexport { ResizePlugin } from './app/ResizePlugin.mjs';\nexport { TickerPlugin } from './app/TickerPlugin.mjs';\nexport { Assets, AssetsClass } from './assets/Assets.mjs';\nexport { BackgroundLoader } from './assets/BackgroundLoader.mjs';\nexport { Cache } from './assets/cache/Cache.mjs';\nexport { cacheTextureArray } from './assets/cache/parsers/cacheTextureArray.mjs';\nexport { detectAvif } from './assets/detections/parsers/detectAvif.mjs';\nexport { detectDefaults } from './assets/detections/parsers/detectDefaults.mjs';\nexport { detectMp4 } from './assets/detections/parsers/detectMp4.mjs';\nexport { detectOgv } from './assets/detections/parsers/detectOgv.mjs';\nexport { detectWebm } from './assets/detections/parsers/detectWebm.mjs';\nexport { detectWebp } from './assets/detections/parsers/detectWebp.mjs';\nexport { testImageFormat } from './assets/detections/utils/testImageFormat.mjs';\nexport { testVideoFormat } from './assets/detections/utils/testVideoFormat.mjs';\nexport { Loader } from './assets/loader/Loader.mjs';\nexport { LoaderParserPriority } from './assets/loader/parsers/LoaderParser.mjs';\nexport { loadJson } from './assets/loader/parsers/loadJson.mjs';\nexport { loadTxt } from './assets/loader/parsers/loadTxt.mjs';\nexport { getFontFamilyName, loadWebFont } from './assets/loader/parsers/loadWebFont.mjs';\nexport { loadSvg } from './assets/loader/parsers/textures/loadSVG.mjs';\nexport { loadImageBitmap, loadTextures } from './assets/loader/parsers/textures/loadTextures.mjs';\nexport { crossOrigin, determineCrossOrigin, loadVideoTextures, preloadVideo } from './assets/loader/parsers/textures/loadVideoTextures.mjs';\nexport { createTexture } from './assets/loader/parsers/textures/utils/createTexture.mjs';\nexport { WorkerManager } from './assets/loader/workers/WorkerManager.mjs';\nexport { resolveJsonUrl } from './assets/resolver/parsers/resolveJsonUrl.mjs';\nexport { resolveTextureUrl } from './assets/resolver/parsers/resolveTextureUrl.mjs';\nexport { Resolver, getUrlExtension } from './assets/resolver/Resolver.mjs';\nexport { checkDataUrl } from './assets/utils/checkDataUrl.mjs';\nexport { checkExtension } from './assets/utils/checkExtension.mjs';\nexport { convertToList } from './assets/utils/convertToList.mjs';\nexport { copySearchParams } from './assets/utils/copySearchParams.mjs';\nexport { createStringVariations } from './assets/utils/createStringVariations.mjs';\nexport { isSingleItem } from './assets/utils/isSingleItem.mjs';\nexport { Color } from './color/Color.mjs';\nexport { detectBasis } from './compressed-textures/basis/detectBasis.mjs';\nexport { loadBasis } from './compressed-textures/basis/loadBasis.mjs';\nexport { createLevelBuffers } from './compressed-textures/basis/utils/createLevelBuffers.mjs';\nexport { gpuFormatToBasisTranscoderFormat } from './compressed-textures/basis/utils/gpuFormatToBasisTranscoderFormat.mjs';\nexport { basisTranscoderUrls, setBasisTranscoderPath } from './compressed-textures/basis/utils/setBasisTranscoderPath.mjs';\nexport { loadBasisOnWorker } from './compressed-textures/basis/worker/loadBasisOnWorker.mjs';\nexport { D3D10_RESOURCE_DIMENSION, D3DFMT, DDS, DXGI_FORMAT, DXGI_TO_TEXTURE_FORMAT, FOURCC_TO_TEXTURE_FORMAT, TEXTURE_FORMAT_BLOCK_SIZE } from './compressed-textures/dds/const.mjs';\nexport { loadDDS } from './compressed-textures/dds/loadDDS.mjs';\nexport { parseDDS } from './compressed-textures/dds/parseDDS.mjs';\nexport { loadKTX } from './compressed-textures/ktx/loadKTX.mjs';\nexport { parseKTX } from './compressed-textures/ktx/parseKTX.mjs';\nexport { GL_INTERNAL_FORMAT, KTX } from './compressed-textures/ktx2/const.mjs';\nexport { loadKTX2 } from './compressed-textures/ktx2/loadKTX2.mjs';\nexport { convertFormatIfRequired } from './compressed-textures/ktx2/utils/convertFormatIfRequired.mjs';\nexport { createLevelBuffersFromKTX } from './compressed-textures/ktx2/utils/createLevelBuffersFromKTX.mjs';\nexport { getTextureFormatFromKTXTexture } from './compressed-textures/ktx2/utils/getTextureFormatFromKTXTexture.mjs';\nexport { glFormatToGPUFormat } from './compressed-textures/ktx2/utils/glFormatToGPUFormat.mjs';\nexport { gpuFormatToKTXBasisTranscoderFormat } from './compressed-textures/ktx2/utils/gpuFormatToKTXBasisTranscoderFormat.mjs';\nexport { ktxTranscoderUrls, setKTXTranscoderPath } from './compressed-textures/ktx2/utils/setKTXTranscoderPath.mjs';\nexport { vkFormatToGPUFormat } from './compressed-textures/ktx2/utils/vkFormatToGPUFormat.mjs';\nexport { loadKTX2onWorker } from './compressed-textures/ktx2/worker/loadKTX2onWorker.mjs';\nexport { detectCompressed } from './compressed-textures/shared/detectCompressed.mjs';\nexport { resolveCompressedTextureUrl, validFormats } from './compressed-textures/shared/resolveCompressedTextureUrl.mjs';\nexport { Culler } from './culling/Culler.mjs';\nexport { CullerPlugin } from './culling/CullerPlugin.mjs';\nexport { cullingMixin } from './culling/cullingMixin.mjs';\nexport { DOMAdapter } from './environment/adapter.mjs';\nexport { autoDetectEnvironment, loadEnvironmentExtensions } from './environment/autoDetectEnvironment.mjs';\nexport { BrowserAdapter } from './environment-browser/BrowserAdapter.mjs';\nexport { WebWorkerAdapter } from './environment-webworker/WebWorkerAdapter.mjs';\nexport { EventBoundary } from './events/EventBoundary.mjs';\nexport { EventSystem } from './events/EventSystem.mjs';\nexport { EventsTicker } from './events/EventTicker.mjs';\nexport { FederatedEvent } from './events/FederatedEvent.mjs';\nexport { FederatedContainer } from './events/FederatedEventTarget.mjs';\nexport { FederatedMouseEvent } from './events/FederatedMouseEvent.mjs';\nexport { FederatedPointerEvent } from './events/FederatedPointerEvent.mjs';\nexport { FederatedWheelEvent } from './events/FederatedWheelEvent.mjs';\nexport { default as blendTemplateFrag } from './filters/blend-modes/blend-template.frag.mjs';\nexport { default as blendTemplateVert } from './filters/blend-modes/blend-template.vert.mjs';\nexport { default as blendTemplateWgsl } from './filters/blend-modes/blend-template.wgsl.mjs';\nexport { default as hslWgsl } from './filters/blend-modes/hsl.wgsl.mjs';\nexport { default as alphaFrag } from './filters/defaults/alpha/alpha.frag.mjs';\nexport { default as alphaWgsl } from './filters/defaults/alpha/alpha.wgsl.mjs';\nexport { default as blurTemplateWgsl } from './filters/defaults/blur/gpu/blur-template.wgsl.mjs';\nexport { default as colorMatrixFilterFrag } from './filters/defaults/color-matrix/colorMatrixFilter.frag.mjs';\nexport { default as colorMatrixFilterWgsl } from './filters/defaults/color-matrix/colorMatrixFilter.wgsl.mjs';\nexport { default as defaultFilterVert } from './filters/defaults/defaultFilter.vert.mjs';\nexport { default as displacementFrag } from './filters/defaults/displacement/displacement.frag.mjs';\nexport { default as displacementVert } from './filters/defaults/displacement/displacement.vert.mjs';\nexport { default as displacementWgsl } from './filters/defaults/displacement/displacement.wgsl.mjs';\nexport { default as noiseFrag } from './filters/defaults/noise/noise.frag.mjs';\nexport { default as noiseWgsl } from './filters/defaults/noise/noise.wgsl.mjs';\nexport { default as maskFrag } from './filters/mask/mask.frag.mjs';\nexport { default as maskVert } from './filters/mask/mask.vert.mjs';\nexport { default as maskWgsl } from './filters/mask/mask.wgsl.mjs';\nexport { BlendModeFilter } from './filters/blend-modes/BlendModeFilter.mjs';\nexport { hslgl } from './filters/blend-modes/hls/GLhls.mjs';\nexport { hslgpu } from './filters/blend-modes/hls/GPUhls.mjs';\nexport { AlphaFilter } from './filters/defaults/alpha/AlphaFilter.mjs';\nexport { BlurFilter } from './filters/defaults/blur/BlurFilter.mjs';\nexport { BlurFilterPass } from './filters/defaults/blur/BlurFilterPass.mjs';\nexport { GAUSSIAN_VALUES } from './filters/defaults/blur/const.mjs';\nexport { generateBlurFragSource } from './filters/defaults/blur/gl/generateBlurFragSource.mjs';\nexport { generateBlurGlProgram } from './filters/defaults/blur/gl/generateBlurGlProgram.mjs';\nexport { generateBlurVertSource } from './filters/defaults/blur/gl/generateBlurVertSource.mjs';\nexport { generateBlurProgram } from './filters/defaults/blur/gpu/generateBlurProgram.mjs';\nexport { ColorMatrixFilter } from './filters/defaults/color-matrix/ColorMatrixFilter.mjs';\nexport { DisplacementFilter } from './filters/defaults/displacement/DisplacementFilter.mjs';\nexport { NoiseFilter } from './filters/defaults/noise/NoiseFilter.mjs';\nexport { Filter } from './filters/Filter.mjs';\nexport { FilterEffect } from './filters/FilterEffect.mjs';\nexport { FilterPipe } from './filters/FilterPipe.mjs';\nexport { FilterSystem } from './filters/FilterSystem.mjs';\nexport { MaskFilter } from './filters/mask/MaskFilter.mjs';\nexport { groupD8 } from './maths/matrix/groupD8.mjs';\nexport { Matrix } from './maths/matrix/Matrix.mjs';\nexport { DEG_TO_RAD, PI_2, RAD_TO_DEG } from './maths/misc/const.mjs';\nexport { isPow2, log2, nextPow2 } from './maths/misc/pow2.mjs';\nexport { squaredDistanceToLineSegment } from './maths/misc/squaredDistanceToLineSegment.mjs';\nexport { ObservablePoint } from './maths/point/ObservablePoint.mjs';\nexport { Point } from './maths/point/Point.mjs';\nexport { pointInTriangle } from './maths/point/pointInTriangle.mjs';\nexport { Circle } from './maths/shapes/Circle.mjs';\nexport { Ellipse } from './maths/shapes/Ellipse.mjs';\nexport { Polygon } from './maths/shapes/Polygon.mjs';\nexport { Rectangle } from './maths/shapes/Rectangle.mjs';\nexport { RoundedRectangle } from './maths/shapes/RoundedRectangle.mjs';\nexport { Triangle } from './maths/shapes/Triangle.mjs';\nexport { PrepareBase } from './prepare/PrepareBase.mjs';\nexport { PrepareQueue } from './prepare/PrepareQueue.mjs';\nexport { PrepareSystem } from './prepare/PrepareSystem.mjs';\nexport { PrepareUpload } from './prepare/PrepareUpload.mjs';\nexport { GlBatchAdaptor } from './rendering/batcher/gl/GlBatchAdaptor.mjs';\nexport { checkMaxIfStatementsInShader } from './rendering/batcher/gl/utils/checkMaxIfStatementsInShader.mjs';\nexport { getMaxTexturesPerBatch } from './rendering/batcher/gl/utils/maxRecommendedTextures.mjs';\nexport { generateGPULayout } from './rendering/batcher/gpu/generateGPULayout.mjs';\nexport { generateLayout } from './rendering/batcher/gpu/generateLayout.mjs';\nexport { getTextureBatchBindGroup } from './rendering/batcher/gpu/getTextureBatchBindGroup.mjs';\nexport { GpuBatchAdaptor } from './rendering/batcher/gpu/GpuBatchAdaptor.mjs';\nexport { Batch, Batcher } from './rendering/batcher/shared/Batcher.mjs';\nexport { BatcherPipe } from './rendering/batcher/shared/BatcherPipe.mjs';\nexport { BatchGeometry } from './rendering/batcher/shared/BatchGeometry.mjs';\nexport { BatchTextureArray } from './rendering/batcher/shared/BatchTextureArray.mjs';\nexport { compileHighShaderGlProgram, compileHighShaderGpuProgram } from './rendering/high-shader/compileHighShaderToProgram.mjs';\nexport { compileHighShader, compileHighShaderGl } from './rendering/high-shader/compiler/compileHighShader.mjs';\nexport { addBits } from './rendering/high-shader/compiler/utils/addBits.mjs';\nexport { compileHooks, findHooksRx } from './rendering/high-shader/compiler/utils/compileHooks.mjs';\nexport { compileInputs } from './rendering/high-shader/compiler/utils/compileInputs.mjs';\nexport { compileOutputs } from './rendering/high-shader/compiler/utils/compileOutputs.mjs';\nexport { formatShader } from './rendering/high-shader/compiler/utils/formatShader.mjs';\nexport { injectBits } from './rendering/high-shader/compiler/utils/injectBits.mjs';\nexport { fragmentGPUTemplate, fragmentGlTemplate, vertexGPUTemplate, vertexGlTemplate } from './rendering/high-shader/defaultProgramTemplate.mjs';\nexport { colorBit, colorBitGl } from './rendering/high-shader/shader-bits/colorBit.mjs';\nexport { generateTextureBatchBit, generateTextureBatchBitGl } from './rendering/high-shader/shader-bits/generateTextureBatchBit.mjs';\nexport { globalUniformsBit, globalUniformsBitGl, globalUniformsUBOBitGl } from './rendering/high-shader/shader-bits/globalUniformsBit.mjs';\nexport { localUniformBit, localUniformBitGl, localUniformBitGroup2 } from './rendering/high-shader/shader-bits/localUniformBit.mjs';\nexport { roundPixelsBit, roundPixelsBitGl } from './rendering/high-shader/shader-bits/roundPixelsBit.mjs';\nexport { textureBit, textureBitGl } from './rendering/high-shader/shader-bits/textureBit.mjs';\nexport { AlphaMask } from './rendering/mask/alpha/AlphaMask.mjs';\nexport { AlphaMaskPipe } from './rendering/mask/alpha/AlphaMaskPipe.mjs';\nexport { ColorMask } from './rendering/mask/color/ColorMask.mjs';\nexport { ColorMaskPipe } from './rendering/mask/color/ColorMaskPipe.mjs';\nexport { MaskEffectManager, MaskEffectManagerClass } from './rendering/mask/MaskEffectManager.mjs';\nexport { ScissorMask } from './rendering/mask/scissor/ScissorMask.mjs';\nexport { StencilMask } from './rendering/mask/stencil/StencilMask.mjs';\nexport { StencilMaskPipe } from './rendering/mask/stencil/StencilMaskPipe.mjs';\nexport { addMaskBounds } from './rendering/mask/utils/addMaskBounds.mjs';\nexport { addMaskLocalBounds, getMatrixRelativeToParent } from './rendering/mask/utils/addMaskLocalBounds.mjs';\nexport { autoDetectRenderer } from './rendering/renderers/autoDetectRenderer.mjs';\nexport { BUFFER_TYPE } from './rendering/renderers/gl/buffer/const.mjs';\nexport { GlBuffer } from './rendering/renderers/gl/buffer/GlBuffer.mjs';\nexport { GlBufferSystem } from './rendering/renderers/gl/buffer/GlBufferSystem.mjs';\nexport { CLEAR } from './rendering/renderers/gl/const.mjs';\nexport { GlContextSystem } from './rendering/renderers/gl/context/GlContextSystem.mjs';\nexport { GlGeometrySystem } from './rendering/renderers/gl/geometry/GlGeometrySystem.mjs';\nexport { getGlTypeFromFormat } from './rendering/renderers/gl/geometry/utils/getGlTypeFromFormat.mjs';\nexport { GlBackBufferSystem } from './rendering/renderers/gl/GlBackBufferSystem.mjs';\nexport { GlColorMaskSystem } from './rendering/renderers/gl/GlColorMaskSystem.mjs';\nexport { GlEncoderSystem } from './rendering/renderers/gl/GlEncoderSystem.mjs';\nexport { GlRenderTarget } from './rendering/renderers/gl/GlRenderTarget.mjs';\nexport { GlStencilSystem } from './rendering/renderers/gl/GlStencilSystem.mjs';\nexport { GlUboSystem } from './rendering/renderers/gl/GlUboSystem.mjs';\nexport { GlRenderTargetAdaptor } from './rendering/renderers/gl/renderTarget/GlRenderTargetAdaptor.mjs';\nexport { GlRenderTargetSystem } from './rendering/renderers/gl/renderTarget/GlRenderTargetSystem.mjs';\nexport { generateShaderSyncCode } from './rendering/renderers/gl/shader/GenerateShaderSyncCode.mjs';\nexport { getBatchSamplersUniformGroup } from './rendering/renderers/gl/shader/getBatchSamplersUniformGroup.mjs';\nexport { GlProgram } from './rendering/renderers/gl/shader/GlProgram.mjs';\nexport { GlProgramData, IGLUniformData } from './rendering/renderers/gl/shader/GlProgramData.mjs';\nexport { GlShaderSystem } from './rendering/renderers/gl/shader/GlShaderSystem.mjs';\nexport { GlUniformGroupSystem } from './rendering/renderers/gl/shader/GlUniformGroupSystem.mjs';\nexport { migrateFragmentFromV7toV8 } from './rendering/renderers/gl/shader/migrateFragmentFromV7toV8.mjs';\nexport { compileShader } from './rendering/renderers/gl/shader/program/compileShader.mjs';\nexport { defaultValue } from './rendering/renderers/gl/shader/program/defaultValue.mjs';\nexport { ensureAttributes } from './rendering/renderers/gl/shader/program/ensureAttributes.mjs';\nexport { extractAttributesFromGlProgram } from './rendering/renderers/gl/shader/program/extractAttributesFromGlProgram.mjs';\nexport { generateProgram } from './rendering/renderers/gl/shader/program/generateProgram.mjs';\nexport { getMaxFragmentPrecision } from './rendering/renderers/gl/shader/program/getMaxFragmentPrecision.mjs';\nexport { getTestContext } from './rendering/renderers/gl/shader/program/getTestContext.mjs';\nexport { getUboData } from './rendering/renderers/gl/shader/program/getUboData.mjs';\nexport { getUniformData } from './rendering/renderers/gl/shader/program/getUniformData.mjs';\nexport { logProgramError } from './rendering/renderers/gl/shader/program/logProgramError.mjs';\nexport { mapSize } from './rendering/renderers/gl/shader/program/mapSize.mjs';\nexport { mapGlToVertexFormat, mapType } from './rendering/renderers/gl/shader/program/mapType.mjs';\nexport { addProgramDefines } from './rendering/renderers/gl/shader/program/preprocessors/addProgramDefines.mjs';\nexport { ensurePrecision } from './rendering/renderers/gl/shader/program/preprocessors/ensurePrecision.mjs';\nexport { insertVersion } from './rendering/renderers/gl/shader/program/preprocessors/insertVersion.mjs';\nexport { setProgramName } from './rendering/renderers/gl/shader/program/preprocessors/setProgramName.mjs';\nexport { stripVersion } from './rendering/renderers/gl/shader/program/preprocessors/stripVersion.mjs';\nexport { WGSL_TO_STD40_SIZE, createUboElementsSTD40 } from './rendering/renderers/gl/shader/utils/createUboElementsSTD40.mjs';\nexport { createUboSyncFunctionSTD40 } from './rendering/renderers/gl/shader/utils/createUboSyncSTD40.mjs';\nexport { generateArraySyncSTD40 } from './rendering/renderers/gl/shader/utils/generateArraySyncSTD40.mjs';\nexport { generateUniformsSync } from './rendering/renderers/gl/shader/utils/generateUniformsSync.mjs';\nexport { UNIFORM_TO_ARRAY_SETTERS, UNIFORM_TO_SINGLE_SETTERS } from './rendering/renderers/gl/shader/utils/generateUniformsSyncTypes.mjs';\nexport { GlStateSystem } from './rendering/renderers/gl/state/GlStateSystem.mjs';\nexport { mapWebGLBlendModesToPixi } from './rendering/renderers/gl/state/mapWebGLBlendModesToPixi.mjs';\nexport { GL_FORMATS, GL_TARGETS, GL_TYPES, GL_WRAP_MODES } from './rendering/renderers/gl/texture/const.mjs';\nexport { GlTexture } from './rendering/renderers/gl/texture/GlTexture.mjs';\nexport { GlTextureSystem } from './rendering/renderers/gl/texture/GlTextureSystem.mjs';\nexport { glUploadBufferImageResource } from './rendering/renderers/gl/texture/uploaders/glUploadBufferImageResource.mjs';\nexport { glUploadCompressedTextureResource } from './rendering/renderers/gl/texture/uploaders/glUploadCompressedTextureResource.mjs';\nexport { glUploadImageResource } from './rendering/renderers/gl/texture/uploaders/glUploadImageResource.mjs';\nexport { glUploadVideoResource } from './rendering/renderers/gl/texture/uploaders/glUploadVideoResource.mjs';\nexport { applyStyleParams } from './rendering/renderers/gl/texture/utils/applyStyleParams.mjs';\nexport { getSupportedGlCompressedTextureFormats } from './rendering/renderers/gl/texture/utils/getSupportedGlCompressedTextureFormats.mjs';\nexport { mapFormatToGlFormat } from './rendering/renderers/gl/texture/utils/mapFormatToGlFormat.mjs';\nexport { mapFormatToGlInternalFormat } from './rendering/renderers/gl/texture/utils/mapFormatToGlInternalFormat.mjs';\nexport { mapFormatToGlType } from './rendering/renderers/gl/texture/utils/mapFormatToGlType.mjs';\nexport { compareModeToGlCompare, mipmapScaleModeToGlFilter, scaleModeToGlFilter, wrapModeToGlAddress } from './rendering/renderers/gl/texture/utils/pixiToGlMaps.mjs';\nexport { unpremultiplyAlpha } from './rendering/renderers/gl/texture/utils/unpremultiplyAlpha.mjs';\nexport { WebGLRenderer } from './rendering/renderers/gl/WebGLRenderer.mjs';\nexport { BindGroupSystem } from './rendering/renderers/gpu/BindGroupSystem.mjs';\nexport { GpuBufferSystem } from './rendering/renderers/gpu/buffer/GpuBufferSystem.mjs';\nexport { GpuReadBuffer } from './rendering/renderers/gpu/buffer/GpuReadBuffer.mjs';\nexport { UboBatch } from './rendering/renderers/gpu/buffer/UboBatch.mjs';\nexport { GpuColorMaskSystem } from './rendering/renderers/gpu/GpuColorMaskSystem.mjs';\nexport { GpuDeviceSystem } from './rendering/renderers/gpu/GpuDeviceSystem.mjs';\nexport { GpuEncoderSystem } from './rendering/renderers/gpu/GpuEncoderSystem.mjs';\nexport { GpuStencilSystem } from './rendering/renderers/gpu/GpuStencilSystem.mjs';\nexport { GpuUboSystem } from './rendering/renderers/gpu/GpuUboSystem.mjs';\nexport { GpuUniformBatchPipe } from './rendering/renderers/gpu/GpuUniformBatchPipe.mjs';\nexport { PipelineSystem } from './rendering/renderers/gpu/pipeline/PipelineSystem.mjs';\nexport { calculateProjection } from './rendering/renderers/gpu/renderTarget/calculateProjection.mjs';\nexport { GpuRenderTarget } from './rendering/renderers/gpu/renderTarget/GpuRenderTarget.mjs';\nexport { GpuRenderTargetAdaptor } from './rendering/renderers/gpu/renderTarget/GpuRenderTargetAdaptor.mjs';\nexport { GpuRenderTargetSystem } from './rendering/renderers/gpu/renderTarget/GpuRenderTargetSystem.mjs';\nexport { BindGroup } from './rendering/renderers/gpu/shader/BindGroup.mjs';\nexport { GpuProgram } from './rendering/renderers/gpu/shader/GpuProgram.mjs';\nexport { GpuShaderSystem } from './rendering/renderers/gpu/shader/GpuShaderSystem.mjs';\nexport { WGSL_ALIGN_SIZE_DATA, createUboElementsWGSL } from './rendering/renderers/gpu/shader/utils/createUboElementsWGSL.mjs';\nexport { createUboSyncFunctionWGSL } from './rendering/renderers/gpu/shader/utils/createUboSyncFunctionWGSL.mjs';\nexport { extractAttributesFromGpuProgram } from './rendering/renderers/gpu/shader/utils/extractAttributesFromGpuProgram.mjs';\nexport { extractStructAndGroups } from './rendering/renderers/gpu/shader/utils/extractStructAndGroups.mjs';\nexport { generateArraySyncWGSL } from './rendering/renderers/gpu/shader/utils/generateArraySyncWGSL.mjs';\nexport { generateGpuLayoutGroups } from './rendering/renderers/gpu/shader/utils/generateGpuLayoutGroups.mjs';\nexport { generateLayoutHash } from './rendering/renderers/gpu/shader/utils/generateLayoutHash.mjs';\nexport { removeStructAndGroupDuplicates } from './rendering/renderers/gpu/shader/utils/removeStructAndGroupDuplicates.mjs';\nexport { GpuBlendModesToPixi } from './rendering/renderers/gpu/state/GpuBlendModesToPixi.mjs';\nexport { GpuStateSystem } from './rendering/renderers/gpu/state/GpuStateSystem.mjs';\nexport { GpuStencilModesToPixi } from './rendering/renderers/gpu/state/GpuStencilModesToPixi.mjs';\nexport { GpuTextureSystem } from './rendering/renderers/gpu/texture/GpuTextureSystem.mjs';\nexport { gpuUploadBufferImageResource } from './rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs';\nexport { blockDataMap, gpuUploadCompressedTextureResource } from './rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs';\nexport { gpuUploadImageResource } from './rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs';\nexport { gpuUploadVideoResource } from './rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs';\nexport { getSupportedGPUCompressedTextureFormats } from './rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.mjs';\nexport { GpuMipmapGenerator } from './rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs';\nexport { WebGPURenderer } from './rendering/renderers/gpu/WebGPURenderer.mjs';\nexport { BackgroundSystem } from './rendering/renderers/shared/background/BackgroundSystem.mjs';\nexport { BlendModePipe } from './rendering/renderers/shared/blendModes/BlendModePipe.mjs';\nexport { Buffer } from './rendering/renderers/shared/buffer/Buffer.mjs';\nexport { BufferResource } from './rendering/renderers/shared/buffer/BufferResource.mjs';\nexport { BufferUsage } from './rendering/renderers/shared/buffer/const.mjs';\nexport { fastCopy } from './rendering/renderers/shared/buffer/utils/fastCopy.mjs';\nexport { ExtractSystem } from './rendering/renderers/shared/extract/ExtractSystem.mjs';\nexport { GenerateTextureSystem } from './rendering/renderers/shared/extract/GenerateTextureSystem.mjs';\nexport { DRAW_MODES } from './rendering/renderers/shared/geometry/const.mjs';\nexport { Geometry } from './rendering/renderers/shared/geometry/Geometry.mjs';\nexport { buildSimpleUvs, buildUvs } from './rendering/renderers/shared/geometry/utils/buildUvs.mjs';\nexport { ensureIsBuffer } from './rendering/renderers/shared/geometry/utils/ensureIsBuffer.mjs';\nexport { getAttributeInfoFromFormat } from './rendering/renderers/shared/geometry/utils/getAttributeInfoFromFormat.mjs';\nexport { getGeometryBounds } from './rendering/renderers/shared/geometry/utils/getGeometryBounds.mjs';\nexport { transformVertices } from './rendering/renderers/shared/geometry/utils/transformVertices.mjs';\nexport { InstructionSet } from './rendering/renderers/shared/instructions/InstructionSet.mjs';\nexport { GlobalUniformSystem } from './rendering/renderers/shared/renderTarget/GlobalUniformSystem.mjs';\nexport { isRenderingToScreen } from './rendering/renderers/shared/renderTarget/isRenderingToScreen.mjs';\nexport { RenderTarget } from './rendering/renderers/shared/renderTarget/RenderTarget.mjs';\nexport { RenderTargetSystem } from './rendering/renderers/shared/renderTarget/RenderTargetSystem.mjs';\nexport { viewportFromFrame } from './rendering/renderers/shared/renderTarget/viewportFromFrame.mjs';\nexport { ShaderStage } from './rendering/renderers/shared/shader/const.mjs';\nexport { Shader } from './rendering/renderers/shared/shader/Shader.mjs';\nexport { UNIFORM_TYPES_MAP, UNIFORM_TYPES_VALUES } from './rendering/renderers/shared/shader/types.mjs';\nexport { UboSystem } from './rendering/renderers/shared/shader/UboSystem.mjs';\nexport { UniformGroup } from './rendering/renderers/shared/shader/UniformGroup.mjs';\nexport { createUboSyncFunction } from './rendering/renderers/shared/shader/utils/createUboSyncFunction.mjs';\nexport { getDefaultUniformValue } from './rendering/renderers/shared/shader/utils/getDefaultUniformValue.mjs';\nexport { uboSyncFunctionsSTD40, uboSyncFunctionsWGSL } from './rendering/renderers/shared/shader/utils/uboSyncFunctions.mjs';\nexport { uniformParsers } from './rendering/renderers/shared/shader/utils/uniformParsers.mjs';\nexport { HelloSystem } from './rendering/renderers/shared/startup/HelloSystem.mjs';\nexport { BLEND_TO_NPM, STENCIL_MODES } from './rendering/renderers/shared/state/const.mjs';\nexport { getAdjustedBlendModeBlend } from './rendering/renderers/shared/state/getAdjustedBlendModeBlend.mjs';\nexport { State } from './rendering/renderers/shared/state/State.mjs';\nexport { AbstractRenderer } from './rendering/renderers/shared/system/AbstractRenderer.mjs';\nexport { SharedRenderPipes, SharedSystems } from './rendering/renderers/shared/system/SharedSystems.mjs';\nexport { SystemRunner } from './rendering/renderers/shared/system/SystemRunner.mjs';\nexport { CanvasPool, CanvasPoolClass } from './rendering/renderers/shared/texture/CanvasPool.mjs';\nexport { DEPRECATED_SCALE_MODES, DEPRECATED_WRAP_MODES, MSAA_QUALITY, SCALE_MODES, WRAP_MODES } from './rendering/renderers/shared/texture/const.mjs';\nexport { RenderTexture } from './rendering/renderers/shared/texture/RenderTexture.mjs';\nexport { BufferImageSource } from './rendering/renderers/shared/texture/sources/BufferImageSource.mjs';\nexport { CanvasSource } from './rendering/renderers/shared/texture/sources/CanvasSource.mjs';\nexport { CompressedSource } from './rendering/renderers/shared/texture/sources/CompressedSource.mjs';\nexport { ImageSource } from './rendering/renderers/shared/texture/sources/ImageSource.mjs';\nexport { TextureSource } from './rendering/renderers/shared/texture/sources/TextureSource.mjs';\nexport { VideoSource } from './rendering/renderers/shared/texture/sources/VideoSource.mjs';\nexport { Texture } from './rendering/renderers/shared/texture/Texture.mjs';\nexport { TextureGCSystem } from './rendering/renderers/shared/texture/TextureGCSystem.mjs';\nexport { TextureMatrix } from './rendering/renderers/shared/texture/TextureMatrix.mjs';\nexport { TexturePool, TexturePoolClass } from './rendering/renderers/shared/texture/TexturePool.mjs';\nexport { TextureStyle } from './rendering/renderers/shared/texture/TextureStyle.mjs';\nexport { TextureUvs } from './rendering/renderers/shared/texture/TextureUvs.mjs';\nexport { generateUID } from './rendering/renderers/shared/texture/utils/generateUID.mjs';\nexport { getCanvasTexture, hasCachedCanvasTexture } from './rendering/renderers/shared/texture/utils/getCanvasTexture.mjs';\nexport { getSupportedCompressedTextureFormats } from './rendering/renderers/shared/texture/utils/getSupportedCompressedTextureFormats.mjs';\nexport { getSupportedTextureFormats, nonCompressedFormats } from './rendering/renderers/shared/texture/utils/getSupportedTextureFormats.mjs';\nexport { autoDetectSource, resourceToTexture, textureFrom } from './rendering/renderers/shared/texture/utils/textureFrom.mjs';\nexport { createIdFromString } from './rendering/renderers/shared/utils/createIdFromString.mjs';\nexport { parseFunctionBody } from './rendering/renderers/shared/utils/parseFunctionBody.mjs';\nexport { ViewSystem } from './rendering/renderers/shared/view/ViewSystem.mjs';\nexport { RendererType } from './rendering/renderers/types.mjs';\nexport { Bounds } from './scene/container/bounds/Bounds.mjs';\nexport { _getGlobalBoundsRecursive, getFastGlobalBounds } from './scene/container/bounds/getFastGlobalBounds.mjs';\nexport { _getGlobalBounds, getGlobalBounds, updateTransformBackwards } from './scene/container/bounds/getGlobalBounds.mjs';\nexport { getLocalBounds, getParent } from './scene/container/bounds/getLocalBounds.mjs';\nexport { getGlobalRenderableBounds } from './scene/container/bounds/getRenderableBounds.mjs';\nexport { boundsPool, matrixPool } from './scene/container/bounds/utils/matrixAndBoundsPool.mjs';\nexport { childrenHelperMixin } from './scene/container/container-mixins/childrenHelperMixin.mjs';\nexport { effectsMixin } from './scene/container/container-mixins/effectsMixin.mjs';\nexport { findMixin } from './scene/container/container-mixins/findMixin.mjs';\nexport { measureMixin } from './scene/container/container-mixins/measureMixin.mjs';\nexport { onRenderMixin } from './scene/container/container-mixins/onRenderMixin.mjs';\nexport { sortMixin } from './scene/container/container-mixins/sortMixin.mjs';\nexport { toLocalGlobalMixin } from './scene/container/container-mixins/toLocalGlobalMixin.mjs';\nexport { Container, UPDATE_BLEND, UPDATE_COLOR, UPDATE_TRANSFORM, UPDATE_VISIBLE } from './scene/container/Container.mjs';\nexport { CustomRenderPipe } from './scene/container/CustomRenderPipe.mjs';\nexport { RenderContainer } from './scene/container/RenderContainer.mjs';\nexport { RenderGroup } from './scene/container/RenderGroup.mjs';\nexport { RenderGroupPipe } from './scene/container/RenderGroupPipe.mjs';\nexport { RenderGroupSystem } from './scene/container/RenderGroupSystem.mjs';\nexport { assignWithIgnore } from './scene/container/utils/assignWithIgnore.mjs';\nexport { buildInstructions, collectAllRenderables } from './scene/container/utils/buildInstructions.mjs';\nexport { checkChildrenDidChange } from './scene/container/utils/checkChildrenDidChange.mjs';\nexport { clearList } from './scene/container/utils/clearList.mjs';\nexport { collectRenderGroups } from './scene/container/utils/collectRenderGroups.mjs';\nexport { definedProps } from './scene/container/utils/definedProps.mjs';\nexport { executeInstructions } from './scene/container/utils/executeInstructions.mjs';\nexport { mixColors, mixStandardAnd32BitColors } from './scene/container/utils/mixColors.mjs';\nexport { mixHexColors } from './scene/container/utils/mixHexColors.mjs';\nexport { multiplyHexColors } from './scene/container/utils/multiplyHexColors.mjs';\nexport { updateLocalTransform } from './scene/container/utils/updateLocalTransform.mjs';\nexport { updateRenderGroupTransform, updateRenderGroupTransforms, updateTransformAndChildren } from './scene/container/utils/updateRenderGroupTransforms.mjs';\nexport { updateWorldTransform } from './scene/container/utils/updateWorldTransform.mjs';\nexport { validateRenderables } from './scene/container/utils/validateRenderables.mjs';\nexport { GlGraphicsAdaptor } from './scene/graphics/gl/GlGraphicsAdaptor.mjs';\nexport { color32BitToUniform, colorToUniform } from './scene/graphics/gpu/colorToUniform.mjs';\nexport { GpuGraphicsAdaptor } from './scene/graphics/gpu/GpuGraphicsAdaptor.mjs';\nexport { BatchableGraphics } from './scene/graphics/shared/BatchableGraphics.mjs';\nexport { buildAdaptiveBezier } from './scene/graphics/shared/buildCommands/buildAdaptiveBezier.mjs';\nexport { buildAdaptiveQuadratic } from './scene/graphics/shared/buildCommands/buildAdaptiveQuadratic.mjs';\nexport { buildArc } from './scene/graphics/shared/buildCommands/buildArc.mjs';\nexport { buildArcTo } from './scene/graphics/shared/buildCommands/buildArcTo.mjs';\nexport { buildArcToSvg } from './scene/graphics/shared/buildCommands/buildArcToSvg.mjs';\nexport { buildCircle, buildEllipse, buildRoundedRectangle } from './scene/graphics/shared/buildCommands/buildCircle.mjs';\nexport { buildLine } from './scene/graphics/shared/buildCommands/buildLine.mjs';\nexport { buildPolygon } from './scene/graphics/shared/buildCommands/buildPolygon.mjs';\nexport { buildRectangle } from './scene/graphics/shared/buildCommands/buildRectangle.mjs';\nexport { buildTriangle } from './scene/graphics/shared/buildCommands/buildTriangle.mjs';\nexport { closePointEps, curveEps } from './scene/graphics/shared/const.mjs';\nexport { FillGradient } from './scene/graphics/shared/fill/FillGradient.mjs';\nexport { FillPattern } from './scene/graphics/shared/fill/FillPattern.mjs';\nexport { Graphics } from './scene/graphics/shared/Graphics.mjs';\nexport { GraphicsContext } from './scene/graphics/shared/GraphicsContext.mjs';\nexport { GpuGraphicsContext, GraphicsContextRenderData, GraphicsContextSystem } from './scene/graphics/shared/GraphicsContextSystem.mjs';\nexport { GraphicsPipe } from './scene/graphics/shared/GraphicsPipe.mjs';\nexport { GraphicsPath } from './scene/graphics/shared/path/GraphicsPath.mjs';\nexport { roundedShapeArc, roundedShapeQuadraticCurve } from './scene/graphics/shared/path/roundShape.mjs';\nexport { ShapePath } from './scene/graphics/shared/path/ShapePath.mjs';\nexport { SVGParser } from './scene/graphics/shared/svg/SVGParser.mjs';\nexport { SVGToGraphicsPath } from './scene/graphics/shared/svg/SVGToGraphicsPath.mjs';\nexport { buildContextBatches, shapeBuilders } from './scene/graphics/shared/utils/buildContextBatches.mjs';\nexport { buildGeometryFromPath } from './scene/graphics/shared/utils/buildGeometryFromPath.mjs';\nexport { toFillStyle, toStrokeStyle } from './scene/graphics/shared/utils/convertFillInputToFillStyle.mjs';\nexport { getOrientationOfPoints } from './scene/graphics/shared/utils/getOrientationOfPoints.mjs';\nexport { triangulateWithHoles } from './scene/graphics/shared/utils/triangulateWithHoles.mjs';\nexport { MeshPlane } from './scene/mesh-plane/MeshPlane.mjs';\nexport { PlaneGeometry } from './scene/mesh-plane/PlaneGeometry.mjs';\nexport { MeshRope } from './scene/mesh-simple/MeshRope.mjs';\nexport { MeshSimple } from './scene/mesh-simple/MeshSimple.mjs';\nexport { RopeGeometry } from './scene/mesh-simple/RopeGeometry.mjs';\nexport { GlMeshAdaptor } from './scene/mesh/gl/GlMeshAdaptor.mjs';\nexport { GpuMeshAdapter } from './scene/mesh/gpu/GpuMeshAdapter.mjs';\nexport { BatchableMesh } from './scene/mesh/shared/BatchableMesh.mjs';\nexport { getTextureDefaultMatrix } from './scene/mesh/shared/getTextureDefaultMatrix.mjs';\nexport { Mesh } from './scene/mesh/shared/Mesh.mjs';\nexport { MeshGeometry } from './scene/mesh/shared/MeshGeometry.mjs';\nexport { MeshPipe } from './scene/mesh/shared/MeshPipe.mjs';\nexport { AnimatedSprite } from './scene/sprite-animated/AnimatedSprite.mjs';\nexport { NineSliceGeometry } from './scene/sprite-nine-slice/NineSliceGeometry.mjs';\nexport { NineSlicePlane, NineSliceSprite } from './scene/sprite-nine-slice/NineSliceSprite.mjs';\nexport { NineSliceSpritePipe } from './scene/sprite-nine-slice/NineSliceSpritePipe.mjs';\nexport { tilingBit, tilingBitGl } from './scene/sprite-tiling/shader/tilingBit.mjs';\nexport { TilingSpriteShader } from './scene/sprite-tiling/shader/TilingSpriteShader.mjs';\nexport { TilingSprite } from './scene/sprite-tiling/TilingSprite.mjs';\nexport { TilingSpritePipe } from './scene/sprite-tiling/TilingSpritePipe.mjs';\nexport { applyMatrix } from './scene/sprite-tiling/utils/applyMatrix.mjs';\nexport { QuadGeometry } from './scene/sprite-tiling/utils/QuadGeometry.mjs';\nexport { setPositions } from './scene/sprite-tiling/utils/setPositions.mjs';\nexport { setUvs } from './scene/sprite-tiling/utils/setUvs.mjs';\nexport { BatchableSprite } from './scene/sprite/BatchableSprite.mjs';\nexport { Sprite } from './scene/sprite/Sprite.mjs';\nexport { SpritePipe } from './scene/sprite/SpritePipe.mjs';\nexport { AbstractBitmapFont } from './scene/text-bitmap/AbstractBitmapFont.mjs';\nexport { bitmapFontTextParser } from './scene/text-bitmap/asset/bitmapFontTextParser.mjs';\nexport { bitmapFontXMLParser } from './scene/text-bitmap/asset/bitmapFontXMLParser.mjs';\nexport { bitmapFontXMLStringParser } from './scene/text-bitmap/asset/bitmapFontXMLStringParser.mjs';\nexport { bitmapFontCachePlugin, loadBitmapFont } from './scene/text-bitmap/asset/loadBitmapFont.mjs';\nexport { BitmapFont } from './scene/text-bitmap/BitmapFont.mjs';\nexport { BitmapFontManager } from './scene/text-bitmap/BitmapFontManager.mjs';\nexport { BitmapText } from './scene/text-bitmap/BitmapText.mjs';\nexport { BitmapTextPipe } from './scene/text-bitmap/BitmapTextPipe.mjs';\nexport { DynamicBitmapFont } from './scene/text-bitmap/DynamicBitmapFont.mjs';\nexport { getBitmapTextLayout } from './scene/text-bitmap/utils/getBitmapTextLayout.mjs';\nexport { resolveCharacters } from './scene/text-bitmap/utils/resolveCharacters.mjs';\nexport { HTMLText } from './scene/text-html/HTMLText.mjs';\nexport { HTMLTextPipe } from './scene/text-html/HTMLTextPipe.mjs';\nexport { HTMLTextRenderData, nssvg, nsxhtml } from './scene/text-html/HTMLTextRenderData.mjs';\nexport { HTMLTextStyle } from './scene/text-html/HtmlTextStyle.mjs';\nexport { HTMLTextSystem } from './scene/text-html/HTMLTextSystem.mjs';\nexport { extractFontFamilies } from './scene/text-html/utils/extractFontFamilies.mjs';\nexport { FontStylePromiseCache, getFontCss } from './scene/text-html/utils/getFontCss.mjs';\nexport { getSVGUrl } from './scene/text-html/utils/getSVGUrl.mjs';\nexport { getTemporaryCanvasFromImage } from './scene/text-html/utils/getTemporaryCanvasFromImage.mjs';\nexport { loadFontAsBase64 } from './scene/text-html/utils/loadFontAsBase64.mjs';\nexport { loadFontCSS } from './scene/text-html/utils/loadFontCSS.mjs';\nexport { loadSVGImage } from './scene/text-html/utils/loadSVGImage.mjs';\nexport { measureHtmlText } from './scene/text-html/utils/measureHtmlText.mjs';\nexport { textStyleToCSS } from './scene/text-html/utils/textStyleToCSS.mjs';\nexport { AbstractText, ensureOptions } from './scene/text/AbstractText.mjs';\nexport { CanvasTextMetrics } from './scene/text/canvas/CanvasTextMetrics.mjs';\nexport { CanvasTextPipe } from './scene/text/canvas/CanvasTextPipe.mjs';\nexport { CanvasTextSystem } from './scene/text/canvas/CanvasTextSystem.mjs';\nexport { fontStringFromTextStyle } from './scene/text/canvas/utils/fontStringFromTextStyle.mjs';\nexport { getCanvasFillStyle } from './scene/text/canvas/utils/getCanvasFillStyle.mjs';\nexport { SdfShader } from './scene/text/sdfShader/SdfShader.mjs';\nexport { localUniformMSDFBit, localUniformMSDFBitGl } from './scene/text/sdfShader/shader-bits/localUniformMSDFBit.mjs';\nexport { mSDFBit, mSDFBitGl } from './scene/text/sdfShader/shader-bits/mSDFBit.mjs';\nexport { Text } from './scene/text/Text.mjs';\nexport { TextStyle } from './scene/text/TextStyle.mjs';\nexport { ensureTextStyle } from './scene/text/utils/ensureTextStyle.mjs';\nexport { generateTextStyleKey } from './scene/text/utils/generateTextStyleKey.mjs';\nexport { getPo2TextureFromSource } from './scene/text/utils/getPo2TextureFromSource.mjs';\nexport { Spritesheet } from './spritesheet/Spritesheet.mjs';\nexport { spritesheetAsset } from './spritesheet/spritesheetAsset.mjs';\nexport { UPDATE_PRIORITY } from './ticker/const.mjs';\nexport { Ticker } from './ticker/Ticker.mjs';\nexport { TickerListener } from './ticker/TickerListener.mjs';\nexport { detectVideoAlphaMode } from './utils/browser/detectVideoAlphaMode.mjs';\nexport { isMobile } from './utils/browser/isMobile.mjs';\nexport { isSafari } from './utils/browser/isSafari.mjs';\nexport { isWebGLSupported } from './utils/browser/isWebGLSupported.mjs';\nexport { isWebGPUSupported } from './utils/browser/isWebGPUSupported.mjs';\nexport { unsafeEvalSupported } from './utils/browser/unsafeEvalSupported.mjs';\nexport { getCanvasBoundingBox } from './utils/canvas/getCanvasBoundingBox.mjs';\nexport { DATA_URI } from './utils/const.mjs';\nexport { default as EventEmitter } from 'eventemitter3';\nexport { removeItems } from './utils/data/removeItems.mjs';\nexport { resetUids, uid } from './utils/data/uid.mjs';\nexport { updateQuadBounds } from './utils/data/updateQuadBounds.mjs';\nexport { ViewableBuffer } from './utils/data/ViewableBuffer.mjs';\nexport { ApplicationInitHook, RendererInitHook } from './utils/global/globalHooks.mjs';\nexport { deprecation, v8_0_0 } from './utils/logging/deprecation.mjs';\nexport { logDebugTexture } from './utils/logging/logDebugTexture.mjs';\nexport { logRenderGroupScene, logScene } from './utils/logging/logScene.mjs';\nexport { warn } from './utils/logging/warn.mjs';\nexport { NOOP } from './utils/misc/NOOP.mjs';\nexport { Transform } from './utils/misc/Transform.mjs';\nexport { getResolutionOfUrl } from './utils/network/getResolutionOfUrl.mjs';\nexport { path } from './utils/path.mjs';\nexport { Pool } from './utils/pool/Pool.mjs';\nexport { BigPool, PoolGroupClass } from './utils/pool/PoolGroup.mjs';\nexport { VERSION, sayHello } from './utils/sayHello.mjs';\nexport { default as earcut } from 'earcut';\n\n\"use strict\";\nextensions.add(browserExt, webworkerExt);\n\nexport { browserExt, extensions, webworkerExt };\n//# sourceMappingURL=index.mjs.map\n","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","// src/analysis/MusicAnalyzer.ts\r\nvar MusicAnalyzer = class {\r\n /**returns a list of measure indexes indicating the start measures of any\r\n * regions that match the region described by your [regionStartIndex] and\r\n * [regionEndIndex]. Time signatures will always be checked if [checkNotes]\r\n * is true, regardless of [checkTimeSigs].*/\r\n findRegionMatches(measures, regionStartIndex, regionEndIndex, {\r\n checkNotes = true,\r\n checkTempi = true,\r\n checkTimeSigs = true,\r\n allowRegionOverlap = false\r\n }) {\r\n let matches = [];\r\n let regLength = regionEndIndex - regionStartIndex + 1;\r\n for (let i = 0; i + regLength <= regionStartIndex; i++) {\r\n if (this.regionsMatch(\r\n measures,\r\n regionStartIndex,\r\n regionEndIndex,\r\n i,\r\n {\r\n checkNotes,\r\n checkTempi,\r\n checkTimeSigs\r\n }\r\n )) {\r\n matches.push(i);\r\n if (!allowRegionOverlap) {\r\n i += regLength - 1;\r\n }\r\n }\r\n }\r\n for (let i = regionEndIndex + 1; i + regLength <= measures.length; i++) {\r\n if (this.regionsMatch(\r\n measures,\r\n regionStartIndex,\r\n regionEndIndex,\r\n i,\r\n {\r\n checkNotes,\r\n checkTempi,\r\n checkTimeSigs\r\n }\r\n )) {\r\n matches.push(i);\r\n if (!allowRegionOverlap) {\r\n i += regLength - 1;\r\n }\r\n }\r\n }\r\n return matches;\r\n }\r\n /**returns true if the measures in two regions match. Specify the indexes\r\n * of the start and end measures in the first region and the index of the\r\n * start measure in the second region. Time signatures will always be \r\n * checked if [checkNotes] is true, regardless of [checkTimeSigs].*/\r\n regionsMatch(measures, region1StartIndex, region1EndIndex, region2StartIndex, {\r\n checkNotes = true,\r\n checkTempi = true,\r\n checkTimeSigs = true\r\n }) {\r\n if (checkNotes && !this._notesMatch(\r\n measures,\r\n region1StartIndex,\r\n region1EndIndex,\r\n region2StartIndex\r\n )) {\r\n return false;\r\n }\r\n if (checkTempi && !this._tempiMatch(\r\n measures,\r\n region1StartIndex,\r\n region1EndIndex,\r\n region2StartIndex\r\n )) {\r\n return false;\r\n }\r\n if (!checkNotes && checkTimeSigs && !this._timeSigsMatch(\r\n measures,\r\n region1StartIndex,\r\n region1EndIndex,\r\n region2StartIndex\r\n )) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n _notesMatch(measures, region1StartIndex, region1EndIndex, region2StartIndex) {\r\n for (let i = region1StartIndex; i <= region1EndIndex; i++) {\r\n let measure1 = measures[i];\r\n let measure2 = measures[region2StartIndex + i - region1StartIndex];\r\n if (measure1.stack.qNoteLength !== measure2.stack.qNoteLength) {\r\n return false;\r\n }\r\n if (measure1.voices.length !== measure2.voices.length) {\r\n return false;\r\n }\r\n for (let j = 0; j < measure1.voices.length; j++) {\r\n let ngList1 = measure1.voices[j].noteGroups;\r\n let ngList2 = measure2.voices[j].noteGroups;\r\n if (ngList1.length !== ngList2.length) {\r\n return false;\r\n }\r\n for (let k = 0; k < ngList1.length; k++) {\r\n let ng1 = ngList1[k];\r\n let ng2 = ngList2[k];\r\n if (ng1.duration !== ng2.duration || ng1.numDots !== ng2.numDots) {\r\n return false;\r\n }\r\n let notes1 = ng1.notes;\r\n let notes2 = ng2.notes;\r\n if (notes1.length !== notes2.length) {\r\n return false;\r\n }\r\n for (let l = 0; l < notes1.length; l++) {\r\n if (notes1[l].displayCents !== notes2[l].displayCents) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n _tempiMatch(measures, region1StartIndex, region1EndIndex, region2StartIndex) {\r\n let stack1 = measures[region1StartIndex].stack;\r\n let stack2 = measures[region2StartIndex].stack;\r\n let currentTM1 = stack1.getInheritedTempoMarker();\r\n let currentTM2 = stack2.getInheritedTempoMarker();\r\n if (currentTM1.tempo !== currentTM2.tempo) {\r\n return false;\r\n }\r\n for (let i = region1StartIndex; i <= region1EndIndex; i++) {\r\n stack1 = measures[i].stack;\r\n stack2 = measures[region2StartIndex + i - region1StartIndex].stack;\r\n if ((stack1.tempoMarkers == null || stack1.tempoMarkers.length === 0) && (stack2.tempoMarkers == null || stack2.tempoMarkers.length === 0)) {\r\n continue;\r\n }\r\n let map1 = /* @__PURE__ */ new Map([[0, currentTM1]]);\r\n if (stack1.tempoMarkers != null) {\r\n for (let tm of stack1.tempoMarkers) {\r\n map1.set(tm.qNoteTime - stack1.startTime, tm);\r\n }\r\n }\r\n let map2 = /* @__PURE__ */ new Map([[0, currentTM2]]);\r\n if (stack2.tempoMarkers != null) {\r\n for (let tm of stack2.tempoMarkers) {\r\n map2.set(tm.qNoteTime - stack2.startTime, tm);\r\n }\r\n }\r\n for (let e of map1.entries()) {\r\n if (map2.get(e[0])?.tempo !== e[1].tempo) {\r\n return false;\r\n }\r\n }\r\n for (let e of map2.entries()) {\r\n if (map1.get(e[0])?.tempo !== e[1].tempo) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n _timeSigsMatch(measures, region1StartIndex, region1EndIndex, region2StartIndex) {\r\n for (let i = region1StartIndex; i <= region1EndIndex; i++) {\r\n let measure1 = measures[i];\r\n let measure2 = measures[region2StartIndex + i - region1StartIndex];\r\n if (measure1.numBeats !== measure2.numBeats || measure1.beatType !== measure2.beatType) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n};\r\n\r\n// src/data/constants/ClefType.ts\r\nvar _ClefType = class _ClefType {\r\n static getClefType(sign, line) {\r\n switch (sign) {\r\n case \"G\":\r\n return _ClefType.TREBLE;\r\n case \"F\":\r\n return _ClefType.BASS;\r\n case \"C\":\r\n return line == 4 ? _ClefType.TENOR : _ClefType.ALTO;\r\n default:\r\n return _ClefType.TREBLE;\r\n }\r\n }\r\n};\r\n_ClefType.TREBLE = \"treble\";\r\n_ClefType.BASS = \"bass\";\r\n_ClefType.ALTO = \"alto\";\r\n_ClefType.TENOR = \"tenor\";\r\nvar ClefType = _ClefType;\r\n\r\n// src/editing/transposition/TranspositionDO.ts\r\nvar TranspositionDO = class {\r\n constructor(diatonic, chromatic) {\r\n this.diatonic = diatonic;\r\n this.chromatic = chromatic;\r\n }\r\n};\r\n\r\n// src/utils/PitchUtils.ts\r\nvar _PitchUtils = class _PitchUtils {\r\n /**\r\n * takes a pitch name (such as \"A4\" or \"C5\" - never with an accidental and \r\n * always uppercase) and converts it into a integer value useful for \r\n * locating the pitch on a staff\r\n * @param\tpitchName A two character string - an uppercase letter followed\r\n * by a single digit number. \r\n * The system depends on these as sequential: A3, B3, C4, D4, E4, F4, G4\r\n * @return\tan integer representation of the pitch that can be used for math\r\n * based placement of objects on staff lines/spaces\r\n */\r\n static getStepValueOfNote(pitchName) {\r\n let letter = pitchName[0];\r\n let number = letter !== \"A\" && letter !== \"B\" ? Number.parseInt(pitchName.substring(1)) : Number.parseInt(pitchName.substring(1)) + 1;\r\n let stepValue = 7 * number + (letter.charCodeAt(0) - 65);\r\n return stepValue;\r\n }\r\n /**\r\n * gets the number of steps (lines and spaces) the requested pitch lies \r\n * below the top staff line of the requested clef\r\n * @param\tpitchName A two character string - an uppercase letter (A-G) \r\n * followed by a single digit number (0-9)\r\n * @param\tclefType A string matching a constant from the \r\n * nEngine.data.symbols.ClefType class\r\n * @return\tthe number of steps below. A negative value means the note is \r\n * above the staff.\r\n */\r\n static getStepsFromTopStaffLine(pitchName, clefType) {\r\n let stepValue = _PitchUtils.getStepValueOfNote(pitchName);\r\n let topStaffLineStepValue = 40;\r\n switch (clefType) {\r\n case ClefType.TREBLE:\r\n topStaffLineStepValue = 40;\r\n break;\r\n case ClefType.BASS:\r\n topStaffLineStepValue = 28;\r\n break;\r\n case ClefType.TENOR:\r\n topStaffLineStepValue = 32;\r\n break;\r\n case ClefType.ALTO:\r\n topStaffLineStepValue = 34;\r\n break;\r\n default:\r\n console.log(\"unsupported clef! nEngine.utils.PitchUtils.getStepsFromTopStaffLine: \" + clefType);\r\n }\r\n return topStaffLineStepValue - stepValue;\r\n }\r\n /**\r\n * returns the name of the note (not including accidental) that matches the \r\n * staff line position on the specified clef\r\n * @param stepsFromTopStaffLine each line and space is a step - negative \r\n * values mean above the staff\r\n * @param clefType a string matching a constant from the ClefType class\r\n * @return the name of the pitch (ex. A4, B5, etc.)\r\n */\r\n static getPitchNameFromStaffLinePosition(stepsFromTopStaffLine, clefType) {\r\n let topStaffLineNoteIndex;\r\n let topStaffLineNoteOctave;\r\n switch (clefType) {\r\n case ClefType.TREBLE:\r\n topStaffLineNoteIndex = 3;\r\n topStaffLineNoteOctave = 5;\r\n break;\r\n case ClefType.BASS:\r\n topStaffLineNoteIndex = 5;\r\n topStaffLineNoteOctave = 3;\r\n break;\r\n case ClefType.TENOR:\r\n topStaffLineNoteIndex = 2;\r\n topStaffLineNoteOctave = 4;\r\n break;\r\n case ClefType.ALTO:\r\n topStaffLineNoteIndex = 4;\r\n topStaffLineNoteOctave = 4;\r\n break;\r\n default:\r\n console.log(\"unsupported clef! nEngine.utils.PitchUtils.getPitchNameFromStaffLinePosition: $clefType\");\r\n topStaffLineNoteIndex = 3;\r\n topStaffLineNoteOctave = 5;\r\n }\r\n let noteIndex = topStaffLineNoteIndex - stepsFromTopStaffLine;\r\n let noteOctave = topStaffLineNoteOctave;\r\n while (noteIndex < 0) {\r\n noteIndex += 7;\r\n noteOctave--;\r\n }\r\n while (noteIndex > 6) {\r\n noteIndex -= 7;\r\n noteOctave++;\r\n }\r\n let noteName = _PitchUtils.pitchNames[noteIndex] + noteOctave.toString();\r\n return noteName;\r\n }\r\n static getCommonPitchNameFromCents(cents) {\r\n let idx = cents / 100 % 12;\r\n if (idx < 0) {\r\n idx += 12;\r\n }\r\n let letter = _PitchUtils.centPitchNames[idx * 100];\r\n letter += (~~(cents / 1200) - 1).toString();\r\n return letter;\r\n }\r\n /**\r\n * returns the number of leger lines for the requested line/space position\r\n * @param stepsFromTopStaffLine negative values indicate steps above the \r\n * staff, positive below\r\n * @return negative values for leger lines above, positive for below\r\n */\r\n static getNumberOfLegerLines(stepsFromTopStaffLine) {\r\n let legerLines = 0;\r\n if (stepsFromTopStaffLine < -1) {\r\n legerLines = Math.trunc(stepsFromTopStaffLine / 2);\r\n } else if (stepsFromTopStaffLine > 9) {\r\n legerLines = Math.trunc((stepsFromTopStaffLine - 8) / 2);\r\n }\r\n return legerLines;\r\n }\r\n /**\r\n * returns a reasonable diatonic transposition for a given chromatic\r\n * transposition\r\n * @param\tchromaticSteps the number of chromatic steps the transposition\r\n * encompasses\r\n * @return\ta corresponding number of diatonic steps that's typically\r\n * associated with this chromatic transposition\r\n */\r\n static getCommonDiatonicTranspositionFromChromaticSteps(chromaticSteps) {\r\n let numOctaves = Math.trunc(chromaticSteps / 12);\r\n let index = chromaticSteps < 0 ? -1 * (chromaticSteps % 12) : chromaticSteps % 12;\r\n let diatonicSteps = chromaticSteps < 0 ? -1 * _PitchUtils.transpositions[index][0] : _PitchUtils.transpositions[index][0];\r\n diatonicSteps += 7 * numOctaves;\r\n return diatonicSteps;\r\n }\r\n ///returns the pitch name, including octave, of the requested MIDI pitch.\r\n ///[midiPitch] is a value from 0 to 127, with 60 as C4 / middle C. The\r\n ///[accidentalPreference] can be 0 for showing both #'s and bs (C#4/Db4),\r\n ///1 for just showing sharps (C#4), or 2 for showing flats (Db4)\r\n static getPitchStringFromMidiPitch(midiPitch, accidentalPreference = 0) {\r\n let octave = Math.trunc((midiPitch - 12) / 12).toString();\r\n let pitchNames;\r\n if (accidentalPreference === 0) {\r\n pitchNames = [\r\n \"C\",\r\n \"C#/Db\",\r\n \"D\",\r\n \"D#/Eb\",\r\n \"E\",\r\n \"F\",\r\n \"F#/Gb\",\r\n \"G\",\r\n \"G#/Ab\",\r\n \"A\",\r\n \"A#/Bb\",\r\n \"B\"\r\n ];\r\n } else if (accidentalPreference === 1) {\r\n pitchNames = [\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"A#\", \"B\"];\r\n } else if (accidentalPreference === 2) {\r\n pitchNames = [\"C\", \"Db\", \"D\", \"Eb\", \"E\", \"F\", \"Gb\", \"G\", \"Ab\", \"A\", \"Bb\", \"B\"];\r\n } else {\r\n throw \"unsupported accidentalPreference: $accidentalPreference\";\r\n }\r\n return pitchNames[midiPitch % 12] + octave;\r\n }\r\n /**\r\n * calculates the alteration for a given note as indicated by the key \r\n * signature\r\n * @param pitchLetterName the uppercase letter name of the pitch (A, B, C, \r\n * D, E, or F)\r\n * @param keySig the number of sharps or flats in the key sig - positive \r\n * values for sharps, negative for flats\r\n * @return negative integers refer to the number of flats, positive values \r\n * indicate sharps, 0 indicates no alteration (natural)\r\n */\r\n static getKeySigAlterationForNote(pitchLetterName, keySig) {\r\n let keySigAlteration = 0;\r\n if (keySig > 0) {\r\n let pitchIndex = _PitchUtils.sharps.indexOf(pitchLetterName);\r\n keySigAlteration = Math.trunc(keySig / 7) + (pitchIndex < keySig % 7 ? 1 : 0);\r\n } else if (keySig < 0) {\r\n let pitchIndex = _PitchUtils.flats.indexOf(pitchLetterName);\r\n keySigAlteration = 1 * Math.trunc(keySig / 7) - (pitchIndex < -1 * keySig % 7 ? 1 : 0);\r\n } else {\r\n keySigAlteration = 0;\r\n }\r\n return keySigAlteration;\r\n }\r\n /** \r\n * Returns the absolute alteration of a note, relative to the key of C, and \r\n * regardless of the key signature. Ex. An F# (6600) in the key of D will \r\n * return 1 even though F# is in the key signature.\r\n * @displayCents = the chromatic pitch displayed (so a Trumpet's D4 and a \r\n * Flute's D4 are both 6200)\r\n * @diatonicStepsFromTopStaffLine = the number of lines and spaces the \r\n * displayed pitch is from the top staff line\r\n * @clefType = the clef of the note*/\r\n static getAlterationForCents(displayCents, pitchName) {\r\n let naturalCents = _PitchUtils.pitchNameToDiatonicCents(pitchName);\r\n return Math.trunc((displayCents - naturalCents) / 100);\r\n }\r\n static pitchNameToDiatonicCents(pitchName) {\r\n let cents = _PitchUtils.pitchNameCentVals[pitchName[0]];\r\n let octave = Number.parseInt(pitchName.substring(1));\r\n cents += 1200 + octave * 1200;\r\n return cents;\r\n }\r\n /**\r\n * transposes a pitch name (minus any octave indication) by a number of \r\n * chromatic and diatonic steps. \r\n * [pitchName] is a character, \"A\", \"B\", \"C\", \"D\", \"E\", \"F\" or \"G\"\r\n * [alteration] is the absolute accidental alteration of the note (not \r\n * considering key signature).\r\n * The pitch will be transposed by the number of [diatonicSteps] and \r\n * [chromaticSteps], and a Record will be returned where the \r\n * String represents the new pitchName and number the new alteration.*/\r\n static transposePitchName(pitchName, alteration, diatonicSteps, chromaticSteps) {\r\n let cents = _PitchUtils.pitchNameCentVals[pitchName] + alteration * 100;\r\n let newCents = cents + chromaticSteps * 100;\r\n while (newCents < 0) {\r\n newCents += 1200;\r\n }\r\n newCents %= 1200;\r\n let index = _PitchUtils.pitchNames.indexOf(pitchName);\r\n index += diatonicSteps;\r\n while (index < 0) {\r\n index += 7;\r\n }\r\n let newPitchName = _PitchUtils.pitchNames[index % 7];\r\n let newAlteration = _PitchUtils.getAlterationForCents(\r\n newCents,\r\n newPitchName + \"-1\"\r\n );\r\n return {\r\n newPitchName,\r\n newAlteration\r\n };\r\n }\r\n /**\r\n * returns the integer value of the display key for a corresponding concert \r\n * key given an instrument transposition. Negative values indicate flats and\r\n * positive values sharps. The [chromaticTransposition] value is the number \r\n * of chromatic steps the written display notes appear above the concert \r\n * sounding pitch (example: 2 for Bb Trumpet, -12 for soprano recorder). */\r\n static getDisplayKeyForConcertKey(concertKey, chromaticTransposition, diatonicTransposition) {\r\n if (diatonicTransposition == null) {\r\n diatonicTransposition = _PitchUtils.getCommonDiatonicTranspositionFromChromaticSteps(\r\n chromaticTransposition\r\n );\r\n }\r\n let delta = _PitchUtils.getKeySigAlterationForTransposition(\r\n diatonicTransposition,\r\n chromaticTransposition\r\n );\r\n return concertKey + delta;\r\n }\r\n /**\r\n * returns the integer value of the concert key for a corresponding display \r\n * key given an instrument transposition. Negative values indicate flats and\r\n * positive values sharps. The [chromaticTransposition] value is the number \r\n * of chromatic steps the written display notes appear above the concert \r\n * sounding pitch (example: 2 for Bb Trumpet, -12 for soprano recorder).*/\r\n static getConcertKeyForDisplayKey(displayKey, chromaticTransposition, diatonicTransposition) {\r\n if (diatonicTransposition == null) {\r\n diatonicTransposition = _PitchUtils.getCommonDiatonicTranspositionFromChromaticSteps(\r\n chromaticTransposition\r\n );\r\n }\r\n let delta = _PitchUtils.getKeySigAlterationForTransposition(\r\n diatonicTransposition,\r\n chromaticTransposition\r\n );\r\n return displayKey - delta;\r\n }\r\n /**\r\n * gets the key signature alteration amount for the passed in transposition \r\n * values\r\n * @param diatonicSteps the number of diatonic steps the transposed note is \r\n * above the concert pitch note (Bb trumpet would be 1)\r\n * @param chromaticSteps the number of chromatic steps the transposed note \r\n * is above the concert pitch note (Bb trumpet would be 2)\r\n * @return negative integer for an alteration in the flats direction, \r\n * positive for an alteration in the sharps direction\r\n */\r\n static getKeySigAlterationForTransposition(diatonicSteps, chromaticSteps) {\r\n return 2 * diatonicSteps + 7 * (chromaticSteps - 2 * diatonicSteps);\r\n }\r\n /**\r\n * returns the key signature value (-7 to 7) for the requested key\r\n * @param diatonicStepsFromC the diatonic steps from C of the new key\r\n * @param chromaticStepsFromC the chromatic steps from C of the new key\r\n * @param major true if the key is Major, false if it's minor\r\n * @return a negative integer indicates a key with that number of flats, \r\n * positive with sharps, and 0 is no sharps or flats\r\n */\r\n static getKeySignature(diatonicStepsFromC, chromaticStepsFromC, major) {\r\n return major ? _PitchUtils.getKeySigAlterationForTransposition(\r\n diatonicStepsFromC,\r\n chromaticStepsFromC\r\n ) : _PitchUtils.getKeySigAlterationForTransposition(\r\n diatonicStepsFromC,\r\n chromaticStepsFromC\r\n ) - 3;\r\n }\r\n static getTranspositionForKeyChange(oldKey, newKey, oldKeyIsMajor, newKeyIsMajor, transposeUp = true) {\r\n if (!oldKeyIsMajor)\r\n oldKey += 3;\r\n if (!newKeyIsMajor)\r\n newKey += 3;\r\n let keyDelta = newKey - oldKey;\r\n let chromDelta = keyDelta * 7 % 12;\r\n let diatDelta = keyDelta * 4 % 7;\r\n if (transposeUp && chromDelta < 0) {\r\n chromDelta += 12;\r\n diatDelta += 7;\r\n } else if (!transposeUp && chromDelta > 0) {\r\n chromDelta -= 12;\r\n diatDelta -= 7;\r\n }\r\n return new TranspositionDO(diatDelta, chromDelta);\r\n }\r\n /**\r\n * determines the nearest transposition direction from an old key to a new \r\n * one -1 means down is closer, 1 means up is closer, 0 means they're equal\r\n */\r\n static getNearestTranspositionDirection(oldKey, newKey, oldKeyIsMajor, newKeyIsMajor) {\r\n if (!oldKeyIsMajor)\r\n oldKey += 3;\r\n if (!newKeyIsMajor)\r\n newKey += 3;\r\n let keyDelta = newKey - oldKey;\r\n let chromDelta = keyDelta * 7 % 12;\r\n if (chromDelta > 6 || chromDelta > -6 && chromDelta < 0) {\r\n return -1;\r\n } else if (chromDelta < -6 || chromDelta < 6 && chromDelta > 0) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n /**\r\n * gets the total key size, combining the outgoing key with the new key by \r\n * figuring out how many outgoing naturals are needed\r\n * @param newKey the new key signature that will be displayed\r\n * @param outgoingKey the key signature from the previous measure\r\n * @return the total number of accidentals that must be displayed (always \r\n * positive)\r\n */\r\n static getTotalKeySize(newKey, outgoingKey) {\r\n if (newKey < 0) {\r\n if (outgoingKey < newKey) {\r\n return outgoingKey * -1;\r\n } else if (outgoingKey <= 0) {\r\n return newKey * -1;\r\n } else {\r\n return newKey * -1 + outgoingKey;\r\n }\r\n } else {\r\n if (outgoingKey > newKey) {\r\n return outgoingKey;\r\n } else if (outgoingKey >= 0) {\r\n return newKey;\r\n } else {\r\n return newKey - outgoingKey;\r\n }\r\n }\r\n }\r\n /**\r\n * figures out which accidentals (naturals, sharps and flats) should be \r\n * shown for the combination of new and outgoing keys\r\n * @param newKey the new key signature (from -7 to 7)\r\n * @param outgoingKey the old key signature (from -7 to 7)\r\n * @return creates an array that contains 4 sets of 7 numbers. Each set \r\n * corresponds to an accidental category - naturalized flats, naturalized \r\n * sharps, flats, and sharps. Each set goes in order for flats or sharps \r\n * (BEADGCF or FCGDAEB). A 1 indicates that an accidental should be drawn \r\n * for that position. A 0 indicates it should not.\r\n * [NAT. FLATS, NAT. SHARPS, FLATS, SHARPS ]\r\n * [0,0,0,1,1,0,0, 0,0,0,0,0,0,0, 1,1,1,0,0,0,0, 0,0,0,0,0,0,0]\r\n */\r\n static getAccidentalsForNewKeySignature(newKey, outgoingKey) {\r\n let numNaturals = 0;\r\n let numFlats = 0;\r\n let numSharps = 0;\r\n let numDoubleFlats = 0;\r\n let numDoubleSharps = 0;\r\n if (newKey < -7) {\r\n numDoubleFlats = -7 - newKey;\r\n newKey = -7;\r\n } else if (newKey > 7) {\r\n numDoubleSharps = newKey - 7;\r\n newKey = 7;\r\n }\r\n if (outgoingKey < -7) {\r\n outgoingKey = -7;\r\n } else if (outgoingKey > 7) {\r\n outgoingKey = 7;\r\n }\r\n let cancelStartIndex = 0;\r\n let cancelSharps = false;\r\n if (newKey < 0) {\r\n numFlats = -1 * newKey;\r\n if (outgoingKey < newKey) {\r\n numNaturals = newKey - outgoingKey;\r\n cancelStartIndex = newKey * -1;\r\n cancelSharps = false;\r\n } else if (outgoingKey <= 0) {\r\n } else {\r\n numNaturals = outgoingKey;\r\n cancelStartIndex = 0;\r\n cancelSharps = true;\r\n }\r\n } else {\r\n numSharps = newKey;\r\n if (outgoingKey > newKey) {\r\n numNaturals = outgoingKey - newKey;\r\n cancelStartIndex = newKey;\r\n cancelSharps = true;\r\n } else if (outgoingKey >= 0) {\r\n } else {\r\n numNaturals = -1 * outgoingKey;\r\n cancelStartIndex = 0;\r\n cancelSharps = false;\r\n }\r\n }\r\n let accidentals = new Array(28);\r\n let i = 0;\r\n for (i; i < 7; i++) {\r\n if (!cancelSharps) {\r\n if (numNaturals > 0 && i >= cancelStartIndex) {\r\n accidentals[i] = 1;\r\n numNaturals--;\r\n continue;\r\n }\r\n }\r\n accidentals[i] = 0;\r\n }\r\n for (i; i < 14; i++) {\r\n if (cancelSharps) {\r\n if (numNaturals > 0 && i - 7 >= cancelStartIndex) {\r\n accidentals[i] = 1;\r\n numNaturals--;\r\n continue;\r\n }\r\n }\r\n accidentals[i] = 0;\r\n }\r\n for (i; i < 21; i++) {\r\n if (i - 14 < numDoubleFlats) {\r\n accidentals[i] = 2;\r\n } else if (i - 14 < numFlats) {\r\n accidentals[i] = 1;\r\n } else {\r\n accidentals[i] = 0;\r\n }\r\n }\r\n for (i; i < 28; i++) {\r\n if (i - 21 < numDoubleSharps) {\r\n accidentals[i] = 2;\r\n } else if (i - 21 < numSharps) {\r\n accidentals[i] = 1;\r\n } else {\r\n accidentals[i] = 0;\r\n }\r\n }\r\n return accidentals;\r\n }\r\n};\r\n//mapping of chromatic to diatonic transpositions\r\n_PitchUtils.transpositions = [\r\n [0, 0],\r\n [1, 1],\r\n [1, 2],\r\n [2, 3],\r\n [2, 4],\r\n [3, 5],\r\n [4, 6],\r\n [4, 7],\r\n [5, 8],\r\n [5, 9],\r\n [6, 10],\r\n [6, 11],\r\n [7, 12]\r\n];\r\n//diatonic base cent values of pitch names\r\n_PitchUtils.pitchNameCentVals = {\r\n \"C\": 0,\r\n \"D\": 200,\r\n \"E\": 400,\r\n \"F\": 500,\r\n \"G\": 700,\r\n \"A\": 900,\r\n \"B\": 1100\r\n};\r\n_PitchUtils.centPitchNames = {\r\n 0: \"C\",\r\n 100: \"C\",\r\n 200: \"D\",\r\n 300: \"E\",\r\n 400: \"E\",\r\n 500: \"F\",\r\n 600: \"F\",\r\n 700: \"G\",\r\n 800: \"A\",\r\n 900: \"A\",\r\n 1e3: \"B\",\r\n 1100: \"B\"\r\n};\r\n_PitchUtils.pitchNames = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\r\n_PitchUtils.sharps = [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"];\r\n_PitchUtils.flats = [\"B\", \"E\", \"A\", \"D\", \"G\", \"C\", \"F\"];\r\nvar PitchUtils = _PitchUtils;\r\n\r\n// src/analysis/TheoryTools.ts\r\nvar sharpFifths = [\"C\", \"G\", \"D\", \"A\", \"E\", \"B\", \"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"];\r\nvar flatFifths = [\"C\", \"F\", \"B\", \"E\", \"A\", \"D\", \"G\", \"C\", \"F\", \"B\", \"E\", \"A\", \"D\"];\r\nvar sharpFifthsWithAccidentals = [\r\n \"C\",\r\n \"G\",\r\n \"D\",\r\n \"A\",\r\n \"E\",\r\n \"B\",\r\n \"F#\",\r\n \"C#\",\r\n \"G#\",\r\n \"D#\",\r\n \"A#\",\r\n \"E#\",\r\n \"B#\"\r\n];\r\nvar flatFifthsWithAccidentals = [\r\n \"C\",\r\n \"F\",\r\n \"Bb\",\r\n \"Eb\",\r\n \"Ab\",\r\n \"Db\",\r\n \"Gb\",\r\n \"Cb\",\r\n \"Fb\",\r\n \"Bbb\",\r\n \"Ebb\",\r\n \"Abb\",\r\n \"Dbb\"\r\n];\r\nfunction getAccidentalString(accidental) {\r\n switch (accidental) {\r\n case 0:\r\n return \"\";\r\n case -1:\r\n return \"b\";\r\n case 1:\r\n return \"#\";\r\n case -2:\r\n return \"bb\";\r\n case 2:\r\n return \"x\";\r\n }\r\n}\r\nvar TheoryTools = class {\r\n /**returns a ScaleInfo object with info pertaining to the passed in key.\r\n * @param key A value indicating the key signature. 0 is no sharps/flats,\r\n * negative value indicates flats, positive value indicates sharps. Ex.\r\n * 3 = 3 sharps, -2 = 2 flats. */\r\n getScaleInfo(key) {\r\n let info = new ScaleInfo();\r\n info.key = key;\r\n let rootMajor;\r\n let rootMinor;\r\n if (key >= 0) {\r\n info.numSharps = key;\r\n info.numFlats = 0;\r\n rootMajor = sharpFifths[key];\r\n rootMinor = key >= 4 ? sharpFifths[key - 4] : sharpFifths[key + 3];\r\n } else {\r\n info.numSharps = 0;\r\n info.numFlats = key * -1;\r\n rootMajor = flatFifths[key * -1];\r\n rootMinor = key > -3 ? flatFifths[key * -1 + 4] : flatFifths[key * -1 - 3];\r\n }\r\n info.accidentals = [\r\n PitchUtils.getKeySigAlterationForNote(\"A\", key),\r\n PitchUtils.getKeySigAlterationForNote(\"B\", key),\r\n PitchUtils.getKeySigAlterationForNote(\"C\", key),\r\n PitchUtils.getKeySigAlterationForNote(\"D\", key),\r\n PitchUtils.getKeySigAlterationForNote(\"E\", key),\r\n PitchUtils.getKeySigAlterationForNote(\"F\", key),\r\n PitchUtils.getKeySigAlterationForNote(\"G\", key)\r\n ];\r\n const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\"];\r\n info.pitchNames = letters.slice();\r\n for (let i = 0; i < 7; i++) {\r\n let accidental = info.accidentals[i];\r\n for (let j = 0; j < Math.abs(accidental); j++) {\r\n accidental > 0 ? info.pitchNames[i] += \"#\" : info.pitchNames[i] += \"b\";\r\n }\r\n }\r\n info.majorScalePitchNames = [];\r\n let startIdx = letters.indexOf(rootMajor);\r\n info.majorScaleRootIndex = startIdx;\r\n for (let i = 0; i < 7; i++) {\r\n info.majorScalePitchNames[i] = info.pitchNames[(startIdx + i) % 7];\r\n }\r\n info.minorScalePitchNames = [];\r\n startIdx = letters.indexOf(rootMinor);\r\n info.minorScaleRootIndex = startIdx;\r\n for (let i = 0; i < 7; i++) {\r\n info.minorScalePitchNames[i] = info.pitchNames[(startIdx + i) % 7];\r\n }\r\n return info;\r\n }\r\n /**returns the pitch names with accidentals that make up the requested\r\n * chord. Not all chords are supported. If not supported, returns null.*/\r\n getPitchNamesInChord(chord) {\r\n let rootName = chord.rootName;\r\n let key;\r\n let idx = sharpFifthsWithAccidentals.indexOf(rootName);\r\n if (idx !== -1) {\r\n key = idx;\r\n } else {\r\n idx = flatFifthsWithAccidentals.indexOf(rootName);\r\n if (idx !== -1) {\r\n key = -1 * idx;\r\n } else {\r\n return null;\r\n }\r\n }\r\n let scaleInfo = this.getScaleInfo(key);\r\n let chordPitches = [];\r\n let letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\"];\r\n function addNote(rootIdx, scaleDegree, accidentalOffset) {\r\n let noteIdx = rootIdx + scaleDegree - 1;\r\n let accidental = scaleInfo.accidentals[noteIdx] + accidentalOffset;\r\n let pitchName = letters[noteIdx] + getAccidentalString(accidental);\r\n chordPitches.push(pitchName);\r\n }\r\n switch (chord.type) {\r\n case \"major\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n break;\r\n }\r\n case \"minor\": {\r\n addNote(scaleInfo.minorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 5, 0);\r\n break;\r\n }\r\n case \"augmented\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 1);\r\n break;\r\n }\r\n case \"diminished\": {\r\n addNote(scaleInfo.minorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 5, -1);\r\n break;\r\n }\r\n case \"dominant\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 7, -1);\r\n break;\r\n }\r\n case \"major-seventh\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 7, 0);\r\n break;\r\n }\r\n case \"minor-seventh\": {\r\n addNote(scaleInfo.minorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 5, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 7, 0);\r\n break;\r\n }\r\n case \"diminished-seventh\": {\r\n addNote(scaleInfo.minorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 5, -1);\r\n addNote(scaleInfo.minorScaleRootIndex, 7, 0);\r\n break;\r\n }\r\n case \"half-diminished\": {\r\n addNote(scaleInfo.minorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 5, -1);\r\n addNote(scaleInfo.minorScaleRootIndex, 7, -1);\r\n break;\r\n }\r\n case \"major-sixth\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 6, 0);\r\n break;\r\n }\r\n case \"major-ninth\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 7, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 9, 0);\r\n break;\r\n }\r\n case \"minor-ninth\": {\r\n addNote(scaleInfo.minorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 3, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 5, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 7, 0);\r\n addNote(scaleInfo.minorScaleRootIndex, 9, 0);\r\n break;\r\n }\r\n case \"suspended-fourth\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 4, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n break;\r\n }\r\n case \"suspended-second\": {\r\n addNote(scaleInfo.majorScaleRootIndex, 1, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 2, 0);\r\n addNote(scaleInfo.majorScaleRootIndex, 5, 0);\r\n break;\r\n }\r\n }\r\n return chordPitches;\r\n }\r\n};\r\nvar ScaleInfo = class {\r\n};\r\n\r\n// src/data/BaseDataObject.ts\r\nimport { v4 as uuidv4 } from \"uuid\";\r\nvar _BaseDataObject = class _BaseDataObject {\r\n constructor() {\r\n this._dataID = 0;\r\n }\r\n static resetIDCounter() {\r\n this._nextID = 0;\r\n }\r\n /**\r\n * Gets the unique dataID for this object in the score.\r\n */\r\n get dataID() {\r\n if (this._dataID == 0) {\r\n this._dataID = _BaseDataObject._nextID;\r\n _BaseDataObject._nextID++;\r\n }\r\n return this._dataID;\r\n }\r\n set dataID(value) {\r\n this._dataID = value;\r\n }\r\n /**\r\n * Gets a string that should be unique across calls and sessions (uses\r\n * uuid lib)\r\n */\r\n get uniqueID() {\r\n if (this._uniqueID == null) {\r\n this._uniqueID = uuidv4();\r\n }\r\n return this._uniqueID;\r\n }\r\n set uniqueID(value) {\r\n this._uniqueID = value;\r\n }\r\n};\r\n_BaseDataObject._nextID = 1;\r\nvar BaseDataObject = _BaseDataObject;\r\n\r\n// src/data/constants/StaffGroupingStyle.ts\r\nvar StaffGroupingStyle = /* @__PURE__ */ ((StaffGroupingStyle2) => {\r\n StaffGroupingStyle2[StaffGroupingStyle2[\"part\"] = 0] = \"part\";\r\n StaffGroupingStyle2[StaffGroupingStyle2[\"score\"] = 1] = \"score\";\r\n return StaffGroupingStyle2;\r\n})(StaffGroupingStyle || {});\r\n\r\n// src/data/ScoreProperties.ts\r\nvar _ScoreProperties = class _ScoreProperties {\r\n constructor() {\r\n /**number of pixels between two staff lines on the same staff*/\r\n this._pixelsPerSpace = _ScoreProperties.DEFAULT_PIXELS_PER_SPACE;\r\n }\r\n ScoreProperties() {\r\n }\r\n clone() {\r\n let scoreProps = new _ScoreProperties();\r\n scoreProps.rights = this._rights;\r\n scoreProps.pageHeight = this._pageHeight;\r\n scoreProps.pageWidth = this._pageWidth;\r\n scoreProps.leftPageMargin = this._leftPageMargin;\r\n scoreProps.rightPageMargin = this._rightPageMargin;\r\n scoreProps.topPageMargin = this._topPageMargin;\r\n scoreProps.bottomPageMargin = this._bottomPageMargin;\r\n scoreProps.firstPageVerticalOffset = this._firstPageVerticalOffset;\r\n scoreProps.systemSpacing = this._systemSpacing;\r\n scoreProps.topSystemDistance = this._topSystemDistance;\r\n scoreProps.leftSystemMargin = this._leftSystemMargin;\r\n scoreProps.rightSystemMargin = this._rightSystemMargin;\r\n scoreProps.staffSpacing = this._staffSpacing;\r\n scoreProps._pixelsPerSpace = this._pixelsPerSpace;\r\n scoreProps.stemWidth = this._stemWidth;\r\n scoreProps.beamWidth = this._beamWidth;\r\n scoreProps.staffLineWidth = this._staffLineWidth;\r\n scoreProps.lightBarlineWidth = this._lightBarlineWidth;\r\n scoreProps.heavyBarlineWidth = this._heavyBarlineWidth;\r\n scoreProps.legerLineWidth = this._legerLineWidth;\r\n scoreProps.repeatEndingWidth = this._repeatEndingWidth;\r\n scoreProps.hairpinLineWidth = this._hairpinLineWidth;\r\n scoreProps.enclosureWidth = this._enclosureWidth;\r\n scoreProps.tupletBracketWidth = this._tupletBracketWidth;\r\n scoreProps.graceNoteSize = this._graceNoteSize;\r\n scoreProps.cueNoteSize = this._cueNoteSize;\r\n scoreProps.noteheadWidth = this._noteheadWidth;\r\n scoreProps.clefDistanceFromBarline = this._clefDistanceFromBarline;\r\n scoreProps.chordSymbolFontHeight = this._chordSymbolFontHeight;\r\n scoreProps.staffGroupingStyle = this._staffGroupingStyle;\r\n return scoreProps;\r\n }\r\n /**\r\n * creates a new ScoreProperties object with default values and returns it\r\n * @return the new ScoreProperties object\r\n */\r\n static getNewScoreProperties() {\r\n let scoreProps = new _ScoreProperties();\r\n scoreProps.rights = \"\";\r\n scoreProps.pageHeight = 130;\r\n scoreProps.pageWidth = _ScoreProperties.DEFAULT_PAGE_WIDTH;\r\n scoreProps.leftPageMargin = 0;\r\n scoreProps.rightPageMargin = 0;\r\n scoreProps.topPageMargin = 7.4;\r\n scoreProps.bottomPageMargin = 7.4;\r\n scoreProps.firstPageVerticalOffset = 5;\r\n scoreProps.systemSpacing = 7.1;\r\n scoreProps.topSystemDistance = 4.3;\r\n scoreProps.leftSystemMargin = 0;\r\n scoreProps.rightSystemMargin = 0;\r\n scoreProps.staffSpacing = 8;\r\n scoreProps.stemWidth = 0.07487;\r\n scoreProps.beamWidth = 0.5;\r\n scoreProps.staffLineWidth = 0.07487;\r\n scoreProps.lightBarlineWidth = 0.07487;\r\n scoreProps.heavyBarlineWidth = 0.5;\r\n scoreProps.legerLineWidth = 0.07487;\r\n scoreProps.repeatEndingWidth = 0.14583;\r\n scoreProps.hairpinLineWidth = 0.07487;\r\n scoreProps.enclosureWidth = 0.07487;\r\n scoreProps.tupletBracketWidth = 0.07487;\r\n scoreProps.graceNoteSize = 0.6;\r\n scoreProps.cueNoteSize = 0.6;\r\n scoreProps.noteheadWidth = 1.2;\r\n scoreProps.clefDistanceFromBarline = 1;\r\n scoreProps.chordSymbolFontHeight = 2.5;\r\n scoreProps.qNoteWidth = 4.44;\r\n scoreProps.keySigWidth = 1.2;\r\n scoreProps.timeSigWidth = 2.4;\r\n scoreProps.clefWidth = 2.82;\r\n scoreProps.measureLeadIn = 1.8;\r\n scoreProps.minMeasureWidth = 0;\r\n scoreProps.staffGroupingStyle = 0 /* part */;\r\n return scoreProps;\r\n }\r\n get cueNoteSize() {\r\n return this._cueNoteSize;\r\n }\r\n set cueNoteSize(value) {\r\n this._cueNoteSize = value > 0 ? value : 0.6;\r\n }\r\n get graceNoteSize() {\r\n return this._graceNoteSize;\r\n }\r\n set graceNoteSize(value) {\r\n this._graceNoteSize = value > 0 ? value : 0.6;\r\n }\r\n get noteheadWidth() {\r\n return this._noteheadWidth;\r\n }\r\n set noteheadWidth(value) {\r\n this._noteheadWidth = value;\r\n }\r\n get tupletBracketWidth() {\r\n return this._tupletBracketWidth;\r\n }\r\n set tupletBracketWidth(value) {\r\n this._tupletBracketWidth = value > 0 ? value : 0.1;\r\n }\r\n get enclosureWidth() {\r\n return this._enclosureWidth;\r\n }\r\n set enclosureWidth(value) {\r\n this._enclosureWidth = value > 0 ? value : 0.1;\r\n }\r\n get hairpinLineWidth() {\r\n return this._hairpinLineWidth;\r\n }\r\n set hairpinLineWidth(value) {\r\n this._hairpinLineWidth = value > 0 ? value : 0.1;\r\n }\r\n get repeatEndingWidth() {\r\n return this._repeatEndingWidth;\r\n }\r\n set repeatEndingWidth(value) {\r\n this._repeatEndingWidth = value > 0 ? value : 0.1;\r\n }\r\n get legerLineWidth() {\r\n return this._legerLineWidth;\r\n }\r\n set legerLineWidth(value) {\r\n this._legerLineWidth = value > 0 ? value : 0.1875;\r\n }\r\n get heavyBarlineWidth() {\r\n return this._heavyBarlineWidth;\r\n }\r\n set heavyBarlineWidth(value) {\r\n this._heavyBarlineWidth = value > 0 ? value : 0.5;\r\n }\r\n get lightBarlineWidth() {\r\n return this._lightBarlineWidth;\r\n }\r\n set lightBarlineWidth(value) {\r\n this._lightBarlineWidth = value > 0 ? value : 0.1875;\r\n }\r\n get staffLineWidth() {\r\n return this._staffLineWidth;\r\n }\r\n set staffLineWidth(value) {\r\n this._staffLineWidth = value > 0 ? value : 0.1;\r\n }\r\n get beamWidth() {\r\n return this._beamWidth;\r\n }\r\n set beamWidth(value) {\r\n this._beamWidth = value > 0 ? value : 0.5;\r\n }\r\n get stemWidth() {\r\n return this._stemWidth;\r\n }\r\n set stemWidth(value) {\r\n this._stemWidth = value > 0 ? value : 0.1;\r\n }\r\n get staffSpacing() {\r\n return this._staffSpacing;\r\n }\r\n set staffSpacing(value) {\r\n this._staffSpacing = value;\r\n }\r\n get pixelsPerSpace() {\r\n return this._pixelsPerSpace;\r\n }\r\n set pixelsPerSpace(value) {\r\n this._pixelsPerSpace = value;\r\n }\r\n get rightSystemMargin() {\r\n return this._rightSystemMargin;\r\n }\r\n set rightSystemMargin(value) {\r\n this._rightSystemMargin = value;\r\n }\r\n get leftSystemMargin() {\r\n return this._leftSystemMargin;\r\n }\r\n set leftSystemMargin(value) {\r\n this._leftSystemMargin = value;\r\n }\r\n get topSystemDistance() {\r\n return this._topSystemDistance;\r\n }\r\n set topSystemDistance(value) {\r\n this._topSystemDistance = value;\r\n }\r\n get systemSpacing() {\r\n return this._systemSpacing;\r\n }\r\n set systemSpacing(value) {\r\n this._systemSpacing = value;\r\n }\r\n get bottomPageMargin() {\r\n return this._bottomPageMargin;\r\n }\r\n set bottomPageMargin(value) {\r\n this._bottomPageMargin = value;\r\n }\r\n get topPageMargin() {\r\n return this._topPageMargin;\r\n }\r\n set topPageMargin(value) {\r\n this._topPageMargin = value;\r\n }\r\n get rightPageMargin() {\r\n return this._rightPageMargin;\r\n }\r\n set rightPageMargin(value) {\r\n this._rightPageMargin = value;\r\n }\r\n get leftPageMargin() {\r\n return this._leftPageMargin;\r\n }\r\n set leftPageMargin(value) {\r\n this._leftPageMargin = value;\r\n }\r\n get firstPageVerticalOffset() {\r\n return this._firstPageVerticalOffset;\r\n }\r\n set firstPageVerticalOffset(value) {\r\n this._firstPageVerticalOffset = value;\r\n }\r\n get pageWidth() {\r\n return this._pageWidth;\r\n }\r\n set pageWidth(value) {\r\n this._pageWidth = value;\r\n }\r\n get pageHeight() {\r\n return this._pageHeight;\r\n }\r\n set pageHeight(value) {\r\n this._pageHeight = value;\r\n }\r\n get rights() {\r\n return this._rights;\r\n }\r\n set rights(value) {\r\n this._rights = value;\r\n }\r\n get software() {\r\n return this._software;\r\n }\r\n set software(value) {\r\n this._software = value;\r\n }\r\n get clefDistanceFromBarline() {\r\n return this._clefDistanceFromBarline;\r\n }\r\n set clefDistanceFromBarline(value) {\r\n this._clefDistanceFromBarline = value;\r\n }\r\n get chordSymbolFontHeight() {\r\n return this._chordSymbolFontHeight;\r\n }\r\n set chordSymbolFontHeight(value) {\r\n this._chordSymbolFontHeight = value;\r\n }\r\n /**\r\n * width granted for a quarter note in music spacing\r\n */\r\n get qNoteWidth() {\r\n return this._qNoteWidth;\r\n }\r\n set qNoteWidth(value) {\r\n this._qNoteWidth = value;\r\n }\r\n /**\r\n * width granted for a single accidental in a key signature for music \r\n * spacing\r\n */\r\n get keySigWidth() {\r\n return this._keySigWidth;\r\n }\r\n set keySigWidth(value) {\r\n this._keySigWidth = value;\r\n }\r\n /**\r\n * width granted for a time signature in music spacing\r\n */\r\n get timeSigWidth() {\r\n return this._timeSigWidth;\r\n }\r\n set timeSigWidth(value) {\r\n this._timeSigWidth = value;\r\n }\r\n /**\r\n * width granted for a normal sized clef in music spacing\r\n */\r\n get clefWidth() {\r\n return this._clefWidth;\r\n }\r\n set clefWidth(value) {\r\n this._clefWidth = value;\r\n }\r\n /**\r\n * width of space before notes begin in a measure for music spacing\r\n */\r\n get measureLeadIn() {\r\n return this._measureLeadIn;\r\n }\r\n set measureLeadIn(value) {\r\n this._measureLeadIn = value;\r\n }\r\n /**\r\n * minimum allowed measure width for music spacing\r\n */\r\n get minMeasureWidth() {\r\n return this._minMeasureWidth;\r\n }\r\n set minMeasureWidth(value) {\r\n this._minMeasureWidth = value;\r\n }\r\n get staffGroupingStyle() {\r\n return this._staffGroupingStyle;\r\n }\r\n set staffGroupingStyle(value) {\r\n this._staffGroupingStyle = value;\r\n }\r\n};\r\n_ScoreProperties.DEFAULT_PAGE_WIDTH = 100;\r\n_ScoreProperties.DEFAULT_PIXELS_PER_SPACE = 10;\r\n_ScoreProperties.DEFAULT_TEMPO = 120;\r\nvar ScoreProperties = _ScoreProperties;\r\n\r\n// src/data/constants/AccidentalType.ts\r\nvar _AccidentalType = class _AccidentalType {\r\n /**\r\n * returns the constant from the AccidentalType class that matches the \r\n * passed in alteration\r\n * @param alteration a value from -2 to 2 (negative for flats, positive for \r\n * sharps, 0 for natural)\r\n * @return a number matching a constant from the AccidentalType class\r\n */\r\n static getAccidentalType(alteration) {\r\n switch (alteration) {\r\n case 0:\r\n return _AccidentalType.NATURAL;\r\n case 1:\r\n return _AccidentalType.SHARP;\r\n case 2:\r\n return _AccidentalType.DOUBLE_SHARP;\r\n case 3:\r\n return _AccidentalType.TRIPLE_SHARP;\r\n case -1:\r\n return _AccidentalType.FLAT;\r\n case -2:\r\n return _AccidentalType.DOUBLE_FLAT;\r\n case -3:\r\n return _AccidentalType.TRIPLE_FLAT;\r\n default:\r\n console.log(\"unsupported accidental alteration: $alteration\");\r\n return _AccidentalType.NONE;\r\n }\r\n }\r\n static getAccidentalFromString(name) {\r\n switch (name) {\r\n case \"none\":\r\n return _AccidentalType.NONE;\r\n case \"natural\":\r\n return _AccidentalType.NATURAL;\r\n case \"sharp\":\r\n return _AccidentalType.SHARP;\r\n case \"flat\":\r\n return _AccidentalType.FLAT;\r\n case \"double-sharp\":\r\n return _AccidentalType.DOUBLE_SHARP;\r\n case \"sharp-sharp\":\r\n return _AccidentalType.DOUBLE_SHARP;\r\n case \"flat-flat\":\r\n return _AccidentalType.DOUBLE_FLAT;\r\n case \"triple-sharp\":\r\n return _AccidentalType.TRIPLE_SHARP;\r\n case \"triplet-flat\":\r\n return _AccidentalType.TRIPLE_FLAT;\r\n default:\r\n return _AccidentalType.NONE;\r\n }\r\n }\r\n};\r\n_AccidentalType.NONE = 100;\r\n_AccidentalType.NATURAL = 0;\r\n_AccidentalType.SHARP = 1;\r\n_AccidentalType.FLAT = -1;\r\n_AccidentalType.DOUBLE_SHARP = 2;\r\n_AccidentalType.DOUBLE_FLAT = -2;\r\n_AccidentalType.TRIPLE_SHARP = 3;\r\n_AccidentalType.TRIPLE_FLAT = -3;\r\nvar AccidentalType = _AccidentalType;\r\n\r\n// src/data/constants/ArticulationType.ts\r\nvar _ArticulationType = class _ArticulationType {\r\n static getTypeFromName(name) {\r\n switch (name) {\r\n case \"staccato\":\r\n return _ArticulationType.STACCATO;\r\n case \"accent\":\r\n return _ArticulationType.ACCENT;\r\n case \"tenuto\":\r\n return _ArticulationType.LEGATO;\r\n default:\r\n return _ArticulationType.UNKNOWN;\r\n }\r\n }\r\n};\r\n_ArticulationType.UNKNOWN = -1;\r\n_ArticulationType.STACCATO = 0;\r\n_ArticulationType.ACCENT = 1;\r\n_ArticulationType.LEGATO = 2;\r\nvar ArticulationType = _ArticulationType;\r\n\r\n// src/data/constants/BarlineLocation.ts\r\nvar _BarlineLocation = class _BarlineLocation {\r\n static getLocation(location) {\r\n if (location == null)\r\n return _BarlineLocation.RIGHT;\r\n switch (location) {\r\n case \"left\":\r\n return _BarlineLocation.LEFT;\r\n case \"middle\":\r\n return _BarlineLocation.MIDDLE;\r\n case \"right\":\r\n return _BarlineLocation.RIGHT;\r\n default:\r\n return _BarlineLocation.RIGHT;\r\n }\r\n }\r\n};\r\n_BarlineLocation.LEFT = 0;\r\n_BarlineLocation.MIDDLE = 1;\r\n_BarlineLocation.RIGHT = 2;\r\nvar BarlineLocation = _BarlineLocation;\r\n\r\n// src/data/constants/BarlineStyle.ts\r\nvar _BarlineStyle = class _BarlineStyle {\r\n static getStyle(type) {\r\n if (type == null)\r\n return _BarlineStyle.REGULAR;\r\n switch (type) {\r\n case \"regular\":\r\n return _BarlineStyle.REGULAR;\r\n case \"dotted\":\r\n return _BarlineStyle.DOTTED;\r\n case \"dashed\":\r\n return _BarlineStyle.DASHED;\r\n case \"heavy\":\r\n return _BarlineStyle.HEAVY;\r\n case \"light-light\":\r\n return _BarlineStyle.LIGHT_LIGHT;\r\n case \"light-heavy\":\r\n return _BarlineStyle.LIGHT_HEAVY;\r\n case \"heavy-light\":\r\n return _BarlineStyle.HEAVY_LIGHT;\r\n case \"heavy-heavy\":\r\n return _BarlineStyle.HEAVY_HEAVY;\r\n case \"tick\":\r\n return _BarlineStyle.TICK;\r\n case \"short\":\r\n return _BarlineStyle.SHORT;\r\n case \"none\":\r\n return _BarlineStyle.NONE;\r\n default:\r\n return _BarlineStyle.REGULAR;\r\n }\r\n }\r\n};\r\n_BarlineStyle.REGULAR = 0;\r\n_BarlineStyle.DOTTED = 1;\r\n_BarlineStyle.DASHED = 2;\r\n_BarlineStyle.HEAVY = 3;\r\n_BarlineStyle.LIGHT_LIGHT = 4;\r\n_BarlineStyle.LIGHT_HEAVY = 5;\r\n_BarlineStyle.HEAVY_LIGHT = 6;\r\n_BarlineStyle.HEAVY_HEAVY = 7;\r\n_BarlineStyle.TICK = 8;\r\n_BarlineStyle.SHORT = 9;\r\n_BarlineStyle.NONE = 10;\r\nvar BarlineStyle = _BarlineStyle;\r\n\r\n// src/data/constants/BeamState.ts\r\nvar BeamState = class {\r\n};\r\nBeamState.NONE = \"none\";\r\nBeamState.BEGIN = \"begin\";\r\nBeamState.CONTINUE = \"continue\";\r\nBeamState.END = \"end\";\r\nBeamState.FORWARD_HOOK = \"forward hook\";\r\nBeamState.BACKWARD_HOOK = \"backward hook\";\r\n\r\n// src/data/constants/DurationType.ts\r\nvar _DurationType = class _DurationType {\r\n /**\r\n * returns the duration unit duration of the durationType:requested, \r\n * factoring in the number of augmentation dots\r\n * @param durationType a String matching a constant from this class\r\n * @param numDots the number of augmentation dots\r\n * @return the duration of the note in Duration Units\r\n */\r\n static getDurationValue(durationType, numDots) {\r\n let duration = durationType;\r\n let dotVal = ~~(duration / 2);\r\n for (let i = 0; i < numDots; i++) {\r\n duration += dotVal;\r\n dotVal = ~~(dotVal / 2);\r\n }\r\n return duration;\r\n }\r\n /**\r\n * returns the String DurationType value for the requested duration\r\n * @param duration a duration that is one of the supported powers of 2\r\n * @return a String matching one of the String constants from this \r\n * class\r\n */\r\n static getDurationType(durationName) {\r\n switch (durationName) {\r\n case \"whole\":\r\n return _DurationType.WHOLE;\r\n case \"half\":\r\n return _DurationType.HALF;\r\n case \"quarter\":\r\n return _DurationType.QUARTER;\r\n case \"eighth\":\r\n return _DurationType.EIGHTH;\r\n case \"16th\":\r\n return _DurationType.SIXTEENTH;\r\n case \"32nd\":\r\n return _DurationType.THIRTY_SECOND;\r\n case \"64th\":\r\n return _DurationType.SIXTY_FOURTH;\r\n case \"breve\":\r\n return _DurationType.BREVE;\r\n case \"long\":\r\n return _DurationType.LONG;\r\n case \"maxima\":\r\n return _DurationType.MAXIMA;\r\n case \"128th\":\r\n return _DurationType.ONE_TWO_EIGHTH;\r\n case \"256th\":\r\n return _DurationType.TWO_FIVE_SIXTH;\r\n case \"512th\":\r\n return _DurationType.FIVE_TWELFTH;\r\n case \"1024th\":\r\n return _DurationType.ONE_ZERO_TWO_FOURTH;\r\n default:\r\n console.log(\"unsupported base duration! ScoreManager.getDurationType: $durationName\");\r\n }\r\n return _DurationType.UNSUPPORTED;\r\n }\r\n /**\r\n * calculates the dots portion of the duration\r\n * @param duration a duration matching one of the powers of 2 durations\r\n * @param numDots number of augmentation dots\r\n * @return the duration value of the dots themselves (not combined with the \r\n * duration:supplied)\r\n */\r\n static calculateDotDuration(duration, numDots) {\r\n let dotVal = ~~(duration / 2);\r\n let dotTotal = 0;\r\n for (let i = 0; i < numDots; i++) {\r\n dotTotal += dotVal;\r\n dotVal = ~~(dotVal / 2);\r\n }\r\n return dotTotal;\r\n }\r\n /**\r\n * gets the base duration and the number of dots needed to create the \r\n * requested total duration\r\n * @param totalDuration the duration you want to match\r\n * @return an array with 2 elements - the base first:duration, then the \r\n * number of dots\r\n */\r\n static getBaseDurationAndDots(totalDuration) {\r\n let baseDuration = 2;\r\n while (baseDuration * 2 < totalDuration) {\r\n baseDuration *= 2;\r\n }\r\n let numDots = 0;\r\n let combinedDuration = baseDuration;\r\n let dotValue = ~~(baseDuration / 2);\r\n while (combinedDuration < totalDuration) {\r\n combinedDuration += dotValue;\r\n dotValue = ~~(dotValue / 2);\r\n numDots++;\r\n }\r\n if (combinedDuration !== totalDuration) {\r\n }\r\n return [baseDuration, numDots];\r\n }\r\n};\r\n_DurationType.MAXIMA = 32768;\r\n_DurationType.LONG = 16384;\r\n_DurationType.BREVE = 8192;\r\n_DurationType.WHOLE = 4096;\r\n_DurationType.HALF = 2048;\r\n_DurationType.QUARTER = 1024;\r\n_DurationType.EIGHTH = 512;\r\n_DurationType.SIXTEENTH = 256;\r\n_DurationType.THIRTY_SECOND = 128;\r\n_DurationType.SIXTY_FOURTH = 64;\r\n_DurationType.ONE_TWO_EIGHTH = 32;\r\n_DurationType.TWO_FIVE_SIXTH = 16;\r\n_DurationType.FIVE_TWELFTH = 8;\r\n_DurationType.ONE_ZERO_TWO_FOURTH = 4;\r\n_DurationType.UNSUPPORTED = -1;\r\nvar DurationType = _DurationType;\r\n\r\n// src/data/constants/DynamicVolumeMap.ts\r\nvar DynamicVolumeMap = class {\r\n constructor() {\r\n this.FFFF = 1;\r\n this.FFF = 0.95;\r\n this.FF = 0.9;\r\n this.F = 0.8;\r\n this.MF = 0.65;\r\n this.MP = 0.5;\r\n this.P = 0.35;\r\n this.PP = 0.25;\r\n this.PPP = 0.15;\r\n this.PPPP = 0.1;\r\n this.DEFAULT = 0.6;\r\n }\r\n};\r\n\r\n// src/data/constants/DynamicType.ts\r\nvar _DynamicType = class _DynamicType {\r\n static getVolumeByType(type) {\r\n switch (type) {\r\n case _DynamicType.F:\r\n return 0.8;\r\n case _DynamicType.P:\r\n return 0.35;\r\n case _DynamicType.FF:\r\n return 0.9;\r\n case _DynamicType.PP:\r\n return 0.25;\r\n case _DynamicType.MF:\r\n return 0.65;\r\n case _DynamicType.MP:\r\n return 0.5;\r\n case _DynamicType.FFF:\r\n return 0.95;\r\n case _DynamicType.PPP:\r\n return 0.15;\r\n case _DynamicType.FFFF:\r\n return 1;\r\n case _DynamicType.PPPP:\r\n return 0.1;\r\n default:\r\n return 0.6;\r\n }\r\n }\r\n};\r\n_DynamicType.FFFF = \"ffff\";\r\n_DynamicType.FFF = \"fff\";\r\n_DynamicType.FF = \"ff\";\r\n_DynamicType.F = \"f\";\r\n_DynamicType.MF = \"mf\";\r\n_DynamicType.MP = \"mp\";\r\n_DynamicType.P = \"p\";\r\n_DynamicType.PP = \"pp\";\r\n_DynamicType.PPP = \"ppp\";\r\n_DynamicType.PPPP = \"pppp\";\r\n_DynamicType.volumeMap = new DynamicVolumeMap();\r\nvar DynamicType = _DynamicType;\r\n\r\n// src/data/constants/EndingType.ts\r\nvar _EndingType = class _EndingType {\r\n static getType(type) {\r\n if (type == null)\r\n return _EndingType.STOP;\r\n switch (type) {\r\n case \"start\":\r\n return _EndingType.START;\r\n case \"stop\":\r\n return _EndingType.STOP;\r\n case \"discontinue\":\r\n return _EndingType.DISCONTINUE;\r\n default:\r\n return _EndingType.STOP;\r\n }\r\n }\r\n};\r\n_EndingType.START = 0;\r\n_EndingType.STOP = 1;\r\n_EndingType.DISCONTINUE = 2;\r\nvar EndingType = _EndingType;\r\n\r\n// src/data/constants/LyricsMode.ts\r\nvar LyricsMode = /* @__PURE__ */ ((LyricsMode2) => {\r\n LyricsMode2[LyricsMode2[\"SHOW_LYRICS\"] = 0] = \"SHOW_LYRICS\";\r\n LyricsMode2[LyricsMode2[\"SHOW_NOTE_NAMES\"] = 1] = \"SHOW_NOTE_NAMES\";\r\n LyricsMode2[LyricsMode2[\"HIDE_LYRICS\"] = 2] = \"HIDE_LYRICS\";\r\n return LyricsMode2;\r\n})(LyricsMode || {});\r\n\r\n// src/data/constants/MeasureAttachmentType.ts\r\nvar MeasureAttachmentType = /* @__PURE__ */ ((MeasureAttachmentType2) => {\r\n MeasureAttachmentType2[MeasureAttachmentType2[\"dynamic\"] = 0] = \"dynamic\";\r\n MeasureAttachmentType2[MeasureAttachmentType2[\"chordSymbol\"] = 1] = \"chordSymbol\";\r\n MeasureAttachmentType2[MeasureAttachmentType2[\"measureInstruction\"] = 2] = \"measureInstruction\";\r\n return MeasureAttachmentType2;\r\n})(MeasureAttachmentType || {});\r\n\r\n// src/data/constants/OrnamentType.ts\r\nvar _OrnamentType = class _OrnamentType {\r\n static getTypeFromName(name) {\r\n switch (name) {\r\n case \"inverted-mordent\":\r\n return _OrnamentType.INVERTED_MORDENT;\r\n case \"mordent\":\r\n return _OrnamentType.MORDENT;\r\n case \"trill-mark\":\r\n return _OrnamentType.TRILL_MARK;\r\n default:\r\n return _OrnamentType.UNKNOWN;\r\n }\r\n }\r\n static getTypeFromMusicXmlName(name) {\r\n let type = _OrnamentType.getTypeFromName(name);\r\n if (type == _OrnamentType.INVERTED_MORDENT) {\r\n type = _OrnamentType.MORDENT;\r\n } else if (type == _OrnamentType.MORDENT) {\r\n type = _OrnamentType.INVERTED_MORDENT;\r\n }\r\n return type;\r\n }\r\n};\r\n_OrnamentType.UNKNOWN = -1;\r\n_OrnamentType.INVERTED_MORDENT = 0;\r\n_OrnamentType.MORDENT = 1;\r\n_OrnamentType.TRILL_MARK = 2;\r\nvar OrnamentType = _OrnamentType;\r\n\r\n// src/data/constants/RepeatDirection.ts\r\nvar _RepeatDirection = class _RepeatDirection {\r\n static getDirection(direction) {\r\n if (direction == null)\r\n return null;\r\n switch (direction) {\r\n case \"forward\":\r\n return _RepeatDirection.FORWARD;\r\n case \"backward\":\r\n return _RepeatDirection.BACKWARD;\r\n default:\r\n return null;\r\n }\r\n }\r\n};\r\n_RepeatDirection.FORWARD = 0;\r\n_RepeatDirection.BACKWARD = 1;\r\nvar RepeatDirection = _RepeatDirection;\r\n\r\n// src/data/constants/StemDirection.ts\r\nvar StemDirection = class {\r\n};\r\nStemDirection.UP = \"up\";\r\nStemDirection.DOWN = \"down\";\r\nStemDirection.NO_STEM = \"noStem\";\r\n\r\n// src/data/constants/SyllablePosition.ts\r\nvar SyllablePosition = class {\r\n};\r\nSyllablePosition.BEGIN = \"begin\";\r\nSyllablePosition.MIDDLE = \"middle\";\r\nSyllablePosition.END = \"end\";\r\n\r\n// src/data/constants/TieState.ts\r\nvar TieState = class {\r\n};\r\nTieState.NONE = \"none\";\r\nTieState.START = \"start\";\r\nTieState.STOP = \"stop\";\r\nTieState.CONTINUE = \"continue\";\r\n\r\n// src/data/io/MeasureData.ts\r\nvar MeasureData = class {\r\n};\r\n\r\n// src/data/io/VoiceData.ts\r\nvar VoiceData = class {\r\n};\r\n\r\n// src/data/containers/Voice.ts\r\nvar Voice = class extends BaseDataObject {\r\n constructor(number) {\r\n super();\r\n this._noteGroups = [];\r\n //the voice number (voice 1, voice 2, etc.)\r\n this._number = 0;\r\n this._number = number;\r\n }\r\n toVoiceData() {\r\n let data = new VoiceData();\r\n data.noteGroups = this._noteGroups.map((ng) => ng.toNoteGroupData());\r\n data.number = this._number;\r\n return data;\r\n }\r\n addNoteGroup(noteGroup) {\r\n noteGroup.voice = this;\r\n this._noteGroups.push(noteGroup);\r\n if (noteGroup.tuplets != null) {\r\n }\r\n }\r\n /**\r\n * removes the NoteGroupContainer and all child NoteGroups and \r\n * NoteGroupContainers. If the parent NGC of this NGC is empty, it too is \r\n * removed. This check is done recursively in both directions (for children\r\n * and parents)\r\n * @param ngc the NoteGroupContainer you want to remove\r\n * @param removeParentIfEmpty if true, if removing the ngc leaves its parent\r\n * with an empty ngcList, the parentNGC will be removed\r\n * @return returns a list of NoteGroup objects that were removed\r\n */\r\n removeNoteGroupContainer(ngc, removeParentIfEmpty = true) {\r\n let removedNoteGroups = [];\r\n if (ngc.noteGroup != null) {\r\n removedNoteGroups.push(ngc.noteGroup);\r\n this._noteGroups.splice(this._noteGroups.indexOf(ngc.noteGroup), 1);\r\n } else {\r\n let ngcList = ngc.ngcList;\r\n for (let i = ngcList.length - 1; i >= 0; i--) {\r\n removedNoteGroups.push(...this.removeNoteGroupContainer(\r\n ngcList[i],\r\n false\r\n ));\r\n }\r\n }\r\n if (ngc.parentNGC != null) {\r\n let parentNGCList = ngc.parentNGC.ngcList;\r\n parentNGCList.splice(parentNGCList.indexOf(ngc), 1);\r\n if (parentNGCList.length === 0 && removeParentIfEmpty) {\r\n this.removeNoteGroupContainer(ngc.parentNGC);\r\n }\r\n } else {\r\n this._noteGroupContainers.splice(\r\n this._noteGroupContainers.indexOf(ngc),\r\n 1\r\n );\r\n }\r\n return removedNoteGroups;\r\n }\r\n /*public function clone():Voice {\r\n \tlet voice:Voice = new Voice(_number);\r\n \t\r\n \treturn voice;\r\n }*/\r\n get noteGroups() {\r\n return this._noteGroups;\r\n }\r\n get noteGroupContainers() {\r\n return this._noteGroupContainers;\r\n }\r\n set noteGroupContainers(value) {\r\n this._noteGroupContainers = value;\r\n }\r\n get number() {\r\n return this._number;\r\n }\r\n get measure() {\r\n return this._measure;\r\n }\r\n set measure(value) {\r\n this._measure = value;\r\n }\r\n get isEmptyOrSingleRest() {\r\n if (this._noteGroups.length > 1 || !this._noteGroups[0].isRest) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n};\r\n\r\n// src/data/containers/Measure.ts\r\nvar Measure = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //voices/layers\r\n this._voices = [];\r\n ////////////KEY SIG////////////\r\n //the number of diatonic steps the transposed pitches appear above concert \r\n //pitch\r\n this._diatonicTransposition = 0;\r\n //the number of chromatic steps the transposed pitches appear above concert \r\n //pitch\r\n this._chromaticTransposition = 0;\r\n //the untransposed key for this measure\r\n this._concertKey = 0;\r\n //key value that is displayed (includes transposition) - 0 = C, -1 = 1 flat,\r\n //1 = 1 sharp\r\n this._displayKey = 0;\r\n //the display key signature from the previous measure - only present if the \r\n //measure follows a measure that was in a different key\r\n this._outgoingKey = 0;\r\n //true if the key signature is major, false if it's minor\r\n this._isMajorKey = false;\r\n //true if the key signature should be rendered for this measure\r\n this._showKey = false;\r\n ////////////TIME SIG////////////\r\n //time sig number beats\r\n this._numBeats = 4;\r\n //time sig beat type\r\n this._beatType = 4;\r\n /**ex. [0, 1, 2, 3] for 4/4 or [0, 1.5] for 6/8. Lists the counts (in \r\n * qNotes) that the main beats in the measure fall on*/\r\n this._beatGroups = [0, 1, 2, 3];\r\n /**ex. [0.5, 1.5, 2.5, 3.5] for 4/4 or [0.5, 1.0, 2.0, 2.5] for 6/8. Lists\r\n * \t *the counts (in qNotes that the sub beats in the measure fall on)*/\r\n this._subBeatGroups = [];\r\n //true if the time signature should be rendered for this measure\r\n this._showTime = false;\r\n ///////////CLEFS/////////\r\n //holds Clef objects for this measure\r\n this._clefs = [];\r\n //a list of the MeasureAttachment objects attached to this measure\r\n this._attachments = [];\r\n //if true, the NoteGroup objects should be re-rendered for this measure \r\n //during the next render\r\n this._notesNeedRendering = true;\r\n }\r\n toMeasureData() {\r\n let data = new MeasureData();\r\n data.voices = this._voices.map((v) => v.toVoiceData());\r\n data.diatonicTransposition = this._diatonicTransposition;\r\n data.chromaticTransposition = this._chromaticTransposition;\r\n data.concertKey = this._concertKey;\r\n data.displayKey = this._displayKey;\r\n data.outgoingKey = this._outgoingKey;\r\n data.isMajorKey = this._isMajorKey;\r\n data.showKey = this._showKey;\r\n data.numBeats = this._numBeats;\r\n data.beatType = this._beatType;\r\n data.displayNumBeats = this._displayNumBeats;\r\n data.displayBeatType = this._displayBeatType;\r\n data.beatGroups = this._beatGroups.slice();\r\n data.subBeatGroups = this._subBeatGroups.slice();\r\n data.showTime = this._showTime;\r\n data.clefs = this._clefs.map((c) => c.toClefData());\r\n data.attachments = this._attachments.map((a) => a.toMeasureAttachmentData());\r\n return data;\r\n }\r\n /**\r\n * gets the Voice object with the number matching the value passed in. If it\r\n * doesn't exist, a new Voice object is created and returned\r\n * @param\tvoiceNumber the number of the voice, typically taken from the \r\n * musicXML\r\n * @return\ta Voice object\r\n */\r\n getVoiceByNumber(voiceNumber) {\r\n for (let voice of this._voices) {\r\n if (voice.number === voiceNumber) {\r\n return voice;\r\n }\r\n }\r\n let newVoice = new Voice(voiceNumber);\r\n newVoice.measure = this;\r\n this._voices.push(newVoice);\r\n return newVoice;\r\n }\r\n /**\r\n * the untransposed key for this measure - positive value indicates sharps, \r\n * negative indicates flats\r\n */\r\n get concertKey() {\r\n return this._concertKey;\r\n }\r\n set concertKey(value) {\r\n this._concertKey = value;\r\n }\r\n /**\r\n * indicates the number of accidentals displayed for the key signature \r\n * (includes transposition) - positive value indicates sharps, negative \r\n * indicates flats\r\n */\r\n get displayKey() {\r\n return this._displayKey;\r\n }\r\n set displayKey(value) {\r\n this._displayKey = value;\r\n }\r\n /**\r\n * the display key signature from the previous measure - only present if the\r\n * measure follows a measure that was in a different key\r\n */\r\n get outgoingKey() {\r\n return this._outgoingKey;\r\n }\r\n set outgoingKey(value) {\r\n this._outgoingKey = value;\r\n }\r\n /**\r\n * the number of diatonic steps the transposed pitches appear above concert \r\n * pitch\r\n */\r\n get diatonicTransposition() {\r\n return this._diatonicTransposition;\r\n }\r\n set diatonicTransposition(value) {\r\n this._diatonicTransposition = value;\r\n }\r\n /**\r\n * the number of chromatic steps the transposed pitches appear above concert\r\n * pitch\r\n */\r\n get chromaticTransposition() {\r\n return this._chromaticTransposition;\r\n }\r\n set chromaticTransposition(value) {\r\n this._chromaticTransposition = value;\r\n }\r\n /**\r\n * true if the key signature is major, false if it's minor\r\n */\r\n get isMajorKey() {\r\n return this._isMajorKey;\r\n }\r\n set isMajorKey(value) {\r\n this._isMajorKey = value;\r\n }\r\n get numBeats() {\r\n return this._numBeats;\r\n }\r\n set numBeats(value) {\r\n this._numBeats = value;\r\n }\r\n get beatType() {\r\n return this._beatType;\r\n }\r\n set beatType(value) {\r\n this._beatType = value;\r\n }\r\n /**if not null, this value will be used for rendering display*/\r\n get displayNumBeats() {\r\n return this._displayNumBeats;\r\n }\r\n set displayNumBeats(value) {\r\n this._displayNumBeats = value;\r\n }\r\n /**if not null, this value will be used for rendering diplay */\r\n get displayBeatType() {\r\n return this._displayBeatType;\r\n }\r\n set displayBeatType(value) {\r\n this._displayBeatType = value;\r\n }\r\n /**\r\n * ex. [0, 1, 2, 3] for 4/4 or [0, 1.5] for 6/8. Lists the counts (in \r\n * qNotes) that the main beats in the measure fall on\r\n */\r\n get beatGroups() {\r\n return this._beatGroups;\r\n }\r\n set beatGroups(value) {\r\n this._beatGroups = value;\r\n }\r\n /**ex. [0.5, 1.5, 2.5, 3.5] for 4/4 or [0.5, 1.0, 2.0, 2.5] for 6/8. Lists\r\n *the counts (in qNotes that the sub beats in the measure fall on)*/\r\n get subBeatGroups() {\r\n return this._subBeatGroups;\r\n }\r\n set subBeatGroups(value) {\r\n this._subBeatGroups = value;\r\n }\r\n /**gets the duration of a beat in quarter notes*/\r\n get beatQnoteDuration() {\r\n return this._beatType % 8 == 0 ? 4 / this._beatType * 3 : 4 / this._beatType;\r\n }\r\n /**gets the duration of a sub beat in quarter notes*/\r\n get subBeatQnoteDuration() {\r\n return this._beatType % 8 == 0 ? 4 / this._beatType : 2 / this._beatType;\r\n }\r\n /**\r\n * holds Clef objects for this measure\r\n */\r\n get clefs() {\r\n return this._clefs;\r\n }\r\n set clefs(value) {\r\n this._clefs = value;\r\n }\r\n get voices() {\r\n return this._voices;\r\n }\r\n /**if true, the time sig will be rendered and will affect spacing*/\r\n get showTime() {\r\n return this._showTime;\r\n }\r\n set showTime(value) {\r\n this._showTime = value;\r\n }\r\n get showKey() {\r\n return this._showKey;\r\n }\r\n set showKey(value) {\r\n this._showKey = value;\r\n }\r\n get stack() {\r\n return this._stack;\r\n }\r\n set stack(value) {\r\n this._stack = value;\r\n }\r\n get staff() {\r\n return this._staff;\r\n }\r\n set staff(value) {\r\n this._staff = value;\r\n }\r\n /**\r\n * a list of the MeasureAttachment objects attached to this measure\r\n */\r\n get attachments() {\r\n return this._attachments;\r\n }\r\n set attachments(value) {\r\n this._attachments = value;\r\n }\r\n /**\r\n * calculates the total note duration (how full the measure is). \r\n * A full bar would be 4 * (numBeats / beatType) QNotes.\r\n */\r\n get totalNoteDuration() {\r\n let lastNG = this._voices[0].noteGroups[this._voices[0].noteGroups.length - 1];\r\n return lastNG.qNoteTime + lastNG.qNoteDuration;\r\n }\r\n /**\r\n * if true, the NoteGroup objects should be re-rendered for this measure \r\n * during the next render\r\n */\r\n get notesNeedRendering() {\r\n return this._notesNeedRendering;\r\n }\r\n set notesNeedRendering(value) {\r\n this._notesNeedRendering = value;\r\n if (value == true) {\r\n if (this.stack != null) {\r\n this.stack.needsRendering = true;\r\n }\r\n }\r\n }\r\n /**\r\n * returns the measure that follows this one - not stored as a property, but\r\n * rather searched for dynamically\r\n */\r\n get next() {\r\n let measures = this._staff.measures;\r\n let numMeasures = measures.length;\r\n for (let i = 0; i < numMeasures; i++) {\r\n if (measures[i] == this) {\r\n return i < numMeasures - 1 ? measures[i + 1] : null;\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * returns the measure that precedes this one - not stored as a property, \r\n * but rather searched for dynamically\r\n */\r\n get prev() {\r\n let measures = this._staff.measures;\r\n let numMeasures = measures.length;\r\n for (let i = numMeasures - 1; i >= 0; i--) {\r\n if (measures[i] == this) {\r\n return i > 0 ? measures[i - 1] : null;\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * returns the measure that is below this one in the stack - not stored as a\r\n * property, but rather searched for dynamically\r\n */\r\n get below() {\r\n let measures = this._stack.measures;\r\n let numMeasures = measures.length;\r\n for (let i = 0; i < numMeasures; i++) {\r\n if (measures[i] == this) {\r\n return i < numMeasures - 1 ? measures[i + 1] : null;\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * returns the measure that is above this one in the stack - not stored as a\r\n * property, but rather searched for dynamically\r\n */\r\n get above() {\r\n let measures = this._stack.measures;\r\n let numMeasures = measures.length;\r\n for (let i = numMeasures - 1; i >= 0; i--) {\r\n if (measures[i] == this) {\r\n return i > 0 ? measures[i - 1] : null;\r\n }\r\n }\r\n return null;\r\n }\r\n};\r\n\r\n// src/data/io/MeasureStackData.ts\r\nvar MeasureStackData = class {\r\n};\r\n\r\n// src/data/containers/MeasureStack.ts\r\nvar MeasureStack = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //all of the NoteGroup objects in the stack\r\n this._noteGroups = [];\r\n //all of the Measure objects in the stack\r\n this._measures = [];\r\n ////////////QNOTE TIME MARKERS//////////\r\n //the start time of the measure stack, in qNoteTime\r\n this._startTime = 0;\r\n //the end time of the measure stack, in qNoteTime\r\n this._endTime = 0;\r\n //the length of the measure stack, in qNotes\r\n this._qNoteLength = 0;\r\n //begins a new system\r\n this._newSystem = false;\r\n //actual width of the measure\r\n this._width = 200;\r\n //the indentation before the music - for keys, clefs, time sig, and standard\r\n //offset. This doesn't scale with measure width when calculating actual \r\n //positions.\r\n this._indent = 0;\r\n //the indentation before the music if this stack happens to be the first \r\n //stack in its system (clef and key are required)\r\n this._indentAsSystemLeader = 0;\r\n //distance from the left edge of the system to the beginning of this measure\r\n this._startPosition = 0;\r\n //the measure number\r\n this._number = 1;\r\n //////////SPACING CONSIDERATION VALUES//////////////\r\n //the amount of horizontal space the stack would consume if no other stacks \r\n //or factors had to be considered\r\n this._idealWidth = 0;\r\n //the highest number of sharps or flats any measure within the stack has (to\r\n //account for transposing staves with differing key sigs)\r\n this._maxKeySize = 0;\r\n //set to true if there is a new key in the bar that must be shown, \r\n //regardless of whether this measure is first in a system.\r\n this._newKey = false;\r\n //set to true if there is a new time sig in the bar that must be shown, \r\n //regardless of whether this measure is first in a system.\r\n //private _newTime:boolean = false; \r\n //set to true if there is a new clef in the bar that must be shown, \r\n //regardless of whether this measure is first in a system.\r\n this._newClef = false;\r\n //true if the stack is a pickup measure stack\r\n this._isPickup = false;\r\n //true if there is at least one Measure in the stack that needs to be\r\n //rendered again\r\n this._needsRendering = true;\r\n }\r\n toMeasureStackData() {\r\n let data = new MeasureStackData();\r\n data.startTime = this._startTime;\r\n data.endTime = this._endTime;\r\n data.qNoteLength = this._qNoteLength;\r\n data.number = this._number;\r\n data.newKey = this._newKey;\r\n data.newClef = this._newClef;\r\n data.tempoMarkers = this._tempoMarkers?.map((tm) => tm.toTempoMarkerData());\r\n data.barline = this.barline?.toBarlineData();\r\n data.repeatDOs = this.repeatDOs?.map((r) => r.toRepeatDOData());\r\n data.isPickup = this._isPickup;\r\n return data;\r\n }\r\n /**\r\n * adds the NoteGroup object to the stack in order by its time\r\n * @param\tnoteGroup the NoteGroup to add - must have its startTime \r\n * property set.\r\n */\r\n addNoteGroup(noteGroup) {\r\n let numNotes = this._noteGroups.length;\r\n let i = 0;\r\n for (i = 0; i < numNotes; i++) {\r\n let cNoteGroup = this._noteGroups[i];\r\n if (noteGroup.qNoteTime < cNoteGroup.qNoteTime) {\r\n this._noteGroups.splice(i, 0, noteGroup);\r\n return;\r\n }\r\n }\r\n this._noteGroups.push(noteGroup);\r\n }\r\n /**\r\n * adds the Measure object to the stack - this does NOT add the NoteGroups \r\n * to the noteGroups list - use addNoteGroupsFromMeasure() for that\r\n * @param\tmeasure\r\n */\r\n addMeasure(measure) {\r\n this._measures.push(measure);\r\n }\r\n /**\r\n * adds all of the NoteGroup objects in the passed in measure. NoteGroups \r\n * are sorted by time against pre-existing NoteGroups\r\n * @param\tmeasure the Measure object to scan for NoteGroup objects\r\n */\r\n addNoteGroupsFromMeasure(measure) {\r\n for (let voice of measure.voices) {\r\n for (let noteGroup of voice.noteGroups) {\r\n this.addNoteGroup(noteGroup);\r\n }\r\n }\r\n }\r\n /**\r\n * removes the passed in NoteGroup from the MeasureStack\r\n * @param noteGroup the NoteGroup to remove\r\n */\r\n removeNoteGroup(noteGroup) {\r\n let numNoteGroups = this._noteGroups.length;\r\n for (let i = 0; i < numNoteGroups; i++) {\r\n if (this._noteGroups[i] === noteGroup) {\r\n this._noteGroups.splice(i, 1);\r\n break;\r\n }\r\n }\r\n }\r\n /**\r\n * clears the NoteGroups (usually used prior to adding NoteGroup objects for\r\n * the current set of parts)\r\n */\r\n clearNoteGroups() {\r\n this._noteGroups = [];\r\n }\r\n /**\r\n * clears the Measures (usually used prior to adding Measure objects for the current set of parts)\r\n */\r\n clearMeasures() {\r\n this._measures = [];\r\n }\r\n ///Retrieves the most recent [TempoMarker] that indicates the tempo at the\r\n ///start time of this [MeasureStack]. If this stack has a marker at the\r\n ///beginning of it, that marker will be returned. Otherwise it will look\r\n ///backwards through previous stacks until it finds the most recent marker.\r\n ///If no marker is found, null is returned.\r\n getInheritedTempoMarker() {\r\n if (this._tempoMarkers != null && this._tempoMarkers.length > 0 && this._tempoMarkers[0].qNoteTime == this._startTime) {\r\n return this._tempoMarkers[0];\r\n }\r\n let cStack = this._previous;\r\n while (cStack != null) {\r\n if (cStack._tempoMarkers != null && cStack._tempoMarkers.length > 0) {\r\n return cStack._tempoMarkers[cStack._tempoMarkers.length - 1];\r\n }\r\n cStack = cStack.previous;\r\n }\r\n return null;\r\n }\r\n ///Creates and returns a list of all the [MeasureAttachment] objects\r\n ///associated with [Measure]s in this stack\r\n ///@param sortByQNoteTime if true, sorts attachments by ascending qNoteTime\r\n getMeasureAttachments(sortByQNoteTime) {\r\n let attachments = [];\r\n for (let measure of this._measures) {\r\n attachments.push(...measure.attachments);\r\n }\r\n if (sortByQNoteTime) {\r\n attachments.sort((a1, a2) => a1.qNoteTime <= a2.qNoteTime ? -1 : 1);\r\n }\r\n return attachments;\r\n }\r\n get noteGroups() {\r\n return this._noteGroups;\r\n }\r\n get measures() {\r\n return this._measures;\r\n }\r\n get qNoteLength() {\r\n return this._qNoteLength;\r\n }\r\n set qNoteLength(value) {\r\n this._qNoteLength = value;\r\n }\r\n get startTime() {\r\n return this._startTime;\r\n }\r\n set startTime(value) {\r\n this._startTime = value;\r\n this._qNoteLength = this._endTime - this._startTime;\r\n }\r\n get endTime() {\r\n return this._endTime;\r\n }\r\n set endTime(value) {\r\n this._endTime = value;\r\n this._qNoteLength = this._endTime - this._startTime;\r\n }\r\n get beatQNotePositions() {\r\n return this._beatQNotePositions;\r\n }\r\n set beatQNotePositions(value) {\r\n this._beatQNotePositions = value;\r\n }\r\n get newSystem() {\r\n return this._newSystem;\r\n }\r\n set newSystem(value) {\r\n this._newSystem = value;\r\n }\r\n get width() {\r\n return this._width;\r\n }\r\n set width(value) {\r\n this._width = value;\r\n }\r\n /**\r\n * The normal indent for this stack if it is not the first stack in a \r\n * system. Clefs and Keys are counted only if they are new (and thus must be\r\n * shown)\r\n */\r\n get indent() {\r\n return this._indent;\r\n }\r\n set indent(value) {\r\n this._indent = value;\r\n }\r\n /**\r\n * the indentation before the music if this stack happens to be the first \r\n * stack in its system (clef and key are required)\r\n */\r\n get indentAsSystemLeader() {\r\n return this._indentAsSystemLeader;\r\n }\r\n set indentAsSystemLeader(value) {\r\n this._indentAsSystemLeader = value;\r\n }\r\n get startPosition() {\r\n return this._startPosition;\r\n }\r\n set startPosition(value) {\r\n this._startPosition = value;\r\n }\r\n get number() {\r\n return this._number;\r\n }\r\n set number(value) {\r\n this._number = value;\r\n }\r\n get idealWidth() {\r\n return this._idealWidth;\r\n }\r\n set idealWidth(value) {\r\n this._idealWidth = value;\r\n }\r\n get maxKeySize() {\r\n return this._maxKeySize;\r\n }\r\n set maxKeySize(value) {\r\n this._maxKeySize = value;\r\n }\r\n get newKey() {\r\n return this._newKey;\r\n }\r\n set newKey(value) {\r\n this._newKey = value;\r\n }\r\n //bool get newTime { return _newTime; }\t\t\r\n //void set newTime(bool value) { _newTime = value;\t}\r\n get newClef() {\r\n return this._newClef;\r\n }\r\n set newClef(value) {\r\n this._newClef = value;\r\n }\r\n /**\r\n * //holds list of TempoMarker objects that take effect starting with this \r\n * stack\r\n */\r\n get tempoMarkers() {\r\n return this._tempoMarkers;\r\n }\r\n set tempoMarkers(value) {\r\n this._tempoMarkers = value;\r\n }\r\n get previous() {\r\n return this._previous;\r\n }\r\n set previous(value) {\r\n this._previous = value;\r\n }\r\n get next() {\r\n return this._next;\r\n }\r\n set next(value) {\r\n this._next = value;\r\n }\r\n get systemRef() {\r\n return this._systemRef;\r\n }\r\n set systemRef(value) {\r\n this._systemRef = value;\r\n }\r\n /**\r\n * true if the stack is a pickup measure stack\r\n */\r\n get isPickup() {\r\n return this._isPickup;\r\n }\r\n set isPickup(value) {\r\n this._isPickup = value;\r\n }\r\n /**\r\n * true if there is at least one Measure in the stack that needs to be \r\n * rendered again\r\n */\r\n get needsRendering() {\r\n return this._needsRendering;\r\n }\r\n set needsRendering(value) {\r\n this._needsRendering = value;\r\n if (value == true && this.systemRef != null) {\r\n this.systemRef.needsRendering = true;\r\n }\r\n }\r\n};\r\n\r\n// src/data/io/NoteGroupData.ts\r\nvar NoteGroupData = class {\r\n};\r\n\r\n// src/data/containers/NoteGroup.ts\r\nvar NoteGroup = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //the notes that make up this NoteGroup\r\n this._notes = [];\r\n //horizontal position of this NoteGroup. Variations of individual notes \r\n //within this group are defined in the Note class\r\n this._hPos = 0;\r\n //\"noStem\", \"up\", or \"down\"\r\n this._stemDirection = StemDirection.NO_STEM;\r\n //the vertical position of the end of the stem measured from the top staff \r\n //line. Negative values are above the top staff line.\r\n this._stemEndPos = 0;\r\n //the horizontal position of the stem\r\n this._stemHPos = 0;\r\n //duration in duration unit values - 1024 is a quarter note. This value DOES\r\n //NOT have the tuplet ratio applied to it, so it must be converted for \r\n //actual length\r\n this._duration = 1024;\r\n //duration in terms of qNotes.\r\n this._qNoteDuration = 1;\r\n //the start time of this note expressed in qNotes\r\n this._qNoteTime = 0;\r\n //\"quarter\", \"eighth\", etc. - the shape of the note - does NOT differentiate\r\n //things like \"triplet\"\r\n this._durationType = DurationType.QUARTER;\r\n //number of augmentation dots\r\n this._numDots = 0;\r\n //true if it's a grace note\r\n this._isGrace = false;\r\n //an array of strings conforming to constants from \r\n //nEngine.data.symbols.BeamState - the order should match outer beam, second\r\n //beam, third beam, etc.\r\n this._beamStates = [];\r\n //the number of beams this note could potentially support (0 for a quarter \r\n //or bigger, 1 for an eighth, 2 for a 16th note, etc.)\r\n this._maxBeams = 0;\r\n //the number of accidental level positions needed for this chord (for \r\n //spacing purposes)\r\n this._numAccidentalLevels = 0;\r\n //true if it's a rest\r\n this._isRest = false;\r\n //the vertical position of the rest (if it's a rest)\r\n this._restVPos = 0;\r\n //true if this note starts a clip\r\n this._clipStart = false;\r\n //true if this note ends a clip\r\n this._clipEnd = false;\r\n //the position this note would occupy within its measure if the measure was\r\n //given its ideal amount of spacing\r\n this._idealHPos = 0;\r\n //the playback start time for this note, in seconds, from the beginning of\r\n //the piece.\r\n this._playbackStartTime = 0;\r\n //true if this noteGroup should be displayed\r\n this._visible = true;\r\n //stores the previous visibility state of the NoteGroup\r\n this._prevVisible = null;\r\n }\r\n toNoteGroupData() {\r\n let data = new NoteGroupData();\r\n data.uniqueID = this.uniqueID;\r\n data.notes = this.notes.map((n) => n.toNoteData());\r\n data.stemDirection = this._stemDirection;\r\n data.duration = this._duration;\r\n data.qNoteDuration = this._qNoteDuration;\r\n data.qNoteTime = this._qNoteTime;\r\n data.durationType = this._durationType;\r\n data.numDots = this._numDots;\r\n data.isGrace = this._isGrace;\r\n data.beamStates = this._beamStates.slice(0);\r\n data.isRest = this._isRest;\r\n data.tuplets = this._tuplets?.map((t) => t.toTupletData());\r\n data.slurs = this._slurs?.map((s) => s.toSlurData());\r\n data.clefUniqueID = this._clef?.uniqueID;\r\n data.lyric = this._lyric?.toLyricData();\r\n data.clipStart = this._clipStart;\r\n data.clipEnd = this._clipEnd;\r\n data.articulations = this._articulations?.map((a) => a.toArticulationData());\r\n data.ornaments = this._ornaments?.map((o) => o.toOrnamentData());\r\n data.visible = this._visible;\r\n data.trackId = this._trackId;\r\n return data;\r\n }\r\n /**\r\n * adds the Note to the NoteGroup at the last position - this does NOT sort\r\n * the Note by pitch (use insertNote() for that).\r\n * @param note the Note object to add\r\n */\r\n addNote(note) {\r\n this._notes.push(note);\r\n note.noteGroup = this;\r\n }\r\n /**\r\n * adds the Note to the NoteGroup in its order by pitch - lowest to highest\r\n * @param note the Note object to add/insert\r\n */\r\n insertNote(note) {\r\n let numNotes = this._notes.length;\r\n let i = 0;\r\n for (i = 0; i < numNotes; i++) {\r\n if (this._notes[i].stepsFromTopStaffLine < note.stepsFromTopStaffLine) {\r\n break;\r\n }\r\n }\r\n this._notes.splice(i, 0, note);\r\n note.noteGroup = this;\r\n }\r\n /**sorts the Notes for this NoteGroup from lowest to highest */\r\n sortNotes() {\r\n this._notes.sort((n1, n2) => n1.stepsFromTopStaffLine >= n2.stepsFromTopStaffLine ? -1 : 1);\r\n }\r\n /**\r\n * removes the Note from the NoteGroup\r\n * @param note the Note object to remove\r\n */\r\n removeNote(note) {\r\n let numNotes = this._notes.length;\r\n for (let i = 0; i < numNotes; i++) {\r\n if (this._notes[i] == note) {\r\n this._notes.splice(i, 1);\r\n if (note.noteGroup == this) {\r\n note.noteGroup = null;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n /**\r\n * sorts the notes by pitch so that the lowest note is first in the list\r\n */\r\n sortNotesByPitch() {\r\n this._notes.sort((n1, n2) => {\r\n return n1.displayCents <= n2.displayCents ? -1 : 1;\r\n });\r\n }\r\n clearNextPrevNGCaches() {\r\n this._cachedNextNG = null;\r\n this._cachedPrevNG = null;\r\n }\r\n clearVisibleNotesCache() {\r\n this._visibleNotesCache = null;\r\n }\r\n /**reverts the visibility of the NG to its last state. Calling multiple\r\n * times will have no additional effect (not a complete undo history).*/\r\n revertVisibility() {\r\n if (this._prevVisible != null) {\r\n this._visible = this._prevVisible;\r\n this._prevVisible = null;\r\n }\r\n }\r\n get notes() {\r\n return this._notes;\r\n }\r\n /**Gets the list of notes, in bottom to top order, that are currently \r\n * visible. When changing notes' visibility property, be sure to call \r\n * clearVisibleNotesCache();*/\r\n get visibleNotes() {\r\n if (this._visibleNotesCache != null) {\r\n return this._visibleNotesCache;\r\n }\r\n if (this._isRest) {\r\n this._visibleNotesCache = null;\r\n return null;\r\n }\r\n this._visibleNotesCache = [];\r\n for (let note of this._notes) {\r\n if (note.visible) {\r\n this._visibleNotesCache.push(note);\r\n }\r\n }\r\n return this._visibleNotesCache;\r\n }\r\n get isRest() {\r\n return this._isRest;\r\n }\r\n set isRest(value) {\r\n this._isRest = value;\r\n }\r\n get restVPos() {\r\n return this._restVPos;\r\n }\r\n set restVPos(value) {\r\n this._restVPos = value;\r\n }\r\n get numDots() {\r\n return this._numDots;\r\n }\r\n set numDots(value) {\r\n this._numDots = value;\r\n }\r\n get durationType() {\r\n return this._durationType;\r\n }\r\n set durationType(value) {\r\n this._durationType = value;\r\n if (value === DurationType.EIGHTH) {\r\n this._maxBeams = 1;\r\n } else if (value === DurationType.SIXTEENTH) {\r\n this._maxBeams = 2;\r\n } else if (value === DurationType.THIRTY_SECOND) {\r\n this._maxBeams = 3;\r\n } else if (value === DurationType.SIXTY_FOURTH) {\r\n this._maxBeams = 4;\r\n } else {\r\n this._maxBeams = 0;\r\n }\r\n }\r\n /**\r\n * duration in duration unit values - 1024 is a quarter note. This value \r\n * DOES NOT have the tuplet ratio applied to it, so it must be converted for\r\n * actual length\r\n */\r\n get duration() {\r\n return this._duration;\r\n }\r\n set duration(value) {\r\n this._duration = value;\r\n }\r\n /**\r\n * /duration in terms of qNotes.\r\n */\r\n get qNoteDuration() {\r\n return this._qNoteDuration;\r\n }\r\n set qNoteDuration(value) {\r\n this._qNoteDuration = value;\r\n }\r\n get qNoteTime() {\r\n return this._qNoteTime;\r\n }\r\n set qNoteTime(value) {\r\n this._qNoteTime = value;\r\n }\r\n get isGrace() {\r\n return this._isGrace;\r\n }\r\n set isGrace(value) {\r\n this._isGrace = value;\r\n }\r\n get stem() {\r\n return this._stem;\r\n }\r\n set stem(value) {\r\n this._stem = value;\r\n }\r\n /**\r\n * the vertical position of the start of the stem (at the notehead) measured\r\n * from the top staff line - negative values are below the top staff line\r\n */\r\n get stemStartPos() {\r\n return this._stemStartPos;\r\n }\r\n set stemStartPos(value) {\r\n this._stemStartPos = value;\r\n }\r\n get stemEndPos() {\r\n return this._stemEndPos;\r\n }\r\n set stemEndPos(value) {\r\n this._stemEndPos = value;\r\n }\r\n /**\r\n * the horizontal position of the stem\r\n */\r\n get stemHPos() {\r\n return this._stemHPos;\r\n }\r\n set stemHPos(value) {\r\n this._stemHPos = value;\r\n }\r\n get stemDirection() {\r\n return this._stemDirection;\r\n }\r\n set stemDirection(value) {\r\n this._stemDirection = value;\r\n }\r\n get beamStates() {\r\n return this._beamStates;\r\n }\r\n set beamStates(value) {\r\n this._beamStates = value;\r\n }\r\n /**\r\n * the number of beams this note could potentially support (0 for a quarter\r\n * or bigger, 1 for an eighth, 2 for a 16th note, etc.)\r\n */\r\n get maxBeams() {\r\n return this._maxBeams;\r\n }\r\n set maxBeams(value) {\r\n this._maxBeams = value;\r\n }\r\n /**\r\n * the number of accidental level positions needed for this chord (for \r\n * spacing purposes)\r\n */\r\n get numAccidentalLevels() {\r\n return this._numAccidentalLevels;\r\n }\r\n set numAccidentalLevels(value) {\r\n this._numAccidentalLevels = value;\r\n }\r\n get hPos() {\r\n return this._hPos;\r\n }\r\n set hPos(value) {\r\n this._hPos = value;\r\n }\r\n get tuplets() {\r\n return this._tuplets;\r\n }\r\n set tuplets(value) {\r\n this._tuplets = value;\r\n }\r\n /**\r\n * contains all Slur objects that start or stop on this note\r\n */\r\n get slurs() {\r\n return this._slurs;\r\n }\r\n set slurs(value) {\r\n this._slurs = value;\r\n }\r\n /**\r\n * if this note is the first note after the start of a mid-measure clef, \r\n * this holds a reference to that Clef - needed for spacing calculation\r\n */\r\n get clef() {\r\n return this._clef;\r\n }\r\n set clef(value) {\r\n this._clef = value;\r\n }\r\n get lyric() {\r\n return this._lyric;\r\n }\r\n set lyric(value) {\r\n this._lyric = value;\r\n }\r\n get clipStart() {\r\n return this._clipStart;\r\n }\r\n set clipStart(value) {\r\n this._clipStart = value;\r\n }\r\n get clipEnd() {\r\n return this._clipEnd;\r\n }\r\n set clipEnd(value) {\r\n this._clipEnd = value;\r\n }\r\n get idealHPos() {\r\n return this._idealHPos;\r\n }\r\n set idealHPos(value) {\r\n this._idealHPos = value;\r\n }\r\n get voice() {\r\n return this._voice;\r\n }\r\n set voice(value) {\r\n this._voice = value;\r\n }\r\n /**\r\n * the NoteGroupContainer this NoteGroup belongs to\r\n */\r\n get ngcRef() {\r\n return this._ngcRef;\r\n }\r\n set ngcRef(value) {\r\n this._ngcRef = value;\r\n }\r\n /**\r\n * returns the NoteGroup that follows this one in the same voice - not \r\n * stored as a property, but rather searched for dynamically\r\n */\r\n get next() {\r\n if (this._cachedNextNG != null) {\r\n return this._cachedNextNG;\r\n }\r\n let noteGroups = this._voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let i = 0; i < numNoteGroups; i++) {\r\n if (noteGroups[i] === this) {\r\n if (i < numNoteGroups - 1) {\r\n this._cachedNextNG = noteGroups[i + 1];\r\n return this._cachedNextNG;\r\n }\r\n }\r\n }\r\n let voiceNum = this._voice.number;\r\n let nextMeasure = this._voice.measure.next;\r\n while (nextMeasure != null) {\r\n let voices = nextMeasure.voices;\r\n for (let nextVoice of voices) {\r\n if (nextVoice.number === voiceNum) {\r\n if (nextVoice.noteGroups.length > 0) {\r\n this._cachedNextNG = nextVoice.noteGroups[0];\r\n return this._cachedNextNG;\r\n }\r\n }\r\n }\r\n nextMeasure = nextMeasure.next;\r\n }\r\n return null;\r\n }\r\n /**\r\n * returns the NoteGroup that precedes this one in the same voice - not \r\n * stored as a property, but rather searched for dynamically\r\n */\r\n get prev() {\r\n if (this._cachedPrevNG != null) {\r\n return this._cachedPrevNG;\r\n }\r\n let noteGroups = this._voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let i = numNoteGroups - 1; i >= 0; i--) {\r\n if (noteGroups[i] === this) {\r\n if (i > 0) {\r\n this._cachedPrevNG = noteGroups[i - 1];\r\n return this._cachedPrevNG;\r\n }\r\n }\r\n }\r\n let voiceNum = this._voice.number;\r\n let prevMeasure = this._voice.measure.prev;\r\n while (prevMeasure != null) {\r\n let voices = prevMeasure.voices;\r\n for (let prevVoice of voices) {\r\n if (prevVoice.number === voiceNum) {\r\n if (prevVoice.noteGroups.length > 0) {\r\n this._cachedPrevNG = prevVoice.noteGroups[prevVoice.noteGroups.length - 1];\r\n return this._cachedPrevNG;\r\n }\r\n }\r\n }\r\n prevMeasure = this._voice.measure.prev;\r\n }\r\n return null;\r\n }\r\n /**\r\n * the playback start time for this note, in seconds, from the beginning of\r\n * the piece.\r\n */\r\n get playbackStartTime() {\r\n return this._playbackStartTime;\r\n }\r\n set playbackStartTime(value) {\r\n this._playbackStartTime = value;\r\n }\r\n /**\r\n * the current tempo at the time of this note\r\n */\r\n get playbackTempo() {\r\n return this._playbackTempo;\r\n }\r\n set playbackTempo(value) {\r\n this._playbackTempo = value;\r\n }\r\n /**\r\n * a list of Articulation objects attached to this NoteGroup. Null if no \r\n * articulations are attached.\r\n */\r\n get articulations() {\r\n return this._articulations;\r\n }\r\n set articulations(value) {\r\n this._articulations = value;\r\n }\r\n ///a list of [Ornament] objects attached to this [NoteGroup]. Is Null if no\r\n ///ornaments are attached.\r\n get ornaments() {\r\n return this._ornaments;\r\n }\r\n set ornaments(value) {\r\n this._ornaments = value;\r\n }\r\n /**\r\n * true if this notegroup should be displayed and accounted for in \r\n * formatting\r\n */\r\n get visible() {\r\n return this._visible;\r\n }\r\n set visible(value) {\r\n this._prevVisible = this._visible;\r\n this._visible = value;\r\n }\r\n /**if not null, playback notes created from this note should be assigned\r\n * this track ID for volume control*/\r\n get trackId() {\r\n return this._trackId;\r\n }\r\n set trackId(value) {\r\n this._trackId = value;\r\n }\r\n};\r\n\r\n// src/data/containers/NoteGroupContainer.ts\r\nvar NoteGroupContainer = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //start duration unit time of the container within the containing measure or\r\n //tuplet\r\n this._durUnitStartTime = 0;\r\n //end duration unit time of the container within the containing measure or \r\n //tuplet\r\n this._durUnitEndTime = 0;\r\n }\r\n get qNoteStartTime() {\r\n return this._qNoteStartTime;\r\n }\r\n set qNoteStartTime(value) {\r\n this._qNoteStartTime = value;\r\n }\r\n get durUnitStartTime() {\r\n return this._durUnitStartTime;\r\n }\r\n set durUnitStartTime(value) {\r\n this._durUnitStartTime = value;\r\n }\r\n get durUnitEndTime() {\r\n return this._durUnitEndTime;\r\n }\r\n set durUnitEndTime(value) {\r\n this._durUnitEndTime = value;\r\n }\r\n get parentNGC() {\r\n return this._parentNGC;\r\n }\r\n set parentNGC(value) {\r\n this._parentNGC = value;\r\n }\r\n get noteGroup() {\r\n return this._noteGroup;\r\n }\r\n set noteGroup(value) {\r\n this._noteGroup = value;\r\n }\r\n get ngcList() {\r\n return this._ngcList;\r\n }\r\n set ngcList(value) {\r\n this._ngcList = value;\r\n }\r\n get tuplet() {\r\n return this._tuplet;\r\n }\r\n set tuplet(value) {\r\n this._tuplet = value;\r\n }\r\n};\r\n\r\n// src/data/containers/Page.ts\r\nvar Page = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n this._systems = [];\r\n }\r\n addSystem(system) {\r\n if (this._systems.length > 0) {\r\n let prevSystem = this._systems[this._systems.length - 1];\r\n prevSystem.next = system;\r\n system.previous = prevSystem;\r\n }\r\n system.pageRef = this;\r\n this._systems.push(system);\r\n }\r\n /**\r\n * removes the System from the Page. The System MUST have no remaining \r\n * MeasureStacks for this to go through\r\n * @param cSystem the empty System to remove\r\n */\r\n removeSystem(system) {\r\n if (system.measureStacks.length === 0) {\r\n for (let i = this._systems.length - 1; i >= 0; i--) {\r\n if (this._systems[i] === system) {\r\n this._systems.splice(i, 1);\r\n if (system.previous != null) {\r\n if (system.next != null) {\r\n system.previous.next = system.next;\r\n } else {\r\n system.previous.next = null;\r\n }\r\n }\r\n if (system.next != null) {\r\n if (system.previous != null) {\r\n system.next.previous = system.previous;\r\n } else {\r\n system.next.previous = null;\r\n }\r\n }\r\n return;\r\n }\r\n }\r\n } else {\r\n console.log(\"Attempted to remove a System that still contains MeasureStacks!\");\r\n }\r\n }\r\n get systems() {\r\n return this._systems;\r\n }\r\n get previous() {\r\n return this._previous;\r\n }\r\n set previous(value) {\r\n this._previous = value;\r\n }\r\n get next() {\r\n return this._next;\r\n }\r\n set next(value) {\r\n this._next = value;\r\n }\r\n};\r\n\r\n// src/data/io/PartData.ts\r\nvar PartData = class {\r\n static fromJsonString(jsonString) {\r\n try {\r\n return JSON.parse(jsonString);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n};\r\n\r\n// src/data/containers/Part.ts\r\nvar Part = class extends BaseDataObject {\r\n constructor(partID, name, abbreviation) {\r\n super();\r\n //private let _divisionsPerQuarterNote:int;\r\n this._staves = [];\r\n //number of diatonic steps that this part appears above concert pitch (- \r\n //values for appearing below)\r\n this._diatonicTransposition = 0;\r\n //number of chromatic steps that this part appears above concert pitch (- \r\n //values for appearing below)\r\n this._chromaticTransposition = 0;\r\n //true if this part is being rendered - affects whether NoteGroups are \r\n //included in MeasureStacks\r\n this._visible = false;\r\n //playback settings\r\n this._midiBank = 0;\r\n this._midiPreset = 0;\r\n this._midiChannel = 0;\r\n this._muted = false;\r\n this._volume = 0.15;\r\n this._pan = 0.5;\r\n //list of assessment instruments assigned to this part\r\n this._assessmentInstruments = [];\r\n this._preventTransposition = false;\r\n ///This is an optional override for controlling the playback pitch of all\r\n ///notes in the Part. When transposing parts there are times we want the\r\n ///changes in displayed pitch and part transposition to have less of an\r\n ///effect on playback. This value can be used by the playback engine to\r\n ///compensate the playback.\r\n this._playbackOctaveDelta = 0;\r\n this._partID = partID;\r\n this._name = name;\r\n this._abbreviation = abbreviation;\r\n }\r\n toPartData() {\r\n let data = new PartData();\r\n data.partID = this._partID;\r\n data.name = this._name;\r\n data.abbreviation = this._abbreviation;\r\n data.staves = this._staves.map((s) => s.toStaffData());\r\n data.diatonicTransposition = this._diatonicTransposition;\r\n data.chromaticTransposition = this._chromaticTransposition;\r\n data.midiBank = this._midiBank;\r\n data.midiPreset = this._midiPreset;\r\n data.midiChannel = this._midiChannel;\r\n data.percussionMap = this._percussionMap?.slice();\r\n return data;\r\n }\r\n addStaff(staff) {\r\n this._staves.push(staff);\r\n staff.partRef = this;\r\n }\r\n /**\r\n * gets all of the Measure objects in this Part containing entries between \r\n * the start and end times\r\n */\r\n getMeasuresByTime(qNoteStartTime, qNoteEndTime = null) {\r\n let allMeasures = [];\r\n if (qNoteEndTime == null) {\r\n let measures = this._staves[0].measures;\r\n qNoteEndTime = measures[measures.length - 1].stack.endTime;\r\n }\r\n let numStaves = this._staves.length;\r\n for (let i = 0; i < numStaves; i++) {\r\n let measures = this._staves[i].measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n let measure = measures[j];\r\n if (measure.stack.endTime <= qNoteStartTime) {\r\n continue;\r\n } else if (measure.stack.startTime > qNoteEndTime) {\r\n break;\r\n }\r\n allMeasures.push(measure);\r\n }\r\n }\r\n return allMeasures;\r\n }\r\n /**\r\n * gets all of the NoteGroup objects in this Part between the start and end\r\n * times\r\n */\r\n getNoteGroupsByTime(qNoteStartTime, qNoteEndTime = null) {\r\n if (qNoteEndTime == null) {\r\n let measures2 = this._staves[0].measures;\r\n qNoteEndTime = measures2[measures2.length - 1].stack.endTime;\r\n }\r\n let measures = this.getMeasuresByTime(qNoteStartTime, qNoteEndTime);\r\n let allNoteGroups = [];\r\n let numMeasures = measures.length;\r\n for (let i = 0; i < numMeasures; i++) {\r\n let voices = measures[i].voices;\r\n for (let j = 0; j < voices.length; j++) {\r\n let noteGroups = voices[j].noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let k = 0; k < numNoteGroups; k++) {\r\n if (i > 0 && i < numMeasures - 1 || noteGroups[k].qNoteTime >= qNoteStartTime && noteGroups[k].qNoteTime < qNoteEndTime) {\r\n allNoteGroups.push(noteGroups[k]);\r\n }\r\n }\r\n }\r\n }\r\n return allNoteGroups;\r\n }\r\n /**\r\n * returns a Array with all NoteGroup objects that are not rests\r\n * from a single staff and voice (noteGroupsExcludingRests property differs\r\n * as it returns all NoteGroups without rests for all staves and voices)\r\n */\r\n getNoteGroupsWithoutRests(staffIndex = 0, voiceIndex = 0) {\r\n let ngList = [];\r\n let measures = this._staves[staffIndex].measures;\r\n for (let measure of measures) {\r\n let noteGroups = measure.voices[voiceIndex].noteGroups;\r\n for (let ng of noteGroups) {\r\n if (!ng.isRest) {\r\n ngList.push(ng);\r\n }\r\n }\r\n }\r\n return ngList;\r\n }\r\n /**\r\n * returns a Array with all NoteGroup objects that are neither\r\n * rests nor the target of ties (NG's that begin ties are included)\r\n */\r\n getNoteGroupsWithoutRestsOrTieIntos(staffIndex = 0, voiceIndex = 0) {\r\n let ngList = [];\r\n let measures = this._staves[staffIndex].measures;\r\n for (let measure of measures) {\r\n let noteGroups = measure.voices[voiceIndex].noteGroups;\r\n for (let ng of noteGroups) {\r\n if (!ng.isRest && ng.visibleNotes[0].tieState !== TieState.CONTINUE && ng.visibleNotes[0].tieState !== TieState.STOP) {\r\n ngList.push(ng);\r\n }\r\n }\r\n }\r\n return ngList;\r\n }\r\n getFirstNote(staffIndex = 0, voiceIndex = 0) {\r\n return this._staves[staffIndex].measures[0].voices[voiceIndex].noteGroups[0];\r\n }\r\n /**\r\n * sets number of diatonic and chromatic steps that this part appears above\r\n * concert pitch (- values for appearing below)\r\n * for sounding pitch, the effect is reversed (appearing above concert pitch\r\n * means sounding below)\r\n * @updateMeasures - Measure.diatonicTransposition should usually be kept in\r\n * sync with Part - this does it.\r\n */\r\n setTransposition(diatonic, chromatic, updateMeasures = true) {\r\n this._diatonicTransposition = diatonic;\r\n this._chromaticTransposition = chromatic;\r\n if (updateMeasures) {\r\n let numStaves = this._staves.length;\r\n for (let i = 0; i < numStaves; i++) {\r\n let measures = this._staves[i].measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n let measure = measures[j];\r\n measure.diatonicTransposition = diatonic;\r\n measure.chromaticTransposition = chromatic;\r\n }\r\n }\r\n }\r\n }\r\n get staves() {\r\n return this._staves;\r\n }\r\n /**\r\n * ID for this Part\r\n */\r\n get partID() {\r\n return this._partID;\r\n }\r\n get name() {\r\n return this._name;\r\n }\r\n set name(value) {\r\n this._name = value;\r\n }\r\n get abbreviation() {\r\n return this._abbreviation;\r\n }\r\n set abbreviation(value) {\r\n this._abbreviation = value;\r\n }\r\n /**\r\n * number of diatonic steps that this part appears above concert pitch \r\n * (- values for appearing below)\r\n * for sounding pitch, the effect is reversed (appearing above concert pitch\r\n * means sounding below)\r\n */\r\n get diatonicTransposition() {\r\n return this._diatonicTransposition;\r\n }\r\n //void set diatonicTransposition(number value) { \r\n //_diatonicTransposition = value; \r\n //}\r\n /**\r\n * number of chromatic steps that this part appears above concert pitch \r\n * (- values for appearing below)\r\n * for sounding pitch, the effect is reversed (appearing above concert pitch\r\n * means sounding below)\r\n */\r\n get chromaticTransposition() {\r\n return this._chromaticTransposition;\r\n }\r\n //void set chromaticTransposition(number value) { \r\n //\t_chromaticTransposition = value; \r\n //}\r\n /**\r\n * true if this part is being rendered - affects whether NoteGroups and\r\n * measures are included in MeasureStacks\r\n */\r\n get visible() {\r\n return this._visible;\r\n }\r\n set visible(value) {\r\n this._visible = value;\r\n }\r\n /**\r\n * gets all of the Measure objects in this Part\r\n */\r\n get measures() {\r\n let allMeasures = [];\r\n let numStaves = this._staves.length;\r\n for (let i = 0; i < numStaves; i++) {\r\n let measures = this._staves[i].measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n allMeasures.push(measures[j]);\r\n }\r\n }\r\n return allMeasures;\r\n }\r\n /**\r\n * gets all of the NoteGroup objects in this Part\r\n */\r\n get noteGroups() {\r\n let allNoteGroups = [];\r\n let numStaves = this._staves.length;\r\n for (let i = 0; i < numStaves; i++) {\r\n let measures = this._staves[i].measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n let voices = measures[j].voices;\r\n for (let k = 0; k < voices.length; k++) {\r\n let noteGroups = voices[k].noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let m = 0; m < numNoteGroups; m++) {\r\n allNoteGroups.push(noteGroups[m]);\r\n }\r\n }\r\n }\r\n }\r\n return allNoteGroups;\r\n }\r\n /**\r\n * gets all of the NoteGroup objects in this Part\r\n */\r\n get noteGroupsExcludingRests() {\r\n let allNoteGroups = [];\r\n let numStaves = this._staves.length;\r\n for (let i = 0; i < numStaves; i++) {\r\n let measures = this._staves[i].measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n let voices = measures[j].voices;\r\n for (let k = 0; k < voices.length; k++) {\r\n let noteGroups = voices[k].noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let m = 0; m < numNoteGroups; m++) {\r\n if (!noteGroups[m].isRest) {\r\n allNoteGroups.push(noteGroups[m]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return allNoteGroups;\r\n }\r\n /**\r\n * MIDI Bank number for the playback sound\r\n */\r\n get midiBank() {\r\n return this._midiBank;\r\n }\r\n set midiBank(value) {\r\n this._midiBank = value;\r\n }\r\n /**\r\n * MIDI Preset number for the playback sound\r\n */\r\n get midiPreset() {\r\n return this._midiPreset;\r\n }\r\n set midiPreset(value) {\r\n this._midiPreset = value;\r\n }\r\n /**\r\n * MIDI Channel number for the playback sound\r\n */\r\n get midiChannel() {\r\n return this._midiChannel;\r\n }\r\n set midiChannel(value) {\r\n this._midiChannel = value;\r\n }\r\n /**\r\n * An array of playback notes for a non-pitched percussion part (will be \r\n * null if part isn't non-pitched percussion)\r\n * The index serves as the display pitch, and the value at that index is the\r\n * note that should be played instead. Indexes for unmapped display notes \r\n * have null values associated with them. The 0 index can be used to serve \r\n * as a default value.\r\n */\r\n get percussionMap() {\r\n return this._percussionMap;\r\n }\r\n set percussionMap(value) {\r\n this._percussionMap = value;\r\n }\r\n /**\r\n * true if playback is muted for this staff\r\n */\r\n get muted() {\r\n return this._muted;\r\n }\r\n set muted(value) {\r\n this._muted = value;\r\n }\r\n /**\r\n * a number between 0 and 1 representing the maximum volume the part can \r\n * play at (assuming max dynamic)\r\n */\r\n get volume() {\r\n return this._volume;\r\n }\r\n set volume(value) {\r\n this._volume = value;\r\n }\r\n /**\r\n * a number between 0 (left) and 1 (right) for the pan position of the \r\n * playback\r\n */\r\n get pan() {\r\n return this._pan;\r\n }\r\n set pan(value) {\r\n this._pan = value;\r\n }\r\n /**\r\n * list of assessment instruments assigned to this part\r\n */\r\n get assessmentInstruments() {\r\n return this._assessmentInstruments;\r\n }\r\n set assessmentInstruments(value) {\r\n this._assessmentInstruments = value;\r\n }\r\n get preventTransposition() {\r\n return this._preventTransposition;\r\n }\r\n set preventTransposition(value) {\r\n this._preventTransposition = value;\r\n }\r\n /**This is an optional override for controlling the playback pitch of all\r\n * notes in the Part. When transposing parts there are times we want the\r\n * changes in displayed pitch and part transposition to have less of an\r\n * effect on playback. This value can be used by the playback engine to\r\n * compensate the playback.*/\r\n get playbackOctaveDelta() {\r\n return this._playbackOctaveDelta;\r\n }\r\n set playbackOctaveDelta(value) {\r\n this._playbackOctaveDelta = value;\r\n }\r\n};\r\n\r\n// src/data/io/ScoreData.ts\r\nvar ScoreData = class {\r\n};\r\n\r\n// src/data/playback/PlaybackRegionDataType.ts\r\nvar PlaybackRegionDataType = /* @__PURE__ */ ((PlaybackRegionDataType2) => {\r\n PlaybackRegionDataType2[PlaybackRegionDataType2[\"MEASURE_STACK\"] = 0] = \"MEASURE_STACK\";\r\n PlaybackRegionDataType2[PlaybackRegionDataType2[\"TEMPO\"] = 1] = \"TEMPO\";\r\n PlaybackRegionDataType2[PlaybackRegionDataType2[\"MEASURE_ATTACHMENT\"] = 2] = \"MEASURE_ATTACHMENT\";\r\n PlaybackRegionDataType2[PlaybackRegionDataType2[\"BEAT\"] = 3] = \"BEAT\";\r\n PlaybackRegionDataType2[PlaybackRegionDataType2[\"SUB_BEAT\"] = 4] = \"SUB_BEAT\";\r\n PlaybackRegionDataType2[PlaybackRegionDataType2[\"NOTE_GROUP\"] = 5] = \"NOTE_GROUP\";\r\n return PlaybackRegionDataType2;\r\n})(PlaybackRegionDataType || {});\r\n\r\n// src/data/playback/TempoTimeStampDO.ts\r\nvar TempoTimeStampDO = class {\r\n constructor(time, msTime, qNoteTime, tempo) {\r\n this.time = time;\r\n this.msTime = msTime;\r\n this.qNoteTime = qNoteTime;\r\n this.tempo = tempo;\r\n }\r\n};\r\n\r\n// src/data/playback/PlaybackRegion.ts\r\nvar PlaybackRegion = class _PlaybackRegion {\r\n constructor(qNoteStartTime, qNoteEndTime) {\r\n /**list of [PlaybackRegionData] objects that describe events in the region*/\r\n this.data = [];\r\n this.qNoteStartTime = qNoteStartTime;\r\n this.qNoteEndTime = qNoteEndTime;\r\n }\r\n /**Creates and returns TempoTimeStampDO objects for the region.*/\r\n createTempoTimeStamps() {\r\n let timeStamps = [];\r\n let timeStamp = new TempoTimeStampDO(\r\n this.startTime,\r\n Math.floor(this.startTime * 1e3),\r\n this.qNoteStartTime,\r\n this.startTempo\r\n );\r\n timeStamps.push(timeStamp);\r\n let tdatas = this.data.filter((d) => d.type === 1 /* TEMPO */);\r\n for (let tdata of tdatas) {\r\n if (tdata.qNoteTime === this.qNoteEndTime) {\r\n continue;\r\n }\r\n if (tdata.qNoteTime > timeStamp.qNoteTime) {\r\n timeStamp.qNoteEndTime = tdata.qNoteTime;\r\n timeStamp = new TempoTimeStampDO(\r\n tdata.time,\r\n Math.floor(tdata.time * 1e3),\r\n tdata.qNoteTime,\r\n tdata.tempo\r\n );\r\n timeStamps[timeStamps.length - 1].nextSampleTimeStampDO = timeStamp;\r\n timeStamps.push(timeStamp);\r\n }\r\n }\r\n timeStamp.qNoteEndTime = this.qNoteEndTime;\r\n return timeStamps;\r\n }\r\n /**clones the [PlaybackRegion], copying all data elements. Data elements\r\n * are not cloned themselves, just referenced.\r\n * @startQNT the start QNoteTime to truncate the new region to. If null, the\r\n * original region's qNoteStartTime is used.\r\n * @endQNT the end QNoteTime to truncate the new region to. If null, the\r\n * original region's qNoteEndTime is used;*/\r\n clone(startQNT = null, endQNT = null) {\r\n if (startQNT == null)\r\n startQNT = this.qNoteStartTime;\r\n if (endQNT == null)\r\n endQNT = this.qNoteEndTime;\r\n if (startQNT < this.qNoteStartTime || endQNT > this.qNoteEndTime)\r\n throw \"startQNT or endQNT outside of range of this region\";\r\n let reg = new _PlaybackRegion(startQNT, endQNT);\r\n let dList = this.data.filter((d) => d.qNoteTime >= startQNT && d.qNoteTime <= endQNT);\r\n if (dList[0].qNoteTime !== startQNT) {\r\n throw \"The requested startQNT does not match any PlaybackRegionData\";\r\n \" objects in this region\";\r\n }\r\n reg.startTime = dList[0].time;\r\n reg.startTempo = dList[0].tempo;\r\n if (dList[dList.length - 1].qNoteTime !== endQNT && endQNT !== this.qNoteEndTime) {\r\n throw \"The requested endQNT does not match any PlaybackRegionData\";\r\n \" objects in this region and does not match the end time of the\";\r\n \" region.\";\r\n }\r\n if (dList[dList.length - 1].qNoteTime === endQNT) {\r\n reg.endTime = dList[dList.length - 1].time;\r\n dList.pop();\r\n } else {\r\n reg.endTime = this.endTime;\r\n }\r\n reg.data = dList;\r\n return reg;\r\n }\r\n /**returns a [PlaybackRegionData] object with a type of MEASURE_STACK that \r\n * contains the startQNoteTime and repeatPass. If repeatPass is null, any \r\n * pass matches. Returns null if a matching stack data isn't found. The \r\n * startQNT has to fall between the beginning of the stack (inclusive) and\r\n * end (exclusive).*/\r\n stackDataWithStartQNT(startQNT, repeatPass = null) {\r\n if (startQNT >= this.qNoteStartTime && startQNT < this.qNoteEndTime) {\r\n let match = this.data.find((d) => d.type == 0 /* MEASURE_STACK */ && d.stack.startTime <= startQNT && d.stack.endTime > startQNT && (repeatPass != null ? d.stackRepeatPass == repeatPass : true));\r\n return match;\r\n }\r\n return null;\r\n }\r\n /**returns a [PlaybackRegionData] object with a type of MEASURE_STACK that \r\n * contains the endQNoteTime and repeatPass. If repeatPass is null, any pass\r\n * matches. Returns null if a matching stack data isn't found. The endQNT\r\n * has to fall between the beginning of the stack (exclusive) and the end\r\n * (inclusive).*/\r\n stackDataWithEndQNT(endQNT, repeatPass = null) {\r\n if (endQNT > this.qNoteStartTime && endQNT <= this.qNoteEndTime) {\r\n let match = this.data.find((d) => d.type == 0 /* MEASURE_STACK */ && d.stack.startTime < endQNT && d.stack.endTime >= endQNT && (repeatPass != null ? d.stackRepeatPass == repeatPass : true));\r\n return match;\r\n }\r\n return null;\r\n }\r\n};\r\n\r\n// src/data/playback/PlaybackRegionData.ts\r\nvar PlaybackRegionData = class {\r\n};\r\n\r\n// src/data/playback/_PlaybackRegionManager.ts\r\nvar _PlaybackRegionManager = class {\r\n constructor(score, stacks, repeatAnalyzer) {\r\n this._score = score;\r\n this._stacks = stacks;\r\n this._repeatAnalyzer = repeatAnalyzer;\r\n }\r\n /**Creates a list of [PlaybackRegion] objects that match the requested\r\n * parameters.\r\n * @param startQNT - the start time in QNotes. 0 is beginning of piece. This\r\n * value must match the QNote value of a MeasureStack, beat or note in the\r\n * score. This value is inclusive (the first event at this QNote time will\r\n * be included.)\r\n * @param endQNT - the end time in QNotes. This value must match the QNote\r\n * value of a MeasureStack beginning or ending, beat or note in the score.\r\n * This value is exclusive (the first event at this QNote time will be\r\n * excluded.) If left null, the end time of the final [MeasureStack] will\r\n * be used (end of the piece).\r\n * @param startRepeatPass - Each time an element is encountered, the repeat\r\n * pass increments. 1 is the first pass.\r\n * @param endRepeatPass - Each time an element is encountered, the repeat\r\n * pass increments. 1 is the first pass. If left null, the final pass for\r\n * the endQNT will be used (matching end of song if endQNT is also null).\r\n * @param includeRepeats - if false, a single PlaybackRegion will be created\r\n * even if the score includes repeats. Both the startRepeatPass and\r\n * endRepeatPass should be 1.*/\r\n getPlaybackRegions(startQNT = 0, endQNT = null, startRepeatPass = 1, endRepeatPass = null, includeRepeats = true) {\r\n if (includeRepeats && this._regions == null) {\r\n this._regions = this._createRegions(\r\n this._repeatAnalyzer.playbackPath\r\n );\r\n } else if (!includeRepeats && this._regionNoRepeats == null) {\r\n this._regionNoRepeats = this._createRegions([\r\n 0,\r\n this._stacks[this._stacks.length - 1].endTime\r\n ])[0];\r\n }\r\n let regions = includeRepeats ? this._regions : [this._regionNoRepeats];\r\n if (startQNT === 0 && endQNT == null && startRepeatPass === 1 && endRepeatPass == null) {\r\n return regions;\r\n }\r\n if (startQNT == null)\r\n startQNT = 0;\r\n if (startRepeatPass == null)\r\n startRepeatPass = 1;\r\n if (endQNT == null)\r\n endQNT = this._stacks[this._stacks.length - 1].endTime;\r\n if (endRepeatPass == null) {\r\n for (let i = regions.length - 1; i >= 0; i--) {\r\n let stackData = regions[i].stackDataWithEndQNT(endQNT);\r\n if (stackData != null) {\r\n endRepeatPass = stackData.stackRepeatPass;\r\n break;\r\n }\r\n }\r\n }\r\n let firstSourceRegion = regions.find((r) => r.stackDataWithStartQNT(startQNT, startRepeatPass) != null);\r\n if (!firstSourceRegion) {\r\n throw \"startQNT not found for requested pass\";\r\n }\r\n let lastSourceRegion = regions.find((r) => r.stackDataWithEndQNT(endQNT, endRepeatPass) != null);\r\n if (!lastSourceRegion) {\r\n throw \"endQNT not found for requested pass\";\r\n }\r\n if (firstSourceRegion === lastSourceRegion) {\r\n let clone = firstSourceRegion.clone(startQNT, endQNT);\r\n return [clone];\r\n }\r\n let clones = [];\r\n for (let reg of regions) {\r\n if (reg === firstSourceRegion) {\r\n clones.push(reg.clone(startQNT));\r\n } else if (reg === lastSourceRegion) {\r\n clones.push(reg.clone(null, endQNT));\r\n break;\r\n } else if (clones.length > 0) {\r\n clones.push(reg.clone());\r\n }\r\n }\r\n return clones;\r\n }\r\n /**Creates and returns TempoTimeStampDO objects for passed in regions.*/\r\n createTempoTimeStamps(regions) {\r\n let allTimeStamps = [];\r\n for (let i = regions.length - 1; i >= 0; i--) {\r\n let regionStamps = regions[i].createTempoTimeStamps();\r\n if (allTimeStamps.length > 0) {\r\n regionStamps[regionStamps.length - 1].nextSampleTimeStampDO = allTimeStamps[0];\r\n }\r\n allTimeStamps.splice(0, 0, ...regionStamps);\r\n }\r\n let reg = regions[regions.length - 1];\r\n let lastStack = this._stacks[this._stacks.length - 1];\r\n let lastTM = lastStack.tempoMarkers[lastStack.tempoMarkers.length - 1];\r\n let stamp = new TempoTimeStampDO(\r\n reg.endTime,\r\n Math.floor(reg.endTime * 1e3),\r\n reg.qNoteEndTime,\r\n lastTM.tempo\r\n );\r\n stamp.qNoteEndTime = reg.qNoteEndTime;\r\n allTimeStamps[allTimeStamps.length - 1].nextSampleTimeStampDO = stamp;\r\n allTimeStamps.push(stamp);\r\n return allTimeStamps;\r\n }\r\n /**Gets the time in seconds for a given qNoteTime\r\n * @param targetQNoteTime - the qNote start time to match\r\n * @param repeatPass - the repeat pass to match - 1 is the first pass.*/\r\n convertQNoteTimeToSeconds(targetQNoteTime, repeatPass, includeRepeats) {\r\n if (this._regions == null && includeRepeats) {\r\n this._regions = this._createRegions(\r\n this._repeatAnalyzer.playbackPath\r\n );\r\n } else if (this._regionNoRepeats == null && !includeRepeats) {\r\n this._regionNoRepeats = this._createRegions(\r\n [0, this._stacks[this._stacks.length - 1].endTime]\r\n )[0];\r\n }\r\n let regions = includeRepeats ? this._regions : [this._regionNoRepeats];\r\n let lastRegion = regions[regions.length - 1];\r\n if (targetQNoteTime === lastRegion.qNoteEndTime) {\r\n return lastRegion.endTime;\r\n }\r\n let passNum;\r\n for (let reg of regions) {\r\n for (let data of reg.data) {\r\n if (data.stack != null) {\r\n passNum = data.stackRepeatPass;\r\n }\r\n if (data.qNoteTime === targetQNoteTime && passNum === repeatPass) {\r\n return Number.parseFloat(data.time.toFixed(4));\r\n }\r\n }\r\n }\r\n throw \"targetQNoteTime and repeatPass combo not found in song\";\r\n }\r\n /**Creates PlaybackRegion objects which contain a list of \r\n * PlaybackSequenceEvents. There will be one region for each pair of qNote\r\n * values in the playbackPath*/\r\n _createRegions(playbackPath) {\r\n if (this._stackNoteGroupsMap == null)\r\n this._createStackMaps();\r\n let cTempo;\r\n let refTempoTime = 0;\r\n let refQNoteTime = 0;\r\n let stackPassMap = /* @__PURE__ */ new Map();\r\n let regions = [];\r\n for (let i = 0; i < playbackPath.length; i += 2) {\r\n let startQNT = playbackPath[i];\r\n let endQNT = playbackPath[i + 1];\r\n let region = new PlaybackRegion(startQNT, endQNT);\r\n region.startTime = regions.length > 0 ? regions[regions.length - 1].endTime : 0;\r\n let regionStacks = this._stacks.filter((s) => s.startTime >= startQNT && s.endTime <= endQNT);\r\n cTempo = regionStacks[0].getInheritedTempoMarker().tempo;\r\n refTempoTime = region.startTime;\r\n refQNoteTime = startQNT;\r\n region.startTempo = cTempo;\r\n for (let stack of regionStacks) {\r\n let stackQNT = stack.startTime;\r\n let cStackData = new PlaybackRegionData();\r\n cStackData.qNoteTime = stack.startTime;\r\n let qNoteDelta2 = cStackData.qNoteTime - refQNoteTime;\r\n cStackData.time = 60 / cTempo * qNoteDelta2 + refTempoTime;\r\n cStackData.tempo = cTempo;\r\n cStackData.stack = stack;\r\n cStackData.type = 0 /* MEASURE_STACK */;\r\n if (stackPassMap.has(stack)) {\r\n stackPassMap.set(stack, stackPassMap.get(stack) + 1);\r\n } else {\r\n stackPassMap.set(stack, 1);\r\n }\r\n cStackData.stackRepeatPass = stackPassMap.get(stack);\r\n region.data.push(cStackData);\r\n let tms = stack.tempoMarkers;\r\n let attachments = this._stackAttachmentsMap.get(stack);\r\n let measure = stack.measures[0];\r\n let beats = measure.beatGroups;\r\n let subBeats = measure.subBeatGroups;\r\n let beatQnoteDur = measure.beatQnoteDuration;\r\n let subBeatQnoteDur = measure.subBeatQnoteDuration;\r\n let ngs = this._stackNoteGroupsMap.get(stack);\r\n let nextTmIndex = 0;\r\n let nextAttIndex = 0;\r\n let nextBeatIndex = 0;\r\n let nextSubBeatIndex = 0;\r\n let nextNgIndex = 0;\r\n let eventFound;\r\n do {\r\n eventFound = false;\r\n let testVals = [];\r\n if (tms != null && tms.length > nextTmIndex) {\r\n testVals.push(tms[nextTmIndex].qNoteTime);\r\n eventFound = true;\r\n } else\r\n testVals.push(Number.MAX_SAFE_INTEGER);\r\n if (attachments.length > nextAttIndex) {\r\n testVals.push(attachments[nextAttIndex].qNoteTime);\r\n eventFound = true;\r\n } else\r\n testVals.push(Number.MAX_SAFE_INTEGER);\r\n if (beats.length > nextBeatIndex) {\r\n testVals.push(stackQNT + beats[nextBeatIndex]);\r\n eventFound = true;\r\n } else\r\n testVals.push(Number.MAX_SAFE_INTEGER);\r\n if (subBeats.length > nextSubBeatIndex) {\r\n testVals.push(stackQNT + subBeats[nextSubBeatIndex]);\r\n eventFound = true;\r\n } else\r\n testVals.push(Number.MAX_SAFE_INTEGER);\r\n if (ngs.length > nextNgIndex) {\r\n testVals.push(ngs[nextNgIndex].qNoteTime);\r\n eventFound = true;\r\n } else\r\n testVals.push(Number.MAX_SAFE_INTEGER);\r\n if (eventFound) {\r\n let prData = new PlaybackRegionData();\r\n let resultIndex = this._getIndexOfMinValue(testVals);\r\n prData.qNoteTime = testVals[resultIndex];\r\n let qNoteDelta3 = prData.qNoteTime - refQNoteTime;\r\n prData.time = 60 / cTempo * qNoteDelta3 + refTempoTime;\r\n switch (resultIndex) {\r\n case 0:\r\n prData.type = 1 /* TEMPO */;\r\n cTempo = tms[nextTmIndex].tempo;\r\n refQNoteTime = prData.qNoteTime;\r\n refTempoTime = prData.time;\r\n if (cStackData.qNoteTime == refQNoteTime) {\r\n cStackData.tempo = cTempo;\r\n }\r\n nextTmIndex++;\r\n break;\r\n case 1:\r\n prData.type = 2 /* MEASURE_ATTACHMENT */;\r\n prData.measureAttachment = attachments[nextAttIndex];\r\n nextAttIndex++;\r\n break;\r\n case 2:\r\n prData.type = 3 /* BEAT */;\r\n prData.qNoteDuration = beatQnoteDur;\r\n nextBeatIndex++;\r\n break;\r\n case 3:\r\n prData.type = 4 /* SUB_BEAT */;\r\n prData.qNoteDuration = subBeatQnoteDur;\r\n nextSubBeatIndex++;\r\n break;\r\n case 4:\r\n prData.type = 5 /* NOTE_GROUP */;\r\n prData.noteGroup = ngs[nextNgIndex];\r\n nextNgIndex++;\r\n break;\r\n }\r\n prData.tempo = cTempo;\r\n region.data.push(prData);\r\n }\r\n } while (eventFound);\r\n }\r\n let qNoteDelta = endQNT - refQNoteTime;\r\n region.endTime = 60 / cTempo * qNoteDelta + refTempoTime;\r\n regions.push(region);\r\n }\r\n return regions;\r\n }\r\n _getIndexOfMinValue(values) {\r\n let minValue = Number.MAX_SAFE_INTEGER;\r\n let minIndex;\r\n for (let i = 0; i < values.length; i++) {\r\n if (values[i] < minValue) {\r\n minValue = values[i];\r\n minIndex = i;\r\n }\r\n }\r\n return minIndex;\r\n }\r\n _createStackMaps() {\r\n this._stackNoteGroupsMap = /* @__PURE__ */ new Map();\r\n this._stackAttachmentsMap = /* @__PURE__ */ new Map();\r\n for (let i = 0; i < this._stacks.length; i++) {\r\n let ngList = [];\r\n let attList = [];\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n let measure = staff.measures[i];\r\n for (let voice of measure.voices) {\r\n ngList.push(...voice.noteGroups);\r\n }\r\n attList.push(...measure.attachments);\r\n }\r\n }\r\n ngList.sort((ng1, ng2) => ng1.qNoteTime <= ng2.qNoteTime ? -1 : 1);\r\n this._stackNoteGroupsMap.set(this._stacks[i], ngList);\r\n attList.sort((a1, a2) => a1.qNoteTime <= a2.qNoteTime ? -1 : 1);\r\n this._stackAttachmentsMap.set(this._stacks[i], attList);\r\n }\r\n }\r\n};\r\n\r\n// src/data/playback/_RepeatAnalyzer.ts\r\nvar _RepeatAnalyzer = class {\r\n constructor(measureStacks) {\r\n this._measureStacks = measureStacks;\r\n }\r\n updatePlaybackPath() {\r\n let passMap = /* @__PURE__ */ new Map();\r\n for (let stack of this._measureStacks) {\r\n if (stack.repeatDOs != null) {\r\n passMap.set(stack, 0);\r\n }\r\n }\r\n this._playbackPath = [];\r\n this._createPlaybackPathPair(this._measureStacks, passMap, 0);\r\n return this._playbackPath;\r\n }\r\n _createPlaybackPathPair(stacks, passMap, startIndex) {\r\n let lastForwardRepeatIndex;\r\n for (let i = startIndex; i < stacks.length; i++) {\r\n let stack = stacks[i];\r\n if (stack.repeatDOs != null) {\r\n passMap.set(stack, passMap.get(stack) + 1);\r\n for (let rdo of stack.repeatDOs) {\r\n if (rdo.repeatDirection === RepeatDirection.FORWARD) {\r\n lastForwardRepeatIndex = i;\r\n }\r\n if (rdo.repeatDirection == RepeatDirection.BACKWARD && passMap.get(stack) <= rdo.repeatTimes) {\r\n if (lastForwardRepeatIndex == null) {\r\n lastForwardRepeatIndex = this._findPrecedingForwardRepeat(\r\n stacks,\r\n startIndex - 1\r\n );\r\n }\r\n this._playbackPath.push(stacks[startIndex].startTime);\r\n this._playbackPath.push(stack.endTime);\r\n this._createPlaybackPathPair(\r\n stacks,\r\n passMap,\r\n lastForwardRepeatIndex\r\n );\r\n return;\r\n }\r\n if (rdo.endingType == EndingType.START && rdo.endingNumber.indexOf(\"1\") !== -1) {\r\n let endingTargetIndex = this._chooseEnding(stacks, passMap, i);\r\n if (endingTargetIndex !== i) {\r\n this._playbackPath.push(\r\n stacks[startIndex].startTime\r\n );\r\n this._playbackPath.push(stack.startTime);\r\n this._createPlaybackPathPair(\r\n stacks,\r\n passMap,\r\n endingTargetIndex\r\n );\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this._playbackPath.push(stacks[startIndex].startTime);\r\n this._playbackPath.push(stacks[stacks.length - 1].endTime);\r\n }\r\n _findPrecedingForwardRepeat(stacks, startIndex) {\r\n for (let i = startIndex; i >= 0; i--) {\r\n let stack = stacks[i];\r\n if (stack.repeatDOs != null) {\r\n for (let rdo of stack.repeatDOs) {\r\n if (rdo.repeatDirection == RepeatDirection.FORWARD) {\r\n return i;\r\n }\r\n }\r\n }\r\n }\r\n return 0;\r\n }\r\n _chooseEnding(stacks, passMap, startIndex) {\r\n let endingTargetNum = passMap.get(stacks[startIndex]).toString();\r\n let lastEndingCloseIndex;\r\n for (let i = startIndex; i < stacks.length; i++) {\r\n let stack = stacks[i];\r\n if (stack.repeatDOs != null) {\r\n for (let rdo of stack.repeatDOs) {\r\n if (rdo.endingType === EndingType.START) {\r\n if (rdo.endingNumber != null && rdo.endingNumber.indexOf(endingTargetNum) !== -1) {\r\n return i;\r\n }\r\n lastEndingCloseIndex = null;\r\n } else if (rdo.endingType === EndingType.DISCONTINUE || rdo.endingType === EndingType.STOP) {\r\n lastEndingCloseIndex = i;\r\n }\r\n }\r\n if (lastEndingCloseIndex != null && lastEndingCloseIndex < i) {\r\n return i;\r\n }\r\n }\r\n }\r\n return startIndex;\r\n }\r\n /**contains a list of qNoteTimes in from/to pairings. If no repeats exist, \r\n * this will be from 0 to the qNoteTime of the end of the song.\r\n * Values are presented as pairs of startQNoteTimes (inclusive) and \r\n * stopQNoteTimes (exclusive). */\r\n get playbackPath() {\r\n return this._playbackPath ?? this.updatePlaybackPath();\r\n }\r\n};\r\n\r\n// src/data/playback/ScorePlaybackInfo.ts\r\nvar ScorePlaybackInfo = class {\r\n constructor(score) {\r\n this._score = score;\r\n this.reset();\r\n }\r\n /**clears cached data - use if Score changes in a way that can affect\r\n * playback (added measures, changed tempos, etc.).*/\r\n reset() {\r\n this._stacks = this._score.getMeasureStacks();\r\n this._repeatAnalyzer = new _RepeatAnalyzer(this._stacks);\r\n this._regionManager = new _PlaybackRegionManager(\r\n this._score,\r\n this._stacks,\r\n this._repeatAnalyzer\r\n );\r\n }\r\n /**Gets the time in seconds for a given qNoteTime at song's default tempo.\r\n * Considers repeats and TempoMarkers.\r\n * @param targetQNoteTime - the qNote start time to match\r\n * @param repeatPass - the repeat pass to match - 1 is the first pass.*/\r\n convertQNoteTimeToSeconds(targetQNoteTime, repeatPass = 1, includeRepeats = true) {\r\n return this._regionManager.convertQNoteTimeToSeconds(\r\n targetQNoteTime,\r\n repeatPass,\r\n includeRepeats\r\n );\r\n }\r\n /**Creates a list of [PlaybackRegion] objects that match the requested\r\n * parameters.\r\n * @param startQNT - the start time in QNotes. 0 is beginning of piece. This\r\n * value must match the QNote value of a MeasureStack, beat or note in the\r\n * score. This value is inclusive (the first event at this QNote time will\r\n * be included.)\r\n * @param endQNT - the end time in QNotes. This value must match the QNote\r\n * value of a MeasureStack beginning or ending, beat or note in the score.\r\n * This value is exclusive (the first event at this QNote time will be\r\n * excluded.) If left null, the end time of the final [MeasureStack] will\r\n * be used (end of the piece).\r\n * @param startRepeatPass - Each time an element is encountered, the repeat\r\n * pass increments. 1 is the first pass.\r\n * @param endRepeatPass - Each time an element is encountered, the repeat\r\n * pass increments. 1 is the first pass. If left null, the final pass for\r\n * the endQNT will be used (matching end of song if endQNT is also null).\r\n * @param includeRepeats - if false, a single PlaybackRegion will be created\r\n * even if the score includes repeats. Both the startRepeatPass and\r\n * endRepeatPass should be 1.*/\r\n getPlaybackRegions(startQNT = null, endQNT = null, startRepeatPass = null, endRepeatPass = null, includeRepeats = true) {\r\n return this._regionManager.getPlaybackRegions(\r\n startQNT,\r\n endQNT,\r\n startRepeatPass,\r\n endRepeatPass,\r\n includeRepeats\r\n );\r\n }\r\n /**contains a list of qNoteTimes in from/to pairings. If no repeats exist, \r\n * this will be from 0 to the qNoteTime of the end of the song.\r\n * Values are presented as pairs of startQNoteTimes (inclusive) and \r\n * stopQNoteTimes (exclusive). */\r\n get playbackPath() {\r\n return this._repeatAnalyzer.playbackPath;\r\n }\r\n /**Creates and returns TempoTimeStampDO objects for passed in regions.*/\r\n createTempoTimeStamps(regions) {\r\n return this._regionManager.createTempoTimeStamps(regions);\r\n }\r\n};\r\n\r\n// src/data/containers/Score.ts\r\nvar Score = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //contains Part objects (container hierarchy: Parts >> Staves >> Measures >>\r\n //Voices >> NoteGroups >> Notes)\r\n this._parts = [];\r\n //contains the Page objects (container hierarchy: Pages >> Systems >> \r\n //MeasureStacks)\r\n this._pages = [];\r\n //true when grace notes have not been offset properly (MusicXML files don't \r\n //have them positioned)\r\n this._graceNotesNeedFixing = false;\r\n }\r\n toScoreData() {\r\n let stacks = this.getMeasureStacks();\r\n let data = new ScoreData();\r\n data.graceNotesNeedFixing = this._graceNotesNeedFixing;\r\n data.measureStacks = stacks.map((s) => s.toMeasureStackData());\r\n return data;\r\n }\r\n /**\r\n * adds the Part\r\n * @param\tpart a Part object\r\n */\r\n addPart(part) {\r\n this._parts.push(part);\r\n }\r\n /**\r\n * adds the Page\r\n * @param\tpage a Page object\r\n */\r\n addPage(page) {\r\n if (this._pages.length > 0) {\r\n let prevPage = this._pages[this._pages.length - 1];\r\n prevPage.next = page;\r\n page.previous = prevPage;\r\n }\r\n this._pages.push(page);\r\n }\r\n /**\r\n * gets all of the System objects found in the score (looks through each \r\n * page)\r\n * @return a list of System objects\r\n */\r\n getSystems() {\r\n let systems = [];\r\n for (let page of this._pages) {\r\n for (let system of page.systems) {\r\n systems.push(system);\r\n }\r\n }\r\n return systems;\r\n }\r\n /**\r\n * gets all of the MeasureStack objects found in the score (looks through \r\n * each page and system\r\n * @return a list of MeasureStack objects\r\n */\r\n getMeasureStacks() {\r\n let stacks = [];\r\n for (let page of this._pages) {\r\n for (let system of page.systems) {\r\n for (let stack of system.measureStacks) {\r\n stacks.push(stack);\r\n }\r\n }\r\n }\r\n return stacks;\r\n }\r\n /**\r\n * gets the qnote position for every beat in the score, returning them in an \r\n * array and also writing them to the MeasureStack objects\r\n * @return a list of the qnote positions\r\n */\r\n getBeatQNotePositions() {\r\n let allBeatQNotePositions = [];\r\n let totalBeats = 0;\r\n let stacks = this.getMeasureStacks();\r\n for (let stack of stacks) {\r\n let measure = stack.measures[0];\r\n let numBeats = measure.numBeats;\r\n let numBigBeats = 0;\r\n let beatQNotePositions = [];\r\n for (let i = 0; i < numBeats; i++) {\r\n if (measure.beatType === 8 || measure.beatType === 16) {\r\n if (i % 3 === 0) {\r\n let position = i * (4 / measure.beatType) + stack.startTime;\r\n beatQNotePositions.push(position);\r\n allBeatQNotePositions.push(position);\r\n }\r\n } else {\r\n let position = i * (4 / measure.beatType) + stack.startTime;\r\n beatQNotePositions.push(position);\r\n allBeatQNotePositions.push(position);\r\n }\r\n }\r\n stack.beatQNotePositions = beatQNotePositions;\r\n }\r\n return allBeatQNotePositions;\r\n }\r\n /**\r\n * removes the Page from the Score. The Page MUST have no remaining Systems \r\n * for this to go through\r\n * @param page the empty Page to remove\r\n */\r\n removePage(page) {\r\n if (page.systems.length == 0) {\r\n for (let i = this._pages.length - 1; i >= 0; i--) {\r\n if (this._pages[i] === page) {\r\n if (i > 0 && this._pages[i - 1].next === page) {\r\n this._pages[i - 1].next = i < this._pages.length - 1 ? this._pages[i + 1] : null;\r\n }\r\n if (i < this._pages.length - 1 && this._pages[i + 1].previous === page) {\r\n this._pages[i + 1].previous = i > 0 ? this._pages[i - 1] : null;\r\n }\r\n this._pages.splice(i, 1);\r\n return;\r\n }\r\n }\r\n } else {\r\n console.log(\"Attempted to remove a Page that still contains Systems!\");\r\n }\r\n }\r\n /**adjusts the scale the score is formatted and rendered at. The number of\r\n * pixels that fit between two staff lines (within the same staff). Default\r\n * is specified in [ScoreProperties._pixelsPerSpace] (10). If\r\n * [preservePageSize] is true, the page width and height in spaces is \r\n * changed to preserve the original pixel width/height.*/\r\n setPixelsPerSpace(pixelsPerSpace, preservePageSize = true) {\r\n if (preservePageSize) {\r\n let scale = this._scoreProperties.pixelsPerSpace / pixelsPerSpace;\r\n this._scoreProperties.pageWidth *= scale;\r\n this._scoreProperties.pageHeight *= scale;\r\n this._scoreProperties.topPageMargin *= scale;\r\n this._scoreProperties.leftPageMargin *= scale;\r\n this._scoreProperties.rightPageMargin *= scale;\r\n this._scoreProperties.bottomPageMargin *= scale;\r\n }\r\n this._scoreProperties.pixelsPerSpace = pixelsPerSpace;\r\n let systems = this.getSystems();\r\n for (let sys of systems) {\r\n sys.getSettingsFromScoreProperties();\r\n }\r\n }\r\n /**adjusts the width and height of the score without changing the\r\n * scaling (staff height) of the notation. If [valuesArePixels] is true,\r\n * then the values are interpreted as pixels instead of spaces.*/\r\n setPageSize(pageWidth, pageHeight, valuesArePixels = true) {\r\n if (valuesArePixels) {\r\n let px = this._scoreProperties.pixelsPerSpace;\r\n this._scoreProperties.pageWidth = pageWidth / px;\r\n this._scoreProperties.pageHeight = pageHeight / px;\r\n } else {\r\n this._scoreProperties.pageWidth = pageWidth;\r\n this._scoreProperties.pageHeight = pageHeight;\r\n }\r\n let systems = this.getSystems();\r\n for (let sys of systems) {\r\n sys.getSettingsFromScoreProperties();\r\n }\r\n }\r\n /**utility method to mark all measures (and thus stacks and systems as\r\n * needing a re-render. Ordinarily measures are marked for rendering as part\r\n * of the formatting process, but this can be used to force a clean redraw*/\r\n markAllMeasuresNeedRendering() {\r\n let stacks = this.getMeasureStacks();\r\n for (let i = 0; i < stacks.length; i++) {\r\n let stack = stacks[i];\r\n let measures = stack.measures;\r\n for (let j = 0; j < measures.length; j++) {\r\n measures[j].notesNeedRendering = true;\r\n }\r\n }\r\n }\r\n get playbackInfo() {\r\n if (this._playbackInfo == null)\r\n this._playbackInfo = new ScorePlaybackInfo(this);\r\n return this._playbackInfo;\r\n }\r\n get scoreProperties() {\r\n return this._scoreProperties;\r\n }\r\n set scoreProperties(value) {\r\n this._scoreProperties = value;\r\n }\r\n get parts() {\r\n return this._parts;\r\n }\r\n get pages() {\r\n return this._pages;\r\n }\r\n /**\r\n * true when grace notes have not been offset properly (MusicXML files don't\r\n * have them positioned)\r\n */\r\n get graceNotesNeedFixing() {\r\n return this._graceNotesNeedFixing;\r\n }\r\n set graceNotesNeedFixing(value) {\r\n this._graceNotesNeedFixing = value;\r\n }\r\n};\r\n\r\n// src/data/io/StaffData.ts\r\nvar StaffData = class {\r\n};\r\n\r\n// src/data/containers/Staff.ts\r\nvar Staff = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n this._measures = [];\r\n this._lyricsMode = 0 /* SHOW_LYRICS */;\r\n ///determines whether staff is rendered\r\n this._visible = true;\r\n }\r\n toStaffData() {\r\n let data = new StaffData();\r\n data.measures = this._measures.map((m) => m.toMeasureData());\r\n data.visible = this._visible;\r\n return data;\r\n }\r\n addMeasure(measure) {\r\n this._measures.push(measure);\r\n measure.staff = this;\r\n }\r\n /**\r\n * removes the measure at the requested index\r\n * @param index the index of the measure with the measures list\r\n */\r\n removeMeasureAt(index) {\r\n this._measures.splice(index, 1);\r\n }\r\n /**\r\n * inserts the Measure at the requested index\r\n * @param\tmeasure the Measure to insert\r\n * @param\tinsertionIndex the position to insert the Measure (if invalid, \r\n * the Measure is not added)\r\n */\r\n insertMeasure(measure, insertionIndex) {\r\n if (insertionIndex <= this._measures.length && insertionIndex >= 0) {\r\n this._measures.splice(insertionIndex, 0, measure);\r\n measure.staff = this;\r\n } else {\r\n console.log(\"requested index out of range!\");\r\n }\r\n }\r\n /**returns the first NoteGroup that isn't a rest or null if none is found.*/\r\n getFirstNonRest() {\r\n for (let measure of this._measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (!ng.isRest) {\r\n return ng;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n get measures() {\r\n return this._measures;\r\n }\r\n set measures(value) {\r\n this._measures = value;\r\n }\r\n get partRef() {\r\n return this._partRef;\r\n }\r\n set partRef(value) {\r\n this._partRef = value;\r\n }\r\n get originalLyrics() {\r\n return this._originalLyrics;\r\n }\r\n set originalLyrics(value) {\r\n this._originalLyrics = value;\r\n }\r\n get lyricsMode() {\r\n return this._lyricsMode;\r\n }\r\n set lyricsMode(value) {\r\n this._lyricsMode = value;\r\n }\r\n /**\r\n * true if this staff is being rendered - affects whether NoteGroups and\r\n * measures are included in MeasureStacks. Note, at least one staff must\r\n * be visible for any given part. To hide an entire part, don't include it\r\n * in the list of Parts sent for render.\r\n */\r\n get visible() {\r\n return this._visible;\r\n }\r\n set visible(value) {\r\n if (value == false) {\r\n let atLeastOneStaffVisible = false;\r\n for (let staff of this._partRef.staves) {\r\n if (staff !== this && staff._visible) {\r\n atLeastOneStaffVisible = true;\r\n }\r\n }\r\n if (!atLeastOneStaffVisible) {\r\n throw \"Part must have at least one visible Staff\";\r\n }\r\n }\r\n this._visible = value;\r\n }\r\n};\r\n\r\n// src/data/containers/System.ts\r\nvar System = class extends BaseDataObject {\r\n constructor(scoreProps) {\r\n super();\r\n //the amount to indent the system, in tenths.\r\n this._indent = 0;\r\n //default space between staff lines\r\n // number _staffLineSpacing; \r\n //vertical offset positions of the staves in the system (in tenths) (0 is \r\n //default position)\r\n this._staffVPosOffsets = [];\r\n this._measureStacks = [];\r\n //set to true if this system starts a new page\r\n this._newPage = false;\r\n //set to true in order to force re-rendering of system on next render\r\n this._needsRendering = true;\r\n this._scoreProps = scoreProps;\r\n this._init();\r\n }\r\n _init() {\r\n this.getSettingsFromScoreProperties();\r\n }\r\n getSettingsFromScoreProperties() {\r\n this._systemWidth = this._scoreProps.pageWidth - this._scoreProps.leftPageMargin - this._scoreProps.rightPageMargin - this._scoreProps.leftSystemMargin - this._scoreProps.rightSystemMargin;\r\n this._staffSpacing = this._scoreProps.staffSpacing;\r\n }\r\n /**\r\n * adds a single MeasureStack\r\n * @param\tstack the MeasureStack object to add\r\n * @param\tlinkStacksBetweenSystems if true, the stacks in this system will\r\n * be linked with the stacks in the surrounding systems (prev and next \r\n * properties)\r\n */\r\n addMeasureStack(stack, linkStacksBetweenSystems = true) {\r\n stack.systemRef = this;\r\n if (this._measureStacks.length > 0) {\r\n let prevStack = this._measureStacks[this._measureStacks.length - 1];\r\n prevStack.next = stack;\r\n stack.previous = prevStack;\r\n }\r\n this._measureStacks.push(stack);\r\n if (linkStacksBetweenSystems) {\r\n this.linkStacksInSurroundingSystems();\r\n }\r\n }\r\n /**\r\n * adds one or more MeasureStack objects\r\n * @param\tstacks a list of MeasureStack objects\r\n * @param\tlinkStacksBetweenSystems if true, the stacks in this system will\r\n * be linked with the stacks in the surrounding systems (prev and next \r\n * properties)\r\n */\r\n addMeasureStacks(stacks, linkStacksBetweenSystems = true) {\r\n let prevStack;\r\n if (this._measureStacks.length > 0) {\r\n prevStack = this._measureStacks[this._measureStacks.length - 1];\r\n }\r\n for (let stack of stacks) {\r\n stack.systemRef = this;\r\n prevStack.next = stack;\r\n stack.previous = prevStack;\r\n this._measureStacks.push(stack);\r\n prevStack = stack;\r\n }\r\n if (linkStacksBetweenSystems) {\r\n this.linkStacksInSurroundingSystems();\r\n }\r\n }\r\n /**\r\n * inserts a single MeasureStack at the beginning of the system\r\n * @param\tstack the MeasureStack to insert\r\n * @param\tlinkStacksBetweenSystems if true, the stacks in this system will\r\n * be linked with the stacks in the surrounding systems (prev and next \r\n * properties)\r\n */\r\n insertStack(stack, linkStacksBetweenSystems = true) {\r\n stack.systemRef = this;\r\n this._measureStacks.splice(0, 0, stack);\r\n if (this._measureStacks.length > 1) {\r\n let nextStack = this._measureStacks[1];\r\n nextStack.previous = stack;\r\n stack.next = nextStack;\r\n }\r\n if (linkStacksBetweenSystems) {\r\n this.linkStacksInSurroundingSystems();\r\n }\r\n }\r\n /**\r\n * inserts one or more MeasureStack objects at the beginning of the system,\r\n * retaining their order\r\n * @param\tstacks a list of MeasureStack objects\r\n * @param\tlinkStacksBetweenSystems if true, the stacks in this system will\r\n * be linked with the stacks in the surrounding systems (prev and next \r\n * properties)\r\n */\r\n insertMeasureStacks(stacks, linkStacksBetweenSystems = true) {\r\n let index = 0;\r\n for (let stack of stacks) {\r\n stack.systemRef = this;\r\n this._measureStacks.splice(index, 0, stack);\r\n if (index > 0) {\r\n let prevStack = this._measureStacks[index - 1];\r\n prevStack.next = stack;\r\n stack.previous = prevStack;\r\n }\r\n if (index < this._measureStacks.length - 1) {\r\n let nextStack = this._measureStacks[index + 1];\r\n nextStack.previous = stack;\r\n stack.next = nextStack;\r\n }\r\n index++;\r\n }\r\n if (linkStacksBetweenSystems) {\r\n this.linkStacksInSurroundingSystems();\r\n }\r\n }\r\n /**\r\n * removes the specified number of stacks from the front of the system and\r\n * returns them as a list\r\n * @param\tcount the number of stacks to remove. If less than or equal to\r\n * 0, all of the stacks are removed.\r\n * @return\tthe list of MeasureStacks that was removed\r\n */\r\n removeStacksFromBeginning(count) {\r\n if (count >= this._measureStacks.length || count <= 0) {\r\n count = this._measureStacks.length;\r\n }\r\n let removedStacks = this._measureStacks.slice(0, count);\r\n this._measureStacks.splice(0, count);\r\n return removedStacks;\r\n }\r\n /**\r\n * removes the specified number of stacks from the end of the system and\r\n * returns them as a list\r\n * @param\tcount the number of stacks to remove. If less than or equal to\r\n * 0, all of the stacks are removed.\r\n * @return\tthe list of MeasureStacks that was removed\r\n */\r\n removeStacksFromEnd(count) {\r\n if (count >= this._measureStacks.length || count <= 0) {\r\n count = this._measureStacks.length;\r\n }\r\n let removedStacks = this._measureStacks.slice(\r\n this._measureStacks.length - count,\r\n this._measureStacks.length\r\n );\r\n this._measureStacks.splice(\r\n this._measureStacks.length - count,\r\n this._measureStacks.length\r\n );\r\n return removedStacks;\r\n }\r\n /**\r\n * adds the new stack directly after an existing stack (used to insert the\r\n * stack in the middle of other stacks)\r\n * @param\tnewStack the Stack to insert\r\n * @param\tstackToFollow the Stack to find and insert the new Stack after\r\n * @param\tlinkStacksBetweenSystems if true, the stacks in this system will\r\n * be linked with the stacks in the surrounding systems (prev and next\r\n * properties)\r\n * @return\treturns true if the stackToFollow is found and the newStack is\r\n * added\r\n */\r\n addStackAfterExistingStack(newStack, stackToFollow, linkStacksBetweenSystems = true) {\r\n let numStacks = this._measureStacks.length;\r\n for (let i = 0; i < numStacks; i++) {\r\n if (this._measureStacks[i] === stackToFollow) {\r\n stackToFollow.next = newStack;\r\n newStack.previous = stackToFollow;\r\n newStack.systemRef = this;\r\n if (i + 1 < numStacks) {\r\n let nextStack = this._measureStacks[i + 1];\r\n nextStack.previous = newStack;\r\n newStack.next = nextStack;\r\n }\r\n this._measureStacks.splice(i + 1, 0, newStack);\r\n if (linkStacksBetweenSystems) {\r\n this.linkStacksInSurroundingSystems();\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * removes the MeasureStack at the requested index and recreates the\r\n * MeasureStack links\r\n * @param index the index of the stack to remove\r\n */\r\n removeStack(stack) {\r\n let index = this._measureStacks.indexOf(stack);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._measureStacks.splice(index, 1);\r\n if (index === 0 || index === this._measureStacks.length) {\r\n this.linkStacksInSurroundingSystems();\r\n } else {\r\n this._measureStacks[index - 1].next = this._measureStacks[index];\r\n this._measureStacks[index].previous = this._measureStacks[index - 1];\r\n }\r\n }\r\n attemptStackDonation() {\r\n return false;\r\n }\r\n /**\r\n * clears all MeasureStacks objects from the System. It does NOT modify the\r\n * references in the MeasureStack objects, so they will still refer to this\r\n * System as their owner and refer to surrounding Stacks as next and \r\n * previous\r\n */\r\n clearAllStacks() {\r\n this._measureStacks = [];\r\n }\r\n /**\r\n * links the first stack of this system with the last stack of the previous\r\n * system and links the last stack in this system with the first stack in \r\n * the next system (assuming the surrounding systems exist)\r\n */\r\n linkStacksInSurroundingSystems() {\r\n if (this._measureStacks.length <= 0) {\r\n return;\r\n }\r\n let firstStack = this._measureStacks[0];\r\n let lastStack = this._measureStacks[this._measureStacks.length - 1];\r\n let prevSystem = this.previous;\r\n if (prevSystem == null) {\r\n firstStack.previous = null;\r\n }\r\n while (prevSystem != null) {\r\n if (prevSystem.measureStacks.length > 0) {\r\n let prevStack = prevSystem.measureStacks[prevSystem.measureStacks.length - 1];\r\n prevStack.next = firstStack;\r\n firstStack.previous = prevStack;\r\n break;\r\n }\r\n prevSystem = prevSystem.previous;\r\n }\r\n let nextSystem = this.next;\r\n if (nextSystem == null) {\r\n lastStack.next = null;\r\n }\r\n while (nextSystem != null) {\r\n if (nextSystem.measureStacks.length > 0) {\r\n let nextStack = nextSystem.measureStacks[0];\r\n nextStack.previous = lastStack;\r\n lastStack.next = nextStack;\r\n break;\r\n }\r\n nextSystem = nextSystem.next;\r\n }\r\n }\r\n /**\r\n * creates a list of the staff barline groupings according to the number of\r\n * staves in each part. Ex. [1, 1, 1, 2] for flute, oboe, bassoon, piano\r\n * Only creates groupings for visible parts and staves.\r\n */\r\n _createPartStaffGroupings() {\r\n if (this._measureStacks.length === 0) {\r\n return [];\r\n }\r\n let groupings = [];\r\n let stack = this._measureStacks[0];\r\n let measures = stack.measures;\r\n let numMeasures = measures.length;\r\n let measureIndex = 0;\r\n while (measureIndex < numMeasures) {\r\n let measure = measures[measureIndex];\r\n let numVisibleStaves = 0;\r\n for (let staff of measure.staff.partRef.staves) {\r\n if (staff.visible)\r\n numVisibleStaves++;\r\n }\r\n let numStaves = measure.staff.partRef.staves.length;\r\n if (this._visibleParts.indexOf(measure.staff.partRef) !== -1) {\r\n groupings.push(numVisibleStaves);\r\n }\r\n measureIndex += numStaves;\r\n }\r\n return groupings;\r\n }\r\n /**creates staff barline groupings with all parts/staves in a single group*/\r\n _createScoreStaffGroupings() {\r\n if (this._measureStacks.length === 0) {\r\n return [];\r\n }\r\n let stack = this._measureStacks[0];\r\n let measures = stack.measures;\r\n let numMeasures = measures.length;\r\n let measureIndex = 0;\r\n let totalStaves = 0;\r\n while (measureIndex < numMeasures) {\r\n let measure = measures[measureIndex];\r\n let numVisibleStaves = 0;\r\n for (let staff of measure.staff.partRef.staves) {\r\n if (staff.visible)\r\n numVisibleStaves++;\r\n }\r\n let numStaves = measure.staff.partRef.staves.length;\r\n if (this._visibleParts.indexOf(measure.staff.partRef) !== -1) {\r\n totalStaves += numVisibleStaves;\r\n }\r\n measureIndex += numStaves;\r\n }\r\n return [totalStaves];\r\n }\r\n /**\r\n * returns the sum of the idealWidths of the measure stacks currently in the\r\n * system (regardless of what the system's width is)\r\n */\r\n get requestedStackWidth() {\r\n if (this._measureStacks.length === 0) {\r\n return 0;\r\n }\r\n let totalWidth = 0;\r\n for (let stack of this._measureStacks) {\r\n totalWidth += stack.idealWidth;\r\n }\r\n return totalWidth;\r\n }\r\n get measureStacks() {\r\n return this._measureStacks;\r\n }\r\n get indent() {\r\n return this._indent;\r\n }\r\n set indent(value) {\r\n this._indent = value;\r\n }\r\n /**\r\n * width of the system, in tenths\r\n */\r\n get systemWidth() {\r\n return this._systemWidth;\r\n }\r\n set systemWidth(value) {\r\n this._systemWidth = value;\r\n }\r\n /**\r\n * default space between staves, in tenths\r\n */\r\n get staffSpacing() {\r\n return this._staffSpacing;\r\n }\r\n set staffSpacing(value) {\r\n this._staffSpacing = value;\r\n }\r\n /**\r\n * default space between staff lines, in tenths\r\n */\r\n // number get staffLineSpacing { return _staffLineSpacing; }\r\n // void set staffLineSpacing(number value) { _staffLineSpacing = value; }\r\n /**\r\n * returns a list of the vertical offsets from default positions (in tenths)\r\n * of all staves in the system - for any that haven't previously been set,\r\n * it sets the offset to 0. We use this system instead of returning exact \r\n * values to account for scores being rendered with only some parts present\r\n */\r\n get staffVPosOffsets() {\r\n if (this._measureStacks.length === 0) {\r\n return [];\r\n }\r\n let staffIndex = this._staffVPosOffsets.length;\r\n let numStaves = this._measureStacks[0].measures.length;\r\n if (staffIndex > numStaves) {\r\n this._staffVPosOffsets.splice(numStaves, staffIndex - numStaves);\r\n staffIndex = this._staffVPosOffsets.length;\r\n }\r\n while (staffIndex < numStaves) {\r\n if (staffIndex >= this._staffVPosOffsets.length) {\r\n this._staffVPosOffsets.push(0);\r\n } else {\r\n this._staffVPosOffsets[staffIndex] = 0;\r\n }\r\n staffIndex++;\r\n }\r\n return this._staffVPosOffsets;\r\n }\r\n set staffVPosOffsets(value) {\r\n this._staffVPosOffsets = value;\r\n }\r\n /**\r\n * returns a list of the staff barline groupings according to the number of\r\n * staves in each part. Ex. [1, 1, 1, 2] for flute, oboe, bassoon, piano\r\n * Only returns groupings for visible parts and staves.\r\n */\r\n get staffGroupings() {\r\n let staffGroupings;\r\n switch (this._scoreProps.staffGroupingStyle) {\r\n case 0 /* part */:\r\n staffGroupings = this._createPartStaffGroupings();\r\n break;\r\n case 1 /* score */:\r\n staffGroupings = this._createScoreStaffGroupings();\r\n break;\r\n }\r\n return staffGroupings;\r\n }\r\n /**\r\n * the parts that are visible in this system\r\n */\r\n get visibleParts() {\r\n return this._visibleParts;\r\n }\r\n set visibleParts(value) {\r\n this._visibleParts = value;\r\n }\r\n get previous() {\r\n return this._previous;\r\n }\r\n set previous(value) {\r\n this._previous = value;\r\n }\r\n get next() {\r\n return this._next;\r\n }\r\n set next(value) {\r\n this._next = value;\r\n }\r\n get pageRef() {\r\n return this._pageRef;\r\n }\r\n set pageRef(value) {\r\n this._pageRef = value;\r\n }\r\n /**\r\n * set to true if this system starts a new page\r\n */\r\n get newPage() {\r\n return this._newPage;\r\n }\r\n set newPage(value) {\r\n this._newPage = value;\r\n }\r\n /**\r\n * set to true in order to force re-rendering of system on next render\r\n */\r\n get needsRendering() {\r\n return this._needsRendering;\r\n }\r\n set needsRendering(value) {\r\n this._needsRendering = value;\r\n }\r\n /**\r\n * list of SlurSegments that should be rendered for this system\r\n */\r\n get slurSegments() {\r\n return this._slurSegments;\r\n }\r\n set slurSegments(value) {\r\n this._slurSegments = value;\r\n }\r\n};\r\n\r\n// src/data/io/RepeatDOData.ts\r\nvar RepeatDOData = class {\r\n};\r\n\r\n// src/data/playback/RepeatDO.ts\r\nvar RepeatDO = class extends BaseDataObject {\r\n toRepeatDOData() {\r\n let data = new RepeatDOData();\r\n data.repeatDirection = this.repeatDirection;\r\n data.repeatTimes = this.repeatTimes;\r\n data.endingNumber = this.endingNumber;\r\n data.endingType = this.endingType;\r\n data.endingVPos = this.endingVPos;\r\n return data;\r\n }\r\n};\r\n\r\n// src/data/io/NotationObjectData.ts\r\nvar NotationObjectData = class {\r\n};\r\n\r\n// src/data/io/NoteAttachmentData.ts\r\nvar NoteAttachmentData = class extends NotationObjectData {\r\n};\r\n\r\n// src/data/io/ArticulationData.ts\r\nvar ArticulationData = class extends NoteAttachmentData {\r\n};\r\n\r\n// src/data/symbols/NotationObject.ts\r\nvar NotationObject = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n this._visible = false;\r\n }\r\n addNotationObjectData(data) {\r\n data.visible = this._visible;\r\n data.hPos = this._hPos;\r\n data.vPos = this._vPos;\r\n }\r\n get visible() {\r\n return this._visible;\r\n }\r\n set visible(value) {\r\n this._visible = value;\r\n }\r\n get hPos() {\r\n return this._hPos;\r\n }\r\n set hPos(value) {\r\n this._hPos = value;\r\n }\r\n get vPos() {\r\n return this._vPos;\r\n }\r\n set vPos(value) {\r\n this._vPos = value;\r\n }\r\n};\r\n\r\n// src/data/symbols/NoteAttachment.ts\r\nvar NoteAttachment = class extends NotationObject {\r\n constructor() {\r\n super();\r\n this._isAbove = false;\r\n this._height = 0;\r\n this._width = 0;\r\n this._outsideStaff = false;\r\n }\r\n addNoteAttachmentData(data) {\r\n super.addNotationObjectData(data);\r\n data.noteGroupUniqueID = this._noteGroup.uniqueID;\r\n data.isAbove = this._isAbove;\r\n data.height = this._height;\r\n data.width = this._width;\r\n data.outsideStaff = this._outsideStaff;\r\n }\r\n get noteGroup() {\r\n return this._noteGroup;\r\n }\r\n set noteGroup(value) {\r\n this._noteGroup = value;\r\n }\r\n get isAbove() {\r\n return this._isAbove;\r\n }\r\n set isAbove(value) {\r\n this._isAbove = value;\r\n }\r\n /**\r\n * the height of the attachment, in staffline spaces\r\n */\r\n get height() {\r\n return this._height;\r\n }\r\n set height(value) {\r\n this._height = value;\r\n }\r\n /**\r\n * the width of the attachment, in staffline spaces\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n set width(value) {\r\n this._width = value;\r\n }\r\n get outsideStaff() {\r\n return this._outsideStaff;\r\n }\r\n set outsideStaff(value) {\r\n this._outsideStaff = value;\r\n }\r\n};\r\n\r\n// src/data/symbols/Articulation.ts\r\nvar Articulation = class extends NoteAttachment {\r\n constructor() {\r\n super();\r\n this._type = 0;\r\n }\r\n toArticulationData() {\r\n let data = new ArticulationData();\r\n super.addNoteAttachmentData(data);\r\n data.type = this._type;\r\n return data;\r\n }\r\n getWidthHeight() {\r\n switch (this._type) {\r\n case ArticulationType.STACCATO:\r\n this.width = 0.4;\r\n this.height = 0.4;\r\n break;\r\n case ArticulationType.LEGATO:\r\n this.width = 1;\r\n this.height = 0.25;\r\n break;\r\n case ArticulationType.ACCENT:\r\n this.width = 1.3;\r\n this.height = 1;\r\n break;\r\n default:\r\n this.width = 1;\r\n this.height = 1;\r\n }\r\n }\r\n /**an integer matching a constant from the ArticulationType class*/\r\n get type() {\r\n return this._type;\r\n }\r\n set type(value) {\r\n this._type = value;\r\n }\r\n};\r\n\r\n// src/data/io/BarlineData.ts\r\nvar BarlineData = class extends NotationObjectData {\r\n};\r\n\r\n// src/data/symbols/Barline.ts\r\nvar Barline = class extends NotationObject {\r\n constructor() {\r\n super();\r\n }\r\n toBarlineData() {\r\n let data = new BarlineData();\r\n super.addNotationObjectData(data);\r\n data.style = this.style;\r\n data.location = this.location;\r\n return data;\r\n }\r\n};\r\n\r\n// src/data/io/MeasureAttachmentData.ts\r\nvar MeasureAttachmentData = class extends NotationObjectData {\r\n};\r\n\r\n// src/data/io/ChordSymbolData.ts\r\nvar ChordSymbolData = class extends MeasureAttachmentData {\r\n};\r\n\r\n// src/data/symbols/MeasureAttachment.ts\r\nvar MeasureAttachment = class extends NotationObject {\r\n constructor() {\r\n super();\r\n this._isAbove = false;\r\n }\r\n addMeasureAttachmentData(data) {\r\n super.addNotationObjectData(data);\r\n data.qNoteTime = this._qNoteTime;\r\n data.isAbove = this._isAbove;\r\n data.height = this._height;\r\n data.width = this._width;\r\n data.baseline = this._baseline;\r\n data.measureAttachmentType = this.measureAttachmentType;\r\n }\r\n /**\r\n * the time in the score that this object is attached (and potentially takes \r\n * effect)\r\n */\r\n get qNoteTime() {\r\n return this._qNoteTime;\r\n }\r\n set qNoteTime(value) {\r\n this._qNoteTime = value;\r\n }\r\n /**\r\n * the Measure this object is attached to\r\n */\r\n get measure() {\r\n return this._measure;\r\n }\r\n set measure(value) {\r\n this._measure = value;\r\n }\r\n /**\r\n * true if this attachment goes above the measure\r\n */\r\n get isAbove() {\r\n return this._isAbove;\r\n }\r\n set isAbove(value) {\r\n this._isAbove = value;\r\n }\r\n /**\r\n * the height of the attachment - used for spacing calculations\r\n */\r\n get height() {\r\n return this._height;\r\n }\r\n set height(value) {\r\n this._height = value;\r\n }\r\n /**\r\n * the width of the attachment - used for spacing calculations\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n set width(value) {\r\n this._width = value;\r\n }\r\n /**the default position, in spaces, relative to the top staff line. Negative\r\n * values indicate a position above the staff. If null, no baseline is used.\r\n **/\r\n get baseline() {\r\n return this._baseline;\r\n }\r\n set baseline(value) {\r\n this._baseline = value;\r\n }\r\n};\r\n\r\n// src/data/symbols/ChordSymbol.ts\r\nvar ChordSymbol = class extends MeasureAttachment {\r\n constructor() {\r\n super();\r\n this.degrees = [];\r\n this.measureAttachmentType = 1 /* chordSymbol */;\r\n }\r\n toMeasureAttachmentData() {\r\n let data = new ChordSymbolData();\r\n super.addMeasureAttachmentData(data);\r\n data.rootName = this.rootName;\r\n data.rootAlteration = this.rootAlteration;\r\n data.bassName = this.bassName;\r\n data.bassAlteration = this.bassAlteration;\r\n data.type = this.type;\r\n data.displayType = this.displayType;\r\n data.degrees = this.degrees.map((d) => d.toChordSymbolDegreeData());\r\n return data;\r\n }\r\n /**calculates the height of the chord symbol. Pass in the [textHeight] in\r\n * spaces (available from [ScoreProperties]).*/\r\n calculateHeight(textHeight) {\r\n this.height = this.bassName != null ? textHeight + 0.5 : textHeight;\r\n }\r\n};\r\n\r\n// src/data/io/ChordSymbolDegreeData.ts\r\nvar ChordSymbolDegreeData = class {\r\n};\r\n\r\n// src/data/symbols/ChordSymbolDegree.ts\r\nvar ChordSymbolDegree = class {\r\n toChordSymbolDegreeData() {\r\n let data = new ChordSymbolDegreeData();\r\n data.value = this.value;\r\n data.alteration = this.alteration;\r\n data.type = this.type;\r\n data.displayText = this.displayText;\r\n return data;\r\n }\r\n};\r\n\r\n// src/data/io/ClefData.ts\r\nvar ClefData = class extends NotationObjectData {\r\n};\r\n\r\n// src/data/symbols/Clef.ts\r\nvar Clef = class extends NotationObject {\r\n constructor() {\r\n super();\r\n this._isNew = false;\r\n this._show = false;\r\n this._smallSize = true;\r\n }\r\n toClefData() {\r\n let data = new ClefData();\r\n super.addNotationObjectData(data);\r\n data.uniqueID = this.uniqueID;\r\n data.type = this._type;\r\n data.qNoteTime = this._qNoteTime;\r\n data.isNew = this._isNew;\r\n data.show = this._show;\r\n data.smallSize = this._smallSize;\r\n return data;\r\n }\r\n /**\r\n * a string matching a constant from the ClefType class\r\n */\r\n get type() {\r\n return this._type;\r\n }\r\n set type(value) {\r\n this._type = value;\r\n }\r\n /**\r\n * the time that this clef starts taking effect, from the beginning of the \r\n * piece in terms of quarter notes\r\n */\r\n get qNoteTime() {\r\n return this._qNoteTime;\r\n }\r\n set qNoteTime(value) {\r\n this._qNoteTime = value;\r\n }\r\n /**\r\n * a reference to the NoteGroup this clef should precede, if any. If this is\r\n * null, the clef is placed at the beginning of the measure.\r\n */\r\n /*public function get ngRef():NoteGroup { return _ngRef; }\r\n public function set ngRef(value:NoteGroup):void { _ngRef = value; }*/\r\n /**\r\n * true if the clef is new (previous music was in a different clef, or there\r\n * was no previous music\r\n */\r\n get isNew() {\r\n return this._isNew;\r\n }\r\n set isNew(value) {\r\n this._isNew = value;\r\n }\r\n /**\r\n * true if the clef should be rendered and counted in spacing\r\n */\r\n get show() {\r\n return this._show;\r\n }\r\n set show(value) {\r\n this._show = value;\r\n }\r\n /**\r\n * true if the clef should be displayed at reduced size (system start clefs \r\n * are full size, but others are usually reduced)\r\n */\r\n get smallSize() {\r\n return this._smallSize;\r\n }\r\n set smallSize(value) {\r\n this._smallSize = value;\r\n }\r\n};\r\n\r\n// src/data/io/DynamicData.ts\r\nvar DynamicData = class extends MeasureAttachmentData {\r\n};\r\n\r\n// src/data/symbols/Dynamic.ts\r\nvar Dynamic = class extends MeasureAttachment {\r\n constructor() {\r\n super();\r\n this._volume = 1;\r\n this.measureAttachmentType = 0 /* dynamic */;\r\n }\r\n toMeasureAttachmentData() {\r\n let data = new DynamicData();\r\n super.addMeasureAttachmentData(data);\r\n data.volume = this._volume;\r\n data.type = this._type;\r\n return data;\r\n }\r\n /**\r\n * A value between 0 and 1 indicating how this marking should affect the \r\n * volume\r\n */\r\n get volume() {\r\n return this._volume;\r\n }\r\n set volume(value) {\r\n this._volume = value;\r\n }\r\n /**\r\n * Matches a constant from the DynamicType class\r\n */\r\n get type() {\r\n return this._type;\r\n }\r\n set type(value) {\r\n this._type = value;\r\n }\r\n};\r\n\r\n// src/data/io/LyricData.ts\r\nvar LyricData = class extends NotationObjectData {\r\n};\r\n\r\n// src/data/symbols/Lyric.ts\r\nvar Lyric = class extends NotationObject {\r\n constructor(syllablePosition, text, verse, hPos, vPos) {\r\n super();\r\n this._verse = 0;\r\n this._syllablePosition = syllablePosition;\r\n this._text = text;\r\n this._verse = verse;\r\n this.hPos = hPos;\r\n this.vPos = vPos;\r\n }\r\n toLyricData() {\r\n let data = new LyricData();\r\n super.addNotationObjectData(data);\r\n data.syllablePosition = this._syllablePosition;\r\n data.text = this._text;\r\n data.verse = this._verse;\r\n return data;\r\n }\r\n get syllablePosition() {\r\n return this._syllablePosition;\r\n }\r\n set syllablePosition(value) {\r\n this._syllablePosition = value;\r\n }\r\n get text() {\r\n return this._text;\r\n }\r\n set text(value) {\r\n this._text = value;\r\n }\r\n get verse() {\r\n return this._verse;\r\n }\r\n set verse(value) {\r\n this._verse = value;\r\n }\r\n};\r\n\r\n// src/data/io/MeasureInstructionData.ts\r\nvar MeasureInstructionData = class extends MeasureAttachmentData {\r\n};\r\n\r\n// src/data/symbols/MeasureInstruction.ts\r\nvar MeasureInstruction = class extends MeasureAttachment {\r\n constructor() {\r\n super();\r\n this.measureAttachmentType = 2 /* measureInstruction */;\r\n }\r\n toMeasureAttachmentData() {\r\n let data = new MeasureInstructionData();\r\n super.addMeasureAttachmentData(data);\r\n data.text = this.text;\r\n return data;\r\n }\r\n};\r\n\r\n// src/data/io/NoteData.ts\r\nvar NoteData = class extends NotationObjectData {\r\n};\r\n\r\n// src/data/symbols/Note.ts\r\nvar Note = class extends NotationObject {\r\n constructor() {\r\n super();\r\n //doesn't include alteration\r\n this._pitchName = \"C4\";\r\n //0 is no alteration, 1 is a half step up, -1 a half step down, etc. \r\n //Absolute (not relative to display key)\r\n this._alteration = 0;\r\n //includes alteration - displayed pitch, not concert pitch (So trumpet D4 is\r\n //6200)\r\n this._displayCents = 0;\r\n //used for drum channels\r\n this._playbackCents = 0;\r\n //absolute accidental, regardless of key signature (aligns with alteration)\r\n this._accidental = AccidentalType.NONE;\r\n this._showAccidental = false;\r\n this._tieState = TieState.NONE;\r\n //the number of leger lines - negative numbers mean lines above, positive \r\n //numbers mean lines below, 0 means no leger lines\r\n this._legerLines = 0;\r\n //the number of steps from the top staff line - each line or space is a \r\n //step - negative values imply above the staff\r\n this._stepsFromTopStaffLine = 0;\r\n //stores previous value of _visible\r\n this._prevVisible = null;\r\n this._visible = true;\r\n }\r\n toNoteData() {\r\n let data = new NoteData();\r\n super.addNotationObjectData(data);\r\n data.pitchName = this._pitchName;\r\n data.alteration = this._alteration;\r\n data.displayCents = this._displayCents;\r\n data.playbackCents = this._playbackCents;\r\n data.accidental = this._accidental;\r\n data.showAccidental = this._showAccidental;\r\n data.tieState = this._tieState;\r\n data.legerLines = this._legerLines;\r\n data.stepsFromTopStaffLine = this._stepsFromTopStaffLine;\r\n return data;\r\n }\r\n /**reverts the visibility of the NG to its last state. Calling multiple\r\n * times will have no additional effect (not a complete undo history).*/\r\n revertVisibility() {\r\n if (this._prevVisible != null) {\r\n this._visible = this._prevVisible;\r\n this._prevVisible = null;\r\n }\r\n }\r\n get tieState() {\r\n return this._tieState;\r\n }\r\n set tieState(value) {\r\n this._tieState = value;\r\n }\r\n get isTieTarget() {\r\n return this._tieState == TieState.CONTINUE || this._tieState == TieState.STOP;\r\n }\r\n get accidental() {\r\n return this._accidental;\r\n }\r\n set accidental(value) {\r\n this._accidental = value;\r\n }\r\n get showAccidental() {\r\n return this._showAccidental;\r\n }\r\n set showAccidental(value) {\r\n this._showAccidental = value;\r\n }\r\n /**\r\n * the horizontal position of the accidental in respect to the NoteGroup \r\n * (not Note)\r\n */\r\n get accidentalPos() {\r\n return this._accidentalPos;\r\n }\r\n set accidentalPos(value) {\r\n this._accidentalPos = value;\r\n }\r\n /**pitch name, including letter and number, but no alteration (C4) */\r\n get pitchName() {\r\n return this._pitchName;\r\n }\r\n set pitchName(value) {\r\n this._pitchName = value;\r\n }\r\n /**the letter portion of the pitch (C in C4) - doesn't include alteration */\r\n get pitchLetter() {\r\n if (this._pitchLetter == null) {\r\n this._pitchLetter = this._pitchName[0];\r\n }\r\n return this._pitchLetter;\r\n }\r\n /**the octave portion of the pitch (4 in C4) */\r\n get pitchOctave() {\r\n if (this._pitchOctave == null) {\r\n this._pitchOctave = Number.parseInt(this._pitchName.slice(1));\r\n }\r\n return this._pitchOctave;\r\n }\r\n get alteration() {\r\n return this._alteration;\r\n }\r\n set alteration(value) {\r\n this._alteration = value;\r\n }\r\n get displayCents() {\r\n return this._displayCents;\r\n }\r\n set displayCents(value) {\r\n this._displayCents = value;\r\n }\r\n /**\r\n * used for drum channels to denote a different playback pitch than \r\n * displayed pitch\r\n */\r\n get playbackCents() {\r\n return this._playbackCents;\r\n }\r\n set playbackCents(value) {\r\n this._playbackCents = value;\r\n }\r\n get legerLines() {\r\n return this._legerLines;\r\n }\r\n set legerLines(value) {\r\n this._legerLines = value;\r\n }\r\n get stepsFromTopStaffLine() {\r\n return this._stepsFromTopStaffLine;\r\n }\r\n set stepsFromTopStaffLine(value) {\r\n this._stepsFromTopStaffLine = value;\r\n }\r\n get visible() {\r\n return this._visible;\r\n }\r\n set visible(value) {\r\n this._prevVisible = value;\r\n this._visible = value;\r\n }\r\n /**\r\n * the parent NoteGroup for this Note\r\n */\r\n get noteGroup() {\r\n return this._noteGroup;\r\n }\r\n set noteGroup(value) {\r\n this._noteGroup = value;\r\n }\r\n};\r\n\r\n// src/data/io/OrnamentData.ts\r\nvar OrnamentData = class extends NoteAttachmentData {\r\n};\r\n\r\n// src/data/symbols/Ornament.ts\r\nvar Ornament = class extends NoteAttachment {\r\n constructor() {\r\n super();\r\n this._type = 0;\r\n }\r\n toOrnamentData() {\r\n let data = new OrnamentData();\r\n super.addNoteAttachmentData(data);\r\n data.type = this._type;\r\n return data;\r\n }\r\n getWidthHeight() {\r\n switch (this._type) {\r\n case OrnamentType.INVERTED_MORDENT:\r\n this.width = 2;\r\n this.height = 1.5;\r\n break;\r\n case OrnamentType.MORDENT:\r\n this.width = 2;\r\n this.height = 1;\r\n break;\r\n case OrnamentType.TRILL_MARK:\r\n this.width = 2;\r\n this.height = 1.6;\r\n break;\r\n default:\r\n this.width = 1;\r\n this.height = 1;\r\n }\r\n }\r\n /** an integer matching a constant from the ArticulationType class*/\r\n get type() {\r\n return this._type;\r\n }\r\n set type(value) {\r\n this._type = value;\r\n }\r\n};\r\n\r\n// src/data/io/SlurData.ts\r\nvar SlurData = class {\r\n};\r\n\r\n// src/data/symbols/Slur.ts\r\nvar Slur = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //used to identify the slur with MusicXML - NOT UNIQUE\r\n this._slurID = 0;\r\n //true if the slur should appear above the notes\r\n this._above = false;\r\n }\r\n toSlurData() {\r\n let sd = new SlurData();\r\n sd.uniqueID = this.uniqueID;\r\n sd.firstNoteUniqueID = this._firstNote.uniqueID;\r\n sd.endNoteUniqueID = this._endNote.uniqueID;\r\n return sd;\r\n }\r\n /**\r\n * used to identify the slur with MusicXML - NOT UNIQUE\r\n */\r\n get slurID() {\r\n return this._slurID;\r\n }\r\n set slurID(value) {\r\n this._slurID = value;\r\n }\r\n /**\r\n * true if the slur should appear above the notes\r\n */\r\n get above() {\r\n return this._above;\r\n }\r\n set above(value) {\r\n this._above = value;\r\n }\r\n /**\r\n * the note where the slur starts\r\n */\r\n get firstNote() {\r\n return this._firstNote;\r\n }\r\n set firstNote(value) {\r\n this._firstNote = value;\r\n }\r\n /**\r\n * the note where the slur ends\r\n */\r\n get endNote() {\r\n return this._endNote;\r\n }\r\n set endNote(value) {\r\n this._endNote = value;\r\n }\r\n /**\r\n * the SlurSegment objects that are drawn for this slur\r\n */\r\n get segments() {\r\n return this._segments;\r\n }\r\n set segments(value) {\r\n this._segments = value;\r\n }\r\n};\r\n\r\n// src/data/io/TempoMarkerData.ts\r\nvar TempoMarkerData = class {\r\n};\r\n\r\n// src/data/symbols/TempoMarker.ts\r\nvar TempoMarker = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n }\r\n toTempoMarkerData() {\r\n let data = new TempoMarkerData();\r\n data.tempo = this._tempo;\r\n data.qNoteTime = this._qNoteTime;\r\n return data;\r\n }\r\n /**\r\n * a bpm tempo value\r\n */\r\n get tempo() {\r\n return this._tempo;\r\n }\r\n set tempo(value) {\r\n this._tempo = value;\r\n }\r\n /**\r\n * the time that this tempo takes effect (in terms of quarter notes from \r\n * song beginning)\r\n */\r\n get qNoteTime() {\r\n return this._qNoteTime;\r\n }\r\n set qNoteTime(value) {\r\n this._qNoteTime = value;\r\n }\r\n};\r\n\r\n// src/data/io/TupletData.ts\r\nvar TupletData = class {\r\n};\r\n\r\n// src/data/symbols/Tuplet.ts\r\nvar Tuplet = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n //an identifier value for the tuplet - useful when dealing with nested \r\n //tuplets\r\n this._tupletID = 0;\r\n //the number of notes private _numeratorDuration:of value that fit in the \r\n //tuplet (for 3 in the space of 2, this is the 3)\r\n this._numerator = 0;\r\n //the number of notes private _denominatorDuration:of value that represent \r\n //the real duration the tuplet takes up (for 3 in the space of 2, this is \r\n //the 2)\r\n this._denominator = 0;\r\n //the duration of the type of note X as in X in the space of Y\r\n this._numeratorDuration = 0;\r\n //the duration of the type of note Y as in X in the space of Y\r\n this._denominatorDuration = 0;\r\n //the tuplet should be placed above\r\n this._above = false;\r\n this._showBracket = false;\r\n this._vPos = 0;\r\n }\r\n toTupletData() {\r\n let td = new TupletData();\r\n td.uniqueID = this.uniqueID;\r\n td.tupletID = this._tupletID;\r\n td.firstNoteUniqueId = this._firstNote.uniqueID;\r\n td.endNoteUniqueId = this._endNote.uniqueID;\r\n td.numerator = this._numerator;\r\n td.denominator = this._denominator;\r\n td.numeratorDuration = this.numeratorDuration;\r\n td.denominatorDuration = this.denominatorDuration;\r\n return td;\r\n }\r\n get tupletID() {\r\n return this._tupletID;\r\n }\r\n set tupletID(value) {\r\n this._tupletID = value;\r\n }\r\n get firstNote() {\r\n return this._firstNote;\r\n }\r\n set firstNote(value) {\r\n this._firstNote = value;\r\n }\r\n get endNote() {\r\n return this._endNote;\r\n }\r\n set endNote(value) {\r\n this._endNote = value;\r\n }\r\n get numerator() {\r\n return this._numerator;\r\n }\r\n set numerator(value) {\r\n this._numerator = value;\r\n }\r\n get denominator() {\r\n return this._denominator;\r\n }\r\n set denominator(value) {\r\n this._denominator = value;\r\n }\r\n get numeratorDuration() {\r\n return this._numeratorDuration;\r\n }\r\n set numeratorDuration(value) {\r\n this._numeratorDuration = value;\r\n }\r\n get denominatorDuration() {\r\n return this._denominatorDuration;\r\n }\r\n set denominatorDuration(value) {\r\n this._denominatorDuration = value;\r\n }\r\n get above() {\r\n return this._above;\r\n }\r\n set above(value) {\r\n this._above = value;\r\n }\r\n get showBracket() {\r\n return this._showBracket;\r\n }\r\n set showBracket(value) {\r\n this._showBracket = value;\r\n }\r\n get vPos() {\r\n return this._vPos;\r\n }\r\n set vPos(value) {\r\n this._vPos = value;\r\n }\r\n};\r\n\r\n// src/data/io/ScoreIO.ts\r\nvar ScoreIO = class {\r\n //////////SCORE/MEASURE STACKS/////////\r\n createScoreData(score) {\r\n return score.toScoreData();\r\n }\r\n createScoreDataJsonString(scoreData) {\r\n return JSON.stringify(scoreData);\r\n }\r\n parseScoreDataJsonString(jsonString) {\r\n return JSON.parse(jsonString);\r\n }\r\n /**\r\n * @param scoreData - the full ScoreData from a createScoreData() call, not\r\n * just the stacks intended for inclusion\r\n * @param scoreProperties optional ScoreProperties settings\r\n * @param startMeasureIndex - the index of the first stack in the scoreData\r\n * that should be included.\r\n * @param endMeasureIndex - the index of the last stack in the scoreData\r\n * that should be included.\r\n */\r\n createScoreFromScoreData(scoreData, scoreProperties = null, startMeasureIndex = 0, endMeasureIndex = null) {\r\n if (scoreProperties == null) {\r\n scoreProperties = ScoreProperties.getNewScoreProperties();\r\n }\r\n let score = new Score();\r\n score.scoreProperties = scoreProperties;\r\n score.graceNotesNeedFixing = scoreData.graceNotesNeedFixing;\r\n let page = new Page();\r\n score.addPage(page);\r\n let system = new System(scoreProperties);\r\n system.newPage = true;\r\n page.addSystem(system);\r\n if (endMeasureIndex == null) {\r\n endMeasureIndex = scoreData.measureStacks.length - 1;\r\n }\r\n let qNoteOffset = scoreData.measureStacks[startMeasureIndex].startTime;\r\n for (let i = startMeasureIndex; i <= endMeasureIndex; i++) {\r\n let stackData = scoreData.measureStacks[i];\r\n let stack = this._createMeasureStack(\r\n stackData,\r\n qNoteOffset,\r\n startMeasureIndex,\r\n startMeasureIndex === i\r\n );\r\n system.addMeasureStack(stack);\r\n }\r\n this._addStartAndEndTempoMarkers(\r\n system.measureStacks[0],\r\n system.measureStacks[system.measureStacks.length - 1],\r\n scoreData,\r\n startMeasureIndex,\r\n endMeasureIndex\r\n );\r\n return score;\r\n }\r\n //////////PARTS//////////\r\n createPartData(part) {\r\n return part.toPartData();\r\n }\r\n createPartDataJsonString(partData) {\r\n return JSON.stringify(partData);\r\n }\r\n parsePartDataJsonString(jsonString) {\r\n return JSON.parse(jsonString);\r\n }\r\n /**\r\n * @param score - the Score object to add the parts to. This should contain\r\n * only the stacks that should be filled, which is potentially a subset of\r\n * the stacks in the ScoreData object\r\n * @param partData - the full PartData from a createPartData() call, not\r\n * just the measures intended for inclusion\r\n * @param scoreData - the full ScoreData from a createScoreData() call, not\r\n * just the stacks intended for inclusion\r\n * @param startMeasureIndex - the index of the first measure in the part\r\n * that measures should be pulled from. The endIndex is determined by the\r\n * number of stacks in the passed in score.\r\n */\r\n addPartDataToScore(score, partData, scoreData, startMeasureIndex = 0) {\r\n let stacks = score.getMeasureStacks();\r\n let qNoteOffset = scoreData.measureStacks[startMeasureIndex].startTime;\r\n let numMeasures = stacks.length;\r\n let part = this._createPart(\r\n partData,\r\n score,\r\n stacks,\r\n startMeasureIndex,\r\n numMeasures,\r\n qNoteOffset\r\n );\r\n score.addPart(part);\r\n }\r\n //////////////score/stack parsing//////////////\r\n _createMeasureStack(data, qNoteOffset, measureOffset, isFirstStack) {\r\n let stack = new MeasureStack();\r\n stack.startTime = data.startTime - qNoteOffset;\r\n stack.endTime = data.endTime - qNoteOffset;\r\n stack.qNoteLength = data.qNoteLength;\r\n stack.number = data.number - measureOffset;\r\n stack.newKey = data.newKey || isFirstStack;\r\n stack.newClef = data.newClef || isFirstStack;\r\n if (data.tempoMarkers != null) {\r\n this._processStackTempoMarkers(stack, data, qNoteOffset);\r\n }\r\n if (data.barline != null) {\r\n stack.barline = this._createBarline(data.barline);\r\n }\r\n if (data.repeatDOs != null) {\r\n this._processStackRepeatDOs(stack, data);\r\n }\r\n stack.isPickup = data.isPickup;\r\n return stack;\r\n }\r\n _processStackTempoMarkers(stack, stackData, qNoteOffset) {\r\n stack.tempoMarkers = [];\r\n for (let tmData of stackData.tempoMarkers) {\r\n let tm = new TempoMarker();\r\n tm.tempo = tmData.tempo;\r\n tm.qNoteTime = tmData.qNoteTime - qNoteOffset;\r\n stack.tempoMarkers.push(tm);\r\n }\r\n }\r\n _createBarline(data) {\r\n let barline = new Barline();\r\n barline.hPos = data.hPos;\r\n barline.vPos = data.vPos;\r\n barline.visible = data.visible;\r\n barline.style = data.style;\r\n barline.location = data.location;\r\n return barline;\r\n }\r\n _processStackRepeatDOs(stack, stackData) {\r\n stack.repeatDOs = [];\r\n for (let rdoData of stackData.repeatDOs) {\r\n let rdo = new RepeatDO();\r\n rdo.repeatDirection = rdoData.repeatDirection;\r\n rdo.repeatTimes = rdoData.repeatTimes;\r\n rdo.endingNumber = rdoData.endingNumber;\r\n rdo.endingType = rdoData.endingType;\r\n rdo.endingVPos = rdoData.endingVPos;\r\n stack.repeatDOs.push(rdo);\r\n }\r\n }\r\n _addStartAndEndTempoMarkers(startStack, endStack, scoreData, startMeasureIndex, endMeasureIndex) {\r\n if (startStack.tempoMarkers == null || startStack.tempoMarkers[0].qNoteTime > startStack.startTime) {\r\n for (let i = startMeasureIndex - 1; i >= 0; i--) {\r\n let data = scoreData.measureStacks[i];\r\n if (data.tempoMarkers != null) {\r\n let tmd = data.tempoMarkers[data.tempoMarkers.length - 1];\r\n let tm = new TempoMarker();\r\n tm.tempo = tmd.tempo;\r\n tm.qNoteTime = startStack.startTime;\r\n if (startStack.tempoMarkers != null) {\r\n startStack.tempoMarkers.splice(0, 0, tm);\r\n } else {\r\n startStack.tempoMarkers = [tm];\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n if (endStack.tempoMarkers == null || endStack.tempoMarkers[endStack.tempoMarkers.length - 1].qNoteTime !== endStack.endTime) {\r\n for (let i = endMeasureIndex; i >= 0; i--) {\r\n let data = scoreData.measureStacks[i];\r\n if (data.tempoMarkers != null) {\r\n let tmd = data.tempoMarkers[data.tempoMarkers.length - 1];\r\n let tm = new TempoMarker();\r\n tm.tempo = tmd.tempo;\r\n tm.qNoteTime = endStack.endTime;\r\n if (endStack.tempoMarkers != null) {\r\n endStack.tempoMarkers.push(tm);\r\n } else {\r\n endStack.tempoMarkers = [tm];\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n //////////////part parsing//////////////////\r\n _createPart(data, score, stacks, startMeasureIndex, numMeasures, qNoteOffset) {\r\n let partId = `P${score.parts.length + 1}`;\r\n let part = new Part(partId, data.name, data.abbreviation);\r\n part.volume = 1;\r\n part.midiChannel = data.midiChannel;\r\n part.midiBank = data.midiBank;\r\n part.midiPreset = data.midiPreset;\r\n part.setTransposition(\r\n data.diatonicTransposition,\r\n data.chromaticTransposition\r\n );\r\n part.percussionMap = data.percussionMap?.slice();\r\n this._slursInPart = [];\r\n for (let staffData of data.staves) {\r\n part.addStaff(this._createStaff(\r\n staffData,\r\n stacks,\r\n startMeasureIndex,\r\n numMeasures,\r\n qNoteOffset\r\n ));\r\n }\r\n this._slursInPart = null;\r\n return part;\r\n }\r\n _createStaff(data, stacks, startMeasureIndex, numMeasures, qNoteOffset) {\r\n let staff = new Staff();\r\n staff.visible = data.visible;\r\n let endMeasureIndex = startMeasureIndex + numMeasures - 1;\r\n for (let i = startMeasureIndex; i <= endMeasureIndex; i++) {\r\n let stack = stacks[i - startMeasureIndex];\r\n let measureData = data.measures[i];\r\n let measure = this._createMeasure(\r\n measureData,\r\n stack,\r\n qNoteOffset,\r\n i === startMeasureIndex\r\n );\r\n staff.addMeasure(measure);\r\n stack.addMeasure(measure);\r\n measure.stack = stack;\r\n }\r\n return staff;\r\n }\r\n _createMeasure(data, stack, qNoteOffset, isFirstMeasure) {\r\n let measure = new Measure();\r\n measure.diatonicTransposition = data.diatonicTransposition;\r\n measure.chromaticTransposition = data.chromaticTransposition;\r\n measure.concertKey = data.concertKey;\r\n measure.displayKey = data.displayKey;\r\n measure.outgoingKey = data.outgoingKey;\r\n measure.isMajorKey = data.isMajorKey;\r\n measure.showKey = data.showKey || isFirstMeasure;\r\n measure.numBeats = data.numBeats;\r\n measure.beatType = data.beatType;\r\n measure.displayNumBeats = data.displayNumBeats;\r\n measure.displayBeatType = data.displayBeatType;\r\n measure.beatGroups = data.beatGroups.slice();\r\n measure.subBeatGroups = data.subBeatGroups.slice();\r\n measure.showTime = data.showTime || isFirstMeasure;\r\n for (let clefData of data.clefs) {\r\n measure.clefs.push(this._createClef(clefData, qNoteOffset));\r\n }\r\n for (let attachmentData of data.attachments) {\r\n measure.attachments.push(this._createMeasureAttachment(\r\n attachmentData,\r\n qNoteOffset,\r\n measure\r\n ));\r\n }\r\n for (let voiceData of data.voices) {\r\n let voice = measure.getVoiceByNumber(voiceData.number);\r\n this._processVoiceData(voiceData, voice, qNoteOffset);\r\n }\r\n return measure;\r\n }\r\n _createClef(data, qNoteOffset) {\r\n let clef = new Clef();\r\n clef.hPos = data.hPos;\r\n clef.vPos = data.vPos;\r\n clef.visible = data.visible;\r\n clef.uniqueID = data.uniqueID;\r\n clef.type = data.type;\r\n clef.qNoteTime = data.qNoteTime - qNoteOffset;\r\n clef.isNew = data.isNew;\r\n clef.show = data.show;\r\n clef.smallSize = data.smallSize;\r\n return clef;\r\n }\r\n _createMeasureAttachment(data, qNoteOffset, measure) {\r\n let attachment;\r\n switch (data.measureAttachmentType) {\r\n case 0 /* dynamic */: {\r\n let dynamic = new Dynamic();\r\n let dynamicData = data;\r\n dynamic.volume = dynamicData.volume;\r\n dynamic.type = dynamicData.type;\r\n attachment = dynamic;\r\n break;\r\n }\r\n case 1 /* chordSymbol */: {\r\n let cs = new ChordSymbol();\r\n let csData = data;\r\n cs.rootName = csData.rootName;\r\n cs.rootAlteration = csData.rootAlteration;\r\n cs.bassName = csData.bassName;\r\n cs.bassAlteration = csData.bassAlteration;\r\n cs.type = csData.type;\r\n cs.displayType = csData.displayType;\r\n for (let csdData of csData.degrees) {\r\n let csd = new ChordSymbolDegree();\r\n csd.value = csdData.value;\r\n csd.alteration = csdData.alteration;\r\n csd.type = csdData.type;\r\n csd.displayText = csdData.displayText;\r\n cs.degrees.push(csd);\r\n }\r\n attachment = cs;\r\n break;\r\n }\r\n case 2 /* measureInstruction */: {\r\n let instruction = new MeasureInstruction();\r\n let instructionData = data;\r\n instruction.text = instructionData.text;\r\n attachment = instruction;\r\n }\r\n }\r\n attachment.hPos = data.hPos;\r\n attachment.vPos = data.vPos;\r\n attachment.visible = data.visible;\r\n attachment.qNoteTime = data.qNoteTime - qNoteOffset;\r\n attachment.measure = measure;\r\n attachment.isAbove = data.isAbove;\r\n attachment.height = data.height;\r\n attachment.width = data.width;\r\n attachment.baseline = data.baseline;\r\n attachment.measureAttachmentType = data.measureAttachmentType;\r\n return attachment;\r\n }\r\n _processVoiceData(data, voice, qNoteOffset) {\r\n let measure = voice.measure;\r\n let tupletsInVoice = [];\r\n for (let ngData of data.noteGroups) {\r\n let ng = new NoteGroup();\r\n ng.uniqueID = ngData.uniqueID;\r\n for (let noteData of ngData.notes) {\r\n ng.addNote(this._createNote(noteData));\r\n }\r\n ng.stemDirection = ngData.stemDirection;\r\n ng.duration = ngData.duration;\r\n ng.qNoteDuration = ngData.qNoteDuration;\r\n ng.qNoteTime = ngData.qNoteTime - qNoteOffset;\r\n ng.durationType = ngData.durationType;\r\n ng.numDots = ngData.numDots;\r\n ng.isGrace = ngData.isGrace;\r\n ng.beamStates = ngData.beamStates.slice();\r\n ng.isRest = ngData.isRest;\r\n if (ngData.tuplets != null) {\r\n this._processTupletsForNoteGroup(ng, ngData, tupletsInVoice);\r\n }\r\n if (ngData.slurs != null) {\r\n this._processSlursForNoteGroup(ng, ngData);\r\n }\r\n if (ngData.clefUniqueID != null) {\r\n ng.clef = measure.clefs.find((c) => c.uniqueID === ngData.clefUniqueID);\r\n }\r\n if (ngData.lyric != null) {\r\n ng.lyric = this._createLyric(ngData.lyric);\r\n }\r\n ng.clipStart = ngData.clipStart;\r\n ng.clipEnd = ngData.clipEnd;\r\n if (ngData.articulations != null) {\r\n this._processArticulations(ng, ngData);\r\n }\r\n if (ngData.ornaments != null) {\r\n this._processOrnaments(ng, ngData);\r\n }\r\n ng.visible = ngData.visible;\r\n ng.trackId = ngData.trackId;\r\n voice.addNoteGroup(ng);\r\n }\r\n }\r\n _createLyric(data) {\r\n let lyric = new Lyric(\r\n data.syllablePosition,\r\n data.text,\r\n data.verse,\r\n data.hPos,\r\n data.vPos\r\n );\r\n lyric.visible = data.visible;\r\n return lyric;\r\n }\r\n _createNote(data) {\r\n let note = new Note();\r\n note.hPos = data.hPos;\r\n note.vPos = data.vPos;\r\n note.visible = data.visible;\r\n note.pitchName = data.pitchName;\r\n note.alteration = data.alteration;\r\n note.displayCents = data.displayCents;\r\n note.playbackCents = data.playbackCents;\r\n note.accidental = data.accidental;\r\n note.showAccidental = data.showAccidental;\r\n note.tieState = data.tieState;\r\n note.legerLines = data.legerLines;\r\n note.stepsFromTopStaffLine = data.stepsFromTopStaffLine;\r\n return note;\r\n }\r\n _processTupletsForNoteGroup(ng, ngData, tupletsInVoice) {\r\n ng.tuplets = [];\r\n for (let tupletData of ngData.tuplets) {\r\n let tuplet = tupletsInVoice.find((t) => t.uniqueID === tupletData.uniqueID);\r\n if (tuplet == null) {\r\n tuplet = this._createTuplet(tupletData);\r\n tupletsInVoice.push(tuplet);\r\n }\r\n if (ng.uniqueID === tupletData.firstNoteUniqueId) {\r\n tuplet.firstNote = ng;\r\n }\r\n if (ng.uniqueID === tupletData.endNoteUniqueId) {\r\n tuplet.endNote = ng;\r\n }\r\n ng.tuplets.push(tuplet);\r\n }\r\n }\r\n _createTuplet(data) {\r\n let tuplet = new Tuplet();\r\n tuplet.uniqueID = data.uniqueID;\r\n tuplet.tupletID = data.tupletID;\r\n tuplet.numerator = data.numerator;\r\n tuplet.denominator = data.denominator;\r\n tuplet.numeratorDuration = data.numeratorDuration;\r\n tuplet.denominatorDuration = data.denominatorDuration;\r\n return tuplet;\r\n }\r\n _processSlursForNoteGroup(ng, ngData) {\r\n ng.slurs = [];\r\n for (let slurData of ngData.slurs) {\r\n let slur = this._slursInPart.find((s) => s.uniqueID === slurData.uniqueID);\r\n if (slur == null) {\r\n slur = this._createSlur(slurData);\r\n this._slursInPart.push(slur);\r\n }\r\n if (ng.uniqueID === slurData.firstNoteUniqueID) {\r\n slur.firstNote = ng;\r\n }\r\n if (ng.uniqueID === slurData.endNoteUniqueID) {\r\n slur.endNote = ng;\r\n }\r\n ng.slurs.push(slur);\r\n }\r\n }\r\n _createSlur(data) {\r\n let slur = new Slur();\r\n slur.uniqueID = data.uniqueID;\r\n return slur;\r\n }\r\n _processArticulations(ng, ngData) {\r\n ng.articulations = [];\r\n for (let articulationData of ngData.articulations) {\r\n let articulation = new Articulation();\r\n articulation.hPos = articulationData.hPos;\r\n articulation.vPos = articulationData.vPos;\r\n articulation.visible = articulationData.visible;\r\n articulation.noteGroup = ng;\r\n articulation.isAbove = articulationData.isAbove;\r\n articulation.height = articulationData.height;\r\n articulation.width = articulationData.width;\r\n articulation.outsideStaff = articulationData.outsideStaff;\r\n articulation.type = articulationData.type;\r\n ng.articulations.push(articulation);\r\n }\r\n }\r\n _processOrnaments(ng, ngData) {\r\n ng.ornaments = [];\r\n for (let ornamentData of ngData.ornaments) {\r\n let ornament = new Ornament();\r\n ornament.hPos = ornamentData.hPos;\r\n ornament.vPos = ornamentData.vPos;\r\n ornament.visible = ornamentData.visible;\r\n ornament.noteGroup = ng;\r\n ornament.isAbove = ornamentData.isAbove;\r\n ornament.height = ornamentData.height;\r\n ornament.width = ornamentData.width;\r\n ornament.outsideStaff = ornamentData.outsideStaff;\r\n ornament.type = ornamentData.type;\r\n ng.ornaments.push(ornament);\r\n }\r\n }\r\n};\r\n\r\n// src/data/symbols/SlurSegment.ts\r\nvar SlurSegment = class extends BaseDataObject {\r\n constructor() {\r\n super();\r\n this._points = new Array(4);\r\n }\r\n /**\r\n * the Slur that this SlurSegment corresponds to\r\n */\r\n get slur() {\r\n return this._slur;\r\n }\r\n set slur(value) {\r\n this._slur = value;\r\n }\r\n /**\r\n * the System this segment belongs to\r\n */\r\n get systemRef() {\r\n return this._systemRef;\r\n }\r\n set systemRef(value) {\r\n this._systemRef = value;\r\n }\r\n /**\r\n * the positions of the (up to) five points of this slur segment - index 0 \r\n * is beginning, index 4 is end, 2 is the middle\r\n */\r\n get points() {\r\n return this._points;\r\n }\r\n /**\r\n * contains a list of X/Y pairs of coordinates for the top and bottom points\r\n * of each NoteGroup that falls in the segment's region\r\n */\r\n get ngCoordinates() {\r\n return this._ngCoordinates;\r\n }\r\n set ngCoordinates(value) {\r\n this._ngCoordinates = value;\r\n }\r\n};\r\n\r\n// src/data/symbols/Stem.ts\r\nvar Stem = class extends NotationObject {\r\n constructor() {\r\n super();\r\n //\"noStem\", \"up\", or \"down\"\r\n this._direction = StemDirection.NO_STEM;\r\n }\r\n get endPosition() {\r\n return this._endPosition;\r\n }\r\n set endPosition(value) {\r\n this._endPosition = value;\r\n }\r\n get direction() {\r\n return this._direction;\r\n }\r\n set direction(value) {\r\n this._direction = value;\r\n }\r\n};\r\n\r\n// src/editing/Arranger.ts\r\nvar Arranger = class {\r\n constructor(scoreManager) {\r\n this._debug = false;\r\n this._scoreManager = scoreManager;\r\n }\r\n //////////////////////////////NOTE/STAFF HIDING//////////////////////////\r\n /** hides all but the indicated staff for the given part*/\r\n makePartSingleStaff(part, staffIndex = 0) {\r\n for (let i = 0; i < part.staves.length; i++) {\r\n part.staves[i].visible = i === staffIndex;\r\n }\r\n }\r\n /**sets all staves to visible (reverts makePartSingleStaff())*/\r\n showAllStaves() {\r\n for (let part of this._scoreManager.score.parts) {\r\n for (let staff of part.staves) {\r\n staff.visible = true;\r\n }\r\n }\r\n }\r\n /**hides all the notes and rests on a staff */\r\n hideAllNotes(staff, exceptions = null) {\r\n if (exceptions == null) {\r\n for (let measure of staff.measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n ng.visible = false;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let measure of staff.measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (exceptions.indexOf(ng) === -1) {\r\n ng.visible = false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**shows only the top notes in the top voice*/\r\n showTopNotesOnly(staff) {\r\n for (let measure of staff.measures) {\r\n let voices = measure.voices;\r\n for (let i = 0; i < voices.length; i++) {\r\n let voice = voices[i];\r\n if (voices.length > 0 && voice.number > 1) {\r\n for (let ng of voice.noteGroups) {\r\n ng.visible = false;\r\n }\r\n } else {\r\n for (let ng of voice.noteGroups) {\r\n if (!ng.isRest) {\r\n let notes = ng.notes;\r\n if (notes.length > 1) {\r\n for (let j = notes.length - 2; j >= 0; j--) {\r\n notes[j].visible = false;\r\n }\r\n ng.clearVisibleNotesCache();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**designed to undo showTopNotes only, reverts all note visibility to\r\n * previous state*/\r\n revertNoteHiding(staff) {\r\n for (let measure of staff.measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n ng.revertVisibility();\r\n for (let note of ng.notes) {\r\n note.revertVisibility();\r\n }\r\n ng.clearVisibleNotesCache();\r\n }\r\n }\r\n }\r\n }\r\n ////////////////////////////SMART TRANSPOSITION///////////////////////////\r\n /**Transposes song to fit the specified range as comfortably as possible.\r\n * All pitches are assumed to be display pitches (not concert pitch), and\r\n * you should call scoreManager.setPartTransposition() before this if you\r\n * need to accommodate a written range.\r\n * \r\n * If you intend to use fixOctaveProblems() after this to enforce an \r\n * instrument range, you should specify a maxAllowedPitch here, as it will \r\n * attempt to choose the key that will result in the fewest required octave \r\n * correction points. If you don't intend to call fixOctaveProblems(), you \r\n * might want to set enforceMinPitch to true and leave maxAllowedPitch null,\r\n * as this will use a simpler algorithm that picks the key and transposition\r\n * that best fits the comfort note and key range while not allowing notes to\r\n * go below the minAllowedPitch.\r\n * \r\n * comfortPitch = the comfort center of the written range (soprano recorder\r\n * \t\tlow C is 60, same as flute)\r\n * minAllowedPitch = the min allowed written pitch for the instrument (60 \r\n * \t\tfor sop recorder).\r\n * \t\tminAllowedPitch is used in conjunction with enforceMinPitch. If \r\n * \t\tenforceMinPitch is set to true,\tthe resulting transposition will \r\n * \t\thonor the minAllowedPitch. If enfoceMinPitch is false, the result \r\n * \t\tmay go below the minAllowedPitch to allow for range octave \r\n * \t\tcorrection to handle the task.\r\n * minKey = desired minimum key sig (negative values for flats, positive for\r\n * \t\tsharps)\r\n * maxKey = desired maximum key sig (negative values for flats, positive for\r\n * \t\tsharps)\r\n * parts = the part to base the song transposition on\r\n * limitPlaybackOctaveChange = if true, each part's playbackOctaveDelta prop\r\n * will be adjusted if necessary to keep the playback octave from changing\r\n * too drastically.\r\n * maxAllowedPitch = if set, this value will be used as a non-binding \r\n * \t\tconsideration for choosing the best key. The result may still go \r\n * \t\tabove this value. With this set to null, a different algorithm is \r\n * \t\trun for choosing the best key to transpose to.*/\r\n fitMusicToRange(comfortPitch, minAllowedPitch, minKey, maxKey, part = null, limitPlaybackOctaveChange = true, maxAllowedPitch = null, enforceMinPitch = true) {\r\n let minPitch = 200;\r\n let maxPitch = 0;\r\n let pitches = [];\r\n if (part == null) {\r\n part = this._scoreManager.score.parts[0];\r\n }\r\n let noteGroups = part.getNoteGroupsWithoutRests(0, 0);\r\n for (let ng of noteGroups) {\r\n if (!ng.isRest && ng.visible) {\r\n let pitch = ~~(ng.visibleNotes[0].displayCents / 100);\r\n pitches.push(pitch);\r\n if (pitch > maxPitch) {\r\n maxPitch = pitch;\r\n }\r\n if (pitch < minPitch) {\r\n minPitch = pitch;\r\n }\r\n }\r\n }\r\n let adjustInterval = comfortPitch - Math.floor((minPitch + maxPitch) / 2);\r\n if (enforceMinPitch && minPitch + adjustInterval < minAllowedPitch) {\r\n adjustInterval = minAllowedPitch - minPitch;\r\n }\r\n let firstMeasure = part.staves[0].measures[0];\r\n let origKey = firstMeasure.displayKey;\r\n let isMajor = firstMeasure.isMajorKey;\r\n let validTranspositions = /* @__PURE__ */ new Map();\r\n for (let newKey = minKey; newKey <= maxKey; newKey++) {\r\n let upTrans = PitchUtils.getTranspositionForKeyChange(\r\n origKey,\r\n newKey,\r\n isMajor,\r\n isMajor,\r\n true\r\n );\r\n while (upTrans.chromatic < adjustInterval) {\r\n upTrans.chromatic += 12;\r\n upTrans.diatonic += 7;\r\n }\r\n while (upTrans.chromatic > adjustInterval + 12) {\r\n upTrans.chromatic -= 12;\r\n upTrans.diatonic -= 7;\r\n }\r\n validTranspositions.set(upTrans, newKey);\r\n let downTrans = new TranspositionDO(\r\n upTrans.diatonic - 7,\r\n upTrans.chromatic - 12\r\n );\r\n if (!enforceMinPitch || downTrans.chromatic + minPitch >= minAllowedPitch) {\r\n validTranspositions.set(downTrans, newKey);\r\n }\r\n }\r\n let bestTrans;\r\n if (maxAllowedPitch == null) {\r\n bestTrans = this._chooseTranspositionByKeyAndDistanceFromIdeal(\r\n validTranspositions,\r\n minKey,\r\n maxKey,\r\n adjustInterval\r\n );\r\n } else {\r\n bestTrans = this._chooseTranspositionByFewestOctaveShifts(\r\n validTranspositions,\r\n pitches,\r\n minAllowedPitch,\r\n maxAllowedPitch,\r\n adjustInterval,\r\n minKey,\r\n maxKey\r\n );\r\n }\r\n let pboDelta = 0;\r\n if (limitPlaybackOctaveChange) {\r\n while (bestTrans.chromatic + pboDelta * 12 > 7) {\r\n pboDelta--;\r\n }\r\n while (bestTrans.chromatic + pboDelta * 12 <= -5) {\r\n pboDelta++;\r\n }\r\n }\r\n this._scoreManager.transposeSong(\r\n bestTrans.diatonic,\r\n bestTrans.chromatic,\r\n false,\r\n pboDelta\r\n );\r\n }\r\n /**scores potential transpositions based on how far they are from the ideal \r\n * chromatic transposition interval and how much they deviate from the ideal\r\n * key - returns the winner*/\r\n _chooseTranspositionByKeyAndDistanceFromIdeal(validTranspositions, minKey, maxKey, idealChromatic) {\r\n let idealKey = ~~((maxKey + minKey) / 2);\r\n let adjustmentOffset;\r\n let bestScore = 0;\r\n let bestTrans;\r\n let points;\r\n for (let trans of validTranspositions.keys()) {\r\n adjustmentOffset = Math.abs(trans.chromatic - idealChromatic);\r\n let newKey = validTranspositions.get(trans);\r\n points = ~~(100 - adjustmentOffset - 1.5 * Math.abs(newKey - idealKey));\r\n if (points > bestScore) {\r\n bestScore = points;\r\n bestTrans = trans;\r\n }\r\n }\r\n return bestTrans;\r\n }\r\n /**scores potential transpositions based on how many octave shifts would be \r\n * necessary to make the notes fit between the min and max allowed pitches*/\r\n _chooseTranspositionByFewestOctaveShifts(validTranspositions, pitches, minAllowedPitch, maxAllowedPitch, idealChromatic, minKey, maxKey) {\r\n let idealKey = ~~((maxKey + minKey) / 2);\r\n let adjustmentOffset;\r\n let bestScore = 999999;\r\n let bestNonZeroOffsets = 999999;\r\n let bestTrans;\r\n let points;\r\n for (let trans of validTranspositions.keys()) {\r\n adjustmentOffset = Math.abs(trans.chromatic - idealChromatic);\r\n if (adjustmentOffset > 6) {\r\n }\r\n let chromaticTrans = trans.chromatic;\r\n let numShifts = 0;\r\n let currentOffset = 0;\r\n let numNonZeroOffsetNotes = 0;\r\n for (let pitch of pitches) {\r\n let changeMade = false;\r\n while (pitch + currentOffset + chromaticTrans > maxAllowedPitch) {\r\n currentOffset -= 12;\r\n changeMade = true;\r\n }\r\n while (pitch + currentOffset + chromaticTrans < minAllowedPitch) {\r\n currentOffset += 12;\r\n changeMade = true;\r\n }\r\n if (changeMade) {\r\n numShifts++;\r\n }\r\n if (currentOffset !== 0) {\r\n numNonZeroOffsetNotes++;\r\n }\r\n }\r\n points = numShifts;\r\n if (points < bestScore) {\r\n bestScore = points;\r\n bestTrans = trans;\r\n bestNonZeroOffsets = numNonZeroOffsetNotes;\r\n } else if (points === bestScore && numNonZeroOffsetNotes < bestNonZeroOffsets) {\r\n bestScore = points;\r\n bestTrans = trans;\r\n bestNonZeroOffsets = numNonZeroOffsetNotes;\r\n } else if (points === bestScore) {\r\n let newKeyDelta = Math.abs(idealKey - validTranspositions.get(trans));\r\n let newPoints = 100 - adjustmentOffset - Math.round(1.5 * newKeyDelta);\r\n let bestKeyDelta = Math.abs(idealKey - validTranspositions.get(bestTrans));\r\n let bestAdjustmentOffset = Math.abs(bestTrans.chromatic - idealChromatic);\r\n let bestPoints = 100 - bestAdjustmentOffset - Math.round(1.5 * bestKeyDelta);\r\n if (newPoints > bestPoints) {\r\n bestScore = points;\r\n bestTrans = trans;\r\n bestNonZeroOffsets = numNonZeroOffsetNotes;\r\n }\r\n }\r\n }\r\n return bestTrans;\r\n }\r\n /**/\r\n ////////////////OCTAVE RANGE CHECKING ADJUSTMENT////////////////////*/\r\n fixOctaveProblems(part, minPitch, maxPitch, comfortPitch) {\r\n let ngList = part.getNoteGroupsWithoutRestsOrTieIntos();\r\n if (ngList.length === 0) {\r\n return;\r\n }\r\n let _isInRange = (index, transposition) => {\r\n let pitch = ~~(ngList[index].visibleNotes[0].displayCents / 100 + 12 * transposition);\r\n return pitch >= minPitch && pitch <= maxPitch;\r\n };\r\n let points = this._getOctaveShiftMarkers(\r\n ngList,\r\n minPitch,\r\n maxPitch\r\n );\r\n let leftIndex = 0;\r\n let rightIndex;\r\n let leftTrans = points[0] == null ? 0 : points[0];\r\n let rightTrans;\r\n for (let i = 0; i < points.length; i++) {\r\n if (points[i] != null || i === points.length - 1) {\r\n if (i === points.length - 1) {\r\n }\r\n rightIndex = i;\r\n rightTrans = points[i] == null ? 0 : points[i];\r\n let leftTransReachIndex = leftIndex;\r\n while (leftTransReachIndex + 1 <= rightIndex && _isInRange(leftTransReachIndex + 1, leftTrans)) {\r\n leftTransReachIndex++;\r\n }\r\n let rightTransReachIndex = rightIndex;\r\n while (rightTransReachIndex - 1 >= leftIndex && _isInRange(rightTransReachIndex - 1, rightTrans)) {\r\n rightTransReachIndex--;\r\n }\r\n if (leftIndex === 0 && leftTrans === 0 && rightIndex === points.length - 1 && rightTrans === 0) {\r\n points[0] = 0;\r\n points[points.length - 1] = 0;\r\n this._createTransitionTranspositions(\r\n ngList,\r\n points,\r\n leftIndex,\r\n rightIndex,\r\n minPitch,\r\n maxPitch,\r\n comfortPitch\r\n );\r\n } else if (rightIndex - leftIndex <= 1) {\r\n if (leftIndex === 0 && leftTrans === 0) {\r\n points[leftIndex] = _isInRange(leftIndex, rightTrans) ? rightTrans : 0;\r\n }\r\n if (rightIndex === points.length - 1 && rightTrans === 0) {\r\n points[points.length - 1] = _isInRange(rightIndex, leftTrans) ? leftTrans : 0;\r\n }\r\n } else if (leftTransReachIndex >= rightTransReachIndex - 1) {\r\n if (leftIndex === 0 && leftTrans === 0) {\r\n points[0] = rightTransReachIndex <= leftIndex ? points[rightIndex] : 0;\r\n } else if (rightIndex === points.length - 1 && rightTrans === 0) {\r\n points[points.length - 1] = leftTransReachIndex >= rightIndex ? points[leftIndex] : 0;\r\n }\r\n this._createTransitionTranspositions(\r\n ngList,\r\n points,\r\n leftIndex,\r\n rightIndex,\r\n minPitch,\r\n maxPitch,\r\n comfortPitch\r\n );\r\n } else {\r\n let m1Index = leftIndex === 0 && leftTrans === 0 ? leftIndex : leftTransReachIndex + 1;\r\n let m2Index = rightIndex === points.length - 1 && rightTrans === 0 ? rightIndex : rightTransReachIndex - 1;\r\n let averageTrans = (leftTrans + rightTrans) / 2;\r\n let testTrans = averageTrans > 0 ? Math.ceil(averageTrans) : Math.floor(averageTrans);\r\n let foundSuitable = false;\r\n while (!foundSuitable) {\r\n if (testTrans === 0) {\r\n break;\r\n } else if (testTrans === leftTrans || testTrans === rightTrans) {\r\n testTrans += testTrans < 0 ? 1 : -1;\r\n continue;\r\n }\r\n foundSuitable = true;\r\n for (let j = m1Index; j <= m2Index; j++) {\r\n if (_isInRange(j, testTrans) === false) {\r\n foundSuitable = false;\r\n testTrans += testTrans < 0 ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n points[m1Index] = testTrans;\r\n points[m2Index] = testTrans;\r\n if (m1Index - leftIndex > 1) {\r\n this._createTransitionTranspositions(\r\n ngList,\r\n points,\r\n leftIndex,\r\n m1Index,\r\n minPitch,\r\n maxPitch,\r\n comfortPitch\r\n );\r\n }\r\n if (m2Index - m1Index > 1) {\r\n this._createTransitionTranspositions(\r\n ngList,\r\n points,\r\n m1Index,\r\n m2Index,\r\n minPitch,\r\n maxPitch,\r\n comfortPitch\r\n );\r\n }\r\n if (rightIndex - m2Index > 1) {\r\n this._createTransitionTranspositions(\r\n ngList,\r\n points,\r\n m2Index,\r\n rightIndex,\r\n minPitch,\r\n maxPitch,\r\n comfortPitch\r\n );\r\n }\r\n }\r\n leftIndex = i;\r\n leftTrans = points[i];\r\n }\r\n }\r\n this._scoreManager.adjustOctavesOfNotes(points, ngList);\r\n }\r\n _getOctaveShiftMarkers(ngList, minPitch, maxPitch) {\r\n let points = [];\r\n let remainingOctaveOptions = null;\r\n let transpositionStartIndex = 0;\r\n for (let i = 0; i < ngList.length; i++) {\r\n points.push(null);\r\n let ng = ngList[i];\r\n let note = ng.visibleNotes[0];\r\n let pitch = ~~(note.displayCents / 100);\r\n if (remainingOctaveOptions != null) {\r\n let octaveOptions = [];\r\n for (let octave of remainingOctaveOptions) {\r\n let testPitch = pitch + 12 * octave;\r\n if (testPitch >= minPitch && testPitch <= maxPitch) {\r\n octaveOptions.push(octave);\r\n }\r\n }\r\n if (octaveOptions.length === 0) {\r\n remainingOctaveOptions.sort((a, b) => a * a <= b * b ? -1 : 1);\r\n if (this._debug)\r\n console.log(remainingOctaveOptions);\r\n points[transpositionStartIndex] = remainingOctaveOptions[0];\r\n if (octaveOptions.length === 0) {\r\n remainingOctaveOptions = null;\r\n }\r\n } else {\r\n remainingOctaveOptions = octaveOptions;\r\n }\r\n }\r\n if (remainingOctaveOptions == null) {\r\n transpositionStartIndex = i;\r\n remainingOctaveOptions = [];\r\n let octave = 0;\r\n while (pitch + 12 * octave <= maxPitch) {\r\n if (pitch + 12 * octave >= minPitch) {\r\n if (remainingOctaveOptions.indexOf(octave) === -1) {\r\n remainingOctaveOptions.push(octave);\r\n }\r\n }\r\n octave++;\r\n }\r\n octave = -1;\r\n while (pitch + 12 * octave >= minPitch) {\r\n if (pitch + 12 * octave <= maxPitch) {\r\n if (remainingOctaveOptions.indexOf(octave) === -1) {\r\n remainingOctaveOptions.push(octave);\r\n }\r\n }\r\n octave--;\r\n }\r\n }\r\n }\r\n if (points.length > 0) {\r\n remainingOctaveOptions.sort((a, b) => a * a <= b * b ? -1 : 1);\r\n points[points.length - 1] = remainingOctaveOptions[0];\r\n if (points[0] == null)\r\n points[0] = points[points.length - 1];\r\n if (this._debug)\r\n console.log(\"points: ${points.toString()}\");\r\n }\r\n return points;\r\n }\r\n _createTransitionTranspositions(ngList, transpositionPoints, leftIndex, rightIndex, minPitch, maxPitch, comfortPitch) {\r\n let leftTrans = transpositionPoints[leftIndex];\r\n let rightTrans = transpositionPoints[rightIndex];\r\n if (leftTrans === rightTrans) {\r\n for (let i = leftIndex + 1; i < rightIndex; i++) {\r\n transpositionPoints[i] = leftTrans;\r\n }\r\n return;\r\n }\r\n let bestTransitionScore = -1e4;\r\n let bestTransitionIndex = leftIndex;\r\n for (let i = leftIndex; i < rightIndex; i++) {\r\n let currentNG = ngList[i];\r\n let cNote = currentNG.visibleNotes[0];\r\n let cPitchLeftTrans = ~~(cNote.displayCents / 100 + 12 * leftTrans);\r\n let nextNG = ngList[i + 1];\r\n let nNote = nextNG.visibleNotes[0];\r\n let nPitchLeftTrans = ~~(nNote.displayCents / 100 + 12 * leftTrans);\r\n let nPitchRightTrans = ~~(nNote.displayCents / 100 + 12 * rightTrans);\r\n if (cPitchLeftTrans < minPitch || cPitchLeftTrans > maxPitch) {\r\n break;\r\n }\r\n if (nPitchRightTrans < minPitch || nPitchRightTrans > maxPitch) {\r\n bestTransitionScore = -1e4;\r\n continue;\r\n }\r\n let interval = Math.abs(nPitchRightTrans - cPitchLeftTrans);\r\n let newIntervalScore = 2 / (interval + 1);\r\n let alternateInterval = Math.abs(nPitchLeftTrans - cPitchLeftTrans);\r\n newIntervalScore = 0.4 * (alternateInterval + 24) / (interval + 24);\r\n let qNoteDistance = Math.abs(nextNG.qNoteTime - currentNG.qNoteTime);\r\n let distanceFactor = Math.pow(qNoteDistance, 0.33);\r\n newIntervalScore *= Math.min(distanceFactor, 2);\r\n let newTransitionScore = newIntervalScore;\r\n if (newTransitionScore >= bestTransitionScore) {\r\n bestTransitionIndex = i;\r\n bestTransitionScore = newTransitionScore;\r\n }\r\n }\r\n for (let i = leftIndex; i <= rightIndex; i++) {\r\n transpositionPoints[i] = i <= bestTransitionIndex ? leftTrans : rightTrans;\r\n }\r\n }\r\n get debug() {\r\n return this._debug;\r\n }\r\n set debug(value) {\r\n this._debug = value;\r\n }\r\n};\r\n\r\n// src/editing/NoteManager.ts\r\nvar NoteManager = class {\r\n //the Score data object\r\n constructor(score) {\r\n this._score = score;\r\n }\r\n /**\r\n * adds the pitch to the specified Note\r\n * @param note the Note to change\r\n * @param octaveDelta the number of octaves to shift the note - negative\r\n * values for transposing down.\r\n */\r\n changeNoteOctave(note, octaveDelta) {\r\n let noteGroup = note.noteGroup;\r\n let measure = noteGroup.voice.measure;\r\n let oldOctave = Number.parseInt(note.pitchName.substring(1));\r\n note.pitchName = note.pitchName[0] + (oldOctave + octaveDelta).toString();\r\n note.displayCents += 1200 * octaveDelta;\r\n note.stepsFromTopStaffLine = PitchUtils.getStepsFromTopStaffLine(\r\n note.pitchName,\r\n measure.clefs[measure.clefs.length - 1].type\r\n );\r\n note.vPos = 1 / 2 * note.stepsFromTopStaffLine;\r\n note.legerLines = PitchUtils.getNumberOfLegerLines(\r\n note.stepsFromTopStaffLine\r\n );\r\n if (noteGroup.notes.length > 0) {\r\n noteGroup.sortNotesByPitch();\r\n }\r\n this.updateAccidentals(measure);\r\n measure.notesNeedRendering = true;\r\n }\r\n /**\r\n * adds the pitch to the specified Note\r\n * @param note the Note to change\r\n * @param octaveDelta the number of octaves to shift the note - negative\r\n * values for transposing down.\r\n */\r\n changeNoteGroupOctave(ng, octaveDelta) {\r\n let measure = ng.voice.measure;\r\n for (let note of ng.notes) {\r\n let oldOctave = Number.parseInt(note.pitchName.substring(1));\r\n note.pitchName = note.pitchName[0] + (oldOctave + octaveDelta).toString();\r\n note.displayCents += 1200 * octaveDelta;\r\n note.stepsFromTopStaffLine = PitchUtils.getStepsFromTopStaffLine(\r\n note.pitchName,\r\n measure.clefs[measure.clefs.length - 1].type\r\n );\r\n note.vPos = 1 / 2 * note.stepsFromTopStaffLine;\r\n note.legerLines = PitchUtils.getNumberOfLegerLines(\r\n note.stepsFromTopStaffLine\r\n );\r\n }\r\n this.updateAccidentals(measure);\r\n measure.notesNeedRendering = true;\r\n }\r\n /**\r\n * changes the passed in NoteGroup's duration. Any notes overlapped by an \r\n * increase in duration are deleted. any gaps created are filled with rests\r\n * @param noteGroup the NoteGroup object to change\r\n * @param newDuration the new Duration Unit duration (a power of 2 matching\r\n * a duration in the DurationType constants)\r\n * @param numDots the number of augmentation dots\r\n */\r\n changeDuration(noteGroup, newDuration, numDots) {\r\n if (noteGroup.duration === newDuration && noteGroup.numDots === numDots) {\r\n return;\r\n }\r\n if (newDuration !== 64 && newDuration !== 128 && newDuration !== 256 && newDuration !== 512 && newDuration !== 1024 && newDuration !== 2048 && newDuration !== 4096) {\r\n return;\r\n }\r\n let totalDuration = newDuration + DurationType.calculateDotDuration(newDuration, numDots);\r\n if (noteGroup.tuplets != null) {\r\n let tupletNGC = noteGroup.ngcRef.parentNGC;\r\n let tuplet = tupletNGC.tuplet;\r\n if (noteGroup.ngcRef.durUnitStartTime + totalDuration > (tupletNGC.durUnitEndTime - tupletNGC.durUnitStartTime) * (tuplet.numerator / tuplet.denominator)) {\r\n return;\r\n }\r\n } else {\r\n if (noteGroup.ngcRef.durUnitStartTime + totalDuration > (noteGroup.voice.measure.stack.endTime - noteGroup.voice.measure.stack.startTime) * 1024) {\r\n return;\r\n }\r\n }\r\n noteGroup.durationType = newDuration;\r\n noteGroup.duration = newDuration;\r\n noteGroup.numDots = numDots;\r\n noteGroup.ngcRef.durUnitEndTime = noteGroup.ngcRef.durUnitStartTime + totalDuration;\r\n noteGroup.qNoteDuration = totalDuration / 1024;\r\n noteGroup.stemDirection = newDuration < 4096 ? StemDirection.DOWN : StemDirection.NO_STEM;\r\n let parentList;\r\n if (noteGroup.tuplets != null) {\r\n let tupletRatio = 1;\r\n for (let tuplet of noteGroup.tuplets) {\r\n tupletRatio *= tuplet.denominator / tuplet.numerator * (tuplet.denominatorDuration / tuplet.numeratorDuration);\r\n }\r\n noteGroup.qNoteDuration *= tupletRatio;\r\n parentList = noteGroup.ngcRef.parentNGC.ngcList;\r\n } else {\r\n parentList = noteGroup.voice.noteGroupContainers;\r\n }\r\n for (let i = parentList.length - 1; i >= 0; i--) {\r\n let ngc = parentList[i];\r\n if (noteGroup.ngcRef.durUnitEndTime > ngc.durUnitStartTime && ngc.durUnitStartTime > noteGroup.ngcRef.durUnitStartTime) {\r\n let removedNoteGroups;\r\n if (ngc.noteGroup != null) {\r\n ngc.noteGroup.voice.removeNoteGroupContainer(ngc);\r\n ngc.noteGroup.voice.measure.stack.removeNoteGroup(\r\n ngc.noteGroup\r\n );\r\n removedNoteGroups = [ngc.noteGroup];\r\n } else {\r\n removedNoteGroups = noteGroup.voice.removeNoteGroupContainer(ngc, false);\r\n }\r\n if (noteGroup.voice.measure.staff.partRef.visible) {\r\n for (let ngToRemove of removedNoteGroups) {\r\n noteGroup.voice.measure.stack.removeNoteGroup(\r\n ngToRemove\r\n );\r\n }\r\n }\r\n for (let ngToRemove of removedNoteGroups) {\r\n if (ngToRemove.slurs != null) {\r\n for (let slur of ngToRemove.slurs) {\r\n this.removeSlur(slur);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n let measure = noteGroup.voice.measure;\r\n this.fillMeasure(measure);\r\n measure.notesNeedRendering = true;\r\n }\r\n addTuplet(ng, numerator, denominator, numeratorDuration, denominatorDuration) {\r\n if (numeratorDuration !== 64 && numeratorDuration !== 128 && numeratorDuration !== 256 && numeratorDuration !== 512 && numeratorDuration !== 1024 && numeratorDuration !== 2048 && numeratorDuration !== 4096) {\r\n return;\r\n }\r\n if (denominatorDuration !== 64 && denominatorDuration !== 128 && denominatorDuration !== 256 && denominatorDuration !== 512 && denominatorDuration !== 1024 && denominatorDuration !== 2048 && denominatorDuration !== 4096) {\r\n return;\r\n }\r\n let parentList;\r\n let totalDuration = denominator * denominatorDuration;\r\n let tuplet;\r\n if (ng.tuplets != null) {\r\n let tupletNGC = ng.ngcRef.parentNGC;\r\n tuplet = tupletNGC.tuplet;\r\n if (ng.ngcRef.durUnitStartTime + totalDuration > (tupletNGC.durUnitEndTime - tupletNGC.durUnitStartTime) * (tuplet.numerator / tuplet.denominator)) {\r\n return;\r\n }\r\n parentList = ng.ngcRef.parentNGC.ngcList;\r\n } else {\r\n if (ng.ngcRef.durUnitStartTime + totalDuration > (ng.voice.measure.stack.endTime - ng.voice.measure.stack.startTime) * 1024) {\r\n return;\r\n }\r\n parentList = ng.voice.noteGroupContainers;\r\n }\r\n for (let i = parentList.length - 1; i >= 0; i--) {\r\n let ngc = parentList[i];\r\n if (ng.ngcRef.durUnitStartTime + totalDuration > ngc.durUnitStartTime && ngc.durUnitStartTime > ng.ngcRef.durUnitStartTime) {\r\n let removedNoteGroups;\r\n if (ngc.noteGroup != null) {\r\n ngc.noteGroup.voice.removeNoteGroupContainer(ngc);\r\n ngc.noteGroup.voice.measure.stack.removeNoteGroup(\r\n ngc.noteGroup\r\n );\r\n removedNoteGroups = [ngc.noteGroup];\r\n } else {\r\n removedNoteGroups = ng.voice.removeNoteGroupContainer(\r\n ngc,\r\n false\r\n );\r\n }\r\n if (ng.voice.measure.staff.partRef.visible) {\r\n for (let ngToRemove of removedNoteGroups) {\r\n ng.voice.measure.stack.removeNoteGroup(ngToRemove);\r\n }\r\n }\r\n for (let ngToRemove of removedNoteGroups) {\r\n if (ngToRemove.slurs != null) {\r\n for (let slur of ngToRemove.slurs) {\r\n this.removeSlur(slur);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n tuplet = new Tuplet();\r\n tuplet.above = true;\r\n tuplet.denominator = denominator;\r\n tuplet.denominatorDuration = denominatorDuration;\r\n tuplet.numerator = numerator;\r\n tuplet.numeratorDuration = numeratorDuration;\r\n tuplet.firstNote = ng;\r\n tuplet.endNote = ng;\r\n if (ng.tuplets == null) {\r\n ng.tuplets = [];\r\n }\r\n tuplet.tupletID = ng.tuplets.length + 1;\r\n ng.tuplets.push(tuplet);\r\n let originalDurUnitDuration = ng.ngcRef.durUnitEndTime - ng.ngcRef.durUnitStartTime;\r\n let parentNGC = ng.ngcRef;\r\n parentNGC.durUnitEndTime = parentNGC.durUnitStartTime + denominator * denominatorDuration;\r\n let childNGC = new NoteGroupContainer();\r\n childNGC.durUnitStartTime = 0;\r\n childNGC.durUnitEndTime = originalDurUnitDuration;\r\n childNGC.noteGroup = ng;\r\n ng.ngcRef = childNGC;\r\n childNGC.qNoteStartTime = parentNGC.qNoteStartTime;\r\n childNGC.parentNGC = parentNGC;\r\n ng.qNoteDuration *= tuplet.denominator / tuplet.numerator;\r\n parentNGC.ngcList = [childNGC];\r\n parentNGC.noteGroup = null;\r\n parentNGC.tuplet = tuplet;\r\n let measure = ng.voice.measure;\r\n this.fillMeasure(measure);\r\n measure.notesNeedRendering = true;\r\n }\r\n /**\r\n * Toggles the tie state for the requested Note\r\n * @param note the Note to change\r\n */\r\n toggleTie(note) {\r\n if (note.tieState === TieState.NONE) {\r\n note.tieState = TieState.START;\r\n } else if (note.tieState === TieState.STOP) {\r\n note.tieState = TieState.CONTINUE;\r\n } else if (note.tieState === TieState.CONTINUE) {\r\n note.tieState = TieState.STOP;\r\n } else {\r\n note.tieState = TieState.NONE;\r\n }\r\n let measure = note.noteGroup.voice.measure;\r\n let measures = [measure];\r\n measure.notesNeedRendering = true;\r\n let stack = measure.stack;\r\n if (stack.next != null) {\r\n let measureIndex = stack.measures.indexOf(measure);\r\n let nextMeasure = stack.next.measures[measureIndex];\r\n measures[1] = nextMeasure;\r\n nextMeasure.notesNeedRendering = true;\r\n }\r\n this.updateTies(measures);\r\n }\r\n fixNotesForClefs(measure) {\r\n for (let i = measure.clefs.length - 1; i >= 0; i--) {\r\n let clef = measure.clefs[i];\r\n let clefType = clef.type;\r\n for (let voice of measure.voices) {\r\n let ngList = voice.noteGroups;\r\n let noteIdx = ngList.length - 1;\r\n while (noteIdx >= 0) {\r\n let ng = ngList[noteIdx];\r\n if (ng.qNoteTime < clef.qNoteTime) {\r\n break;\r\n }\r\n for (let note of ng.notes) {\r\n let steps = PitchUtils.getStepsFromTopStaffLine(\r\n note.pitchName,\r\n clefType\r\n );\r\n note.stepsFromTopStaffLine = steps;\r\n note.legerLines = PitchUtils.getNumberOfLegerLines(\r\n steps\r\n );\r\n note.vPos = 0.5 * steps;\r\n }\r\n noteIdx--;\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * adds the pitch to the specified NoteGroup\r\n * @param noteGroup the NoteGroup to add the Note to\r\n * @param pitchLetterName A, B, C, D, E, F, or G (uppercase)\r\n * @param octave the octave for the note - C4 is middle C, the note below it\r\n * is B3.\r\n * @param alteration a value from -2 (number flat) to 2 (number sharp). This\r\n * is an absolute alteration - not relative to the key signature's\r\n * adjustment for this pitch.\r\n */\r\n addPitch(noteGroup, pitchLetterName, octave, alteration) {\r\n let measure = noteGroup.voice.measure;\r\n let newNote = new Note();\r\n newNote.pitchName = pitchLetterName + octave.toString();\r\n newNote.displayCents = PitchUtils.pitchNameToDiatonicCents(\r\n newNote.pitchName\r\n ) + 100 * alteration;\r\n this._setPercussionPlaybackCents(newNote);\r\n newNote.stepsFromTopStaffLine = PitchUtils.getStepsFromTopStaffLine(\r\n newNote.pitchName,\r\n measure.clefs[measure.clefs.length - 1].type\r\n );\r\n newNote.vPos = 1 / 2 * newNote.stepsFromTopStaffLine;\r\n newNote.alteration = alteration;\r\n newNote.legerLines = PitchUtils.getNumberOfLegerLines(\r\n newNote.stepsFromTopStaffLine\r\n );\r\n if (noteGroup.durationType === DurationType.WHOLE && noteGroup.duration < 4096) {\r\n let newDurationInfo = DurationType.getBaseDurationAndDots(\r\n noteGroup.duration\r\n );\r\n noteGroup.durationType = newDurationInfo[0];\r\n noteGroup.numDots = newDurationInfo[1];\r\n }\r\n noteGroup.isRest = false;\r\n noteGroup.stemDirection = noteGroup.duration < 4096 ? StemDirection.DOWN : StemDirection.NO_STEM;\r\n noteGroup.insertNote(newNote);\r\n this.updateAccidentals(measure);\r\n measure.notesNeedRendering = true;\r\n }\r\n /**changes the pitch of a Note\r\n * @param note the Note to repitch\r\n * @param pitchLetterName A, B, C, D, E, F, or G (uppercase)\r\n * @param octave the octave for the note - C4 is middle C, the note below it\r\n * is B3.\r\n * @param alteration a value from -2 (number flat) to 2 (number sharp). This\r\n * is an absolute alteration - not relative to the key signature's\r\n * adjustment for this pitch. */\r\n repitch(note, pitchLetterName, octave, alteration) {\r\n let ng = note.noteGroup;\r\n let measure = ng.voice.measure;\r\n note.pitchName = pitchLetterName + octave.toString();\r\n note.displayCents = PitchUtils.pitchNameToDiatonicCents(\r\n note.pitchName\r\n ) + 100 * alteration;\r\n this._setPercussionPlaybackCents(note);\r\n note.stepsFromTopStaffLine = PitchUtils.getStepsFromTopStaffLine(\r\n note.pitchName,\r\n measure.clefs[measure.clefs.length - 1].type\r\n );\r\n note.vPos = 1 / 2 * note.stepsFromTopStaffLine;\r\n note.alteration = alteration;\r\n note.legerLines = PitchUtils.getNumberOfLegerLines(\r\n note.stepsFromTopStaffLine\r\n );\r\n ng.sortNotes();\r\n this.updateAccidentals(measure);\r\n measure.notesNeedRendering = true;\r\n }\r\n _setPercussionPlaybackCents(note) {\r\n if (note.noteGroup.voice.measure.staff.partRef.percussionMap != null) {\r\n let percussionMap = note.noteGroup.voice.measure.staff.partRef.percussionMap;\r\n let midiPitch = ~~(note.displayCents / 100);\r\n if (percussionMap[midiPitch] != null) {\r\n note.playbackCents = percussionMap[midiPitch] * 100;\r\n } else if (percussionMap[0] != null) {\r\n note.playbackCents = percussionMap[0] * 100;\r\n } else {\r\n note.playbackCents = 3800;\r\n }\r\n }\r\n }\r\n /**\r\n * removes the Note from the NoteGroup\r\n * @param noteGroup the NoteGroup to remove the Note from\r\n * @param note the Note to remove\r\n */\r\n removePitch(noteGroup, note) {\r\n noteGroup.removeNote(note);\r\n if (noteGroup.notes.length <= 0) {\r\n let ngcToRemove = noteGroup.ngcRef;\r\n while (ngcToRemove.parentNGC != null && ngcToRemove.parentNGC.tuplet.firstNote === noteGroup) {\r\n ngcToRemove = ngcToRemove.parentNGC;\r\n }\r\n let removedNoteGroups = noteGroup.voice.removeNoteGroupContainer(\r\n ngcToRemove\r\n );\r\n if (noteGroup.voice.measure.staff.partRef.visible) {\r\n for (let ng of removedNoteGroups) {\r\n noteGroup.voice.measure.stack.removeNoteGroup(ng);\r\n }\r\n }\r\n for (let ng of removedNoteGroups) {\r\n if (ng.slurs != null) {\r\n for (let slur of ng.slurs) {\r\n this.removeSlur(slur);\r\n }\r\n }\r\n }\r\n this.fillMeasure(noteGroup.voice.measure);\r\n }\r\n this.updateAccidentals(noteGroup.voice.measure);\r\n noteGroup.voice.measure.notesNeedRendering = true;\r\n }\r\n /**\r\n * updates the accidentals in the measure so that all necessary accidentals\r\n * are shown and unnecessary ones are hidden\r\n * @param measure the Measure to update\r\n */\r\n updateAccidentals(measure) {\r\n let pitchHistory = {};\r\n let voices = measure.voices;\r\n for (let voice of voices) {\r\n let noteGroups = voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let i = 0; i < numNoteGroups; i++) {\r\n if (noteGroups[i].isRest) {\r\n continue;\r\n }\r\n let notes = noteGroups[i].visibleNotes;\r\n for (let note of notes) {\r\n if (note.tieState === TieState.CONTINUE || note.tieState === TieState.STOP) {\r\n note.showAccidental = false;\r\n continue;\r\n }\r\n let pos = note.stepsFromTopStaffLine + 50;\r\n if (pitchHistory[pos] == null) {\r\n pitchHistory[pos] = PitchUtils.getKeySigAlterationForNote(\r\n note.pitchName[0],\r\n measure.displayKey\r\n );\r\n }\r\n if (pitchHistory[pos] === note.alteration) {\r\n note.showAccidental = false;\r\n } else {\r\n note.accidental = AccidentalType.getAccidentalType(\r\n note.alteration\r\n );\r\n note.showAccidental = true;\r\n pitchHistory[pos] = note.alteration;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * updates the ties in the measure region, getting rid of orphaned ties and\r\n * changing the state of ties where necessary\r\n * @param measure the measures to update (must be consecutive). The last\r\n * note in the region will not be updated in terms of how it connects to the\r\n * following measure.\r\n */\r\n updateTies(measures) {\r\n let ngLists = new Array();\r\n let numMeasures = measures.length;\r\n for (let i = 0; i < numMeasures; i++) {\r\n let voices = measures[i].voices;\r\n let numVoices = voices.length;\r\n for (let j = 0; j < numVoices; j++) {\r\n let voice = voices[j];\r\n while (voice.number >= ngLists.length) {\r\n ngLists.push(new Array());\r\n }\r\n let ngList = ngLists[voice.number];\r\n let nextNGIndex = ngList.length;\r\n let noteGroups = voices[j].noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let k = 0; k < numNoteGroups; k++) {\r\n if (k < ngList.length) {\r\n ngList[nextNGIndex] = noteGroups[k];\r\n } else {\r\n ngList.push(noteGroups[k]);\r\n }\r\n nextNGIndex++;\r\n }\r\n }\r\n }\r\n let numLists = ngLists.length;\r\n for (let i = 0; i < numLists; i++) {\r\n let ngList = ngLists[i];\r\n let numNoteGroups = ngList.length;\r\n for (let j = 0; j < numNoteGroups - 1; j++) {\r\n let ng = ngList[j];\r\n let nextNG = ngList[j + 1];\r\n let notes = ng.notes;\r\n let numNotes = notes.length;\r\n for (let k = 0; k < numNotes; k++) {\r\n let note = notes[k];\r\n let nextNote = this._getMatchingNoteInNextNoteGroup(\r\n note,\r\n nextNG\r\n );\r\n if (note.tieState === TieState.START || note.tieState === TieState.CONTINUE) {\r\n if (nextNote != null) {\r\n if (nextNote.tieState === TieState.NONE) {\r\n nextNote.tieState = TieState.STOP;\r\n } else if (nextNote.tieState === TieState.START) {\r\n nextNote.tieState = TieState.CONTINUE;\r\n }\r\n } else {\r\n if (note.tieState === TieState.CONTINUE) {\r\n note.tieState = TieState.STOP;\r\n } else {\r\n note.tieState = TieState.NONE;\r\n }\r\n }\r\n } else {\r\n if (nextNote != null) {\r\n if (nextNote.tieState === TieState.CONTINUE) {\r\n nextNote.tieState = TieState.START;\r\n } else if (nextNote.tieState === TieState.START) {\r\n } else {\r\n nextNote.tieState = TieState.NONE;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _getMatchingNoteInNextNoteGroup(firstNote, nextNoteGroup) {\r\n let nextNotes = nextNoteGroup.notes;\r\n for (let nxNote of nextNotes) {\r\n if (nxNote.pitchName === firstNote.pitchName && nxNote.alteration === firstNote.alteration) {\r\n return nxNote;\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * For music coming from MusicXML, this creates NoteGroupContainer objects\r\n * for NoteGroups and Tuplets, adding relative time stamps and creating a\r\n * hierarchy that makes it possible to fill measures with rests\r\n */\r\n createNoteGroupContainers() {\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n let measures = staff.measures;\r\n for (let measure of measures) {\r\n let voices = measure.voices;\r\n for (let voice of voices) {\r\n let topContainer = new NoteGroupContainer();\r\n topContainer.ngcList = [];\r\n this.addNotesToContainer(\r\n topContainer.ngcList,\r\n null,\r\n voice.noteGroups,\r\n 0\r\n );\r\n voice.noteGroupContainers = topContainer.ngcList;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * updates the start time values for NoteGroups and their\r\n * NoteGroupContainers by the specified deltaTime value. Any containers with\r\n * an end time beyond the end of the measure are deleted\r\n * @param ngcList the list of NoteGroupContainers to adjust\r\n * @param deltaTime the amount to adjust the times by (this value is added\r\n * to their current qNote times)\r\n * @param measureEndTime the qnote end time of the measure\r\n * @param voiceRef the Voice object to which the NGCs and NoteGroups belong\r\n * @param checkEndTimes set to true if you want check the end times of\r\n * NoteGroupContainers and remove the ones that hang over the end\r\n */\r\n changeNoteGroupTimeStamps(ngcList, deltaTime, measureEndTime, voiceRef, checkEndTimes) {\r\n for (let i = ngcList.length - 1; i >= 0; i--) {\r\n let ngc = ngcList[i];\r\n ngc.qNoteStartTime += deltaTime;\r\n if (checkEndTimes) {\r\n let tupletRatio = 1;\r\n let parentNGC = ngc.parentNGC;\r\n while (parentNGC != null) {\r\n let tuplet = parentNGC.tuplet;\r\n tupletRatio *= tuplet.denominator / tuplet.numerator * (tuplet.denominatorDuration / tuplet.numeratorDuration);\r\n parentNGC = parentNGC.parentNGC;\r\n }\r\n let ngcEndTime = ngc.qNoteStartTime + (ngc.durUnitEndTime - ngc.durUnitStartTime) / 1024 * tupletRatio;\r\n if (ngcEndTime > measureEndTime) {\r\n let removedNoteGroups = voiceRef.removeNoteGroupContainer(ngc);\r\n for (let ng of removedNoteGroups) {\r\n voiceRef.measure.stack.removeNoteGroup(ng);\r\n if (ng.slurs != null) {\r\n for (let slur of ng.slurs) {\r\n this.removeSlur(slur);\r\n }\r\n }\r\n }\r\n continue;\r\n }\r\n }\r\n if (ngc.noteGroup != null) {\r\n ngc.noteGroup.qNoteTime += deltaTime;\r\n } else {\r\n this.changeNoteGroupTimeStamps(\r\n ngc.ngcList,\r\n deltaTime,\r\n measureEndTime,\r\n voiceRef,\r\n false\r\n );\r\n }\r\n }\r\n }\r\n /**\r\n * fills the measure's blank areas with rests\r\n * @param\tmeasure the Measure object to fill\r\n */\r\n fillMeasure(measure) {\r\n let measureDuration = ~~(measure.numBeats * (1024 * (4 / measure.beatType)));\r\n for (let voice of measure.voices) {\r\n if (voice.noteGroupContainers == null || voice.noteGroupContainers.length === 0) {\r\n let noteGroup = new NoteGroup();\r\n noteGroup.qNoteTime = measure.stack.startTime;\r\n noteGroup.qNoteDuration = measureDuration / 1024;\r\n noteGroup.duration = measureDuration;\r\n noteGroup.durationType = DurationType.WHOLE;\r\n noteGroup.isRest = true;\r\n voice.addNoteGroup(noteGroup);\r\n if (measure.staff.partRef.visible) {\r\n measure.stack.addNoteGroup(noteGroup);\r\n }\r\n let ngc = new NoteGroupContainer();\r\n ngc.noteGroup = noteGroup;\r\n ngc.durUnitStartTime = 0;\r\n ngc.durUnitEndTime = measureDuration;\r\n ngc.parentNGC = null;\r\n ngc.qNoteStartTime = noteGroup.qNoteTime;\r\n noteGroup.ngcRef = ngc;\r\n if (voice.noteGroupContainers == null) {\r\n voice.noteGroupContainers = [ngc];\r\n } else {\r\n voice.noteGroupContainers.splice(\r\n 0,\r\n voice.noteGroupContainers.length\r\n );\r\n }\r\n } else {\r\n let beatPositions = [];\r\n let beatGroups = measure.beatGroups;\r\n for (let i = 0; i < beatGroups.length; i++) {\r\n beatPositions.push(~~(beatGroups[i] * 1024));\r\n }\r\n let maxRestSize = 1024 * ~~(4 / measure.beatType);\r\n this.checkLevelForGaps(\r\n voice.noteGroupContainers,\r\n null,\r\n 0,\r\n measureDuration,\r\n voice,\r\n beatPositions,\r\n maxRestSize,\r\n measure.stack.startTime,\r\n 1\r\n );\r\n }\r\n }\r\n for (let voice of measure.voices) {\r\n let ngList = voice.noteGroups;\r\n if (ngList != null) {\r\n for (let i = 0; i < ngList.length; i++) {\r\n let ng = ngList[i];\r\n ng.clearNextPrevNGCaches();\r\n if (i === 0) {\r\n let prevNG = ng.prev;\r\n if (prevNG != null) {\r\n prevNG.clearNextPrevNGCaches();\r\n }\r\n } else if (i === ngList.length - 1) {\r\n let nextNG = ng.next;\r\n if (nextNG != null) {\r\n nextNG.clearNextPrevNGCaches();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * adds a slur between two notes\r\n * @param ng1 the first NoteGroup\r\n * @param ng2 the second NoteGroup\r\n */\r\n addSlur(ng1, ng2) {\r\n if (ng1 == null || ng2 == null || ng1.isRest || ng2.isRest || ng1.voice.number !== ng2.voice.number || ng1.voice.measure.staff !== ng2.voice.measure.staff || ng1 === ng2 || ng1.qNoteTime === ng2.qNoteTime) {\r\n return;\r\n }\r\n let slur = new Slur();\r\n if (ng1.qNoteTime < ng2.qNoteTime) {\r\n slur.firstNote = ng1;\r\n slur.endNote = ng2;\r\n } else {\r\n slur.firstNote = ng2;\r\n slur.endNote = ng1;\r\n }\r\n if (ng1.slurs != null) {\r\n ng1.slurs.push(slur);\r\n } else {\r\n ng1.slurs = [slur];\r\n }\r\n if (ng2.slurs != null) {\r\n ng2.slurs.push(slur);\r\n } else {\r\n ng2.slurs = [slur];\r\n }\r\n ng1.voice.measure.notesNeedRendering = true;\r\n ng2.voice.measure.notesNeedRendering = true;\r\n }\r\n /**\r\n * removes a Slur from the score\r\n * @param slur the Slur to remove\r\n */\r\n removeSlur(slur) {\r\n let ng1 = slur.firstNote;\r\n let ng2 = slur.endNote;\r\n let segments = slur.segments;\r\n if (ng1 != null && ng1.slurs != null) {\r\n ng1.slurs.splice(ng1.slurs.indexOf(slur), 1);\r\n if (ng1.slurs.length === 0) {\r\n ng1.slurs = null;\r\n }\r\n }\r\n if (ng2 != null && ng2.slurs != null) {\r\n ng2.slurs.splice(ng2.slurs.indexOf(slur), 1);\r\n if (ng2.slurs.length === 0) {\r\n ng2.slurs = null;\r\n }\r\n }\r\n ng1.voice.measure.notesNeedRendering = true;\r\n ng2.voice.measure.notesNeedRendering = true;\r\n let segment;\r\n for (segment of segments) {\r\n segment.systemRef.slurSegments.splice(\r\n segment.systemRef.slurSegments.indexOf(segment),\r\n 1\r\n );\r\n }\r\n if (segment.systemRef.slurSegments.length === 0) {\r\n segment.systemRef.slurSegments = null;\r\n }\r\n }\r\n /**\r\n * checks the contents of one NoteGroupContainer for gaps - calls itself\r\n * recursively for sub levels\r\n * @param ngcList the list of NoteGroupContainer objects for the current\r\n * level, including containers that hold NoteGroups and Tuplets\r\n * @param parentNGC the NoteGroupContainer object that stores the ngcList -\r\n * this will contain any tuplet information for notes in the ngcList as well\r\n * as the parent's start time in duration units\r\n * @param startTime the expected start time in duration units\r\n * @param endTime the expected end time in duration units\r\n * @param voice the voice to add any rests to\r\n * @param beatPositions the positions of the beat divisions, where rests\r\n * will need to be split - in duration units\r\n * @param maxRestSize the max ordinary rest size, in duration units. Note\r\n * that rests which occupy a full beat may exceed this (like a dotted rest\r\n * in compound meters)\r\n */\r\n checkLevelForGaps(ngcList, parentNGC, startTime, endTime, voice, beatPositions, maxRestSize, parentNGCQNoteTime, tupletRatio) {\r\n let numContainers = ngcList.length;\r\n for (let i = numContainers - 1; i >= 0; i--) {\r\n let ngc = ngcList[i];\r\n if (ngc.durUnitEndTime < endTime) {\r\n this.fillGapWithRests(\r\n ngc.durUnitEndTime,\r\n endTime,\r\n voice,\r\n ngcList,\r\n i + 1,\r\n beatPositions,\r\n maxRestSize,\r\n parentNGC,\r\n parentNGCQNoteTime,\r\n tupletRatio\r\n );\r\n }\r\n if (ngc.ngcList != null) {\r\n let tuplet = ngc.tuplet;\r\n let subTupletBeatPositions = [];\r\n for (let j = 0; j < tuplet.numerator; j++) {\r\n subTupletBeatPositions.push(j * tuplet.numeratorDuration);\r\n }\r\n let subTupletMaxRestSize = tuplet.numeratorDuration;\r\n let subTupletRatio = tupletRatio * (tuplet.denominator / tuplet.numerator * (tuplet.denominatorDuration / tuplet.numeratorDuration));\r\n let unadjustedEndtime = Math.trunc(\r\n (ngc.durUnitEndTime - ngc.durUnitStartTime) * (tuplet.numerator / tuplet.denominator) * (tuplet.numeratorDuration / tuplet.denominatorDuration)\r\n );\r\n this.checkLevelForGaps(\r\n ngc.ngcList,\r\n ngc,\r\n 0,\r\n unadjustedEndtime,\r\n voice,\r\n subTupletBeatPositions,\r\n subTupletMaxRestSize,\r\n ngc.qNoteStartTime,\r\n subTupletRatio\r\n );\r\n }\r\n endTime = ngc.durUnitStartTime;\r\n }\r\n if (endTime > startTime) {\r\n this.fillGapWithRests(\r\n startTime,\r\n endTime,\r\n voice,\r\n ngcList,\r\n 0,\r\n beatPositions,\r\n maxRestSize,\r\n parentNGC,\r\n parentNGCQNoteTime,\r\n tupletRatio\r\n );\r\n }\r\n }\r\n fillGapWithRests(startPoint, endPoint, voice, ngcList, ngcListIndex, beatPositions, maxRestSize, parentNGC, parentNGCQNoteTime, tupletRatio) {\r\n let currentPos = endPoint;\r\n while (currentPos > startPoint) {\r\n let beatIndex = 0;\r\n let beatPos = beatPositions[0];\r\n while (beatIndex + 1 < beatPositions.length && beatPositions[beatIndex + 1] < currentPos) {\r\n beatIndex++;\r\n beatPos = beatPositions[beatIndex];\r\n }\r\n let goalPos = beatPos > startPoint ? beatPos : startPoint;\r\n let goalRestSize = currentPos - goalPos;\r\n let beatSize;\r\n if (beatIndex < beatPositions.length - 1) {\r\n beatSize = beatPositions[beatIndex + 1] - beatPos;\r\n } else {\r\n beatSize = endPoint - beatPos;\r\n }\r\n let restSize;\r\n let ng;\r\n if (goalRestSize === beatSize) {\r\n restSize = beatSize;\r\n currentPos = goalPos;\r\n } else if (goalRestSize < beatSize) {\r\n restSize = maxRestSize;\r\n while (restSize > goalRestSize) {\r\n restSize = ~~(restSize / 2);\r\n }\r\n ng = this.getRestBySize(restSize);\r\n currentPos -= restSize;\r\n } else {\r\n }\r\n ng = this.getRestBySize(restSize);\r\n ng.qNoteTime = parentNGCQNoteTime + currentPos * tupletRatio / 1024;\r\n ng.qNoteDuration = ng.duration / 1024 * tupletRatio;\r\n ng.voice = voice;\r\n let superNGC = parentNGC;\r\n if (superNGC != null) {\r\n let tuplets = [];\r\n while (superNGC != null && superNGC.tuplet != null) {\r\n tuplets.push(superNGC.tuplet);\r\n superNGC = superNGC.parentNGC;\r\n }\r\n ng.tuplets = tuplets.reverse();\r\n for (let tuplet of tuplets) {\r\n if (ng.qNoteTime > tuplet.endNote.qNoteTime) {\r\n tuplet.endNote = ng;\r\n } else if (ng.qNoteTime < tuplet.firstNote.qNoteTime) {\r\n tuplet.firstNote = ng;\r\n }\r\n }\r\n }\r\n let ngc = new NoteGroupContainer();\r\n ngc.noteGroup = ng;\r\n ngc.durUnitStartTime = currentPos;\r\n ngc.durUnitEndTime = currentPos + restSize;\r\n ngc.qNoteStartTime = ng.qNoteTime;\r\n ngc.parentNGC = parentNGC;\r\n ng.ngcRef = ngc;\r\n ngcList.splice(ngcListIndex, 0, ngc);\r\n let noteGroups = voice.noteGroups;\r\n let numNotes = noteGroups.length;\r\n let i = 0;\r\n for (i = numNotes - 1; i >= 0; i--) {\r\n if (noteGroups[i].qNoteTime < ng.qNoteTime) {\r\n break;\r\n }\r\n }\r\n noteGroups.splice(i + 1, 0, ng);\r\n if (voice.measure.staff.partRef.visible) {\r\n voice.measure.stack.addNoteGroup(ng);\r\n }\r\n }\r\n }\r\n getRestBySize(goalSize) {\r\n let baseDuration = 16;\r\n while (baseDuration < goalSize) {\r\n baseDuration *= 2;\r\n }\r\n if (baseDuration > goalSize) {\r\n baseDuration = ~~(baseDuration / 2);\r\n }\r\n let numDots = 0;\r\n let dotsValue = ~~(baseDuration / 2);\r\n let totalDuration = baseDuration;\r\n while (totalDuration < goalSize) {\r\n numDots++;\r\n totalDuration += dotsValue;\r\n dotsValue = ~~(dotsValue / 2);\r\n }\r\n let ng = new NoteGroup();\r\n ng.duration = goalSize;\r\n ng.numDots = numDots;\r\n ng.isRest = true;\r\n ng.durationType = baseDuration;\r\n return ng;\r\n }\r\n addNotesToContainer(ngcList, parentNGC, notes, tupletIndex) {\r\n let cTime = 0;\r\n let subTupletNGList = [];\r\n for (let ng of notes) {\r\n if (ng.tuplets != null && ng.tuplets.length > tupletIndex) {\r\n subTupletNGList.push(ng);\r\n if (ng.tuplets[tupletIndex].endNote === ng) {\r\n let subTupletNGC = new NoteGroupContainer();\r\n subTupletNGC.tuplet = ng.tuplets[tupletIndex];\r\n subTupletNGC.ngcList = [];\r\n subTupletNGC.qNoteStartTime = subTupletNGList[0].qNoteTime;\r\n subTupletNGC.durUnitStartTime = cTime;\r\n cTime += subTupletNGC.tuplet.denominatorDuration * subTupletNGC.tuplet.denominator;\r\n subTupletNGC.durUnitEndTime = cTime;\r\n subTupletNGC.parentNGC = parentNGC;\r\n this.addNotesToContainer(\r\n subTupletNGC.ngcList,\r\n subTupletNGC,\r\n subTupletNGList,\r\n tupletIndex + 1\r\n );\r\n ngcList.push(subTupletNGC);\r\n subTupletNGList = [];\r\n }\r\n } else {\r\n let ngc = new NoteGroupContainer();\r\n ng.ngcRef = ngc;\r\n ngc.noteGroup = ng;\r\n ngc.qNoteStartTime = ng.qNoteTime;\r\n ngc.durUnitStartTime = cTime;\r\n ngc.parentNGC = parentNGC;\r\n cTime += DurationType.getDurationValue(\r\n ng.durationType,\r\n ng.numDots\r\n );\r\n ngc.durUnitEndTime = cTime;\r\n ngcList.push(ngc);\r\n }\r\n }\r\n }\r\n};\r\n\r\n// src/editing/PitchNameManager.ts\r\nvar PitchNameManager = class {\r\n constructor(score) {\r\n this._score = score;\r\n }\r\n /**\r\n * removes note names and restores lyrics for all staves\r\n */\r\n showLyrics() {\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n if (staff.originalLyrics == null) {\r\n continue;\r\n }\r\n let originalLyrics = staff.originalLyrics;\r\n let lyricIndex = 0;\r\n for (let measure of staff.measures) {\r\n let voice = measure.voices[0];\r\n for (let ng of voice.noteGroups) {\r\n if (lyricIndex < originalLyrics.length && originalLyrics[lyricIndex].has(ng)) {\r\n ng.lyric = originalLyrics[lyricIndex].get(ng);\r\n lyricIndex++;\r\n } else {\r\n ng.lyric = null;\r\n }\r\n }\r\n }\r\n staff.originalLyrics = null;\r\n staff.lyricsMode = 0 /* SHOW_LYRICS */;\r\n }\r\n }\r\n }\r\n showNoteNames(staff) {\r\n let storeLyrics = false;\r\n if (staff.originalLyrics == null) {\r\n staff.originalLyrics = [];\r\n storeLyrics = true;\r\n }\r\n let originalLyrics = staff.originalLyrics;\r\n let vPos = -8;\r\n let hPos = 0.5;\r\n for (let measure of staff.measures) {\r\n let voice = measure.voices[0];\r\n for (let ng of voice.noteGroups) {\r\n if (ng.isRest || ng.isGrace) {\r\n continue;\r\n }\r\n let note = ng.visibleNotes[0];\r\n if (storeLyrics && ng.lyric != null) {\r\n originalLyrics.push(/* @__PURE__ */ new Map([[ng, ng.lyric]]));\r\n }\r\n if (note.tieState !== \"none\" && note.tieState !== \"start\") {\r\n ng.lyric = null;\r\n continue;\r\n }\r\n let pitchName = note.pitchName;\r\n pitchName = pitchName.substring(0, pitchName.length - 1);\r\n pitchName += this._getAccidentalText(note.alteration);\r\n ng.lyric = new Lyric(\r\n SyllablePosition.MIDDLE,\r\n \" \" + pitchName,\r\n 1,\r\n hPos,\r\n vPos\r\n );\r\n }\r\n }\r\n staff.lyricsMode = 1 /* SHOW_NOTE_NAMES */;\r\n }\r\n updateNoteNames() {\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n if (this.isStaffShowingNoteNames(staff)) {\r\n this.showNoteNames(staff);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * hides lyrics for all staves\r\n */\r\n hideLyrics() {\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n let storeLyrics = false;\r\n if (staff.originalLyrics == null) {\r\n staff.originalLyrics = [];\r\n storeLyrics = true;\r\n }\r\n let originalLyrics = staff.originalLyrics;\r\n for (let measure of staff.measures) {\r\n let voice = measure.voices[0];\r\n for (let ng of voice.noteGroups) {\r\n if (ng.isRest || ng.isGrace) {\r\n continue;\r\n }\r\n if (storeLyrics && ng.lyric != null) {\r\n originalLyrics.push(/* @__PURE__ */ new Map([[ng, ng.lyric]]));\r\n }\r\n ng.lyric = null;\r\n }\r\n }\r\n staff.lyricsMode = 2 /* HIDE_LYRICS */;\r\n }\r\n }\r\n }\r\n _getAccidentalText(alteration) {\r\n switch (alteration) {\r\n case -2:\r\n return \"bb\";\r\n case 2:\r\n return \"x\";\r\n case -1:\r\n return \"b\";\r\n case 1:\r\n return \"#\";\r\n default:\r\n return \"\";\r\n }\r\n }\r\n isStaffShowingNoteNames(staff) {\r\n return staff.lyricsMode === 1 /* SHOW_NOTE_NAMES */;\r\n }\r\n};\r\n\r\n// src/editing/transposition/MeasureRegion.ts\r\nvar MeasureRegion = class {\r\n constructor(part, startMeasure, endMeasure) {\r\n this.part = part;\r\n this.startMeasure = startMeasure;\r\n this.endMeasure = endMeasure;\r\n this.startMeasure = startMeasure;\r\n this.endMeasure = endMeasure;\r\n if (startMeasure != null) {\r\n this.startMeasureIndex = startMeasure.staff.measures.indexOf(\r\n startMeasure\r\n );\r\n }\r\n if (endMeasure != null) {\r\n this.endMeasureIndex = endMeasure.staff.measures.indexOf(\r\n endMeasure\r\n );\r\n }\r\n }\r\n};\r\n\r\n// src/editing/transposition/TranspositionDirection.ts\r\nvar TransposeDirection = /* @__PURE__ */ ((TransposeDirection2) => {\r\n TransposeDirection2[TransposeDirection2[\"nearest\"] = 0] = \"nearest\";\r\n TransposeDirection2[TransposeDirection2[\"up\"] = 1] = \"up\";\r\n TransposeDirection2[TransposeDirection2[\"down\"] = 2] = \"down\";\r\n return TransposeDirection2;\r\n})(TransposeDirection || {});\r\n\r\n// src/editing/transposition/TranspositionRecord.ts\r\nvar TranspositionRecord = class {\r\n};\r\n\r\n// src/editing/transposition/TranspositionType.ts\r\nvar TranspositionType = /* @__PURE__ */ ((TranspositionType2) => {\r\n TranspositionType2[TranspositionType2[\"partOctave\"] = 0] = \"partOctave\";\r\n TranspositionType2[TranspositionType2[\"noteOctaves\"] = 1] = \"noteOctaves\";\r\n TranspositionType2[TranspositionType2[\"score\"] = 2] = \"score\";\r\n TranspositionType2[TranspositionType2[\"repitches\"] = 3] = \"repitches\";\r\n return TranspositionType2;\r\n})(TranspositionType || {});\r\n\r\n// src/editing/transposition/TranspositionManager.ts\r\nvar TranspositionManager = class {\r\n constructor(score, noteManager) {\r\n this._history = [];\r\n this._score = score;\r\n this._noteManager = noteManager;\r\n }\r\n /**/\r\n ////////////////MACRO LEVEL CHANGES//////////////*/\r\n /**prevents transposition of all parts set to midiChannel 10*/\r\n preventPercussionTransposition() {\r\n for (let part of this._score.parts) {\r\n if (part.midiChannel === 10) {\r\n part.preventTransposition = true;\r\n }\r\n }\r\n }\r\n /**repitches multiple notes and stores the action in the transposition\r\n * history. */\r\n repitchNotes(repitchDOs) {\r\n for (let rdo of repitchDOs) {\r\n rdo.storeOldSettings();\r\n this._noteManager.repitch(\r\n rdo.note,\r\n rdo.letter,\r\n rdo.octave,\r\n rdo.alteration\r\n );\r\n }\r\n let record = new TranspositionRecord();\r\n record.type = 3 /* repitches */;\r\n record.repitchDOs = repitchDOs;\r\n this._history.push(record);\r\n }\r\n /**\r\n * Changes the octave of each note in a list. This is intended to operate\r\n * on all of the notes in a single part, staff and voice and should not be\r\n * used on a sub-selection of notes or notes from multiple parts, staves, or\r\n * voices.\r\n * @param octaveShiftValues a Array with each value designating the\r\n * number of octaves to transpose each corresponding note.\r\n * @param ngsNoTieIntosOrRests - a Array that contains all the\r\n * NoteGroups from one part/staff/voice which aren't rests and which aren't\r\n * the target (landing spot) of ties. This list is typically obtained via\r\n * calling Part.getNoteGroupsWithoutRestsOrTieIntos().\r\n */\r\n adjustOctavesOfNotes(octaveShiftValues, ngsNoTieIntosOrRests) {\r\n if (ngsNoTieIntosOrRests.length !== octaveShiftValues.length) {\r\n throw \"octave shift values don't match up with NoteGroups\";\r\n }\r\n let length = octaveShiftValues.length;\r\n for (let i = 0; i < length; i++) {\r\n let transposition = octaveShiftValues[i];\r\n if (transposition === 0)\r\n continue;\r\n let ng = ngsNoTieIntosOrRests[i];\r\n do {\r\n if (!ng.isRest)\r\n this._noteManager.changeNoteGroupOctave(ng, transposition);\r\n ng = ng.next;\r\n } while (i < length - 1 && ng !== ngsNoTieIntosOrRests[i + 1] || i === length - 1 && ng != null);\r\n }\r\n let record = new TranspositionRecord();\r\n record.type = 1 /* noteOctaves */;\r\n record.ngList = ngsNoTieIntosOrRests;\r\n record.ngOctaveDeltas = octaveShiftValues;\r\n this._history.push(record);\r\n }\r\n /**\r\n * transposes all of the notes in a given part by the specifed number\r\n * of octaves.\r\n * @octaveDelta - +1 for up one octave, -1 for down one octave, etc.\r\n */\r\n changeOctaveOfPart(part, octaveDelta) {\r\n if (part.preventTransposition) {\r\n return;\r\n }\r\n let ngList = part.noteGroupsExcludingRests;\r\n if (octaveDelta > 0) {\r\n for (let ng of ngList) {\r\n let notes = ng.notes;\r\n for (let i = notes.length - 1; i >= 0; i--) {\r\n this._noteManager.changeNoteOctave(notes[i], octaveDelta);\r\n }\r\n }\r\n } else if (octaveDelta < 0) {\r\n for (let ng of ngList) {\r\n let notes = ng.notes;\r\n for (let i = 0; i < notes.length; i++) {\r\n this._noteManager.changeNoteOctave(notes[i], octaveDelta);\r\n }\r\n }\r\n }\r\n let record = new TranspositionRecord();\r\n record.type = 0 /* partOctave */;\r\n record.part = part;\r\n record.octaveDelta = octaveDelta;\r\n this._history.push(record);\r\n }\r\n /**sets the transposition for the requested part, transposing the notes and\r\n * display key chromaticTrans and diatonicTrans are absolute values, not\r\n * relative shifts. So trumpet should always be 2 and 1 (the amount the\r\n * transposed pitches APPEAR above concert pitch*/\r\n setPartTransposition(part, chromaticTrans, diatonicTrans = null) {\r\n if (diatonicTrans == null) {\r\n diatonicTrans = PitchUtils.getCommonDiatonicTranspositionFromChromaticSteps(\r\n chromaticTrans\r\n );\r\n }\r\n let chromaticShift = chromaticTrans - part.chromaticTransposition;\r\n let diatonicShift = diatonicTrans - part.diatonicTransposition;\r\n part.setTransposition(diatonicTrans, chromaticTrans);\r\n let regions = this._getKeyMeasureRegions(part);\r\n for (let reg of regions) {\r\n this._updateDisplayKeyOfRegion(reg, false);\r\n this._transposeRegion(reg, chromaticShift, diatonicShift, true);\r\n }\r\n }\r\n /**creates a record of all the part transpositions in the [Score]*/\r\n savePartTranspositions() {\r\n this._partTranspositions = /* @__PURE__ */ new Map();\r\n for (let part of this._score.parts) {\r\n this._partTranspositions.set(part, new TranspositionDO(\r\n part.diatonicTransposition,\r\n part.chromaticTransposition\r\n ));\r\n }\r\n }\r\n /**restores the part transpositions to those that were saved with \r\n * [savePartTranspositions] call*/\r\n restorePartTranspositions() {\r\n if (this._partTranspositions == null) {\r\n throw \"you must call savePartTranspositions() before using restorePartTranspositions()\";\r\n }\r\n for (let part of this._score.parts) {\r\n let tdo = this._partTranspositions.get(part);\r\n if (tdo != null) {\r\n this.setPartTransposition(part, tdo.chromatic, tdo.diatonic);\r\n }\r\n }\r\n }\r\n /**transposes the entire song by the relative amount specified\r\n * positive values for chromaticShift/diatonicShift transpose the song up,\r\n * negative down values are relative, so 2,1 always transposes the song up a\r\n * whole step from its current key changes concertKey, displayKey, and\r\n * transposes notes\r\n * @preventInitialKeyOptimization - if you want the first region's key to be\r\n * exactly what you set without looking for a better enharmonic equivalent,\r\n * set this to true\r\n * @playbackOctaveDelta - this option will adjust the\r\n * Part.playbackOctaveDelta property for each part by one or\r\n * more octaves to minimize the transposition's effect on the playback\r\n * pitch.*/\r\n transposeSong(chromaticShift, diatonicShift = null, preventInitialKeyOptimization = false, playbackOctaveDelta = 0) {\r\n if (diatonicShift == null) {\r\n diatonicShift = PitchUtils.getCommonDiatonicTranspositionFromChromaticSteps(\r\n chromaticShift\r\n );\r\n }\r\n let parts = this._score.parts;\r\n let regions = this._getKeyMeasureRegions(this._score.parts[0]);\r\n for (let reg of regions) {\r\n let oldKey = reg.startMeasure.concertKey;\r\n let isMajor = reg.startMeasure.isMajorKey;\r\n let keyDelta = PitchUtils.getKeySigAlterationForTransposition(\r\n diatonicShift,\r\n chromaticShift\r\n );\r\n let newKey = reg.startMeasure.concertKey + keyDelta;\r\n if (!preventInitialKeyOptimization || reg !== regions[0]) {\r\n newKey = this._optimizeKeyEnharmonically(newKey);\r\n }\r\n let transposeUp = chromaticShift > 0;\r\n let tdo = PitchUtils.getTranspositionForKeyChange(\r\n oldKey,\r\n newKey,\r\n isMajor,\r\n isMajor,\r\n transposeUp\r\n );\r\n let adjustedChromaticShift = tdo.chromatic;\r\n let adjustedDiatonicShift = tdo.diatonic;\r\n let adjustedUp = false;\r\n while (adjustedChromaticShift < chromaticShift) {\r\n adjustedChromaticShift += 12;\r\n adjustedDiatonicShift += 7;\r\n adjustedUp = true;\r\n }\r\n if (adjustedUp && adjustedChromaticShift !== chromaticShift) {\r\n console.log(\"TranspositionManager: chromaticShift should equal adjustedChromaticShift!!!\");\r\n }\r\n while (adjustedChromaticShift > chromaticShift) {\r\n adjustedChromaticShift -= 12;\r\n adjustedDiatonicShift -= 7;\r\n }\r\n this._setConcertKeyForRegion(reg, newKey, isMajor, false);\r\n for (let part of parts) {\r\n if (part.preventTransposition) {\r\n continue;\r\n }\r\n this._transposeRegion(\r\n new MeasureRegion(\r\n part,\r\n reg.startMeasure,\r\n reg.endMeasure\r\n ),\r\n adjustedChromaticShift,\r\n adjustedDiatonicShift,\r\n true\r\n );\r\n }\r\n }\r\n for (let part of parts) {\r\n part.playbackOctaveDelta += playbackOctaveDelta;\r\n }\r\n let record = new TranspositionRecord();\r\n record.type = 2 /* score */;\r\n record.diatonicShift = diatonicShift;\r\n record.chromaticShift = chromaticShift;\r\n record.playbackOctaveDelta = playbackOctaveDelta;\r\n this._history.push(record);\r\n }\r\n /**transposes the entire song to the specified key, proportionally changing\r\n * key signatures that happen after the first measure\r\n * @newConcertKey - the new concert key (3 would be 2 sharps, -2 would be 2\r\n * flats)\r\n * @transposeDirection - matches constant from TransposeDirection class - 0\r\n * is NEAREST*/\r\n setConcertKeyOfSong(newConcertKey, transposeDirection = 0) {\r\n let measure = this._score.parts[0].staves[0].measures[0];\r\n let oldKey = measure.concertKey;\r\n let isMajor = measure.isMajorKey;\r\n let transposeUp;\r\n if (transposeDirection === 1 /* up */) {\r\n transposeUp = true;\r\n } else if (transposeDirection === 2 /* down */) {\r\n transposeUp = false;\r\n } else {\r\n transposeUp = PitchUtils.getNearestTranspositionDirection(\r\n oldKey,\r\n newConcertKey,\r\n isMajor,\r\n isMajor\r\n ) >= 0;\r\n }\r\n let transDO = PitchUtils.getTranspositionForKeyChange(\r\n oldKey,\r\n newConcertKey,\r\n isMajor,\r\n isMajor,\r\n transposeUp\r\n );\r\n this.transposeSong(transDO.chromatic, transDO.diatonic, true);\r\n }\r\n /**\r\n * reverts transpositions that were performed by transposeSong(),\r\n * setConcertKeyOfSong(), changeOctaveOfPart(), and adjustOctavesOfNotes()\r\n * @param steps - the number of steps in the transposition history to undo.\r\n * If 0 (default), all transpositions will be undone.\r\n */\r\n revertTranspositions(steps = 0) {\r\n if (steps <= 0 || steps > this._history.length) {\r\n steps = this._history.length;\r\n }\r\n let cutoffIndex = this._history.length - steps;\r\n for (let i = this._history.length - 1; i >= cutoffIndex; i--) {\r\n let record = this._history[i];\r\n switch (record.type) {\r\n case 2 /* score */: {\r\n this.transposeSong(\r\n -1 * record.chromaticShift,\r\n -1 * record.diatonicShift,\r\n false,\r\n -1 * record.playbackOctaveDelta\r\n );\r\n break;\r\n }\r\n case 0 /* partOctave */: {\r\n this.changeOctaveOfPart(\r\n record.part,\r\n -1 * record.octaveDelta\r\n );\r\n break;\r\n }\r\n case 1 /* noteOctaves */: {\r\n let inverse = record.ngOctaveDeltas.map((val) => val * -1);\r\n this.adjustOctavesOfNotes(inverse, record.ngList);\r\n break;\r\n }\r\n case 3 /* repitches */: {\r\n this._revertRepitchNotes(record.repitchDOs);\r\n break;\r\n }\r\n }\r\n }\r\n this._history = [];\r\n }\r\n //currently unused?\r\n transposeByChromaticSteps(chromaticSteps) {\r\n let diatonicSteps = [\r\n -7,\r\n -6,\r\n -6,\r\n -5,\r\n -5,\r\n -4,\r\n -4,\r\n -3,\r\n -2,\r\n -2,\r\n -1,\r\n -1,\r\n 0,\r\n 1,\r\n 1,\r\n 2,\r\n 2,\r\n 3,\r\n 4,\r\n 4,\r\n 5,\r\n 5,\r\n 6,\r\n 6,\r\n 7\r\n ];\r\n this.transposeSong(diatonicSteps[chromaticSteps + 12], chromaticSteps);\r\n }\r\n /**/\r\n ///////////////BUILDING BLOCK METHODS//////////////////*/\r\n /**reverts note pitches changed via repitchNotes() */\r\n _revertRepitchNotes(repitchDOs) {\r\n for (let rdo of repitchDOs) {\r\n this._noteManager.repitch(\r\n rdo.note,\r\n rdo.oldLetter,\r\n rdo.oldOctave,\r\n rdo.oldAlteration\r\n );\r\n }\r\n }\r\n /**transposes notes for a single part and region\r\n * optionally updates which notes display accidentals (checking against key\r\n * and previous accidentals in measure)*/\r\n _transposeRegion(mr, chromaticShift, diatonicShift = null, updateDisplayedAccidentals = true) {\r\n if (diatonicShift == null) {\r\n diatonicShift = PitchUtils.getCommonDiatonicTranspositionFromChromaticSteps(\r\n chromaticShift\r\n );\r\n }\r\n let staves = mr.part.staves;\r\n for (let i = 0; i < staves.length; i++) {\r\n let staff = staves[i];\r\n let measures = staff.measures;\r\n let j = 0;\r\n for (j = mr.startMeasureIndex; j <= mr.endMeasureIndex; j++) {\r\n let cMeasure = measures[j];\r\n let clefList = cMeasure.clefs;\r\n let voices = cMeasure.voices;\r\n for (let voice of voices) {\r\n let noteGroups = voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let k = 0; k < numNoteGroups; k++) {\r\n let ng = noteGroups[k];\r\n let qNoteTime = ng.qNoteTime;\r\n if (ng.isGrace && ng.attachmentNG != null) {\r\n qNoteTime = ng.attachmentNG.qNoteTime;\r\n }\r\n let clefType;\r\n for (let clef of clefList) {\r\n if (qNoteTime + 1e-4 > clef.qNoteTime) {\r\n clefType = clef.type;\r\n } else {\r\n break;\r\n }\r\n }\r\n let notes = ng.notes;\r\n for (let note of notes) {\r\n note.stepsFromTopStaffLine -= diatonicShift;\r\n note.pitchName = PitchUtils.getPitchNameFromStaffLinePosition(\r\n note.stepsFromTopStaffLine,\r\n clefType\r\n );\r\n note.displayCents += chromaticShift * 100;\r\n note.alteration = PitchUtils.getAlterationForCents(\r\n note.displayCents,\r\n note.pitchName\r\n );\r\n note.accidental = AccidentalType.getAccidentalType(\r\n note.alteration\r\n );\r\n note.legerLines = PitchUtils.getNumberOfLegerLines(\r\n note.stepsFromTopStaffLine\r\n );\r\n note.vPos = 1 / 2 * note.stepsFromTopStaffLine;\r\n }\r\n }\r\n }\r\n if (updateDisplayedAccidentals) {\r\n this._noteManager.updateAccidentals(cMeasure);\r\n }\r\n for (let att of cMeasure.attachments) {\r\n if (att instanceof ChordSymbol) {\r\n let pitch = PitchUtils.transposePitchName(\r\n att.rootName,\r\n att.rootAlteration,\r\n diatonicShift,\r\n chromaticShift\r\n );\r\n att.rootName = pitch.newPitchName;\r\n att.rootAlteration = pitch.newAlteration;\r\n if (att.bassName != null) {\r\n pitch = PitchUtils.transposePitchName(\r\n att.bassName,\r\n att.bassAlteration,\r\n diatonicShift,\r\n chromaticShift\r\n );\r\n att.bassName = pitch.newPitchName;\r\n att.bassAlteration = pitch.newAlteration;\r\n }\r\n }\r\n }\r\n cMeasure.notesNeedRendering = true;\r\n }\r\n }\r\n }\r\n /**calculates the number of accidentals for a new key based on the original\r\n * key and the change. Wraps new key if it gets too many flats/sharps*/\r\n _optimizeKeyEnharmonically(key) {\r\n if (key > 7) {\r\n key -= 12;\r\n } else if (key < -7) {\r\n key += 12;\r\n }\r\n return key;\r\n }\r\n /**updates concertKey to new value and adjusts display key accordingly\r\n * this affects all parts for the specified region\r\n * doesn't transpose notes, but can (optionally) update which notes display\r\n * accidentals. the MeasureRegion.part property doesn't matter, since the\r\n * entire score is affected*/\r\n _setConcertKeyForRegion(mr, newConcertKey, isMajor, updateDisplayedAccidentals = true) {\r\n mr.startMeasure.stack.newKey = !(mr.startMeasureIndex > 0 && mr.startMeasure.prev.concertKey === newConcertKey);\r\n if (mr.endMeasure.next != null) {\r\n mr.endMeasure.next.stack.newKey = mr.endMeasure.next.concertKey !== newConcertKey;\r\n mr.endMeasure.next.notesNeedRendering = true;\r\n }\r\n if (this._stacks == null) {\r\n this._stacks = this._score.getMeasureStacks();\r\n }\r\n for (let i = mr.startMeasureIndex + 1; i <= mr.endMeasureIndex; i++) {\r\n this._stacks[i].newKey = false;\r\n }\r\n let parts = this._score.parts;\r\n for (let part of parts) {\r\n this._setKeysForPartMeasureRegion(\r\n part,\r\n mr.startMeasureIndex,\r\n mr.endMeasureIndex,\r\n newConcertKey,\r\n isMajor,\r\n updateDisplayedAccidentals\r\n );\r\n }\r\n this._updateKeySizeForStacks(mr);\r\n }\r\n /**updates displayKey for one measure region and part based on measure\r\n * transposition settings doesn't transpose notes, but can (optionally)\r\n * update which notes display accidentals intended to be used after changing\r\n * Part/Measure chromatic/diatonic transpositions*/\r\n _updateDisplayKeyOfRegion(mr, updateDisplayedAccidentals = true) {\r\n this._setKeysForPartMeasureRegion(\r\n mr.part,\r\n mr.startMeasureIndex,\r\n mr.endMeasureIndex,\r\n mr.startMeasure.concertKey,\r\n mr.startMeasure.isMajorKey,\r\n updateDisplayedAccidentals\r\n );\r\n this._updateKeySizeForStacks(mr);\r\n }\r\n /**finds and stores the largest key signature size for each stack in the\r\n * MeasureRegion*/\r\n _updateKeySizeForStacks(mr) {\r\n if (this._stacks == null) {\r\n this._stacks = this._score.getMeasureStacks();\r\n }\r\n let lastIndex = mr.endMeasureIndex < this._stacks.length - 1 ? mr.endMeasureIndex + 1 : mr.endMeasureIndex;\r\n for (let i = mr.startMeasureIndex; i <= lastIndex; i++) {\r\n let stack = this._stacks[i];\r\n let maxKeySize = 0;\r\n let measures = stack.measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n let totalKeySize = PitchUtils.getTotalKeySize(\r\n measures[j].displayKey,\r\n measures[j].outgoingKey\r\n );\r\n if (totalKeySize > maxKeySize) {\r\n maxKeySize = totalKeySize;\r\n }\r\n }\r\n stack.maxKeySize = maxKeySize;\r\n }\r\n }\r\n /**getKeyMeasureRegions - returns MeasureRegion objects for a Part based on\r\n * changes in concertKey*/\r\n _getKeyMeasureRegions(part) {\r\n let regions = [];\r\n let measures = part.staves[0].measures;\r\n let startMeasure = null;\r\n let measure;\r\n for (measure of measures) {\r\n if (measure.stack.newKey) {\r\n if (startMeasure != null) {\r\n regions.push(new MeasureRegion(\r\n part,\r\n startMeasure,\r\n measure.prev\r\n ));\r\n }\r\n startMeasure = measure;\r\n }\r\n }\r\n regions.push(new MeasureRegion(part, startMeasure, measure));\r\n return regions;\r\n }\r\n /**/\r\n ///////////////////////INTERNAL METHODS///////////////////////////*/\r\n /**sets the display, concert and outgoing keys for a single region of\r\n * measures in a single part optionally updates the displayed notes on\r\n * accidentals*/\r\n _setKeysForPartMeasureRegion(part, startMeasureIndex, endMeasureIndex, newConcertKey, isMajor, updateDisplayedAccidentals) {\r\n let staves = part.staves;\r\n for (let i = 0; i < staves.length; i++) {\r\n let staff = staves[i];\r\n let measures = staff.measures;\r\n let j = 0;\r\n let displayedKey = 0;\r\n for (j = startMeasureIndex; j <= endMeasureIndex; j++) {\r\n let cMeasure = measures[j];\r\n displayedKey = PitchUtils.getKeySigAlterationForTransposition(\r\n cMeasure.diatonicTransposition,\r\n cMeasure.chromaticTransposition\r\n ) + newConcertKey;\r\n cMeasure.displayKey = displayedKey;\r\n cMeasure.concertKey = newConcertKey;\r\n cMeasure.isMajorKey = isMajor;\r\n cMeasure.outgoingKey = j > startMeasureIndex || startMeasureIndex === 0 ? 0 : measures[j - 1].displayKey;\r\n if (updateDisplayedAccidentals) {\r\n this._noteManager.updateAccidentals(cMeasure);\r\n cMeasure.notesNeedRendering = true;\r\n }\r\n }\r\n if (j < measures.length) {\r\n measures[j].outgoingKey = displayedKey;\r\n }\r\n }\r\n }\r\n};\r\n\r\n// src/editing/ScoreManager.ts\r\nvar ScoreManager = class {\r\n ScoreManager() {\r\n }\r\n /////////////////////////////TRANSPOSITION//////////////////////////////\r\n /** prevents transposition of all parts set to midiChannel 10*/\r\n preventPercussionTransposition() {\r\n this._transpositionManager.preventPercussionTransposition();\r\n }\r\n /**repitches multiple notes and stores the action in the transposition\r\n * history. */\r\n repitchNotes(repitchDOs) {\r\n this._transpositionManager.repitchNotes(repitchDOs);\r\n }\r\n /** Changes the octave of each note in a list. This is intended to operate\r\n * on all of the notes in a single part, staff and voice and should not be\r\n * used on a sub-selection of notes or notes from multiple parts, staves,\r\n * or voices.\r\n * @param octaveShiftValues a Array with each value designating the\r\n * number of octaves to transpose each corresponding note.\r\n * @param ngsNoTieIntosOrRests - a Array that contains all the\r\n * NoteGroups from one part/staff/voice which aren't rests and which aren't\r\n * the target (landing spot) of ties. This list is typically obtained via\r\n * calling Part.getNoteGroupsWithoutRestsOrTieIntos().*/\r\n adjustOctavesOfNotes(octaveShiftValues, ngsNoTieIntosOrRests) {\r\n this._transpositionManager.adjustOctavesOfNotes(\r\n octaveShiftValues,\r\n ngsNoTieIntosOrRests\r\n );\r\n }\r\n /** transposes all of the notes in a given part by the specifed number of\r\n * octaves.\r\n * @octaveDelta - +1 for up one octave, -1 for down one octave, etc.*/\r\n changeOctaveOfPart(part, octaveDelta) {\r\n this._transpositionManager.changeOctaveOfPart(part, octaveDelta);\r\n }\r\n /**transposes the entire song by the relative amount specified\r\n * positive values for chromaticShift/diatonicShift transpose the song up, \r\n * negative down values are relative, so 2,1 always transposes the song up a\r\n * whole step from its current key changes concertKey, displayKey, and \r\n * transposes notes \r\n * @preventInitialKeyOptimization - if you want the first region's key to be\r\n * exactly what you set without looking for a better enharmonic equivalent, \r\n * set this to true \r\n * @playbackOctaveCorrection - this option will adjust the\r\n * Part.playbackOctaveDelta property for each part by one or more octaves to\r\n * minimize the transposition's effect on the playback pitch.*/\r\n transposeSong(diatonicShift, chromaticShift, preventInitialKeyOptimization = false, playbackOctaveDelta = 0) {\r\n this._transpositionManager.transposeSong(\r\n chromaticShift,\r\n diatonicShift,\r\n preventInitialKeyOptimization,\r\n playbackOctaveDelta\r\n );\r\n this._pitchNameManager.updateNoteNames();\r\n }\r\n /**sets the transposition for the requested part, transposing the notes and \r\n * display key chromaticTrans and diatonicTrans are absolute values, not \r\n * relative shifts. So trumpet should always be 2 and 1 (the amount the \r\n * transposed pitches APPEAR above concert pitch*/\r\n setPartTransposition(part, chromaticTrans, diatonicTrans = null) {\r\n this._transpositionManager.setPartTransposition(\r\n part,\r\n chromaticTrans,\r\n diatonicTrans\r\n );\r\n this._pitchNameManager.updateNoteNames();\r\n }\r\n /**creates a record of all the part transpositions in the [Score]*/\r\n savePartTranspositions() {\r\n this._transpositionManager.savePartTranspositions();\r\n }\r\n /**restores the part transpositions to those that were saved with \r\n * [savePartTranspositions] call*/\r\n restorePartTranspositions() {\r\n this._transpositionManager.restorePartTranspositions();\r\n }\r\n /**transposes the entire song to the specified key, proportionally changing \r\n * key signatures that happen after the first measure\r\n * @newConcertKey - the new concert key (3 would be 2 sharps, -2 would be 2 \r\n * flats)\r\n * @transposeDirection - matches constant from TransposeDirection class - 0 \r\n * is NEAREST*/\r\n setConcertKeyOfSong(newConcertKey, transposeDirection = 0) {\r\n this._transpositionManager.setConcertKeyOfSong(\r\n newConcertKey,\r\n transposeDirection\r\n );\r\n this._pitchNameManager.updateNoteNames();\r\n }\r\n /** reverts transpositions that were performed by transposeSong(),\r\n * setConcertKeyOfSong(), changeOctaveOfPart(), and adjustOctavesOfNotes()\r\n * @param steps - the number of steps in the transposition history to undo.\r\n * If 0 (default), all transpositions will be undone.*/\r\n revertTranspositions(steps = 0) {\r\n this._transpositionManager.revertTranspositions(steps);\r\n }\r\n /**/\r\n //////////////////////////NOTE NAMES/LYRICS///////////////////////////*/\r\n /** reverts pitch names to original lyrics (if showNoteNames() was called)*/\r\n showLyrics() {\r\n this._pitchNameManager.showLyrics();\r\n }\r\n /** replaces lyrics with pitch names for each note*/\r\n showNoteNames(staff) {\r\n this._pitchNameManager.showNoteNames(staff);\r\n }\r\n hideLyrics() {\r\n this._pitchNameManager.hideLyrics();\r\n }\r\n /**completely deletes the lyrics from the score*/\r\n removeLyrics() {\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n staff.originalLyrics = null;\r\n for (let measure of staff.measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n ng.lyric = null;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**sets the vertical position of the lyrics in spaces from the top of the\r\n * staff. A negative value means lower (typical)*/\r\n setLyricsVerticalPosition(vPos = -8) {\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n for (let measure of staff.measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (ng.lyric != null) {\r\n ng.lyric.vPos = vPos;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**/\r\n ///////////////////////////SCORE CREATION/////////////////////////////*/\r\n /** creates a new Score object, populates its scoreSettings property and \r\n * creates a single first measure\r\n * @param\tscoreSettings optional set of data for setting ScoreProperties \r\n * values*/\r\n createScore(scoreSettings = null) {\r\n this.score = new Score();\r\n if (scoreSettings != null) {\r\n this._score.scoreProperties = scoreSettings;\r\n } else {\r\n this._score.scoreProperties = ScoreProperties.getNewScoreProperties();\r\n }\r\n let page = new Page();\r\n let system = new System(this._score.scoreProperties);\r\n system.newPage = true;\r\n page.addSystem(system);\r\n this._score.addPage(page);\r\n }\r\n /** adds the part to the score\r\n * @param\tname the name of the part\r\n * @param\tabbr abbreviated name of the part\r\n * @param\tdiatonicTransposition number of diatonic steps that this part \r\n * appears below concert pitch (- values for appearing above)\r\n * @param\tchromaticTransposition number of chromatic steps that this part \r\n * sounds above concert pitch (- values for sounding below)\r\n * @return*/\r\n addPart(name, abbr, diatonicTransposition, chromaticTransposition) {\r\n let partID = \"P\" + (this._score.parts.length + 1).toString();\r\n let part = new Part(partID, name, abbr);\r\n part.setTransposition(\r\n diatonicTransposition,\r\n chromaticTransposition,\r\n false\r\n );\r\n this._score.addPart(part);\r\n return part;\r\n }\r\n /** adds a new staff to the part\r\n * @param\tpart the Part to add a staff to*/\r\n addStaff(part) {\r\n let staff = new Staff();\r\n part.addStaff(staff);\r\n return staff;\r\n }\r\n /** adds the measure at the position indicated\r\n * @param\tpositionIndex the index to insert the measure at - if greater \r\n * than the number of measures in the song, it is just added to the end\r\n * @return*/\r\n addMeasureStack(positionIndex = 16777215) {\r\n if (this._score.parts.length < 1 || this._score.parts[0].staves.length < 1) {\r\n throw \"No parts and/or staves have been added to the score - you must add a part and a staff before adding measure stacks\";\r\n }\r\n let firstStaff = this._score.parts[0].staves[0];\r\n let numExistingMeasures = firstStaff.measures.length;\r\n positionIndex = numExistingMeasures;\r\n if (positionIndex > numExistingMeasures || positionIndex < 0) {\r\n positionIndex = numExistingMeasures;\r\n }\r\n let newStack = new MeasureStack();\r\n let prevStack;\r\n if (numExistingMeasures > 0) {\r\n prevStack = firstStaff.measures[numExistingMeasures - 1].stack;\r\n prevStack.systemRef.addStackAfterExistingStack(newStack, prevStack);\r\n newStack.startTime = prevStack.endTime;\r\n newStack.endTime = prevStack.endTime + prevStack.qNoteLength;\r\n newStack.maxKeySize = prevStack.maxKeySize;\r\n } else {\r\n newStack.startTime = 0;\r\n newStack.endTime = 4;\r\n newStack.maxKeySize = 0;\r\n newStack.newSystem = true;\r\n newStack.newClef = true;\r\n newStack.newKey = true;\r\n this._score.pages[0].systems[0].addMeasureStack(newStack);\r\n }\r\n newStack.number = positionIndex + 1;\r\n let staffIndex = 0;\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n let newMeasure = new Measure();\r\n if (prevStack != null) {\r\n let prevMeasure = prevStack.measures[staffIndex];\r\n newMeasure.beatGroups = prevMeasure.beatGroups.slice(0);\r\n newMeasure.beatType = prevMeasure.beatType;\r\n newMeasure.numBeats = prevMeasure.numBeats;\r\n newMeasure.displayKey = prevMeasure.displayKey;\r\n newMeasure.concertKey = prevMeasure.concertKey;\r\n newMeasure.isMajorKey = prevMeasure.isMajorKey;\r\n newMeasure.diatonicTransposition = prevMeasure.diatonicTransposition;\r\n newMeasure.chromaticTransposition = prevMeasure.chromaticTransposition;\r\n let clef = new Clef();\r\n clef.type = prevMeasure.clefs[prevMeasure.clefs.length - 1].type;\r\n clef.qNoteTime = newStack.startTime;\r\n newMeasure.clefs.push(clef);\r\n } else {\r\n newMeasure;\r\n newMeasure.beatGroups = [0, 1, 2, 3];\r\n newMeasure.beatType = 4;\r\n newMeasure.numBeats = 4;\r\n newMeasure.showTime = true;\r\n newMeasure.concertKey = 0;\r\n newMeasure.displayKey = PitchUtils.getKeySigAlterationForTransposition(\r\n part.diatonicTransposition,\r\n part.chromaticTransposition\r\n );\r\n newMeasure.diatonicTransposition = part.diatonicTransposition;\r\n newMeasure.chromaticTransposition = part.chromaticTransposition;\r\n newMeasure.isMajorKey = true;\r\n let keySize = Math.abs(newMeasure.displayKey);\r\n if (keySize > newStack.maxKeySize) {\r\n newStack.maxKeySize = keySize;\r\n }\r\n let clef = new Clef();\r\n clef.isNew = true;\r\n clef.show = true;\r\n clef.type = ClefType.TREBLE;\r\n clef.qNoteTime = 0;\r\n newMeasure.clefs.push(clef);\r\n }\r\n newMeasure.stack = newStack;\r\n newStack.addMeasure(newMeasure);\r\n staff.insertMeasure(newMeasure, positionIndex);\r\n newMeasure.getVoiceByNumber(1);\r\n this._noteManager.fillMeasure(newMeasure);\r\n staffIndex++;\r\n }\r\n }\r\n return newStack;\r\n }\r\n deleteMeasures(firstMeasure, lastMeasure) {\r\n let startIndex = firstMeasure.staff.measures.indexOf(\r\n firstMeasure\r\n );\r\n let endIndex = lastMeasure.staff.measures.indexOf(lastMeasure);\r\n let parts = this._score.parts;\r\n for (let part of parts) {\r\n let staves = part.staves;\r\n for (let staff of staves) {\r\n let measures = staff.measures;\r\n for (let i = endIndex; i >= startIndex; i--) {\r\n let voices = measures[i].voices;\r\n for (let cVoice of voices) {\r\n let cNoteGroups = cVoice.noteGroups;\r\n for (let cng of cNoteGroups) {\r\n if (cng.slurs != null) {\r\n for (let slur of cng.slurs) {\r\n this.removeSlur(slur);\r\n }\r\n }\r\n }\r\n }\r\n staff.removeMeasureAt(i);\r\n }\r\n if (measures.length > startIndex) {\r\n let nextMeas = measures[startIndex];\r\n if (startIndex > 0) {\r\n let prevMeas = measures[startIndex - 1];\r\n if (nextMeas.beatType !== prevMeas.beatType || nextMeas.numBeats !== prevMeas.numBeats) {\r\n nextMeas.showTime = true;\r\n }\r\n if (nextMeas.concertKey !== prevMeas.concertKey) {\r\n nextMeas.showKey = true;\r\n nextMeas.stack.newKey = true;\r\n }\r\n if (nextMeas.clefs[0].type !== prevMeas.clefs[prevMeas.clefs.length - 1].type) {\r\n nextMeas.clefs[0].show = true;\r\n nextMeas.stack.newClef = true;\r\n }\r\n } else {\r\n nextMeas.showTime = true;\r\n nextMeas.showKey = true;\r\n nextMeas.stack.newKey = true;\r\n nextMeas.clefs[0].show = true;\r\n nextMeas.stack.newClef = true;\r\n }\r\n }\r\n }\r\n }\r\n let stacks = this._score.getMeasureStacks();\r\n let totalTime = 0;\r\n for (let i = endIndex; i >= startIndex; i--) {\r\n let stack = stacks[i];\r\n stack.systemRef.needsRendering = true;\r\n totalTime += stack.qNoteLength;\r\n stack.systemRef.removeStack(stacks[i]);\r\n }\r\n totalTime *= -1;\r\n stacks = this._score.getMeasureStacks();\r\n if (startIndex < stacks.length) {\r\n stacks[startIndex].needsRendering = true;\r\n let numMeasures = stacks.length;\r\n for (let i = startIndex; i < numMeasures; i++) {\r\n let stack = stacks[i];\r\n stack.startTime += totalTime;\r\n stack.endTime += totalTime;\r\n }\r\n for (let i = startIndex; i < numMeasures; i++) {\r\n for (let part of parts) {\r\n let staves = part.staves;\r\n for (let staff of staves) {\r\n let measure = staff.measures[i];\r\n for (let voice of measure.voices) {\r\n this._noteManager.changeNoteGroupTimeStamps(\r\n voice.noteGroupContainers,\r\n totalTime,\r\n measure.stack.endTime,\r\n voice,\r\n true\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n changeTime(firstMeasureStack, lastMeasureStack, numBeats, beatType, beatGroups) {\r\n let stacks = this._score.getMeasureStacks();\r\n let startMeasureIndex = firstMeasureStack != null ? stacks.indexOf(firstMeasureStack) : 0;\r\n let endMeasureIndex = lastMeasureStack != null ? stacks.indexOf(lastMeasureStack) : stacks.length - 1;\r\n if (startMeasureIndex === -1 || endMeasureIndex === -1) {\r\n return;\r\n }\r\n let prevStack = startMeasureIndex > 0 ? stacks[startMeasureIndex - 1] : null;\r\n let firstStack = stacks[startMeasureIndex];\r\n let showTime = !(prevStack != null && prevStack.measures[0].numBeats === numBeats && prevStack.measures[0].beatType === beatType);\r\n for (let measure of firstStack.measures) {\r\n measure.showTime = showTime;\r\n }\r\n if (endMeasureIndex < stacks.length - 1) {\r\n let nextStack = stacks[endMeasureIndex + 1];\r\n let showTime2 = nextStack.measures[0].numBeats !== numBeats || nextStack.measures[0].beatType !== beatType;\r\n nextStack.measures[0].notesNeedRendering = true;\r\n for (let measure of nextStack.measures) {\r\n measure.showTime = showTime2;\r\n }\r\n }\r\n for (let i = startMeasureIndex + 1; i <= endMeasureIndex; i++) {\r\n for (let measure of stacks[i].measures) {\r\n measure.showTime = false;\r\n }\r\n }\r\n let numStacks = stacks.length;\r\n let timeOffsets = [];\r\n for (let i = 0; i < numStacks - startMeasureIndex; i++) {\r\n timeOffsets.push(0);\r\n }\r\n let cTime = firstStack.startTime;\r\n for (let i = startMeasureIndex; i < numStacks; i++) {\r\n let stack = stacks[i];\r\n timeOffsets.push(cTime - stack.startTime);\r\n stack.startTime = cTime;\r\n cTime += i <= endMeasureIndex ? numBeats * (4 / beatType) : stack.measures[0].numBeats * (4 / stack.measures[0].beatType);\r\n stack.endTime = cTime;\r\n }\r\n let parts = this._score.parts;\r\n for (let part of parts) {\r\n let staves = part.staves;\r\n for (let i = 0; i < staves.length; i++) {\r\n let staff = staves[i];\r\n let measures = staff.measures;\r\n let numMeasures = measures.length;\r\n for (let j = startMeasureIndex; j < numMeasures; j++) {\r\n let cMeasure = measures[j];\r\n let voices = cMeasure.voices;\r\n for (let voice of voices) {\r\n let ngContainers = voice.noteGroupContainers;\r\n this._noteManager.changeNoteGroupTimeStamps(\r\n ngContainers,\r\n timeOffsets[j - startMeasureIndex],\r\n cMeasure.stack.endTime,\r\n voice,\r\n j <= endMeasureIndex\r\n );\r\n }\r\n if (j <= endMeasureIndex) {\r\n cMeasure.numBeats = numBeats;\r\n cMeasure.beatType = beatType;\r\n cMeasure.displayNumBeats = null;\r\n cMeasure.displayBeatType = null;\r\n cMeasure.beatGroups = beatGroups.slice(0);\r\n if (j > startMeasureIndex) {\r\n cMeasure.showTime = false;\r\n }\r\n }\r\n cMeasure.notesNeedRendering = true;\r\n }\r\n }\r\n }\r\n for (let part of parts) {\r\n let staves = part.staves;\r\n for (let i = 0; i < staves.length; i++) {\r\n let staff = staves[i];\r\n let measures = staff.measures;\r\n for (let j = startMeasureIndex; j <= endMeasureIndex; j++) {\r\n this._noteManager.fillMeasure(measures[j]);\r\n }\r\n }\r\n }\r\n }\r\n /**creates a record of all the [Clef] objects in the [Score]*/\r\n saveClefs() {\r\n this._clefsMap = /* @__PURE__ */ new Map();\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n for (let measure of staff.measures) {\r\n this._clefsMap.set(measure, measure.clefs);\r\n }\r\n }\r\n }\r\n }\r\n /**restores the clefs to those that were saved with [saveClefs] call*/\r\n restoreClefs() {\r\n if (this._clefsMap == null) {\r\n throw \"you must call saveClefs() before using restoreClefs()\";\r\n }\r\n for (let part of this._score.parts) {\r\n for (let staff of part.staves) {\r\n for (let measure of staff.measures) {\r\n if (measure.clefs !== this._clefsMap.get(measure)) {\r\n measure.clefs = this._clefsMap.get(measure);\r\n this._noteManager.fixNotesForClefs(measure);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Changes the clef for the requested region\r\n * @param firstMeasure the first measure of the region\r\n * @param lastMeasure the last measure of the region\r\n * @param clefType a string matching a constant from the ClefType class.*/\r\n changeClef(firstMeasure, lastMeasure, clefType) {\r\n let measures = firstMeasure.staff.measures;\r\n let startMeasureIndex = measures.indexOf(firstMeasure);\r\n let endMeasureIndex = measures.indexOf(lastMeasure);\r\n if (endMeasureIndex === -1) {\r\n endMeasureIndex = measures.length - 1;\r\n }\r\n let newClef = new Clef();\r\n newClef.isNew = startMeasureIndex === 0 || measures[startMeasureIndex - 1].clefs[measures[startMeasureIndex - 1].clefs.length - 1].type !== clefType;\r\n newClef.show = newClef.isNew;\r\n newClef.type = clefType;\r\n newClef.qNoteTime = firstMeasure.stack.startTime;\r\n firstMeasure.clefs = [newClef];\r\n firstMeasure.stack.newClef = newClef.isNew;\r\n if (endMeasureIndex < measures.length - 1) {\r\n let followingMeasure = measures[endMeasureIndex + 1];\r\n followingMeasure.clefs[0].isNew = followingMeasure.clefs[0].type !== clefType;\r\n followingMeasure.clefs[0].show = followingMeasure.clefs[0].isNew;\r\n followingMeasure.stack.newClef = followingMeasure.clefs[0].isNew;\r\n followingMeasure.notesNeedRendering = true;\r\n }\r\n let spacePerStep = 1 / 2;\r\n for (let i = startMeasureIndex; i <= endMeasureIndex; i++) {\r\n let measure = measures[i];\r\n if (i > startMeasureIndex) {\r\n newClef = new Clef();\r\n newClef.type = clefType;\r\n newClef.qNoteTime = measure.stack.startTime;\r\n measure.clefs = [newClef];\r\n measure.stack.newClef = false;\r\n }\r\n let voices = measure.voices;\r\n for (let voice of voices) {\r\n let noteGroups = voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let j = 0; j < numNoteGroups; j++) {\r\n let notes = noteGroups[j].notes;\r\n let numNotes = notes.length;\r\n for (let k = 0; k < numNotes; k++) {\r\n let note = notes[k];\r\n let steps = PitchUtils.getStepsFromTopStaffLine(\r\n note.pitchName,\r\n clefType\r\n );\r\n note.stepsFromTopStaffLine = steps;\r\n note.legerLines = PitchUtils.getNumberOfLegerLines(\r\n steps\r\n );\r\n note.vPos = spacePerStep * steps;\r\n }\r\n }\r\n }\r\n measure.notesNeedRendering = true;\r\n }\r\n }\r\n /** changes the passed in NoteGroup's duration. Any notes overlapped by an \r\n * increase in duration are deleted. any gaps created are filled with rests\r\n * @param noteGroup the NoteGroup object to change\r\n * @param newDuration the new Duration Unit duration (a power of 2 matching\r\n * a duration in the DurationType constants)\r\n * @param numDots the number of augmentation dots*/\r\n changeDuration(noteGroup, newDuration, numDots) {\r\n this._noteManager.changeDuration(noteGroup, newDuration, numDots);\r\n }\r\n addTuplet(ng, numerator, denominator, numeratorDuration, denominatorDuration) {\r\n this._noteManager.addTuplet(\r\n ng,\r\n numerator,\r\n denominator,\r\n numeratorDuration,\r\n denominatorDuration\r\n );\r\n }\r\n /** Toggles the tie state for the requested Note\r\n * @param note the Note to change*/\r\n toggleTie(note) {\r\n this._noteManager.toggleTie(note);\r\n }\r\n /** adds the pitch to the specified NoteGroup\r\n * @param noteGroup the NoteGroup to add the Note to\r\n * @param pitchLetterName A, B, C, D, E, F, or G (uppercase)\r\n * @param octave the octave for the note - C4 is middle C, the note below \r\n * it is B3.\r\n * @param alteration a value from -2 (number flat) to 2 (number sharp). \r\n * This is an absolute alteration - not relative to the key signature's \r\n * adjustment for this pitch.*/\r\n addPitch(noteGroup, pitchLetterName, octave, alteration) {\r\n this._noteManager.addPitch(\r\n noteGroup,\r\n pitchLetterName,\r\n octave,\r\n alteration\r\n );\r\n }\r\n /** removes the Note from the NoteGroup\r\n * @param noteGroup the NoteGroup to remove the Note from\r\n * @param note the Note to remove*/\r\n removePitch(noteGroup, note) {\r\n this._noteManager.removePitch(noteGroup, note);\r\n }\r\n /** changes the octave of the specified Note\r\n * @param note the Note to change\r\n * @param octaveDelta the number of octaves to shift the note - negative \r\n * values for transposing down.*/\r\n changeNoteOctave(note, octaveDelta) {\r\n this._noteManager.changeNoteOctave(note, octaveDelta);\r\n }\r\n /** changes the octave of the specified NoteGroup\r\n * @param ng the NoteGroup to change\r\n * @param octaveDelta the number of octaves to shift the note - negative \r\n * values for transposing down.*/\r\n changeNoteGroupOctave(ng, octaveDelta) {\r\n this._noteManager.changeNoteGroupOctave(ng, octaveDelta);\r\n }\r\n /** For music coming from MusicXML, this creates NoteGroupContainer objects \r\n * for NoteGroups and Tuplets, adding relative time stamps and creating a \r\n * hierarchy that makes it possible to fill measures with rests*/\r\n createNoteGroupContainers() {\r\n this._noteManager.createNoteGroupContainers();\r\n }\r\n /** adds a slur between two notes\r\n * @param ng1 the first NoteGroup\r\n * @param ng2 the second NoteGroup*/\r\n addSlur(ng1, ng2) {\r\n this._noteManager.addSlur(ng1, ng2);\r\n }\r\n /** removes a Slur from the score\r\n * @param slur the Slur to remove*/\r\n removeSlur(slur) {\r\n this._noteManager.removeSlur(slur);\r\n }\r\n get score() {\r\n return this._score;\r\n }\r\n set score(value) {\r\n this._score = value;\r\n this._noteManager = new NoteManager(value);\r\n this._transpositionManager = new TranspositionManager(\r\n value,\r\n this._noteManager\r\n );\r\n this._pitchNameManager = new PitchNameManager(value);\r\n }\r\n};\r\n\r\n// src/editing/transposition/TranspositionStatsDO.ts\r\nvar TranspositionStatsDO = class _TranspositionStatsDO {\r\n constructor() {\r\n }\r\n static getStats(part) {\r\n let minPitch = 99999;\r\n let maxPitch = -99999;\r\n let concertKeys = [];\r\n let displayKeys = [];\r\n let lastConcertKey = 99999;\r\n let lastDisplayKey = -99999;\r\n for (let staff of part.staves) {\r\n for (let measure of staff.measures) {\r\n if (measure.concertKey !== lastConcertKey) {\r\n lastConcertKey = measure.concertKey;\r\n concertKeys.push(lastConcertKey);\r\n }\r\n if (measure.displayKey !== lastDisplayKey) {\r\n lastDisplayKey = measure.displayKey;\r\n displayKeys.push(lastDisplayKey);\r\n }\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (!ng.isRest) {\r\n let notes = ng.notes;\r\n if (notes[0].displayCents < minPitch) {\r\n minPitch = notes[0].displayCents;\r\n }\r\n if (notes[notes.length - 1].displayCents > maxPitch) {\r\n maxPitch = notes[notes.length - 1].displayCents;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n let tStatsDO = new _TranspositionStatsDO();\r\n tStatsDO.concertKeys = concertKeys;\r\n tStatsDO.displayKeys = displayKeys;\r\n tStatsDO.minPitch = ~~(minPitch / 100);\r\n tStatsDO.maxPitch = ~~(maxPitch / 100);\r\n return tStatsDO;\r\n }\r\n};\r\n\r\n// src/utils/PointXY.ts\r\nvar PointXY = class {\r\n constructor(x, y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n};\r\n\r\n// src/formatting/attachments/AttachmentFormatter.ts\r\nvar _AttachmentFormatter = class _AttachmentFormatter {\r\n constructor(score) {\r\n this._score = score;\r\n }\r\n /**\r\n * formats the measure attachments (and eventually note attachments)\r\n * @param system the System to process\r\n */\r\n formatAttachments(system) {\r\n this._formatMeasureAttachments(system);\r\n this._formatNoteAttachments(system);\r\n }\r\n /**\r\n * formats slurs (and eventually hairpins or other lines drawn on the \r\n * systems\r\n */\r\n formatLines() {\r\n let systems = this._score.getSystems();\r\n for (let system of systems) {\r\n system.slurSegments = [];\r\n }\r\n let measuresPerStack = systems[0].measureStacks[0].measures.length;\r\n for (let system of systems) {\r\n let repeatEndingHeightSet = false;\r\n let staffSpacing = 4 + system.staffSpacing;\r\n let staffVPosOffsets = system.staffVPosOffsets;\r\n let stacks = system.measureStacks;\r\n let numStacks = stacks.length;\r\n for (let i = 0; i < numStacks; i++) {\r\n let stack = stacks[i];\r\n let vStaffPos = 0;\r\n let measures = stack.measures;\r\n for (let j = 0; j < measuresPerStack; j++) {\r\n let measure = measures[j];\r\n let voices = measure.voices;\r\n for (let voice of voices) {\r\n let noteGroups = voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let k = 0; k < numNoteGroups; k++) {\r\n let ng = noteGroups[k];\r\n this._processSlursForNoteGroup(\r\n ng,\r\n voice,\r\n k,\r\n vStaffPos + staffVPosOffsets[j]\r\n );\r\n this._processTupletsForNoteGroup(ng);\r\n }\r\n }\r\n vStaffPos += staffSpacing;\r\n }\r\n if (!repeatEndingHeightSet && stack.repeatDOs != null) {\r\n for (let rdo of stack.repeatDOs) {\r\n if (rdo.endingType != null) {\r\n this._setRepeatEndingHeight(stacks, i);\r\n repeatEndingHeightSet = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _processSlursForNoteGroup(ng, voice, ngIndex, vStaffPos) {\r\n if (ng.slurs != null) {\r\n let slurs = ng.slurs;\r\n for (let x = slurs.length - 1; x >= 0; x--) {\r\n let slur = slurs[x];\r\n if (slur.firstNote === ng) {\r\n if (slur.endNote == null || voice.number !== slur.endNote.voice.number || ng.voice.measure.staff !== slur.endNote.voice.measure.staff || ng.isRest || slur.endNote.isRest || ng === slur.endNote) {\r\n ng.slurs.splice(x, 1);\r\n if (slur.endNote != null) {\r\n slur.endNote.slurs.splice(\r\n slur.endNote.slurs.indexOf(slur),\r\n 1\r\n );\r\n }\r\n } else {\r\n this._buildSlurSegments(slur, ngIndex, vStaffPos);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _processTupletsForNoteGroup(ng) {\r\n if (ng.tuplets != null) {\r\n let tupletIndex = 0;\r\n for (let tuplet of ng.tuplets) {\r\n if (tuplet.firstNote === ng) {\r\n this._formatTuplet(\r\n ng,\r\n tuplet,\r\n ng.tuplets.length - 1 - tupletIndex\r\n );\r\n }\r\n tupletIndex++;\r\n }\r\n }\r\n }\r\n _formatMeasureAttachments(system) {\r\n let stacks = system.measureStacks;\r\n for (let i = 0; i < stacks.length; i++) {\r\n let stack = stacks[i];\r\n let measures = stack.measures;\r\n let numMeasures = measures.length;\r\n for (let j = 0; j < numMeasures; j++) {\r\n if (measures[j].attachments != null) {\r\n let measure = measures[j];\r\n let attachments = measure.attachments;\r\n let stackWidth = stack.newSystem ? stack.width - stack.indentAsSystemLeader : stack.width - stack.indent;\r\n for (let attachment of attachments) {\r\n this._processMeasureAttachment(\r\n attachment,\r\n measure,\r\n stack,\r\n stackWidth,\r\n i === 0\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _processMeasureAttachment(attachment, measure, stack, stackWidth, stackIsSystemLeader) {\r\n let hPos;\r\n let vPos;\r\n let voices = measure.voices;\r\n let isEmptyMeasure = voices.length === 0 || voices.length === 1 && voices[0].isEmptyOrSingleRest;\r\n if (!isEmptyMeasure) {\r\n let attachmentTime = attachment.qNoteTime;\r\n let closestPrevNG = null;\r\n let closestNextNG = null;\r\n let matchingNG = null;\r\n for (let voice of voices) {\r\n let noteGroups = voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let j = 0; j < numNoteGroups; j++) {\r\n let ngTime = noteGroups[j].qNoteTime;\r\n if (ngTime < attachmentTime) {\r\n if (closestPrevNG == null || closestPrevNG.qNoteTime < ngTime) {\r\n closestPrevNG = noteGroups[j];\r\n }\r\n } else if (ngTime === attachmentTime) {\r\n matchingNG = noteGroups[j];\r\n break;\r\n } else {\r\n if (closestNextNG == null || closestNextNG.qNoteTime > ngTime) {\r\n closestNextNG = noteGroups[j];\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n let collisionNG = null;\r\n if (matchingNG != null) {\r\n hPos = matchingNG.hPos;\r\n collisionNG = matchingNG;\r\n } else if (closestNextNG != null && closestPrevNG != null) {\r\n let posRatio = (attachmentTime - closestPrevNG.qNoteTime) / (closestNextNG.qNoteTime - closestPrevNG.qNoteTime);\r\n hPos = posRatio * (closestNextNG.hPos - closestPrevNG.hPos) + closestPrevNG.hPos;\r\n collisionNG = hPos - closestPrevNG.hPos < closestNextNG.hPos - hPos ? closestPrevNG : closestNextNG;\r\n } else if (closestPrevNG != null) {\r\n let posRatio = (attachmentTime - closestPrevNG.qNoteTime) / (stack.endTime - closestPrevNG.qNoteTime);\r\n hPos = posRatio * (stack.width - closestPrevNG.hPos) + closestPrevNG.hPos;\r\n collisionNG = closestPrevNG;\r\n } else if (closestNextNG != null) {\r\n let posRatio = (attachmentTime - stack.startTime) / (closestNextNG.qNoteTime - stack.startTime);\r\n hPos = posRatio * closestNextNG.hPos;\r\n collisionNG = closestNextNG;\r\n } else {\r\n hPos = (attachment.qNoteTime - stack.startTime) / stack.qNoteLength * stackWidth;\r\n }\r\n if (collisionNG != null && !collisionNG.isRest) {\r\n let notes = collisionNG.visibleNotes;\r\n if (attachment.isAbove) {\r\n let min = collisionNG.stemDirection === StemDirection.UP ? collisionNG.stemEndPos : notes[notes.length - 1].vPos;\r\n vPos = min < _AttachmentFormatter.defaultAbovePos + attachment.height + 1.5 ? min - 1.5 - attachment.height : _AttachmentFormatter.defaultAbovePos - attachment.height;\r\n } else {\r\n let max = collisionNG.stemDirection === StemDirection.DOWN ? collisionNG.stemEndPos : notes[0].vPos;\r\n vPos = max > _AttachmentFormatter.defaultBelowPos - 1.5 ? max + 1.5 : _AttachmentFormatter.defaultBelowPos;\r\n }\r\n } else {\r\n vPos = attachment.isAbove ? _AttachmentFormatter.defaultAbovePos - attachment.height : _AttachmentFormatter.defaultBelowPos;\r\n }\r\n } else {\r\n let stackIndent = stackIsSystemLeader ? stack.indentAsSystemLeader : stack.indent;\r\n hPos = (attachment.qNoteTime - stack.startTime) / stack.qNoteLength * stackWidth + stackIndent;\r\n vPos = attachment.isAbove ? _AttachmentFormatter.defaultAbovePos - attachment.height : _AttachmentFormatter.defaultBelowPos;\r\n }\r\n if (attachment.isAbove && attachment.baseline - attachment.height < vPos) {\r\n vPos = attachment.baseline - attachment.height;\r\n } else if (!attachment.isAbove && attachment.baseline > vPos) {\r\n vPos = attachment.baseline;\r\n }\r\n attachment.hPos = hPos;\r\n attachment.vPos = vPos;\r\n }\r\n _formatNoteAttachments(system) {\r\n let stacks = system.measureStacks;\r\n for (let stack of stacks) {\r\n let measures = stack.measures;\r\n let numMeasures = measures.length;\r\n for (let i = 0; i < numMeasures; i++) {\r\n let measure = measures[i];\r\n let voices = measure.voices;\r\n for (let j = 0; j < voices.length; j++) {\r\n let noteGroups = voices[j].noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let k = 0; k < numNoteGroups; k++) {\r\n let ng = noteGroups[k];\r\n if (ng.articulations != null) {\r\n for (let artic of ng.articulations) {\r\n this._formatArticulation(\r\n artic,\r\n ng,\r\n voices.length,\r\n j\r\n );\r\n }\r\n }\r\n if (ng.ornaments != null) {\r\n for (let orn of ng.ornaments) {\r\n this._formatOrnament(orn, ng);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _formatArticulation(articulation, ng, numVoices, voiceIndex) {\r\n let type = articulation.type;\r\n articulation.outsideStaff = type === ArticulationType.ACCENT || ng.isRest;\r\n let above;\r\n if (numVoices > 1) {\r\n above = voiceIndex % 2 === 0;\r\n } else {\r\n above = ng.stemDirection !== StemDirection.UP;\r\n }\r\n articulation.isAbove = above;\r\n this._formatAttachment(articulation, ng);\r\n }\r\n _formatOrnament(ornament, ng) {\r\n ornament.outsideStaff = true;\r\n this._formatAttachment(ornament, ng);\r\n }\r\n _formatAttachment(att, ng) {\r\n let notes = ng.visibleNotes;\r\n let vOffset = 0.5;\r\n if (att.isAbove) {\r\n if (ng.isRest) {\r\n att.hPos = (1 - att.width) / 2;\r\n att.vPos = -vOffset - att.height;\r\n } else {\r\n let topNote = notes[notes.length - 1];\r\n let highestNoteSteps = ng.stemDirection === StemDirection.UP ? Math.round(ng.stemEndPos * 2) : topNote.stepsFromTopStaffLine;\r\n let attSteps;\r\n if (att.outsideStaff || highestNoteSteps <= 1) {\r\n attSteps = ng.stemDirection === StemDirection.UP ? Math.min(0, highestNoteSteps) : Math.min(0, highestNoteSteps - 1);\r\n att.vPos = -vOffset + attSteps * 0.5 - att.height;\r\n } else {\r\n attSteps = highestNoteSteps % 2 === 0 ? highestNoteSteps - 3 : highestNoteSteps - 2;\r\n att.vPos = attSteps / 2 - att.height / 2;\r\n }\r\n att.hPos = topNote.hPos + (1 - att.width) / 2;\r\n }\r\n } else {\r\n if (ng.isRest) {\r\n att.hPos = (1 - att.width) / 2;\r\n att.vPos = vOffset;\r\n } else {\r\n let bottomNote = notes[0];\r\n let lowestNoteSteps = ng.stemDirection === StemDirection.DOWN ? Math.round(ng.stemEndPos * 2) : bottomNote.stepsFromTopStaffLine;\r\n let attSteps;\r\n if (att.outsideStaff || lowestNoteSteps >= 7) {\r\n attSteps = ng.stemDirection === StemDirection.DOWN ? Math.max(8, lowestNoteSteps) : Math.max(8, lowestNoteSteps + 1);\r\n att.vPos = vOffset + attSteps * 0.5;\r\n } else {\r\n attSteps = lowestNoteSteps % 2 === 0 ? lowestNoteSteps + 3 : lowestNoteSteps + 2;\r\n att.vPos = attSteps / 2 - att.height / 2;\r\n }\r\n att.hPos = bottomNote.hPos + (1 - att.width) / 2;\r\n }\r\n }\r\n }\r\n _formatTuplet(ng, tuplet, level) {\r\n let needBracket = ng.isRest || tuplet.endNote != null && tuplet.endNote.isRest;\r\n let nextNG = ng;\r\n let stemUpTally = 0;\r\n let stemDownTally = 0;\r\n let highPoint = 1e3;\r\n let lowPoint = -1e3;\r\n while (nextNG != null) {\r\n let nextNotes = nextNG.visibleNotes;\r\n if (nextNG.beamStates.length === 0) {\r\n needBracket = true;\r\n }\r\n if (nextNG.stemDirection === StemDirection.UP) {\r\n stemUpTally++;\r\n if (nextNotes[0].vPos > lowPoint) {\r\n lowPoint = nextNotes[0].vPos;\r\n }\r\n if (nextNG.stemEndPos < highPoint) {\r\n highPoint = nextNG.stemEndPos;\r\n }\r\n } else if (nextNG.stemDirection === StemDirection.DOWN) {\r\n stemDownTally++;\r\n let lastNote = nextNotes[nextNotes.length - 1];\r\n if (lastNote.vPos < highPoint) {\r\n highPoint = lastNote.vPos;\r\n }\r\n if (nextNG.stemEndPos > lowPoint) {\r\n lowPoint = nextNG.stemEndPos;\r\n }\r\n } else if (nextNG.isRest) {\r\n stemUpTally++;\r\n } else {\r\n stemUpTally++;\r\n if (nextNotes[0].vPos > lowPoint) {\r\n lowPoint = nextNotes[0].vPos;\r\n }\r\n let lastNote = nextNotes[nextNotes.length - 1];\r\n if (lastNote.vPos < highPoint) {\r\n highPoint = lastNote.vPos;\r\n }\r\n }\r\n if (nextNG === tuplet.endNote) {\r\n break;\r\n }\r\n nextNG = nextNG.next;\r\n }\r\n let isAbove = stemUpTally >= stemDownTally;\r\n tuplet.above = isAbove;\r\n if (highPoint > 0) {\r\n highPoint = 0;\r\n }\r\n if (lowPoint < 4) {\r\n lowPoint = 4;\r\n }\r\n if (isAbove) {\r\n tuplet.vPos = highPoint - (level + 1);\r\n } else {\r\n tuplet.vPos = lowPoint + (level + 1);\r\n }\r\n tuplet.showBracket = needBracket;\r\n }\r\n _buildSlurSegments(slur, ngIndex, vStaffPos) {\r\n let ng1 = slur.firstNote;\r\n let ng2 = slur.endNote;\r\n let voiceNumber = ng2.voice.number;\r\n let offset = 1 / 2;\r\n let measure = ng1.voice.measure;\r\n let cSystem = measure.stack.systemRef;\r\n let isAbove = ng1.stemDirection === StemDirection.DOWN;\r\n let multipleVoices = measure.voices.length > 1;\r\n let segments = [];\r\n let ngCoordinates = {};\r\n let coordPos = 0;\r\n let endNoteFound = false;\r\n let segment;\r\n ngIndex++;\r\n let breakOuterLoop = false;\r\n while (measure != null) {\r\n let measureHPos = cSystem.indent + measure.stack.startPosition;\r\n if (measure.stack.systemRef !== cSystem) {\r\n segment = new SlurSegment();\r\n segment.systemRef = cSystem;\r\n segment.slur = slur;\r\n segment.ngCoordinates = ngCoordinates;\r\n segments.push(segment);\r\n cSystem.slurSegments.push(segment);\r\n cSystem = measure.stack.systemRef;\r\n if (cSystem.needsRendering) {\r\n }\r\n ngCoordinates = {};\r\n coordPos = 0;\r\n }\r\n let voices = measure.voices;\r\n for (let voice of voices) {\r\n if (voice.number === voiceNumber) {\r\n let noteGroups = voice.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let i = ngIndex; i < numNoteGroups; i++) {\r\n let cng = noteGroups[i];\r\n if (cng.isRest) {\r\n continue;\r\n }\r\n if (cng.stemDirection === StemDirection.DOWN) {\r\n isAbove = true;\r\n }\r\n if (cng !== ng2) {\r\n let cngNotes = cng.visibleNotes;\r\n if (cng.stemDirection === StemDirection.DOWN) {\r\n let topNote = cngNotes[cngNotes.length - 1];\r\n ngCoordinates[coordPos] = cng.hPos + measureHPos;\r\n ngCoordinates[coordPos + 1] = topNote.vPos;\r\n coordPos += 2;\r\n ngCoordinates[coordPos] = cng.hPos + measureHPos;\r\n ngCoordinates[coordPos + 1] = cng.stemEndPos;\r\n coordPos += 2;\r\n } else {\r\n let bottomNote = cngNotes[0];\r\n ngCoordinates[coordPos] = cng.hPos + measureHPos;\r\n ngCoordinates[coordPos + 1] = bottomNote.vPos;\r\n coordPos += 2;\r\n ngCoordinates[coordPos] = cng.hPos + measureHPos;\r\n ngCoordinates[coordPos + 1] = cng.stemDirection === StemDirection.UP ? cng.stemEndPos : cngNotes[cngNotes.length - 1].vPos;\r\n coordPos += 2;\r\n }\r\n } else {\r\n segment = new SlurSegment();\r\n segment.ngCoordinates = ngCoordinates;\r\n segment.systemRef = cSystem;\r\n segment.slur = slur;\r\n segments.push(segment);\r\n cSystem.slurSegments.push(segment);\r\n endNoteFound = true;\r\n breakOuterLoop = true;\r\n break;\r\n }\r\n }\r\n if (breakOuterLoop) {\r\n break;\r\n }\r\n ngIndex = 0;\r\n }\r\n }\r\n if (breakOuterLoop) {\r\n break;\r\n }\r\n measure = measure.next;\r\n if (measure.voices.length > 1) {\r\n multipleVoices = true;\r\n }\r\n }\r\n if (!endNoteFound) {\r\n ng1.slurs.splice(ng1.slurs.indexOf(slur), 1);\r\n if (slur.endNote != null) {\r\n slur.endNote.slurs.splice(slur.endNote.slurs.indexOf(slur), 1);\r\n }\r\n return;\r\n }\r\n if (multipleVoices) {\r\n isAbove = ng1.voice.number === 1;\r\n }\r\n slur.segments = segments;\r\n let startPoint;\r\n let endPoint;\r\n let slope;\r\n let angle;\r\n let cpXOffset;\r\n let cp1;\r\n let cp2;\r\n let yShift;\r\n let yIntercept;\r\n let perpSlope;\r\n let intersectX;\r\n let intersectY;\r\n for (let i = 0; i < segments.length; i++) {\r\n segment = segments[i];\r\n let hPos;\r\n let vPos;\r\n if (i === 0) {\r\n if (isAbove) {\r\n if (ng1.stemDirection === StemDirection.UP) {\r\n if (ng1.beamStates.length > 0 && ng1.beamStates[0] !== BeamState.END) {\r\n hPos = segment.systemRef.indent + ng1.voice.measure.stack.startPosition + ng1.hPos + ng1.stemHPos;\r\n vPos = ng1.stemEndPos - offset;\r\n } else {\r\n hPos = segment.systemRef.indent + ng1.voice.measure.stack.startPosition + ng1.hPos + ng1.stemHPos + offset;\r\n vPos = ng1.stemEndPos + 2 * offset;\r\n }\r\n } else {\r\n hPos = segment.systemRef.indent + ng1.voice.measure.stack.startPosition + ng1.hPos + offset;\r\n vPos = ng1.visibleNotes[ng1.visibleNotes.length - 1].vPos - 2 * offset;\r\n }\r\n startPoint = new PointXY(hPos, vPos);\r\n } else {\r\n if (ng1.stemDirection === StemDirection.DOWN) {\r\n if (ng1.beamStates.length > 0 && ng1.beamStates[0] !== BeamState.END) {\r\n hPos = segment.systemRef.indent + ng1.voice.measure.stack.startPosition + ng1.hPos + ng1.stemHPos;\r\n vPos = ng1.stemEndPos + offset;\r\n } else {\r\n hPos = segment.systemRef.indent + ng1.voice.measure.stack.startPosition + ng1.hPos + ng1.stemHPos + offset;\r\n vPos = ng1.stemEndPos - 2 * offset;\r\n }\r\n } else {\r\n hPos = segment.systemRef.indent + ng1.voice.measure.stack.startPosition + ng1.hPos + offset;\r\n vPos = ng1.visibleNotes[0].vPos + 2 * offset;\r\n }\r\n startPoint = new PointXY(hPos, vPos);\r\n }\r\n } else {\r\n let firstStack = segment.systemRef.measureStacks[0];\r\n hPos = firstStack.startPosition + firstStack.indentAsSystemLeader - firstStack.indent + segment.systemRef.indent;\r\n if (i === segments.length - 1) {\r\n if (isAbove) {\r\n vPos = -1 * offset;\r\n if (ng2.stemEndPos - offset < vPos) {\r\n vPos = ng2.stemEndPos - offset;\r\n } else {\r\n let ng2TopNote = ng2.visibleNotes[ng2.visibleNotes.length - 1];\r\n if (ng2TopNote.vPos - offset < vPos) {\r\n vPos = ng2TopNote.vPos - offset;\r\n }\r\n }\r\n } else {\r\n vPos = 4 + offset;\r\n if (ng2.stemEndPos + offset > vPos) {\r\n vPos = ng2.stemEndPos + offset;\r\n } else {\r\n let ng2BottomNote = ng2.visibleNotes[0];\r\n if (ng2BottomNote.vPos + offset > vPos) {\r\n vPos = ng2BottomNote.vPos + offset;\r\n }\r\n }\r\n }\r\n } else {\r\n vPos = isAbove ? -1 * offset : 4 + offset;\r\n }\r\n startPoint = new PointXY(hPos, vPos);\r\n }\r\n segment.points[0] = startPoint;\r\n if (i === segments.length - 1) {\r\n if (isAbove) {\r\n if (ng2.stemDirection === StemDirection.UP) {\r\n if (ng2.beamStates.length > 0 && ng2.beamStates[0] !== BeamState.BEGIN) {\r\n hPos = segment.systemRef.indent + ng2.voice.measure.stack.startPosition + ng2.hPos + ng2.stemHPos;\r\n vPos = ng2.stemEndPos - offset;\r\n } else {\r\n hPos = segment.systemRef.indent + ng2.voice.measure.stack.startPosition + ng2.hPos + ng2.stemHPos - offset;\r\n vPos = ng2.stemEndPos + 2 * offset;\r\n }\r\n } else {\r\n hPos = segment.systemRef.indent + ng2.voice.measure.stack.startPosition + ng2.hPos + offset;\r\n vPos = ng2.visibleNotes[ng2.visibleNotes.length - 1].vPos - 2 * offset;\r\n }\r\n endPoint = new PointXY(hPos, vPos);\r\n } else {\r\n if (ng2.stemDirection === StemDirection.DOWN) {\r\n if (ng2.beamStates.length > 0 && ng2.beamStates[0] !== BeamState.BEGIN) {\r\n hPos = segment.systemRef.indent + ng2.voice.measure.stack.startPosition + ng2.hPos + ng2.stemHPos;\r\n vPos = ng2.stemEndPos + offset;\r\n } else {\r\n hPos = segment.systemRef.indent + ng2.voice.measure.stack.startPosition + ng2.hPos + ng2.stemHPos - offset;\r\n vPos = ng2.stemEndPos - 2 * offset;\r\n }\r\n } else {\r\n hPos = segment.systemRef.indent + ng2.voice.measure.stack.startPosition + ng2.hPos + offset;\r\n vPos = ng2.visibleNotes[0].vPos + 2 * offset;\r\n }\r\n endPoint = new PointXY(hPos, vPos);\r\n }\r\n } else {\r\n let lastStack = segment.systemRef.measureStacks[segment.systemRef.measureStacks.length - 1];\r\n hPos = lastStack.startPosition + lastStack.width + segment.systemRef.indent;\r\n if (i === 0) {\r\n if (isAbove) {\r\n vPos = -1 * offset;\r\n if (startPoint.y < vPos) {\r\n vPos = startPoint.y;\r\n }\r\n } else {\r\n vPos = 4 + offset;\r\n if (startPoint.y > vPos) {\r\n vPos = startPoint.y;\r\n }\r\n }\r\n } else {\r\n vPos = isAbove ? -1 * offset : 4 + offset;\r\n }\r\n endPoint = new PointXY(hPos, vPos);\r\n }\r\n segment.points[3] = endPoint;\r\n let deltaX = startPoint.x * -1;\r\n let deltaY = startPoint.y * -1;\r\n let sp = new PointXY(startPoint.x + deltaX, startPoint.y + deltaY);\r\n let ep = new PointXY(endPoint.x + deltaX, endPoint.y + deltaY);\r\n let defaultCPHeight = Math.min(\r\n 2 * offset,\r\n offset * ((ep.x - sp.x) / 100)\r\n );\r\n if (isAbove) {\r\n slope = (ep.y - sp.y) / (ep.x - sp.x);\r\n angle = Math.atan2(ep.y - sp.y, ep.x - sp.x);\r\n cpXOffset = ep.x - sp.x > 100 ? 10 : (ep.x - sp.x) / 4;\r\n cp1 = new PointXY(\r\n cpXOffset * Math.cos(angle),\r\n (ep.y - sp.y) * cpXOffset / ep.x - defaultCPHeight * Math.cos(angle)\r\n );\r\n cp2 = new PointXY(\r\n ep.x - cpXOffset * Math.cos(angle),\r\n (ep.y - sp.y) * ((ep.x - cpXOffset) / ep.x) - defaultCPHeight * Math.cos(angle)\r\n );\r\n ngCoordinates = segment.ngCoordinates;\r\n let numValues = Object.keys(ngCoordinates).length;\r\n let j = 0;\r\n while (j < numValues) {\r\n ngCoordinates[j] += deltaX;\r\n ngCoordinates[j + 1] += deltaY;\r\n if (ngCoordinates[j] / ep.x < 0.25) {\r\n ngCoordinates[j + 1] -= offset;\r\n } else if (ngCoordinates[j] / ep.x > 0.75) {\r\n ngCoordinates[j + 1] -= offset;\r\n }\r\n if (ngCoordinates[j + 1] < ngCoordinates[j] * slope + cp1.y) {\r\n yShift = ngCoordinates[j + 1] - (ngCoordinates[j] * slope + cp1.y);\r\n cp1.y += yShift;\r\n cp2.y += yShift;\r\n }\r\n j += 2;\r\n }\r\n if (slope === 0) {\r\n slope = 1e-3;\r\n }\r\n yIntercept = cp1.y - slope * cp1.x;\r\n perpSlope = -1 / slope;\r\n intersectX = yIntercept / (perpSlope - slope);\r\n intersectY = perpSlope * intersectX;\r\n cp1.x += intersectX + 2 * offset * Math.sin(angle);\r\n cp1.y += intersectY - 2 * offset * Math.cos(angle);\r\n cp2.x += intersectX + 2 * offset * Math.sin(angle);\r\n cp2.y += intersectY - 2 * offset * Math.cos(angle);\r\n } else {\r\n slope = (ep.y - sp.y) / (ep.x - sp.x);\r\n angle = Math.atan2(ep.y - sp.y, ep.x - sp.x);\r\n cpXOffset = ep.x - sp.x > 100 ? 10 : (ep.x - sp.x) / 4;\r\n cp1 = new PointXY(\r\n cpXOffset * Math.cos(angle),\r\n (ep.y - sp.y) * cpXOffset / ep.x + defaultCPHeight * Math.cos(angle)\r\n );\r\n cp2 = new PointXY(\r\n ep.x - cpXOffset * Math.cos(angle),\r\n (ep.y - sp.y) * ((ep.x - cpXOffset) / ep.x) + defaultCPHeight * Math.cos(angle)\r\n );\r\n ngCoordinates = segment.ngCoordinates;\r\n let numValues = Object.keys(ngCoordinates).length;\r\n let j = 0;\r\n while (j < numValues) {\r\n ngCoordinates[j] += deltaX;\r\n ngCoordinates[j + 1] += deltaY;\r\n if (ngCoordinates[j] / ep.x < 0.25) {\r\n ngCoordinates[j + 1] += offset;\r\n } else if (ngCoordinates[j] / ep.x > 0.75) {\r\n ngCoordinates[j + 1] += offset;\r\n }\r\n if (ngCoordinates[j + 1] > ngCoordinates[j] * slope + cp1.y) {\r\n yShift = ngCoordinates[j + 1] - (ngCoordinates[j] * slope + cp1.y);\r\n cp1.y += yShift;\r\n cp2.y += yShift;\r\n }\r\n j += 2;\r\n }\r\n if (slope === 0) {\r\n slope = 1e-3;\r\n }\r\n yIntercept = cp1.y - slope * cp1.x;\r\n perpSlope = -1 / slope;\r\n intersectX = yIntercept / (perpSlope - slope);\r\n intersectY = perpSlope * intersectX;\r\n cp1.x += intersectX - 2 * offset * Math.sin(angle);\r\n cp1.y += intersectY + 2 * offset * Math.cos(angle);\r\n cp2.x += intersectX - 2 * offset * Math.sin(angle);\r\n cp2.y += intersectY + 2 * offset * Math.cos(angle);\r\n }\r\n segment.points[0] = sp;\r\n segment.points[1] = cp1;\r\n segment.points[2] = cp2;\r\n segment.points[3] = ep;\r\n segment.points[0].x += -deltaX;\r\n segment.points[0].y += vStaffPos - deltaY;\r\n segment.points[1].x += -deltaX;\r\n segment.points[1].y += vStaffPos - deltaY;\r\n segment.points[2].x += -deltaX;\r\n segment.points[2].y += vStaffPos - deltaY;\r\n segment.points[3].x += -deltaX;\r\n segment.points[3].y += vStaffPos - deltaY;\r\n }\r\n }\r\n _setRepeatEndingHeight(stacks, firstStackIndex) {\r\n let highestVPos = 2576980377;\r\n let underEndingBracket = true;\r\n let endingRDOs = [];\r\n for (let i = firstStackIndex; i < stacks.length; i++) {\r\n let stack = stacks[i];\r\n let endingFinished = false;\r\n if (stack.repeatDOs != null) {\r\n for (let rdo of stack.repeatDOs) {\r\n if (rdo.endingType === EndingType.START) {\r\n underEndingBracket = true;\r\n endingRDOs.push(rdo);\r\n } else if (rdo.endingType === EndingType.DISCONTINUE || rdo.endingType === EndingType.STOP) {\r\n endingFinished = true;\r\n endingRDOs.push(rdo);\r\n }\r\n }\r\n }\r\n if (underEndingBracket) {\r\n let measure = stack.measures[0];\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (ng.stemDirection === StemDirection.UP) {\r\n if (ng.stemEndPos < highestVPos) {\r\n highestVPos = ng.stemEndPos;\r\n }\r\n } else if (ng.isRest) {\r\n if (ng.restVPos < highestVPos) {\r\n highestVPos = ng.restVPos;\r\n }\r\n } else {\r\n let noteVPos = ng.visibleNotes[ng.visibleNotes.length - 1].vPos;\r\n if (noteVPos < highestVPos) {\r\n highestVPos = noteVPos;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (endingFinished) {\r\n underEndingBracket = false;\r\n }\r\n }\r\n if (highestVPos > 0) {\r\n highestVPos = 0;\r\n }\r\n let endingVPos = highestVPos - 2;\r\n for (let rdo of endingRDOs) {\r\n rdo.endingVPos = endingVPos;\r\n }\r\n }\r\n};\r\n_AttachmentFormatter.defaultAbovePos = -1;\r\n_AttachmentFormatter.defaultBelowPos = 5;\r\nvar AttachmentFormatter = _AttachmentFormatter;\r\n\r\n// src/formatting/notes/MusicBeamer.ts\r\nvar MusicBeamer = class {\r\n constructor() {\r\n this.successCount = 0;\r\n }\r\n /**\r\n * sets beam state for each NoteGroup in the system - it does not set the \r\n * height or direction of stems\r\n * @param\tsystem the System to process\r\n */\r\n getSystemBeamGroupings(system) {\r\n let stacks = system.measureStacks;\r\n for (let stack of stacks) {\r\n let measures = stack.measures;\r\n for (let measure of measures) {\r\n this.getMeasureBeamGroupings(measure);\r\n }\r\n }\r\n }\r\n /**\r\n * sets beam state for each NoteGroup in the measure - it does not set the \r\n * height or direction of stems\r\n * @param\tmeasure the Measure to process\r\n */\r\n getMeasureBeamGroupings(measure) {\r\n for (let voice of measure.voices) {\r\n let noteGroups = voice.noteGroups;\r\n let ng1 = null;\r\n let ng2 = null;\r\n let currentBeamStartTimes = {};\r\n for (let cng of noteGroups) {\r\n cng.beamStates = new Array(cng.maxBeams);\r\n for (let i = 0; i < cng.beamStates.length; i++) {\r\n cng.beamStates[i] = BeamState.NONE;\r\n }\r\n if (cng.maxBeams <= 0) {\r\n ng1 = null;\r\n ng2 = null;\r\n continue;\r\n } else if (cng.isRest) {\r\n continue;\r\n }\r\n ng1 = ng2;\r\n ng2 = cng;\r\n if (ng1 == null) {\r\n continue;\r\n }\r\n if (ng1.isGrace && !ng2.isGrace || !ng1.isGrace && ng2.isGrace) {\r\n continue;\r\n }\r\n let numBeatGroups = measure.beatGroups.length;\r\n let ng1EndTime = ng1.qNoteTime - measure.stack.startTime + ng1.qNoteDuration - 1e-3;\r\n let beatGroupIndex = 0;\r\n while (beatGroupIndex < numBeatGroups && ng1EndTime > measure.beatGroups[beatGroupIndex]) {\r\n beatGroupIndex++;\r\n }\r\n if (beatGroupIndex === numBeatGroups || ng2.qNoteTime - measure.stack.startTime < measure.beatGroups[beatGroupIndex]) {\r\n for (let i = 0; i < ng1.maxBeams; i++) {\r\n if (ng1.beamStates.length <= i || ng1.beamStates[i] === BeamState.NONE) {\r\n if (i < ng2.maxBeams) {\r\n ng1.beamStates[i] = BeamState.BEGIN;\r\n currentBeamStartTimes[i] = ng1.qNoteTime;\r\n } else {\r\n ng1.beamStates[i] = this.getBeamletDirection(\r\n currentBeamStartTimes[Object.keys(\r\n currentBeamStartTimes\r\n ).length - 1],\r\n ng1.qNoteTime,\r\n ng1.qNoteDuration,\r\n ng1.beamStates[i - 1]\r\n );\r\n }\r\n } else {\r\n if (i < ng2.maxBeams) {\r\n if (ng1.beamStates[i] === BeamState.END) {\r\n ng1.beamStates[i] = BeamState.CONTINUE;\r\n } else {\r\n ng1.beamStates[i] = BeamState.BEGIN;\r\n currentBeamStartTimes[i] = ng1.qNoteTime;\r\n }\r\n } else {\r\n }\r\n }\r\n }\r\n for (let i = 0; i < ng2.maxBeams; i++) {\r\n if (i < ng1.maxBeams) {\r\n ng2.beamStates[i] = BeamState.END;\r\n currentBeamStartTimes[i] = -1;\r\n } else {\r\n ng2.beamStates[i] = this.getBeamletDirection(\r\n currentBeamStartTimes[Object.keys(\r\n currentBeamStartTimes\r\n ).length - 1],\r\n ng2.qNoteTime,\r\n ng2.qNoteDuration,\r\n ng2.beamStates[i - 1]\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Gets the direction for the beamlet\r\n * @param\tbeamStartTime the start time of the first note of the beam group\r\n * @param\tnoteTime the start time of the note whose beamlet direction \r\n * we're setting\r\n * @param\tnoteDuration the duration of the note whose beamlet direction \r\n * we're setting\r\n * @param\tpreviousBeamLevelState The beam state of the immediately \r\n * preceding beam level (the 8th note beam if we're considering a sixteenth \r\n * note level beam, etc.)\r\n * @return\tBeamState.BACKWARD_HOOK or BeamState.FORWARD_HOOK\r\n */\r\n getBeamletDirection(beamStartTime, noteTime, noteDuration, previousBeamLevelState) {\r\n if (previousBeamLevelState === BeamState.END) {\r\n return BeamState.BACKWARD_HOOK;\r\n } else if (previousBeamLevelState === BeamState.BACKWARD_HOOK || previousBeamLevelState === BeamState.FORWARD_HOOK) {\r\n return previousBeamLevelState;\r\n }\r\n if (noteDuration === 0) {\r\n noteDuration = 0.25;\r\n }\r\n let isEvenMultiple = false;\r\n while (noteTime >= beamStartTime - 1e-3) {\r\n if (noteTime - beamStartTime < 1e-3) {\r\n isEvenMultiple = true;\r\n break;\r\n }\r\n noteTime -= noteDuration;\r\n }\r\n return isEvenMultiple ? BeamState.FORWARD_HOOK : BeamState.BACKWARD_HOOK;\r\n }\r\n};\r\n\r\n// src/formatting/notes/NoteGroupFormatter.ts\r\nvar NoteGroupFormatter = class {\r\n constructor(scoreProperties) {\r\n this._scoreProps = scoreProperties;\r\n }\r\n /**\r\n * gets the stem directions for all of the notes in the system\r\n * @param\tsystem the System to process\r\n */\r\n getSystemStemDirections(system) {\r\n let stacks = system.measureStacks;\r\n for (let stack of stacks) {\r\n let measures = stack.measures;\r\n for (let measure of measures) {\r\n this.getMeasureStemDirections(measure);\r\n }\r\n }\r\n }\r\n /**\r\n * gets the stem directions for all of the notes in the measure\r\n * @param\tmeasure the Measure to process\r\n */\r\n getMeasureStemDirections(measure) {\r\n let numVoices = measure.voices.length;\r\n let numVisibleVoices = 0;\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (ng.visible) {\r\n numVisibleVoices++;\r\n break;\r\n }\r\n }\r\n }\r\n for (let voiceIndex = 0; voiceIndex < numVoices; voiceIndex++) {\r\n let noteGroups = measure.voices[voiceIndex].noteGroups;\r\n let currentUpScore = 0;\r\n let currentDownScore = 0;\r\n let highestUpScore = 0;\r\n let highestDownScore = 0;\r\n let numUpVotes = 0;\r\n let numDownVotes = 0;\r\n let beamGroup = [];\r\n for (let ng of noteGroups) {\r\n if (ng.isRest) {\r\n if (numVisibleVoices > 1) {\r\n ng.restVPos = voiceIndex % 2 === 0 ? -1 : 5;\r\n } else {\r\n ng.restVPos = 2;\r\n }\r\n continue;\r\n }\r\n if (ng.stemDirection === StemDirection.NO_STEM) {\r\n continue;\r\n }\r\n if (numVisibleVoices > 1) {\r\n ng.stemDirection = voiceIndex % 2 === 0 ? StemDirection.UP : StemDirection.DOWN;\r\n continue;\r\n }\r\n let visNotes = ng.visibleNotes;\r\n currentUpScore = visNotes[0].stepsFromTopStaffLine - 4;\r\n currentDownScore = 4 - visNotes[visNotes.length - 1].stepsFromTopStaffLine;\r\n if (currentUpScore > currentDownScore) {\r\n numUpVotes++;\r\n } else {\r\n numDownVotes++;\r\n }\r\n if (currentUpScore > highestUpScore) {\r\n highestUpScore = currentUpScore;\r\n }\r\n if (currentDownScore > highestDownScore) {\r\n highestDownScore = currentDownScore;\r\n }\r\n if (ng.beamStates.length === 0 || ng.beamStates[0] === BeamState.NONE) {\r\n ng.stemDirection = highestUpScore > highestDownScore ? StemDirection.UP : StemDirection.DOWN;\r\n highestUpScore = 0;\r\n highestDownScore = 0;\r\n numUpVotes = 0;\r\n numDownVotes = 0;\r\n } else if (ng.beamStates[0] === BeamState.END) {\r\n beamGroup.push(ng);\r\n if (highestUpScore > highestDownScore || highestUpScore === highestDownScore && numUpVotes > numDownVotes) {\r\n this.setStemDirectionsForBeamedNotes(\r\n beamGroup,\r\n StemDirection.UP\r\n );\r\n } else {\r\n this.setStemDirectionsForBeamedNotes(\r\n beamGroup,\r\n StemDirection.DOWN\r\n );\r\n }\r\n highestUpScore = 0;\r\n highestDownScore = 0;\r\n numUpVotes = 0;\r\n numDownVotes = 0;\r\n beamGroup = new Array();\r\n } else {\r\n beamGroup.push(ng);\r\n }\r\n }\r\n }\r\n }\r\n setStemDirectionsForBeamedNotes(beamedNotes, direction) {\r\n for (let beamedNG of beamedNotes) {\r\n beamedNG.stemDirection = direction;\r\n }\r\n }\r\n /**\r\n * sets the positions of noteheads within a notegroup for the passed in \r\n * system\r\n * @param\tsystem the system to process\r\n */\r\n getSystemNoteheadOffsets(system) {\r\n let stacks = system.measureStacks;\r\n for (let stack of stacks) {\r\n let measures = stack.measures;\r\n for (let measure of measures) {\r\n this.getMeasureNoteheadOffsets(measure);\r\n }\r\n }\r\n }\r\n /**\r\n * sets the positions of noteheads within a notegroup for the passed in \r\n * Measure\r\n * @param\tmeasure the Measure to process\r\n */\r\n getMeasureNoteheadOffsets(measure) {\r\n for (let voice of measure.voices) {\r\n let groups = voice.noteGroups;\r\n for (let ng of groups) {\r\n this.getNoteheadOffsets(ng);\r\n }\r\n }\r\n }\r\n /**\r\n * sets the positions of noteheads within a notegroup\r\n * @param\tnoteGroup the noteGroup to process\r\n */\r\n getNoteheadOffsets(noteGroup) {\r\n if (noteGroup.isRest) {\r\n return;\r\n }\r\n let placeOnLeft;\r\n let notes = noteGroup.visibleNotes;\r\n let numNotes = notes.length;\r\n let lastPosition = 1e3;\r\n let leftNotePos = 0;\r\n let rightNotePos = !noteGroup.isGrace ? this._scoreProps.noteheadWidth : 0.65 * this._scoreProps.noteheadWidth;\r\n let stemHPos = 0;\r\n let stemStartPos;\r\n let cNote;\r\n if (noteGroup.stemDirection === StemDirection.UP) {\r\n stemStartPos = notes[0].vPos;\r\n stemHPos = rightNotePos;\r\n placeOnLeft = true;\r\n for (let i = 0; i < numNotes; i++) {\r\n cNote = notes[i];\r\n if (lastPosition - cNote.stepsFromTopStaffLine <= 1) {\r\n placeOnLeft = !placeOnLeft;\r\n cNote.hPos = placeOnLeft ? leftNotePos : rightNotePos;\r\n } else {\r\n placeOnLeft = true;\r\n cNote.hPos = 0;\r\n }\r\n lastPosition = cNote.stepsFromTopStaffLine;\r\n }\r\n } else if (noteGroup.stemDirection === StemDirection.DOWN) {\r\n stemStartPos = notes[numNotes - 1].vPos;\r\n placeOnLeft = false;\r\n lastPosition = -1e3;\r\n let clusterFound = false;\r\n let i = numNotes - 1;\r\n while (i >= 0) {\r\n cNote = notes[i];\r\n if (cNote.stepsFromTopStaffLine - lastPosition <= 1) {\r\n placeOnLeft = !placeOnLeft;\r\n cNote.hPos = placeOnLeft ? -1 * rightNotePos : leftNotePos;\r\n stemHPos = rightNotePos;\r\n clusterFound = true;\r\n } else {\r\n placeOnLeft = false;\r\n cNote.hPos = 0;\r\n }\r\n lastPosition = cNote.stepsFromTopStaffLine;\r\n i--;\r\n }\r\n if (clusterFound) {\r\n for (let i2 = 0; i2 < numNotes; i2++) {\r\n notes[i2].hPos += rightNotePos;\r\n }\r\n }\r\n } else {\r\n stemStartPos = 0;\r\n stemHPos = rightNotePos;\r\n placeOnLeft = true;\r\n for (let i = 0; i < numNotes; i++) {\r\n cNote = notes[i];\r\n if (lastPosition - cNote.stepsFromTopStaffLine <= 1) {\r\n placeOnLeft = !placeOnLeft;\r\n cNote.hPos = placeOnLeft ? leftNotePos : rightNotePos;\r\n } else {\r\n placeOnLeft = true;\r\n cNote.hPos = 0;\r\n }\r\n lastPosition = cNote.stepsFromTopStaffLine;\r\n }\r\n }\r\n noteGroup.stemHPos = stemHPos;\r\n noteGroup.stemStartPos = stemStartPos;\r\n noteGroup.numAccidentalLevels = 0;\r\n if (numNotes === 1) {\r\n if (notes[0].showAccidental) {\r\n notes[0].accidentalPos = -1.1 * rightNotePos;\r\n noteGroup.numAccidentalLevels = 1;\r\n }\r\n } else {\r\n let offset = -1 * notes[numNotes - 1].stepsFromTopStaffLine;\r\n let listLength = notes[0].stepsFromTopStaffLine + offset + 1;\r\n let levelClaimsList = {};\r\n let numPositions = listLength;\r\n for (let i = 0; i < numNotes; i++) {\r\n cNote = i % 2 === 0 ? notes[numNotes - Math.trunc(i / 2) - 1] : notes[Math.trunc(i / 2)];\r\n if (cNote.showAccidental === false) {\r\n continue;\r\n }\r\n let noteIndex = cNote.stepsFromTopStaffLine + offset;\r\n let lowerBound = noteIndex - 5 >= 0 ? noteIndex - 5 : 0;\r\n let upperBound = noteIndex + 5 <= numPositions - 1 ? noteIndex + 5 : numPositions - 1;\r\n let cLevel = 1;\r\n let repeat = true;\r\n while (repeat) {\r\n repeat = false;\r\n let j = lowerBound;\r\n while (j <= upperBound) {\r\n if (levelClaimsList[j] === cLevel) {\r\n cLevel++;\r\n repeat = true;\r\n break;\r\n }\r\n j++;\r\n }\r\n }\r\n levelClaimsList[noteIndex] = cLevel;\r\n cNote.accidentalPos = -1.1 * rightNotePos - (cLevel - 1) * rightNotePos;\r\n if (cLevel > noteGroup.numAccidentalLevels) {\r\n noteGroup.numAccidentalLevels = cLevel;\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * gets the stem end positions for all NoteGroups in the System\r\n * @param\tsystem the System to process\r\n */\r\n getSystemStemEndPositions(system) {\r\n let stacks = system.measureStacks;\r\n for (let stack of stacks) {\r\n let measures = stack.measures;\r\n for (let measure of measures) {\r\n this.getMeasureStemEndPositions(measure);\r\n }\r\n }\r\n }\r\n /**\r\n * gets the stem end positions for all NoteGroups in the Measure\r\n * @param\tmeasure the Measure to process\r\n */\r\n getMeasureStemEndPositions(measure) {\r\n for (let voice of measure.voices) {\r\n let noteGroups = voice.noteGroups;\r\n let beamedNotes = [];\r\n let firstNote = null;\r\n let lastNote = null;\r\n let firstNoteRP = 0;\r\n let lastNoteRP = 0;\r\n let interiorHighestRP = 0;\r\n let interiorLowestRP = 0;\r\n let beamedNoteCount = 0;\r\n for (let ng of noteGroups) {\r\n if (ng.isRest || ng.stemDirection === StemDirection.NO_STEM) {\r\n continue;\r\n }\r\n let requestedStemPos = this.getRequestedStemEndPosition(ng);\r\n if (ng.beamStates.length === 0 || ng.beamStates[0] === BeamState.NONE) {\r\n ng.stemEndPos = 1 / 2 * requestedStemPos;\r\n } else if (ng.beamStates[0] === BeamState.BEGIN) {\r\n beamedNotes = [ng];\r\n beamedNoteCount = 1;\r\n firstNote = ng;\r\n firstNoteRP = requestedStemPos;\r\n interiorHighestRP = 1e3;\r\n interiorLowestRP = -1e3;\r\n } else if (ng.beamStates[0] === BeamState.CONTINUE) {\r\n if (requestedStemPos < interiorHighestRP) {\r\n interiorHighestRP = requestedStemPos;\r\n }\r\n if (requestedStemPos > interiorLowestRP) {\r\n interiorLowestRP = requestedStemPos;\r\n }\r\n beamedNotes.push(ng);\r\n beamedNoteCount++;\r\n } else if (ng.beamStates[0] === BeamState.END) {\r\n lastNoteRP = requestedStemPos;\r\n lastNote = ng;\r\n beamedNotes.push(ng);\r\n beamedNoteCount++;\r\n if (firstNote.stemDirection === StemDirection.UP) {\r\n if (firstNoteRP < interiorHighestRP || lastNoteRP < interiorHighestRP) {\r\n if (firstNoteRP <= lastNoteRP) {\r\n lastNoteRP = firstNoteRP + (lastNoteRP - firstNoteRP) / 4;\r\n } else {\r\n firstNoteRP = lastNoteRP + (firstNoteRP - lastNoteRP) / 4;\r\n }\r\n } else {\r\n firstNoteRP = interiorHighestRP;\r\n lastNoteRP = interiorHighestRP;\r\n }\r\n } else {\r\n if (firstNoteRP > interiorLowestRP || lastNoteRP > interiorLowestRP) {\r\n if (firstNoteRP >= lastNoteRP) {\r\n lastNoteRP = firstNoteRP - (firstNoteRP - lastNoteRP) / 4;\r\n } else {\r\n firstNoteRP = lastNoteRP - (lastNoteRP - firstNoteRP) / 4;\r\n }\r\n } else {\r\n firstNoteRP = interiorLowestRP;\r\n lastNoteRP = interiorLowestRP;\r\n }\r\n }\r\n firstNote.stemEndPos = 1 / 2 * firstNoteRP;\r\n lastNote.stemEndPos = 1 / 2 * lastNoteRP;\r\n let totalHDistance = lastNote.hPos - firstNote.hPos;\r\n let totalRise = lastNote.stemEndPos - firstNote.stemEndPos;\r\n let i = 1;\r\n while (i < beamedNoteCount - 1) {\r\n let cIntNote = beamedNotes[i];\r\n cIntNote.stemEndPos = firstNote.stemEndPos + totalRise * ((cIntNote.hPos - firstNote.hPos) / totalHDistance);\r\n i++;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n getRequestedStemEndPosition(noteGroup) {\r\n let decidingNote;\r\n let bonusDurationLength;\r\n let penaltyLength;\r\n let request;\r\n let notes = noteGroup.visibleNotes;\r\n if (noteGroup.stemDirection === StemDirection.UP) {\r\n decidingNote = notes[notes.length - 1];\r\n bonusDurationLength = noteGroup.maxBeams < 2 ? 0 : noteGroup.maxBeams - 2;\r\n if (!noteGroup.isGrace) {\r\n penaltyLength = (noteGroup.maxBeams === 0 || noteGroup.beamStates.length > 0) && decidingNote.stepsFromTopStaffLine < 4 ? 1 : 0;\r\n } else {\r\n penaltyLength = 3;\r\n }\r\n request = decidingNote.stepsFromTopStaffLine - 7 - bonusDurationLength + penaltyLength;\r\n return request <= 4 ? request : 4;\r\n } else {\r\n decidingNote = notes[0];\r\n bonusDurationLength = noteGroup.maxBeams < 2 ? 0 : noteGroup.maxBeams - 2;\r\n if (!noteGroup.isGrace) {\r\n penaltyLength = (noteGroup.maxBeams === 0 || noteGroup.beamStates.length > 0) && decidingNote.stepsFromTopStaffLine > 4 ? 1 : 0;\r\n } else {\r\n penaltyLength = 3;\r\n }\r\n request = decidingNote.stepsFromTopStaffLine + 7 + bonusDurationLength - penaltyLength;\r\n return request >= 4 ? request : 4;\r\n }\r\n }\r\n};\r\n\r\n// src/formatting/spacing/MusicSpacer.ts\r\nvar _MusicSpacer = class _MusicSpacer {\r\n constructor(score) {\r\n this._score = score;\r\n this.init();\r\n }\r\n init() {\r\n this.initializeScoreSettings();\r\n }\r\n initializeScoreSettings() {\r\n let sProps = this._score.scoreProperties;\r\n this._qNoteWidth = sProps.qNoteWidth;\r\n this._keySigWidth = sProps.keySigWidth;\r\n this._timeSigWidth = sProps.timeSigWidth;\r\n this._clefWidth = sProps.clefWidth;\r\n this._clefDistanceFromBarline = sProps.clefDistanceFromBarline;\r\n this._measureLeadIn = sProps.measureLeadIn;\r\n this._minMeasureWidth = sProps.minMeasureWidth;\r\n this._noteheadWidth = sProps.noteheadWidth;\r\n this._standardSystemWidth = sProps.pageWidth - sProps.leftPageMargin - sProps.rightPageMargin - sProps.leftSystemMargin - sProps.rightSystemMargin;\r\n }\r\n /** computes the ideal hPos for every note and the ideal width of each \r\n * measure stack\r\n * @param\tmeasureStack the measureStack to compute - if null, all stacks \r\n * in the score are computed*/\r\n computeIdealSpacingValues(measureStack = null) {\r\n if (measureStack != null) {\r\n this.computeIdealSpacingForStack(measureStack);\r\n } else {\r\n let stacks = this._score.getMeasureStacks();\r\n for (let stack of stacks) {\r\n this.computeIdealSpacingForStack(stack);\r\n }\r\n }\r\n }\r\n /** groups the measures into systems\r\n * @param\tmeasuresPerSystem if greater than 0, this number of measures \r\n * will be enforced for all systems*/\r\n groupMeasuresIntoSystems(measuresPerSystem = 0) {\r\n let systems = this._score.getSystems();\r\n if (systems.length < 1) {\r\n return;\r\n }\r\n let originalStackGroupings = new Array();\r\n let firstSystem = systems[0];\r\n let firstSystemsStacks = systems[0].measureStacks;\r\n originalStackGroupings.push(firstSystemsStacks.slice());\r\n let cSystem = null;\r\n for (let i2 = 1; i2 < systems.length; i2++) {\r\n cSystem = systems[i2];\r\n let stacks = cSystem.measureStacks;\r\n originalStackGroupings.push(stacks.slice());\r\n for (let stack of stacks) {\r\n stack.systemRef = firstSystem;\r\n firstSystemsStacks.push(stack);\r\n }\r\n cSystem.clearAllStacks();\r\n }\r\n let i = 0;\r\n while (i < systems.length) {\r\n cSystem = systems[i];\r\n let totalWidth = 0;\r\n for (let j = 0; j < cSystem.measureStacks.length; j++) {\r\n let cStack = cSystem.measureStacks[j];\r\n if (j === 0) {\r\n cStack.newSystem = true;\r\n for (let measure of cStack.measures) {\r\n measure.showKey = true;\r\n measure.clefs[0].show = true;\r\n measure.clefs[0].smallSize = false;\r\n }\r\n if (!cStack.newKey) {\r\n totalWidth += cStack.maxKeySize * this._keySigWidth;\r\n }\r\n if (!cStack.newClef) {\r\n totalWidth += this._clefWidth;\r\n }\r\n } else {\r\n cStack.newSystem = false;\r\n for (let measure of cStack.measures) {\r\n measure.clefs[0].show = measure.clefs[0].isNew;\r\n measure.clefs[0].smallSize = true;\r\n measure.showKey = cStack.newKey;\r\n }\r\n }\r\n totalWidth += cStack.idealWidth;\r\n if (measuresPerSystem > 0) {\r\n if (j >= measuresPerSystem) {\r\n if (cSystem.next == null) {\r\n systems.push(this.addSystem(cSystem));\r\n }\r\n cSystem.next.insertMeasureStacks(cSystem.removeStacksFromEnd(\r\n cSystem.measureStacks.length - j\r\n ));\r\n break;\r\n }\r\n } else if (j > 0 && totalWidth > (this._standardSystemWidth - cSystem.indent) * 0.95) {\r\n if (cSystem.next == null) {\r\n systems.push(this.addSystem(cSystem));\r\n }\r\n cSystem.next.insertMeasureStacks(cSystem.removeStacksFromEnd(cSystem.measureStacks.length - j));\r\n break;\r\n }\r\n if (j === cSystem.measureStacks.length - 1) {\r\n if (cSystem.next != null) {\r\n cSystem.addMeasureStacks(cSystem.next.removeStacksFromBeginning(1));\r\n }\r\n }\r\n }\r\n i++;\r\n }\r\n i--;\r\n while (cSystem.measureStacks.length === 0) {\r\n let cPage = cSystem.pageRef;\r\n cPage.removeSystem(cSystem);\r\n systems.pop();\r\n if (cPage.systems.length === 0) {\r\n this._score.removePage(cPage);\r\n }\r\n cSystem = cSystem.previous;\r\n }\r\n let changeMade = measuresPerSystem === 0;\r\n while (changeMade) {\r\n changeMade = false;\r\n cSystem = systems[systems.length - 1];\r\n while (cSystem.previous != null) {\r\n let prevSystem = cSystem.previous;\r\n let qStack = prevSystem.measureStacks[prevSystem.measureStacks.length - 1];\r\n while (prevSystem.requestedStackWidth - qStack.idealWidth > 0.95 * cSystem.requestedStackWidth && prevSystem.measureStacks.length > 1) {\r\n let leadStack = cSystem.measureStacks[0];\r\n leadStack.newSystem = false;\r\n for (let measure of leadStack.measures) {\r\n measure.clefs[0].show = measure.clefs[0].isNew;\r\n measure.clefs[0].smallSize = true;\r\n measure.showKey = leadStack.newKey;\r\n }\r\n cSystem.insertStack(prevSystem.removeStacksFromEnd(1)[0]);\r\n leadStack = cSystem.measureStacks[0];\r\n leadStack.newSystem = true;\r\n for (let measure of leadStack.measures) {\r\n measure.clefs[0].show = true;\r\n measure.clefs[0].smallSize = false;\r\n measure.showKey = true;\r\n }\r\n changeMade = true;\r\n }\r\n cSystem = cSystem.previous;\r\n }\r\n }\r\n let numNewSystems = systems.length;\r\n let numOriginalSystems = originalStackGroupings.length;\r\n for (let i2 = 0; i2 < numNewSystems; i2++) {\r\n cSystem = systems[i2];\r\n if (i2 >= numOriginalSystems) {\r\n cSystem.needsRendering = true;\r\n continue;\r\n }\r\n let newSystemStacks = cSystem.measureStacks;\r\n let oldSystemStacks = originalStackGroupings[i2];\r\n if (oldSystemStacks.length === newSystemStacks.length) {\r\n let numStacks = oldSystemStacks.length;\r\n for (let j = 0; j < numStacks; j++) {\r\n if (oldSystemStacks[j] !== newSystemStacks[j]) {\r\n cSystem.needsRendering = true;\r\n break;\r\n }\r\n }\r\n } else {\r\n cSystem.needsRendering = true;\r\n }\r\n }\r\n }\r\n addSystem(currentSystem) {\r\n let newSystem = new System(this._score.scoreProperties);\r\n newSystem.previous = currentSystem;\r\n currentSystem.next = newSystem;\r\n currentSystem.pageRef.addSystem(newSystem);\r\n return newSystem;\r\n }\r\n /**\r\n * computes the actual position values for the measures and notes of the \r\n * System in preparation for rendering\r\n * @param\tsystem the system to calculate\r\n */\r\n computeActualSpacingValues(system) {\r\n let stacks = system.measureStacks;\r\n let numStacks = stacks.length;\r\n if (numStacks === 0) {\r\n return;\r\n }\r\n let sysWidth = this._standardSystemWidth - system.indent;\r\n let firstStack = stacks[0];\r\n let totalIndentSpace = firstStack.indentAsSystemLeader;\r\n let totalNoteIdealSpace = firstStack.idealWidth - firstStack.indent;\r\n for (let i = 1; i < numStacks; i++) {\r\n let stack = stacks[i];\r\n totalIndentSpace += stack.indent;\r\n totalNoteIdealSpace += stack.idealWidth - stack.indent;\r\n }\r\n let scale = (sysWidth - totalIndentSpace) / totalNoteIdealSpace;\r\n let hPos = 0;\r\n let stackIdealWidth;\r\n let stackIndent;\r\n for (let i = 0; i < numStacks; i++) {\r\n let stack = stacks[i];\r\n stack.startPosition = hPos;\r\n if (i === 0) {\r\n stackIdealWidth = stack.idealWidth - stack.indent + stack.indentAsSystemLeader;\r\n stackIndent = stack.indentAsSystemLeader;\r\n } else {\r\n stackIdealWidth = stack.idealWidth;\r\n stackIndent = stack.indent;\r\n }\r\n let newWidth = (stackIdealWidth - stackIndent) * scale + stackIndent;\r\n stack.width = newWidth;\r\n for (let ng of stack.noteGroups) {\r\n if (ng.visible === false) {\r\n ng.hPos = stackIndent;\r\n continue;\r\n }\r\n if (ng.isRest && ng.voice.noteGroups.length === 1) {\r\n ng.hPos = (newWidth + stackIndent - this._measureLeadIn) / 2;\r\n } else {\r\n ng.hPos = (ng.idealHPos + stackIndent - stackIndent) * scale + stackIndent;\r\n }\r\n }\r\n hPos += stack.width;\r\n }\r\n }\r\n /**\r\n * computes the ideal position of each note group and the ideal width of the\r\n * measure stack\r\n * @param\tstack the MeasureStack to compute\r\n */\r\n computeIdealSpacingForStack(stack) {\r\n let cTime = stack.noteGroups.length > 0 ? stack.noteGroups[0].qNoteTime : stack.startTime;\r\n let cPosition = 0;\r\n let clefDFB = this._score.scoreProperties.clefDistanceFromBarline;\r\n stack.indent = this._measureLeadIn;\r\n if (stack.newClef) {\r\n stack.indent += this._clefWidth + clefDFB;\r\n }\r\n if (stack.newKey) {\r\n stack.indent += stack.maxKeySize * this._keySigWidth + clefDFB;\r\n }\r\n let showTime = stack.measures[0].showTime;\r\n if (showTime) {\r\n stack.indent += this._timeSigWidth + clefDFB;\r\n }\r\n stack.indentAsSystemLeader = this._measureLeadIn + this._clefWidth + clefDFB;\r\n if (stack.maxKeySize > 0) {\r\n stack.indentAsSystemLeader += stack.maxKeySize * this._keySigWidth + clefDFB;\r\n }\r\n if (showTime) {\r\n stack.indentAsSystemLeader += this._timeSigWidth + clefDFB;\r\n }\r\n let repeatSpaceAtEnd = 0;\r\n if (stack.repeatDOs != null) {\r\n for (let rdo of stack.repeatDOs) {\r\n if (rdo.repeatDirection === RepeatDirection.FORWARD) {\r\n stack.indent += this._measureLeadIn;\r\n stack.indentAsSystemLeader += this._measureLeadIn;\r\n } else if (rdo.repeatDirection === RepeatDirection.BACKWARD) {\r\n repeatSpaceAtEnd = this._measureLeadIn;\r\n }\r\n }\r\n }\r\n cPosition = 0;\r\n const NORMAL_MIN_WHITE_SPACE = this._noteheadWidth * 1.3;\r\n const LYRIC_LETTER_SPACE = 0.9 * this._noteheadWidth;\r\n let newTimePositionDelta = 0;\r\n let firstNoteTime = cTime;\r\n let notesAtCurrentPos = [];\r\n let largestLeftExtension = 0;\r\n let largestRightExtension = 0;\r\n let prevRightExtension = 0;\r\n let minWhiteSpace;\r\n let noteGroups = stack.noteGroups;\r\n let numNoteGroups = noteGroups.length;\r\n for (let i = 0; i < numNoteGroups; i++) {\r\n let ng = noteGroups[i];\r\n if (ng.visible === false) {\r\n continue;\r\n }\r\n let ngLeftExtension = ng.numAccidentalLevels * this._noteheadWidth;\r\n if (ngLeftExtension > 0 && ng.qNoteTime === stack.startTime) {\r\n ngLeftExtension -= this._measureLeadIn / 2;\r\n }\r\n let ngRightExtension = 0;\r\n if (ng.clef != null) {\r\n ngLeftExtension += this._clefWidth + this._clefDistanceFromBarline;\r\n }\r\n if (ng.lyric != null) {\r\n let halfLyricWidth = ng.lyric.text.length * LYRIC_LETTER_SPACE / 2 - this._noteheadWidth / 2;\r\n ngRightExtension += halfLyricWidth;\r\n if (ng.qNoteTime !== stack.startTime) {\r\n if (halfLyricWidth > ngLeftExtension) {\r\n ngLeftExtension = halfLyricWidth;\r\n }\r\n } else {\r\n if (halfLyricWidth - this._measureLeadIn > ngLeftExtension) {\r\n ngLeftExtension = halfLyricWidth - this._measureLeadIn;\r\n }\r\n }\r\n }\r\n if (!ng.isRest && (ng.beamStates.length === 0 || ng.beamStates[0] === BeamState.NONE) && ng.duration < 1024 && ngRightExtension < 0.5 * this._noteheadWidth && ng.stemDirection === StemDirection.UP) {\r\n ngRightExtension = 0.5 * this._noteheadWidth;\r\n }\r\n if (ng.qNoteTime > cTime) {\r\n if (notesAtCurrentPos.length > 0) {\r\n minWhiteSpace = cTime > firstNoteTime ? NORMAL_MIN_WHITE_SPACE : 0;\r\n if (newTimePositionDelta - largestLeftExtension - prevRightExtension < minWhiteSpace) {\r\n cPosition += minWhiteSpace - (newTimePositionDelta - largestLeftExtension - prevRightExtension);\r\n for (let previousNG of notesAtCurrentPos) {\r\n previousNG.idealHPos = cPosition;\r\n }\r\n }\r\n prevRightExtension = largestRightExtension;\r\n }\r\n notesAtCurrentPos = [ng];\r\n largestLeftExtension = ngLeftExtension;\r\n largestRightExtension = ngRightExtension;\r\n newTimePositionDelta = this._qNoteWidth * Math.pow(\r\n _MusicSpacer.SPACING_FACTOR,\r\n Math.log(ng.qNoteTime - cTime) / Math.log(2)\r\n );\r\n cPosition += newTimePositionDelta;\r\n cTime = ng.qNoteTime;\r\n } else {\r\n notesAtCurrentPos.push(ng);\r\n if (ngLeftExtension > largestLeftExtension) {\r\n largestLeftExtension = ngLeftExtension;\r\n }\r\n if (ngRightExtension > largestRightExtension) {\r\n largestRightExtension = ngRightExtension;\r\n }\r\n }\r\n ng.idealHPos = cPosition;\r\n }\r\n if (notesAtCurrentPos.length > 0) {\r\n minWhiteSpace = cTime > firstNoteTime ? NORMAL_MIN_WHITE_SPACE : 0;\r\n if (newTimePositionDelta - largestLeftExtension - prevRightExtension < minWhiteSpace) {\r\n cPosition += minWhiteSpace - (newTimePositionDelta - largestLeftExtension - prevRightExtension);\r\n for (let previousNG of notesAtCurrentPos) {\r\n previousNG.idealHPos = cPosition;\r\n }\r\n }\r\n }\r\n if (stack.endTime > cTime) {\r\n let endSpace = repeatSpaceAtEnd + this._qNoteWidth * Math.pow(\r\n _MusicSpacer.SPACING_FACTOR,\r\n Math.log(stack.endTime - cTime) / Math.log(2)\r\n );\r\n if (endSpace < largestRightExtension) {\r\n endSpace = largestRightExtension;\r\n }\r\n stack.idealWidth = stack.indent + cPosition + endSpace;\r\n } else {\r\n stack.idealWidth = cPosition + stack.indent > this._minMeasureWidth ? cPosition + stack.indent : this._minMeasureWidth;\r\n console.log(\"probably shouldn't get here... MusicSpacer.computeIdealSpacingForStack()\");\r\n }\r\n }\r\n};\r\n/**the ratio of the horizontal spacing requirement of one note to another \r\n * note of half the first note's duration (a quarter gets X times as much \r\n * space as an eighth note)*/\r\n_MusicSpacer.SPACING_FACTOR = 1.4179;\r\nvar MusicSpacer = _MusicSpacer;\r\n\r\n// src/formatting/ScoreFormatter.ts\r\nvar ScoreFormatter = class {\r\n constructor(score = null) {\r\n this._score = score;\r\n if (score != null) {\r\n this.init();\r\n }\r\n }\r\n init() {\r\n this._musicSpacer = new MusicSpacer(this._score);\r\n this._beamer = new MusicBeamer();\r\n this._ngFormatter = new NoteGroupFormatter(this._score.scoreProperties);\r\n this._attachmentFormatter = new AttachmentFormatter(this._score);\r\n this._parts = this._score.parts;\r\n if (this._score.graceNotesNeedFixing) {\r\n this.correctGraceNoteStartTimes();\r\n this._score.graceNotesNeedFixing = false;\r\n }\r\n this.setPartList(null);\r\n }\r\n /** Sets the parts that will be worked with for formatting. If null, all \r\n * parts in the score will be used*/\r\n setPartList(parts = null) {\r\n this._parts = parts != null && parts.length > 0 ? parts : this._score.parts;\r\n this._parts.forEach((p) => p.visible = this._parts.indexOf(p) !== -1);\r\n this.updateMeasureStackNoteGroupsAndMeasures();\r\n }\r\n /** performs spacing and positioning algorithms on entire Score. This method\r\n * is \"intelligent,\" only updating the measures that need it.\r\n * [reflowMeasuresAcrossSystems] if true, the engine will calculate how \r\n * many measures should fit on each system\r\n * [measuresPerSystem] if greater than 0, this many measures will be \r\n * enforced per system (reflowMeasuresAcrossSystems must also be true)*/\r\n formatScore2(reflowMeasuresAcrossSystems, measuresPerSystem = 0) {\r\n this._musicSpacer.initializeScoreSettings();\r\n this._processUpdateRequests();\r\n if (reflowMeasuresAcrossSystems) {\r\n this._musicSpacer.groupMeasuresIntoSystems(measuresPerSystem);\r\n }\r\n this._getActualSpacingAndPositioning();\r\n }\r\n _processUpdateRequests() {\r\n let systems = this._score.getSystems();\r\n for (let system of systems) {\r\n if (system.needsRendering) {\r\n let stacks = system.measureStacks;\r\n for (let stack of stacks) {\r\n if (stack.needsRendering) {\r\n let measures = stack.measures;\r\n for (let measure of measures) {\r\n if (measure.notesNeedRendering) {\r\n this._beamer.getMeasureBeamGroupings(measure);\r\n this._ngFormatter.getMeasureStemDirections(\r\n measure\r\n );\r\n this._ngFormatter.getMeasureNoteheadOffsets(\r\n measure\r\n );\r\n }\r\n }\r\n this._musicSpacer.computeIdealSpacingValues(stack);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _getActualSpacingAndPositioning() {\r\n let systems = this._score.getSystems();\r\n for (let system of systems) {\r\n if (system.needsRendering) {\r\n this._musicSpacer.computeActualSpacingValues(system);\r\n this._ngFormatter.getSystemStemEndPositions(system);\r\n this._attachmentFormatter.formatAttachments(system);\r\n }\r\n }\r\n this._attachmentFormatter.formatLines();\r\n }\r\n /** adjusts the start times of grace notes so that they aren't identical to\r\n * the notes they precede*/\r\n correctGraceNoteStartTimes() {\r\n for (let part of this._parts) {\r\n for (let staff of part.staves) {\r\n for (let measure of staff.measures) {\r\n for (let voice of measure.voices) {\r\n let noteGroups = voice.noteGroups;\r\n let consecutiveGraceNotes = 0;\r\n let i = noteGroups.length - 1;\r\n let attachmentNG;\r\n while (i >= 0) {\r\n let ng = noteGroups[i];\r\n if (ng.isGrace) {\r\n consecutiveGraceNotes++;\r\n ng.qNoteTime -= consecutiveGraceNotes * 0.1;\r\n ng.attachmentNG = attachmentNG;\r\n } else {\r\n consecutiveGraceNotes = 0;\r\n attachmentNG = ng;\r\n }\r\n i--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n updateMeasureStackNoteGroupsAndMeasures() {\r\n let stacks = this._score.getMeasureStacks();\r\n let numMeasures = stacks.length;\r\n for (let stack2 of stacks) {\r\n stack2.clearNoteGroups();\r\n stack2.clearMeasures();\r\n stack2.maxKeySize = 0;\r\n }\r\n let stack;\r\n for (let part of this._parts) {\r\n for (let staff of part.staves) {\r\n if (!staff.visible)\r\n continue;\r\n let measures = staff.measures;\r\n for (let i = 0; i < numMeasures; i++) {\r\n stack = stacks[i];\r\n let measure = measures[i];\r\n stack.addNoteGroupsFromMeasure(measure);\r\n stack.addMeasure(measure);\r\n let totalKeySize = PitchUtils.getTotalKeySize(\r\n measure.displayKey,\r\n measure.outgoingKey\r\n );\r\n if (totalKeySize > stack.maxKeySize) {\r\n stack.maxKeySize = totalKeySize;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** performs spacing and positioning algorithms on entire Score\r\n * [reflowMeasuresAcrossSystems] if true, the engine will calculate how \r\n * many measures should fit on each system\r\n * [measuresPerSystem] if greater than 0, this many measures will be \r\n * enforced per system (reflowMeasuresAcrossSystems must also be true)*/\r\n formatScore(reflowMeasuresAcrossSystems, measuresPerSystem = 0) {\r\n if (reflowMeasuresAcrossSystems) {\r\n this._musicSpacer.groupMeasuresIntoSystems(measuresPerSystem);\r\n }\r\n let systems = this._score.getSystems();\r\n for (let system of systems) {\r\n this.formatSystem(system);\r\n }\r\n }\r\n /** performs spacing and positioning algorithms on one System*/\r\n formatSystem(system) {\r\n this._beamer.getSystemBeamGroupings(system);\r\n this._ngFormatter.getSystemStemDirections(system);\r\n this._ngFormatter.getSystemNoteheadOffsets(system);\r\n this._musicSpacer.computeActualSpacingValues(system);\r\n this._ngFormatter.getSystemStemEndPositions(system);\r\n }\r\n /** gets and sets the Score object - running initialization tasks when set*/\r\n get score() {\r\n return this._score;\r\n }\r\n set score(value) {\r\n this._score = value;\r\n this.init();\r\n }\r\n};\r\n\r\n// src/musicXML/MusicXmlParser2.ts\r\nvar MusicXmlParser2 = class {\r\n constructor() {\r\n this._getMusicXMLObject = () => {\r\n try {\r\n let parser = new DOMParser();\r\n this._musicXML = parser.parseFromString(\r\n this._musicXMLString,\r\n \"application/xml\"\r\n ).querySelector(\"score-partwise\");\r\n this._musicXMLString = null;\r\n } catch (e) {\r\n this._rejectCompleter(e);\r\n return;\r\n }\r\n setTimeout(this._parseXML);\r\n };\r\n this._parseXML = () => {\r\n try {\r\n this._lastPauseMsTime = Date.now();\r\n this._midiInstrumentsXMLList = null;\r\n this._measureStacks = null;\r\n this._currentTuplets = null;\r\n this._currentSlurs = null;\r\n this._currentPage = null;\r\n this._currentSystem = null;\r\n this._currentStack = null;\r\n this._score = new Score();\r\n let defaultsEl = this._musicXML.querySelector(\"defaults\");\r\n this._score.scoreProperties = this.getScoreProperties(defaultsEl);\r\n let rightsEl = this._musicXML.querySelector(\r\n \"identification > rights\"\r\n );\r\n this._score.scoreProperties.rights = rightsEl != null ? rightsEl.textContent : null;\r\n if (this._overrideScoreProps) {\r\n this._score.scoreProperties = this._requestedScoreProps != null ? this._requestedScoreProps : ScoreProperties.getNewScoreProperties();\r\n }\r\n let softwareEl = this._musicXML.querySelector(\r\n \"identification > encoding > software\"\r\n );\r\n if (softwareEl != null) {\r\n this._score.scoreProperties.software = softwareEl.textContent;\r\n }\r\n this._score.graceNotesNeedFixing = true;\r\n this._getMusicData();\r\n } catch (e) {\r\n this._rejectCompleter(e);\r\n }\r\n };\r\n this._processNextMeasure = () => {\r\n try {\r\n if (this._measureIndex >= this._measureXMLList.length) {\r\n this._checkPartForErrors(this._cPart);\r\n this._processNextPart();\r\n return false;\r\n }\r\n let measureXML = this._measureXMLList[this._measureIndex];\r\n for (let staff of this._cPart.staves) {\r\n let prevMeasure = staff.measures.length > 0 ? staff.measures[staff.measures.length - 1] : null;\r\n this._measure = this._createNewMeasure(\r\n measureXML,\r\n prevMeasure,\r\n this._measureIndex\r\n );\r\n if (this._score.parts.length === 1) {\r\n this._measure.stack.startTime = this._passedTimeDPQ / this._cPartDPQ;\r\n this._measure.stack.endTime = this._measure.stack.startTime + this._measure.numBeats * (4 / this._measure.beatType);\r\n }\r\n staff.addMeasure(this._measure);\r\n }\r\n let cVoice = null;\r\n let cNoteGroup = null;\r\n let midMeasureClef = null;\r\n let dpqPositionBeforeBackup = 0;\r\n let staffIndex = 0;\r\n for (let node of measureXML.childNodes) {\r\n if (!(node instanceof Element)) {\r\n continue;\r\n }\r\n let element = node;\r\n let elemName = element.tagName.toString();\r\n let noteXML;\r\n if (elemName === \"note\") {\r\n noteXML = element;\r\n } else if (elemName === \"backup\") {\r\n dpqPositionBeforeBackup = this._passedTimeDPQ;\r\n this._passedTimeDPQ -= this._eint(element, \"duration\");\r\n continue;\r\n } else if (elemName === \"forward\") {\r\n this._passedTimeDPQ += this._eint(element, \"duration\");\r\n continue;\r\n } else if (this._estr(element, \"clef\") !== \"\") {\r\n for (let clefXML of element.querySelectorAll(\"clef\")) {\r\n let clef = new Clef();\r\n let line = this._eint(clefXML, \"line\");\r\n clef.type = ClefType.getClefType(\r\n this._estr(clefXML, \"sign\"),\r\n line\r\n );\r\n clef.isNew = true;\r\n clef.show = true;\r\n staffIndex = clefXML.getAttribute(\"number\") != null ? Number.parseInt(\r\n clefXML.getAttribute(\"number\")\r\n ) - 1 : 0;\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let targetMeasure = staffMsrs[staffMsrs.length - 1];\r\n let noteHasBeenAdded = false;\r\n for (let voice of targetMeasure.voices) {\r\n if (voice.noteGroups.length > 0) {\r\n noteHasBeenAdded = true;\r\n break;\r\n }\r\n }\r\n if (noteHasBeenAdded) {\r\n targetMeasure.clefs.push(clef);\r\n midMeasureClef = clef;\r\n clef.qNoteTime = this._passedTimeDPQ / this._cPartDPQ;\r\n } else {\r\n clef.qNoteTime = targetMeasure.stack.startTime;\r\n if (targetMeasure.clefs.length === 0) {\r\n targetMeasure.clefs.push(clef);\r\n } else {\r\n targetMeasure.clefs[0] = clef;\r\n }\r\n targetMeasure.stack.newClef = true;\r\n if (targetMeasure.stack.newSystem) {\r\n clef.show = true;\r\n clef.smallSize = false;\r\n }\r\n }\r\n }\r\n continue;\r\n } else if (elemName === \"sound\") {\r\n if (element.getAttribute(\"tempo\") != null) {\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let targetStack = staffMsrs[staffMsrs.length - 1].stack;\r\n this._createTempoMarker(\r\n element,\r\n this._passedTimeDPQ / this._cPartDPQ,\r\n targetStack,\r\n null\r\n );\r\n }\r\n continue;\r\n } else if (elemName === \"direction\") {\r\n if (element.querySelectorAll(\r\n \"direction-type dynamics\"\r\n ).length > 0) {\r\n staffIndex = this._estr(element, \"staff\") !== \"\" ? this._eint(element, \"staff\") - 1 : 0;\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let targetMeasure = staffMsrs[staffMsrs.length - 1];\r\n let dyn = new Dynamic();\r\n dyn.type = element.querySelector(\"direction-type dynamics *\").tagName;\r\n dyn.isAbove = element.getAttribute(\"placement\") === \"above\";\r\n dyn.baseline = dyn.isAbove ? -2 : 6;\r\n dyn.qNoteTime = (this._eint(element, \"offset\") + this._passedTimeDPQ) / this._cPartDPQ;\r\n dyn.volume = DynamicType.getVolumeByType(dyn.type);\r\n dyn.measure = targetMeasure;\r\n dyn.width = this._score.scoreProperties.noteheadWidth * dyn.type.length;\r\n dyn.height = 2;\r\n if (targetMeasure.attachments != null) {\r\n targetMeasure.attachments.push(dyn);\r\n } else {\r\n targetMeasure.attachments = [dyn];\r\n }\r\n } else if (element.querySelector(\"sound[tempo]\") != null) {\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let targetStack = staffMsrs[staffMsrs.length - 1].stack;\r\n let metronomeEl = element.querySelector(\r\n \"direction-type > metronome\"\r\n );\r\n this._createTempoMarker(\r\n element.querySelector(\"sound\"),\r\n this._passedTimeDPQ / this._cPartDPQ,\r\n targetStack,\r\n metronomeEl\r\n );\r\n } else if (element.querySelectorAll(\r\n \"direction-type words\"\r\n ).length > 0) {\r\n let words = element.querySelector(\r\n \"direction-type words\"\r\n ).textContent;\r\n if (words[0] === \"{\" && words[words.length - 1] === \"}\") {\r\n staffIndex = this._estr(element, \"staff\") !== \"\" ? this._eint(element, \"staff\") - 1 : 0;\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let targetMeasure = staffMsrs[staffMsrs.length - 1];\r\n let instruction = new MeasureInstruction();\r\n instruction.text = words;\r\n instruction.qNoteTime = (this._eint(element, \"offset\") + this._passedTimeDPQ) / this._cPartDPQ;\r\n if (targetMeasure.attachments != null) {\r\n targetMeasure.attachments.push(instruction);\r\n } else {\r\n targetMeasure.attachments = [instruction];\r\n }\r\n }\r\n }\r\n continue;\r\n } else if (elemName === \"barline\" && this._cPart === this._score.parts[0]) {\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let targetStack = staffMsrs[staffMsrs.length - 1].stack;\r\n if (targetStack.barline == null) {\r\n let barline = new Barline();\r\n barline.location = BarlineLocation.getLocation(\r\n element.getAttribute(\"location\")\r\n );\r\n let styleEl = element.querySelector(\"bar-style\");\r\n barline.style = styleEl != null ? BarlineStyle.getStyle(styleEl.textContent) : BarlineStyle.getStyle(null);\r\n targetStack.barline = barline;\r\n }\r\n let repeatEl = element.querySelector(\"repeat\");\r\n let endingEl = element.querySelector(\"ending\");\r\n if ((repeatEl != null || endingEl != null) && targetStack.repeatDOs == null) {\r\n targetStack.repeatDOs = [];\r\n }\r\n if (repeatEl != null) {\r\n let repeatDO = new RepeatDO();\r\n repeatDO.repeatDirection = RepeatDirection.getDirection(\r\n repeatEl.getAttribute(\"direction\")\r\n );\r\n let repeatTimesStr = repeatEl.getAttribute(\"times\");\r\n repeatDO.repeatTimes = repeatTimesStr != null ? Number.parseInt(repeatTimesStr) - 1 : 1;\r\n targetStack.repeatDOs.push(repeatDO);\r\n }\r\n if (endingEl != null) {\r\n let repeatDO = new RepeatDO();\r\n repeatDO.endingNumber = endingEl.getAttribute(\"number\");\r\n repeatDO.endingType = EndingType.getType(endingEl.getAttribute(\"type\"));\r\n targetStack.repeatDOs.push(repeatDO);\r\n }\r\n continue;\r\n } else if (elemName === \"harmony\") {\r\n let staffMsrs = this._cPart.staves[staffIndex].measures;\r\n let cMeasure2 = staffMsrs[staffMsrs.length - 1];\r\n this._processHarmonyEl(element, cMeasure2);\r\n continue;\r\n } else {\r\n continue;\r\n }\r\n let staffNum = noteXML.querySelector(\"staff\") == null ? 1 : this._eint(noteXML, \"staff\");\r\n let cStaff = this._cPart.staves[staffNum - 1];\r\n let cMeasure = cStaff.measures[cStaff.measures.length - 1];\r\n let voiceNum = this._eint(noteXML, \"voice\");\r\n cVoice = cMeasure.getVoiceByNumber(voiceNum);\r\n if (noteXML.querySelector(\"chord\") == null) {\r\n cNoteGroup = this._createNoteGroup(noteXML, cMeasure);\r\n cVoice.addNoteGroup(cNoteGroup);\r\n cNoteGroup.qNoteTime = this._passedTimeDPQ / this._cPartDPQ;\r\n cNoteGroup.qNoteDuration = cNoteGroup.duration / this._cPartDPQ;\r\n this._passedTimeDPQ += cNoteGroup.duration;\r\n cNoteGroup.duration = DurationType.getDurationValue(\r\n cNoteGroup.durationType,\r\n cNoteGroup.numDots\r\n );\r\n if (midMeasureClef != null && midMeasureClef.qNoteTime <= cNoteGroup.qNoteTime) {\r\n cNoteGroup.clef = midMeasureClef;\r\n midMeasureClef = null;\r\n }\r\n }\r\n if (!cNoteGroup.isRest) {\r\n let cNote = this._createNote(noteXML, cNoteGroup, cMeasure);\r\n cNoteGroup.insertNote(cNote);\r\n if (cNoteGroup.notes.length === 1) {\r\n cNoteGroup.stemStartPos = cNote.vPos;\r\n } else {\r\n if (cNote.hPos !== 0) {\r\n cNoteGroup.stemHPos = this._score.scoreProperties.noteheadWidth;\r\n }\r\n cNoteGroup.stemStartPos = cNoteGroup.stemDirection === StemDirection.UP ? cNoteGroup.notes[0].vPos : cNoteGroup.notes[cNoteGroup.notes.length - 1].vPos;\r\n }\r\n }\r\n }\r\n if (!this._measure.stack.isPickup) {\r\n this._passedTimeDPQ = Math.round(this._measure.stack.endTime * this._cPartDPQ);\r\n } else if (this._passedTimeDPQ < dpqPositionBeforeBackup) {\r\n this._passedTimeDPQ = Math.round(dpqPositionBeforeBackup);\r\n }\r\n if (this._score.parts.length === 1) {\r\n this._measure.stack.endTime = this._passedTimeDPQ / this._cPartDPQ;\r\n }\r\n for (let staff of this._cPart.staves) {\r\n this._updateMeasureBeatGroups(\r\n staff.measures[this._measureIndex]\r\n );\r\n }\r\n this._measureIndex++;\r\n return true;\r\n } catch (e) {\r\n console.log(`parse fail on measureIndex: ${this._measureIndex}`);\r\n this._rejectCompleter(e);\r\n return;\r\n }\r\n };\r\n }\r\n //////////////////////////XML UTILITY METHODS////////////////////////\r\n /**get element's text as number*/\r\n _enum(el, selector, zeroIfNull = true) {\r\n let e = el.querySelector(selector);\r\n if (e == null) {\r\n return zeroIfNull ? 0 : null;\r\n } else {\r\n return e.textContent !== \"\" ? Number.parseFloat(e.textContent) : 0;\r\n }\r\n }\r\n /**get element's text as an integer*/\r\n _eint(el, selector, zeroIfNull = true) {\r\n let e = el.querySelector(selector);\r\n if (e == null) {\r\n return zeroIfNull ? 0 : null;\r\n } else {\r\n return e.textContent !== \"\" ? Number.parseInt(e.textContent) : 0;\r\n }\r\n }\r\n /**get element's text as string*/\r\n _estr(el, selector, emptyStringIfNull = true) {\r\n let e = el.querySelector(selector);\r\n if (e == null) {\r\n return emptyStringIfNull ? \"\" : null;\r\n } else {\r\n return e.textContent;\r\n }\r\n }\r\n /**get the attribute text as an integer*/\r\n _aint(el, attribute, zeroIfNull = true) {\r\n let val = el.getAttribute(attribute);\r\n if (val == null) {\r\n return zeroIfNull ? 0 : null;\r\n } else {\r\n return val !== \"\" ? Number.parseInt(val) : 0;\r\n }\r\n }\r\n /**get the attribute text as a number*/\r\n _anum(el, attribute, zeroIfNull = true) {\r\n let val = el.getAttribute(attribute);\r\n if (val == null) {\r\n return zeroIfNull ? 0 : null;\r\n } else {\r\n return val !== \"\" ? Number.parseFloat(val) : 0;\r\n }\r\n }\r\n /**returns the numeric equivalent of a string, returning 0 if the string is \r\n *null or \"\"*/\r\n _s2n(str) {\r\n return str !== \"\" && str != null ? Number.parseFloat(str) : 0;\r\n }\r\n /////////////////////////////////////////////////////////////////////\r\n /**\r\n * parses the passed in Music XML file into a nEngine.data.containers.Score \r\n * object Dispatches a FINISHED_PARSING event when done - access score via \r\n * score property\r\n * @param\tmusicXML an XML object in the Music XML format\r\n * @param \tcomputeMaxKeySizeForRendering if true, max key sizes will be \r\n * computed for each measure stack - \r\n * \t\tleave false if you plan on using the formatter (which does this \r\n * anyway)\r\n * @param\toverrideScoreProps if true, when a score is loaded, default \r\n * score properties are set before parsing instead of the settings from the\r\n * XML\r\n */\r\n parseXML(musicXMLString, computeMaxKeySizeForRendering = true, overrideScoreProps = false, scoreProps = null) {\r\n return new Promise((resolve, reject) => {\r\n this._resolveCompleter = resolve;\r\n this._rejectCompleter = reject;\r\n this._musicXMLString = musicXMLString;\r\n this._computeMaxKeySizeForRendering = computeMaxKeySizeForRendering;\r\n this._overrideScoreProps = overrideScoreProps;\r\n this._requestedScoreProps = scoreProps;\r\n setTimeout(this._getMusicXMLObject);\r\n });\r\n }\r\n getScoreProperties(defEl) {\r\n if (defEl == null) {\r\n return ScoreProperties.getNewScoreProperties();\r\n }\r\n let sProps = ScoreProperties.getNewScoreProperties();\r\n let mm = this._enum(defEl, \"scaling millimeters\");\r\n let tenths = this._enum(defEl, \"scaling tenths\");\r\n const pixelsPerMillimeter = 4;\r\n sProps.pixelsPerSpace = mm / tenths * pixelsPerMillimeter * 10;\r\n sProps.pageHeight = this._enum(defEl, \"page-layout page-height\") / 10;\r\n sProps.pageWidth = this._enum(defEl, \"page-layout page-width\") / 10;\r\n sProps.leftPageMargin = this._enum(\r\n defEl,\r\n \"page-layout page-margins left-margin\"\r\n ) / 10;\r\n sProps.rightPageMargin = this._enum(\r\n defEl,\r\n \"page-layout page-margins right-margin\"\r\n ) / 10;\r\n sProps.topPageMargin = this._enum(\r\n defEl,\r\n \"page-layout page-margins top-margin\"\r\n ) / 10;\r\n sProps.bottomPageMargin = this._enum(\r\n defEl,\r\n \"page-layout page-margins bottom-margin\"\r\n ) / 10;\r\n sProps.systemSpacing = this._enum(\r\n defEl,\r\n \"system-layout system-distance\"\r\n ) / 10;\r\n sProps.topSystemDistance = this._enum(\r\n defEl,\r\n \"system-layout top-system-distance\"\r\n ) / 10;\r\n sProps.leftSystemMargin = this._enum(\r\n defEl,\r\n \"system-layout system-margins left-margin\"\r\n ) / 10;\r\n sProps.rightSystemMargin = this._enum(\r\n defEl,\r\n \"system-layout system-margins right-margin\"\r\n ) / 10;\r\n sProps.staffSpacing = this._enum(\r\n defEl,\r\n \"staff-layout staff-distance\"\r\n ) / 10;\r\n if (sProps.staffSpacing === 0) {\r\n sProps.staffSpacing = 8;\r\n }\r\n defEl.querySelectorAll(\"appearance line-width\").forEach((el) => {\r\n switch (el.getAttribute(\"type\")) {\r\n case \"stem\":\r\n sProps.stemWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"beam\":\r\n sProps.beamWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"staff\":\r\n sProps.staffLineWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"light barline\":\r\n sProps.lightBarlineWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"heavy barline\":\r\n sProps.heavyBarlineWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"leger\":\r\n sProps.legerLineWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"ending\":\r\n sProps.repeatEndingWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"wedge\":\r\n sProps.hairpinLineWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"enclosure\":\r\n sProps.enclosureWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n case \"tuplet bracket\":\r\n sProps.tupletBracketWidth = this._s2n(el.textContent) / 10;\r\n break;\r\n }\r\n });\r\n defEl.querySelectorAll(\"appearance note-size\").forEach((el) => {\r\n switch (el.getAttribute(\"type\")) {\r\n case \"grace\":\r\n sProps.graceNoteSize = this._s2n(el.textContent);\r\n break;\r\n case \"cue\":\r\n sProps.cueNoteSize = this._s2n(el.textContent);\r\n break;\r\n }\r\n });\r\n return sProps;\r\n }\r\n _getMusicData() {\r\n this._buildInstrumentsXMLList();\r\n this._measureStacks = [];\r\n this._currentTuplets = [];\r\n this._currentSlurs = [];\r\n this._calculatePartVolumes();\r\n this._cPartIndex = 0;\r\n this._partXMLList = this._musicXML.querySelectorAll(\r\n \"score-partwise > part\"\r\n );\r\n this._processNextPart();\r\n }\r\n _buildInstrumentsXMLList() {\r\n this._midiInstrumentsXMLList = this._musicXML.querySelectorAll(\r\n \"part-list score-part midi-instrument\"\r\n );\r\n }\r\n _calculatePartVolumes() {\r\n this._partVol = Math.min(1 / this._musicXML.querySelectorAll(\r\n \"score-partwise > part\"\r\n ).length, 0.15);\r\n }\r\n _processNextPart() {\r\n if (this._cPartIndex >= this._partXMLList.length) {\r\n if (this._computeMaxKeySizeForRendering) {\r\n this._computeMaxKeySizes();\r\n }\r\n this._adjustMeasureLengthsToFitNotes();\r\n this._checkScoreForErrors();\r\n this._resolveCompleter(this._score);\r\n return;\r\n }\r\n this._partXML = this._partXMLList[this._cPartIndex];\r\n this._cPartIndex++;\r\n this._removeIncompleteSlurs();\r\n this._cPart = this._createPartObj();\r\n this._cPartDPQ = this._eint(\r\n this._partXML,\r\n \"measure attributes divisions\"\r\n );\r\n this._passedTimeDPQ = 0;\r\n if (this._createStavesForPart() === false) {\r\n this._processNextPart();\r\n return;\r\n }\r\n this._measureIndex = 0;\r\n this._measureXMLList = this._partXML.querySelectorAll(\"measure\");\r\n this._measure = null;\r\n let moreMeasures = true;\r\n while (moreMeasures) {\r\n moreMeasures = this._processNextMeasure();\r\n }\r\n }\r\n _runTimeout() {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(resolve);\r\n });\r\n }\r\n _removeIncompleteSlurs() {\r\n for (let slur of this._currentSlurs) {\r\n let index = slur.firstNote.slurs.indexOf(slur);\r\n slur.firstNote.slurs.splice(index, 1);\r\n if (slur.firstNote.slurs.length === 0) {\r\n slur.firstNote.slurs = null;\r\n }\r\n }\r\n this._currentSlurs = [];\r\n }\r\n _createPartObj() {\r\n let staffName = \"\";\r\n let abbrName = \"\";\r\n let midiPreset = 0;\r\n let midiChannel = 1;\r\n Array.from(this._musicXML.querySelectorAll(\"part-list score-part\")).filter((el) => el.getAttribute(\"id\") === this._partXML.getAttribute(\"id\")).forEach((scorePartEl) => {\r\n staffName = this._estr(scorePartEl, \"part-name\");\r\n abbrName = this._estr(scorePartEl, \"part-abbreviation\");\r\n midiPreset = this._eint(\r\n scorePartEl,\r\n \"midi-instrument midi-program\"\r\n );\r\n let channel = this._eint(\r\n scorePartEl,\r\n \"midi-instrument midi-channel\"\r\n );\r\n if (channel > 0) {\r\n midiChannel = channel;\r\n }\r\n });\r\n let partId = `P${this._score.parts.length + 1}`;\r\n let cPart = new Part(partId, staffName, abbrName);\r\n cPart.volume = this._partVol;\r\n cPart.midiChannel = midiChannel;\r\n cPart.midiPreset = midiPreset - 1;\r\n if (cPart.midiPreset < 0)\r\n cPart.midiPreset = 0;\r\n this._score.addPart(cPart);\r\n return cPart;\r\n }\r\n _createStavesForPart() {\r\n let measuresXML = this._partXML.querySelectorAll(\"part > measure\");\r\n if (measuresXML.length > 0) {\r\n let measureXML = measuresXML[0];\r\n let numStaves = this._eint(measureXML, \"attributes staves\");\r\n if (numStaves < 1) {\r\n numStaves = 1;\r\n }\r\n for (let i = 0; i < numStaves; i++) {\r\n this._cPart.addStaff(new Staff());\r\n }\r\n if (this._estr(measureXML, \"attributes transpose\") !== \"\") {\r\n let transXml = measureXML.querySelector(\"attributes transpose\");\r\n let diatonicTrans = -1 * this._eint(transXml, \"diatonic\");\r\n let chromaticTrans = -1 * this._eint(transXml, \"chromatic\");\r\n if (transXml.querySelector(\"octave-change\") != null) {\r\n let numOctaves = this._eint(transXml, \"octave-change\");\r\n diatonicTrans += -7 * numOctaves;\r\n chromaticTrans += -12 * numOctaves;\r\n }\r\n this._cPart.setTransposition(\r\n diatonicTrans,\r\n chromaticTrans,\r\n false\r\n );\r\n }\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n _processHarmonyEl(el, measure) {\r\n let rootEl = el.querySelector(\"root\");\r\n if (rootEl == null) {\r\n return;\r\n }\r\n let pitchName = rootEl.querySelector(\"root-step\")?.textContent;\r\n if (pitchName == null) {\r\n return;\r\n }\r\n let offset = this._eint(el, \"offset\");\r\n let symbol = new ChordSymbol();\r\n symbol.qNoteTime = (this._passedTimeDPQ + offset) / this._cPartDPQ;\r\n symbol.isAbove = true;\r\n symbol.rootName = pitchName;\r\n symbol.rootAlteration = this._eint(rootEl, \"root-alter\");\r\n let bassEl = el.querySelector(\"bass\");\r\n if (bassEl != null) {\r\n symbol.bassName = bassEl.querySelector(\"bass-step\")?.textContent;\r\n symbol.bassAlteration = this._eint(bassEl, \"bass-alter\");\r\n }\r\n let kindEl = el.querySelector(\"kind\");\r\n if (kindEl != null) {\r\n symbol.type = kindEl.textContent;\r\n symbol.displayType = kindEl.getAttribute(\"text\") ?? \"\";\r\n }\r\n let degreeEl = el.querySelector(\"degree\");\r\n if (degreeEl != null) {\r\n let degree = new ChordSymbolDegree();\r\n degree.value = this._eint(degreeEl, \"degree-value\");\r\n degree.alteration = this._eint(degreeEl, \"degree-alter\");\r\n degree.type = degreeEl.querySelector(\"degree-type\")?.textContent;\r\n degree.displayText = degreeEl.querySelector(\"degree-type\")?.getAttribute(\"text\");\r\n symbol.degrees.push(degree);\r\n }\r\n symbol.baseline = -2;\r\n symbol.calculateHeight(this._score.scoreProperties.chordSymbolFontHeight);\r\n measure.attachments.push(symbol);\r\n }\r\n _createNewMeasure(measureXML, previousMeasure, measureIndex) {\r\n let measure = new Measure();\r\n let reParentedMidMeasureClef = false;\r\n if (previousMeasure != null) {\r\n measure.diatonicTransposition = previousMeasure.diatonicTransposition;\r\n measure.chromaticTransposition = previousMeasure.chromaticTransposition;\r\n measure.concertKey = previousMeasure.concertKey;\r\n measure.displayKey = previousMeasure.displayKey;\r\n measure.isMajorKey = previousMeasure.isMajorKey;\r\n measure.numBeats = previousMeasure.numBeats;\r\n measure.beatType = previousMeasure.beatType;\r\n measure.beatGroups = previousMeasure.beatGroups.slice(0);\r\n measure.subBeatGroups = previousMeasure.subBeatGroups.slice(0);\r\n let prevClef = previousMeasure.clefs[previousMeasure.clefs.length - 1];\r\n if (prevClef.qNoteTime === previousMeasure.stack.endTime) {\r\n measure.clefs.push(previousMeasure.clefs.splice(\r\n previousMeasure.clefs.length - 1,\r\n 1\r\n )[0]);\r\n prevClef.qNoteTime = previousMeasure.stack.endTime;\r\n prevClef.isNew = true;\r\n reParentedMidMeasureClef = true;\r\n } else {\r\n let clef = new Clef();\r\n clef.type = prevClef.type;\r\n clef.qNoteTime = previousMeasure.stack.endTime;\r\n if (measure.clefs.length === 0) {\r\n measure.clefs.push(clef);\r\n } else {\r\n measure.clefs[0] = clef;\r\n }\r\n }\r\n } else {\r\n let clef = new Clef();\r\n clef.type = ClefType.TREBLE;\r\n clef.qNoteTime = 0;\r\n clef.show = true;\r\n clef.smallSize = false;\r\n measure.clefs.push(clef);\r\n }\r\n let stack = null;\r\n if (this._measureStacks.length > measureIndex) {\r\n stack = this._measureStacks[measureIndex];\r\n } else {\r\n stack = new MeasureStack();\r\n try {\r\n stack.number = Number.parseInt(\r\n measureXML.getAttribute(\"number\")\r\n );\r\n } catch (e) {\r\n if (this._measureStacks.length > 1 && this._measureStacks[0].isPickup || measureXML.getAttribute(\"implicit\") === \"yes\") {\r\n stack.number = measureIndex;\r\n } else {\r\n stack.number = measureIndex + 1;\r\n }\r\n }\r\n if (measureXML.getAttribute(\"implicit\") === \"yes\" && stack.number === 0) {\r\n stack.isPickup = true;\r\n }\r\n stack.startPosition = previousMeasure != null ? previousMeasure.stack.width + previousMeasure.stack.startPosition : 0;\r\n stack.width = measureXML.getAttribute(\"width\") != null ? Number.parseFloat(measureXML.getAttribute(\"width\")) : 0;\r\n if (this._currentStack != null) {\r\n this._currentStack.next = stack;\r\n stack.previous = this._currentStack;\r\n }\r\n }\r\n this._currentStack = stack;\r\n measure.stack = stack;\r\n if (reParentedMidMeasureClef) {\r\n stack.newClef = true;\r\n }\r\n stack.addMeasure(measure);\r\n if (stack.systemRef != null) {\r\n this._currentSystem = stack.systemRef;\r\n }\r\n let page;\r\n let system;\r\n if (measureXML.querySelector(\"print\") != null || this._measureStacks.length === 0) {\r\n if (this._estr(measureXML, \"print page-number\") !== \"\" || Array.from(measureXML.querySelectorAll(\"print\")).filter(\r\n (e) => e.getAttribute(\"new-page\") === \"yes\"\r\n ).length > 0 || measureIndex === 0) {\r\n if (stack.systemRef == null || !stack.systemRef.newPage) {\r\n page = new Page();\r\n system = new System(this._score.scoreProperties);\r\n page.addSystem(system);\r\n this._score.addPage(page);\r\n if (this._currentPage != null) {\r\n this._currentPage.next = page;\r\n this._currentSystem.next = system;\r\n page.previous = this._currentPage;\r\n system.previous = this._currentSystem;\r\n }\r\n this._currentPage = page;\r\n this._currentSystem = system;\r\n system.newPage = true;\r\n stack.newSystem = true;\r\n stack.startPosition = 0;\r\n }\r\n } else if (Array.from(measureXML.querySelectorAll(\"print\")).filter(\r\n (e) => e.getAttribute(\"new-system\") === \"yes\"\r\n ).length > 0) {\r\n if (!stack.newSystem) {\r\n system = new System(this._score.scoreProperties);\r\n this._currentPage.addSystem(system);\r\n if (this._currentSystem != null) {\r\n this._currentSystem.next = system;\r\n system.previous = this._currentSystem;\r\n }\r\n this._currentSystem = system;\r\n stack.newSystem = true;\r\n stack.startPosition = 0;\r\n }\r\n }\r\n if (!this._overrideScoreProps) {\r\n let val = this._enum(\r\n measureXML,\r\n \"system-layout system-margins left-margin\"\r\n );\r\n if (val !== 0) {\r\n this._currentSystem.indent = val / 10;\r\n }\r\n }\r\n }\r\n if (this._measureStacks.length <= measureIndex) {\r\n this._currentSystem.addMeasureStack(stack, false);\r\n this._measureStacks.push(stack);\r\n }\r\n if (stack.newSystem) {\r\n if (measure.clefs.length > 0) {\r\n measure.clefs[0].show = true;\r\n measure.clefs[0].smallSize = false;\r\n }\r\n measure.showKey = true;\r\n }\r\n let attXML = measureXML.querySelector(\"attributes\");\r\n if (attXML != null) {\r\n if (attXML.querySelector(\"transpose\") != null) {\r\n measure.diatonicTransposition = -1 * this._eint(\r\n attXML,\r\n \"transpose diatonic\"\r\n );\r\n measure.chromaticTransposition = -1 * this._eint(\r\n attXML,\r\n \"transpose chromatic\"\r\n );\r\n if (attXML.querySelector(\"transpose octave-change\") != null) {\r\n let numOctaves = this._eint(\r\n attXML,\r\n \"transpose octave-change\"\r\n );\r\n measure.diatonicTransposition += -7 * numOctaves;\r\n measure.chromaticTransposition += -12 * numOctaves;\r\n }\r\n }\r\n if (this._estr(attXML, \"key fifths\") !== \"\") {\r\n let keyXML = attXML.querySelector(\"key\");\r\n measure.displayKey = this._eint(keyXML, \"fifths\");\r\n measure.concertKey = measure.displayKey - PitchUtils.getKeySigAlterationForTransposition(\r\n measure.diatonicTransposition,\r\n measure.chromaticTransposition\r\n );\r\n measure.outgoingKey = previousMeasure != null ? previousMeasure.displayKey : 0;\r\n if (keyXML.querySelector(\"mode\") != null) {\r\n let mode = this._estr(keyXML, \"mode\").toLowerCase();\r\n measure.isMajorKey = mode === \"major\" || mode === \"(unknown)\";\r\n } else {\r\n measure.isMajorKey = true;\r\n }\r\n measure.showKey = true;\r\n stack.newKey = true;\r\n }\r\n if (this._estr(attXML, \"time beats\") !== \"\") {\r\n let timeXML = attXML.querySelector(\"time\");\r\n measure.numBeats = this._eint(timeXML, \"beats\");\r\n measure.beatType = this._eint(timeXML, \"beat-type\");\r\n measure.showTime = true;\r\n }\r\n }\r\n return measure;\r\n }\r\n _updateMeasureBeatGroups(measure) {\r\n let beatGroups = [];\r\n let subBeatGroups = [];\r\n if (!measure.stack.isPickup) {\r\n for (let i = 0; i < measure.numBeats; i++) {\r\n let beatType = measure.beatType;\r\n if (beatType % 8 !== 0) {\r\n let beat = i * (4 / beatType);\r\n beatGroups.push(beat);\r\n subBeatGroups.push(beat + 2 / beatType);\r\n } else if (i % 3 === 0) {\r\n let beat = i * (4 / beatType);\r\n beatGroups.push(beat);\r\n subBeatGroups.push(beat + 4 / beatType);\r\n subBeatGroups.push(beat + 8 / beatType);\r\n }\r\n }\r\n } else {\r\n let stack = measure.stack;\r\n let stackQNoteDuration = stack.endTime - stack.startTime;\r\n let beatType = measure.beatType;\r\n let beatDur = beatType % 8 === 0 ? 3 * 4 / beatType : 4 / beatType;\r\n let qNotePos = stackQNoteDuration - beatDur;\r\n while (qNotePos > 0) {\r\n beatGroups.splice(0, 0, qNotePos);\r\n qNotePos -= beatDur;\r\n }\r\n }\r\n measure.beatGroups = beatGroups;\r\n measure.subBeatGroups = subBeatGroups;\r\n }\r\n _createNoteGroup(noteXML, cMeasure) {\r\n let noteGroup = new NoteGroup();\r\n if (noteXML.getAttribute(\"print-object\") === \"no\") {\r\n noteGroup.visible = false;\r\n }\r\n if (noteXML.querySelector(\"duration\") != null) {\r\n noteGroup.duration = this._eint(noteXML, \"duration\");\r\n } else {\r\n noteGroup.duration = 0;\r\n }\r\n noteGroup.durationType = noteXML.querySelector(\"type\") != null ? DurationType.getDurationType(this._estr(noteXML, \"type\")) : DurationType.WHOLE;\r\n noteGroup.isGrace = noteXML.querySelector(\"grace\") != null || noteGroup.duration === 0;\r\n noteGroup.hPos = noteXML.getAttribute(\"default-x\") != null ? Number.parseFloat(noteXML.getAttribute(\"default-x\")) : cMeasure.stack.width / 2;\r\n noteGroup.numDots = noteXML.querySelectorAll(\"dot\").length;\r\n let tupletsToRemove = [];\r\n let notationsXML = noteXML.querySelector(\"notations\");\r\n let tupletsXML = notationsXML == null ? null : notationsXML.querySelectorAll(\"tuplet\");\r\n if (tupletsXML != null) {\r\n for (let tupletXML of tupletsXML) {\r\n if (tupletXML.getAttribute(\"type\") === \"start\") {\r\n let tuplet = new Tuplet();\r\n tuplet.tupletID = tupletXML.getAttribute(\"number\") != null ? Number.parseInt(tupletXML.getAttribute(\"number\")) : 0;\r\n tuplet.firstNote = noteGroup;\r\n tuplet.above = tupletXML.getAttribute(\"placement\") === \"above\";\r\n let numDots;\r\n let tupletDurType;\r\n if (tupletXML.querySelector(\"tuplet-actual\") != null) {\r\n let tupActualXML = tupletXML.querySelector(\r\n \"tuplet-actual\"\r\n );\r\n tuplet.numerator = this._eint(\r\n tupActualXML,\r\n \"tuplet-number\"\r\n );\r\n numDots = tupActualXML.querySelector(\r\n \"tuplet-dot\"\r\n ) != null ? tupActualXML.querySelectorAll(\"tuplet-dot\").length : 0;\r\n tupletDurType = DurationType.getDurationType(\r\n this._estr(tupActualXML, \"tuplet-type\")\r\n );\r\n tuplet.numeratorDuration = DurationType.getDurationValue(\r\n tupletDurType,\r\n numDots\r\n );\r\n } else {\r\n tuplet.numerator = this._eint(\r\n noteXML,\r\n \"time-modification actual-notes\"\r\n );\r\n tuplet.numeratorDuration = DurationType.getDurationValue(\r\n noteGroup.durationType,\r\n noteGroup.numDots\r\n );\r\n }\r\n if (tupletXML.querySelector(\"tuplet-normal\") != null) {\r\n let tupNormalXML = tupletXML.querySelector(\r\n \"tuplet-normal\"\r\n );\r\n tuplet.denominator = this._eint(\r\n tupNormalXML,\r\n \"tuplet-number\"\r\n );\r\n numDots = tupNormalXML.querySelector(\r\n \"tuplet-dot\"\r\n ) != null ? tupNormalXML.querySelectorAll(\"tuplet-dot\").length : 0;\r\n tupletDurType = DurationType.getDurationType(\r\n this._estr(tupNormalXML, \"tuplet-type\")\r\n );\r\n tuplet.denominatorDuration = DurationType.getDurationValue(\r\n tupletDurType,\r\n numDots\r\n );\r\n } else {\r\n tuplet.denominator = this._eint(\r\n noteXML,\r\n \"time-modification normal-notes\"\r\n );\r\n numDots = noteXML.querySelectorAll(\r\n \"time-modification normal-dot\"\r\n ).length;\r\n let durString = this._estr(\r\n noteXML,\r\n \"time-modification normal-type\"\r\n );\r\n tupletDurType = durString !== \"\" ? DurationType.getDurationType(durString) : noteGroup.durationType;\r\n tuplet.denominatorDuration = DurationType.getDurationValue(\r\n tupletDurType,\r\n numDots\r\n );\r\n }\r\n this._currentTuplets.push(tuplet);\r\n } else if (tupletXML.getAttribute(\"type\") === \"stop\" && this._currentTuplets.length > 0) {\r\n let tupletID = this._aint(tupletXML, \"number\");\r\n let tuplet = this._currentTuplets[0];\r\n for (let tup of this._currentTuplets) {\r\n if (tup.tupletID === tupletID) {\r\n tuplet = tup;\r\n break;\r\n }\r\n }\r\n tuplet.endNote = noteGroup;\r\n tupletsToRemove.push(tuplet);\r\n }\r\n }\r\n }\r\n if (this._currentTuplets.length > 0) {\r\n noteGroup.tuplets = this._currentTuplets.slice(0);\r\n if (tupletsToRemove.length > 0) {\r\n for (let tupletToRemove of tupletsToRemove) {\r\n for (let i = 0; i < this._currentTuplets.length; i++) {\r\n if (tupletToRemove === this._currentTuplets[i]) {\r\n this._currentTuplets.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n let slursXML = notationsXML != null ? notationsXML.querySelectorAll(\"slur\") : null;\r\n if (slursXML != null) {\r\n for (let slurXML of slursXML) {\r\n let slur = null;\r\n if (slurXML.getAttribute(\"type\") === TieState.START) {\r\n slur = new Slur();\r\n slur.slurID = Number.parseInt(\r\n slurXML.getAttribute(\"number\")\r\n );\r\n slur.firstNote = noteGroup;\r\n this._currentSlurs.push(slur);\r\n } else if (slurXML.getAttribute(\"type\") === TieState.STOP) {\r\n let slurID = Number.parseInt(\r\n slurXML.getAttribute(\"number\")\r\n );\r\n let numSlurs = this._currentSlurs.length;\r\n let slurIndex = numSlurs - 1;\r\n while (slurIndex >= 0) {\r\n if (this._currentSlurs[slurIndex].slurID === slurID) {\r\n slur = this._currentSlurs[slurIndex];\r\n break;\r\n }\r\n slurIndex--;\r\n }\r\n if (slur != null) {\r\n slur.endNote = noteGroup;\r\n let index = this._currentSlurs.indexOf(slur);\r\n this._currentSlurs.splice(index, 1);\r\n }\r\n }\r\n if (slur != null) {\r\n if (noteGroup.slurs == null) {\r\n noteGroup.slurs = [slur];\r\n } else {\r\n noteGroup.slurs.push(slur);\r\n }\r\n }\r\n }\r\n }\r\n let notationsElements = noteXML.querySelectorAll(\"notations\");\r\n if (notationsElements.length > 0) {\r\n let articulationElements = notationsElements[0].querySelectorAll(\"articulations\");\r\n if (articulationElements != null && articulationElements.length > 0) {\r\n for (let node of articulationElements[0].childNodes) {\r\n if (!(node instanceof Element)) {\r\n continue;\r\n }\r\n let articXML = node;\r\n let articulation = new Articulation();\r\n articulation.type = ArticulationType.getTypeFromName(\r\n articXML.tagName\r\n );\r\n let hPos = articXML.getAttribute(\"default-x\");\r\n let vPos = articXML.getAttribute(\"default-y\");\r\n articulation.hPos = hPos != null ? Number.parseFloat(hPos) : 0;\r\n articulation.vPos = vPos != null ? -1 * Number.parseFloat(vPos) : 0;\r\n articulation.isAbove = articXML.getAttribute(\"placement\") === \"above\";\r\n articulation.noteGroup = noteGroup;\r\n articulation.getWidthHeight();\r\n if (noteGroup.articulations == null) {\r\n noteGroup.articulations = [];\r\n }\r\n noteGroup.articulations.push(articulation);\r\n }\r\n }\r\n }\r\n let ornamentElements = noteXML.querySelectorAll(\"ornaments > *\");\r\n for (let ornamentEl of ornamentElements) {\r\n let type = OrnamentType.getTypeFromMusicXmlName(\r\n ornamentEl.tagName\r\n );\r\n if (type === OrnamentType.UNKNOWN) {\r\n continue;\r\n }\r\n let ornament = new Ornament();\r\n ornament.type = type;\r\n ornament.hPos = 0;\r\n ornament.vPos = 0;\r\n ornament.isAbove = ornamentEl.getAttribute(\"placement\") !== \"below\";\r\n ornament.noteGroup = noteGroup;\r\n ornament.getWidthHeight();\r\n if (noteGroup.ornaments == null) {\r\n noteGroup.ornaments = [];\r\n }\r\n noteGroup.ornaments.push(ornament);\r\n }\r\n if (noteXML.querySelector(\"lyric\") != null) {\r\n try {\r\n let lyricXML = noteXML.querySelector(\"lyric\");\r\n let vPos = this._anum(lyricXML, \"default-y\", false);\r\n if (vPos != null)\r\n vPos /= 10;\r\n else\r\n vPos = -8;\r\n let lyric = new Lyric(\r\n this._estr(lyricXML, \"syllabic\"),\r\n this._estr(lyricXML, \"text\"),\r\n this._aint(lyricXML, \"number\"),\r\n 0,\r\n vPos\r\n );\r\n noteGroup.lyric = lyric;\r\n } catch (err) {\r\n console.log(\"problem with lyric from XML: ${err.toString()}\");\r\n }\r\n }\r\n if (noteXML.querySelector(\"rest\") != null) {\r\n noteGroup.isRest = true;\r\n if (this._estr(noteXML, \"rest display-step\") !== \"\") {\r\n let clefType = cMeasure.clefs.length > 0 ? cMeasure.clefs[cMeasure.clefs.length - 1].type : ClefType.TREBLE;\r\n let pitchName = this._estr(noteXML, \"rest display-step\") + this._estr(noteXML, \"rest display-octave\");\r\n let stepsFromTopStaffLine = PitchUtils.getStepsFromTopStaffLine(pitchName, clefType);\r\n noteGroup.restVPos = 1 / 2 * stepsFromTopStaffLine;\r\n } else {\r\n noteGroup.restVPos = 2;\r\n }\r\n if (noteGroup.durationType === DurationType.WHOLE) {\r\n noteGroup.restVPos -= 0.5;\r\n } else if (noteGroup.durationType === DurationType.HALF) {\r\n noteGroup.restVPos -= 0.3;\r\n }\r\n return noteGroup;\r\n }\r\n let beamsXML = noteXML.querySelectorAll(\"beam\");\r\n for (let beamXML of beamsXML) {\r\n noteGroup.beamStates.push(beamXML.textContent);\r\n }\r\n if (noteXML.getAttribute(\"default-x\") != null) {\r\n noteGroup.hPos = Number.parseFloat(noteXML.getAttribute(\"default-x\"));\r\n }\r\n let stemDirection;\r\n if (noteXML.querySelector(\"stem\") != null) {\r\n stemDirection = this._estr(noteXML, \"stem\");\r\n if (noteXML.querySelector(\"stem[default-y]\") != null) {\r\n noteGroup.stemEndPos = -1 * Number.parseFloat(noteXML.querySelector(\"stem[default-y]\").getAttribute(\"default-y\"));\r\n }\r\n } else if (noteGroup.durationType === DurationType.WHOLE) {\r\n stemDirection = StemDirection.NO_STEM;\r\n } else {\r\n stemDirection = StemDirection.UP;\r\n }\r\n noteGroup.stemDirection = stemDirection;\r\n noteGroup.stemHPos = stemDirection === StemDirection.UP ? this._score.scoreProperties.noteheadWidth : 0;\r\n return noteGroup;\r\n }\r\n _createNote(noteXML, noteGroup, measure) {\r\n let note = new Note();\r\n if (noteXML.getAttribute(\"print-object\") === \"no\") {\r\n } else if (noteGroup.visible === false) {\r\n noteGroup.visible = true;\r\n }\r\n if (noteXML.querySelector(\"pitch\") != null) {\r\n note.pitchName = this._estr(noteXML, \"pitch step\") + this._estr(noteXML, \"pitch octave\");\r\n } else if (noteXML.querySelector(\"unpitched\") != null) {\r\n note.pitchName = this._estr(noteXML, \"unpitched display-step\") + this._estr(noteXML, \"unpitched display-octave\");\r\n if (noteXML.querySelector(\"instrument\") != null && this._midiInstrumentsXMLList != null) {\r\n let instID = noteXML.querySelector(\"instrument\").getAttribute(\"id\");\r\n for (let miXML of this._midiInstrumentsXMLList) {\r\n if (miXML.getAttribute(\"id\") === instID) {\r\n note.playbackCents = this._eint(\r\n miXML,\r\n \"midi-unpitched\"\r\n ) * 100 - 100;\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n console.log(\"unknown note pitch format! $noteXML\");\r\n note.pitchName = \"C4\";\r\n }\r\n let alteration = this._eint(noteXML, \"pitch alter\");\r\n note.alteration = alteration;\r\n note.displayCents = PitchUtils.pitchNameToDiatonicCents(\r\n note.pitchName\r\n ) + 100 * alteration;\r\n let accidental;\r\n if (alteration < 3 && alteration > -3) {\r\n accidental = noteXML.querySelector(\"accidental\") != null ? AccidentalType.getAccidentalFromString(this._estr(\r\n noteXML,\r\n \"accidental\"\r\n )) : AccidentalType.NONE;\r\n } else {\r\n let newPitchName = PitchUtils.getCommonPitchNameFromCents(\r\n note.displayCents\r\n );\r\n note.alteration = PitchUtils.getAlterationForCents(\r\n note.displayCents,\r\n newPitchName\r\n );\r\n note.pitchName = newPitchName;\r\n accidental = AccidentalType.NONE;\r\n }\r\n if (accidental !== AccidentalType.NONE) {\r\n note.accidental = accidental;\r\n note.showAccidental = true;\r\n } else {\r\n note.accidental = AccidentalType.getAccidentalType(note.alteration);\r\n }\r\n note.accidentalPos = -1 * this._score.scoreProperties.noteheadWidth;\r\n let clefType = \"\";\r\n for (let clef of measure.clefs) {\r\n if (noteGroup.qNoteTime + 1e-4 > clef.qNoteTime) {\r\n clefType = clef.type;\r\n } else {\r\n break;\r\n }\r\n }\r\n note.stepsFromTopStaffLine = PitchUtils.getStepsFromTopStaffLine(\r\n note.pitchName,\r\n clefType\r\n );\r\n if (noteXML.getAttribute(\"default-x\") != null) {\r\n note.hPos = Number.parseFloat(noteXML.getAttribute(\"default-x\")) - noteGroup.hPos;\r\n }\r\n note.vPos = 1 / 2 * note.stepsFromTopStaffLine;\r\n if (note.stepsFromTopStaffLine < -1) {\r\n note.legerLines = Math.trunc(note.stepsFromTopStaffLine / 2);\r\n } else if (note.stepsFromTopStaffLine > 9) {\r\n note.legerLines = Math.trunc((note.stepsFromTopStaffLine - 8) / 2);\r\n }\r\n let tieXMLs = noteXML.querySelectorAll(\"tie\");\r\n if (tieXMLs.length > 0) {\r\n note.tieState = tieXMLs.length === 1 ? tieXMLs[0].getAttribute(\"type\") : TieState.CONTINUE;\r\n }\r\n return note;\r\n }\r\n _createTempoMarker(element, qNoteTime, targetStack, metronomeEl) {\r\n let tempoMarker = new TempoMarker();\r\n let tempoFac = 1;\r\n if (metronomeEl != null) {\r\n if (metronomeEl.querySelector(\"beat-unit\") != null) {\r\n let durationType = DurationType.getDurationType(\r\n metronomeEl.querySelector(\"beat-unit\").textContent\r\n );\r\n let numDots = metronomeEl.querySelector(\"dotted\") != null ? 1 : 0;\r\n let duration = DurationType.getDurationValue(\r\n durationType,\r\n numDots\r\n );\r\n tempoFac = duration / 1024;\r\n }\r\n }\r\n tempoMarker.qNoteTime = qNoteTime;\r\n tempoMarker.tempo = Number.parseFloat(element.getAttribute(\"tempo\"));\r\n if (targetStack.tempoMarkers == null) {\r\n targetStack.tempoMarkers = [tempoMarker];\r\n } else {\r\n if (targetStack.tempoMarkers[targetStack.tempoMarkers.length - 1].qNoteTime < tempoMarker.qNoteTime) {\r\n targetStack.tempoMarkers.push(tempoMarker);\r\n }\r\n }\r\n }\r\n _computeMaxKeySizes() {\r\n let stacks = this._score.getMeasureStacks();\r\n let numStacks = stacks.length;\r\n for (let i = 0; i < numStacks; i++) {\r\n let stack = stacks[i];\r\n let measures = stack.measures;\r\n let numMeasures = measures.length;\r\n let maxKeySize = 0;\r\n for (let j = 0; j < numMeasures; j++) {\r\n let measure = measures[j];\r\n let totalKeySize = PitchUtils.getTotalKeySize(\r\n measure.displayKey,\r\n measure.outgoingKey\r\n );\r\n if (totalKeySize > maxKeySize) {\r\n maxKeySize = totalKeySize;\r\n }\r\n }\r\n stack.maxKeySize = maxKeySize;\r\n }\r\n }\r\n _checkPartForErrors(part) {\r\n for (let staff of part.staves) {\r\n for (let measure of staff.measures) {\r\n if (measure.voices.length === 0) {\r\n measure.getVoiceByNumber(1);\r\n }\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n if (ng.isRest) {\r\n continue;\r\n }\r\n for (let note of ng.notes) {\r\n if (note.tieState === TieState.START || note.tieState === TieState.CONTINUE) {\r\n let nextNG = ng.next;\r\n if (nextNG == null || nextNG.isRest) {\r\n note.tieState = TieState.NONE;\r\n } else {\r\n let matchFound = false;\r\n for (let nextNote of nextNG.notes) {\r\n if ((nextNote.tieState === TieState.CONTINUE || nextNote.tieState === TieState.STOP) && nextNote.pitchName === note.pitchName && nextNote.alteration === note.alteration) {\r\n matchFound = true;\r\n break;\r\n }\r\n }\r\n if (!matchFound) {\r\n note.tieState = TieState.NONE;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n _checkScoreForErrors() {\r\n let firstStack = this._score.parts[0].staves[0].measures[0].stack;\r\n if (firstStack.newKey === false) {\r\n firstStack.newKey = true;\r\n for (let measure of firstStack.measures) {\r\n measure.showKey = true;\r\n }\r\n }\r\n let markers = firstStack.tempoMarkers;\r\n if (markers == null || markers.length === 0 || markers[0].qNoteTime > 0) {\r\n let tempoMarker = new TempoMarker();\r\n tempoMarker.tempo = ScoreProperties.DEFAULT_TEMPO;\r\n tempoMarker.qNoteTime = 0;\r\n firstStack.tempoMarkers = [tempoMarker];\r\n }\r\n let staffMsrs = this._score.parts[0].staves[0].measures;\r\n let lastStack = staffMsrs[staffMsrs.length - 1].stack;\r\n markers = lastStack.tempoMarkers;\r\n if (markers == null || markers.length === 0 || markers[markers.length - 1].qNoteTime < lastStack.endTime) {\r\n if (lastStack.tempoMarkers == null) {\r\n lastStack.tempoMarkers = [];\r\n }\r\n let tempoMarker = new TempoMarker();\r\n tempoMarker.tempo = ScoreProperties.DEFAULT_TEMPO;\r\n tempoMarker.qNoteTime = lastStack.endTime;\r\n lastStack.tempoMarkers.push(tempoMarker);\r\n }\r\n }\r\n _adjustMeasureLengthsToFitNotes() {\r\n let stacks = this._score.getMeasureStacks();\r\n let currentQNoteOffset = 0;\r\n for (let stack of stacks) {\r\n stack.startTime += currentQNoteOffset;\r\n stack.endTime += currentQNoteOffset;\r\n let stackStartTime = stack.startTime;\r\n let latestNoteEndTime = stackStartTime;\r\n for (let measure of stack.measures) {\r\n for (let voice of measure.voices) {\r\n for (let ng of voice.noteGroups) {\r\n ng.qNoteTime += currentQNoteOffset;\r\n if (ng.tuplets != null && ng.tuplets.length > 0) {\r\n let tuplet = ng.tuplets[0];\r\n let tupletQNoteEndTime = tuplet.firstNote.qNoteTime + tuplet.denominator * tuplet.denominatorDuration / DurationType.QUARTER;\r\n if (tupletQNoteEndTime > latestNoteEndTime) {\r\n latestNoteEndTime = tupletQNoteEndTime;\r\n }\r\n } else if (ng.qNoteTime + ng.qNoteDuration > latestNoteEndTime) {\r\n latestNoteEndTime = ng.qNoteTime + ng.qNoteDuration;\r\n }\r\n }\r\n }\r\n if (currentQNoteOffset !== 0) {\r\n for (let clef of measure.clefs) {\r\n clef.qNoteTime += currentQNoteOffset;\r\n }\r\n for (let attachment of measure.attachments) {\r\n attachment.qNoteTime += currentQNoteOffset;\r\n }\r\n }\r\n }\r\n if (currentQNoteOffset !== 0 && stack.tempoMarkers != null) {\r\n for (let tm of stack.tempoMarkers) {\r\n tm.qNoteTime += currentQNoteOffset;\r\n }\r\n }\r\n if (latestNoteEndTime !== stack.endTime) {\r\n if (latestNoteEndTime === stack.startTime) {\r\n continue;\r\n } else {\r\n let newNumerator;\r\n let newDenominator;\r\n let stackNewQNoteDur = latestNoteEndTime - stackStartTime;\r\n let qNoteRemainder = stackNewQNoteDur >= 1 ? stackNewQNoteDur % Math.floor(stackNewQNoteDur) : stackNewQNoteDur;\r\n if (qNoteRemainder === 0) {\r\n newNumerator = Math.floor(stackNewQNoteDur);\r\n newDenominator = 4;\r\n } else {\r\n let mult = 1 / qNoteRemainder;\r\n if (Math.floor(mult) === mult) {\r\n newNumerator = Math.floor(stackNewQNoteDur * mult);\r\n newDenominator = Math.floor(4 * mult);\r\n }\r\n }\r\n if (newNumerator != null) {\r\n currentQNoteOffset += latestNoteEndTime - stack.endTime;\r\n stack.endTime = latestNoteEndTime;\r\n if (stack === stacks[0]) {\r\n stack.isPickup = true;\r\n } else if (stack.repeatDOs != null && stack.repeatDOs.length > 0) {\r\n if (stack.repeatDOs[0].repeatDirection === RepeatDirection.FORWARD) {\r\n stack.isPickup = true;\r\n }\r\n }\r\n for (let measure of stack.measures) {\r\n measure.displayNumBeats = measure.numBeats;\r\n measure.displayBeatType = measure.beatType;\r\n measure.numBeats = newNumerator;\r\n measure.beatType = newDenominator;\r\n this._updateMeasureBeatGroups(measure);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n get score() {\r\n return this._score;\r\n }\r\n get musicXML() {\r\n return this._musicXML;\r\n }\r\n};\r\n/**\r\n * Dispatched when the xml file finishes parsing.\r\n * The MusicXMLParser.FINISHED_PARSING constant defines the value of the \r\n * type property of the event object \r\n * for a finishedParsing event.\r\n * \r\n * @eventType finishedParsing\r\n */\r\nMusicXmlParser2.FINISHED_PARSING = \"finishedParsing\";\r\nvar Dlog = class {\r\n static log(data) {\r\n let div = document.querySelector(\"#divLog\");\r\n if (div == null) {\r\n div = document.createElement(\"div\");\r\n div.id = \"divLog\";\r\n div.style.height = \"300px\";\r\n div.style.width = \"300px\";\r\n div.style.overflow = \"auto\";\r\n document.body.append(div);\r\n }\r\n if (data instanceof Array) {\r\n for (let item of data) {\r\n let p = document.createElement(\"p\");\r\n p.innerHTML = item == null ? \"null\" : item.toString();\r\n div.append(p);\r\n }\r\n } else {\r\n let p = document.createElement(\"p\");\r\n p.innerHTML = data == null ? \"null\" : data.toString();\r\n div.append(p);\r\n }\r\n div.scrollTop = 1e5;\r\n }\r\n};\r\n\r\n// src/utils/MusicXmlUtils.ts\r\nimport { CompressionUtils, ConversionUtils, HttpUtils } from \"ts_utils\";\r\nvar MusicXmlUtils = class _MusicXmlUtils {\r\n /**looks at the end of the [fileNamePath] string to determine which type\r\n * of MusicXml file it is. If it doesn't match one of the [MusicXmlFileType]\r\n * values, null is returned.*/\r\n static getFileType(fileNamePath) {\r\n if (fileNamePath.endsWith(\".xml\"))\r\n return 0 /* xml */;\r\n else if (fileNamePath.endsWith(\".mxl\"))\r\n return 1 /* mxl */;\r\n else if (fileNamePath.endsWith(\".zip\"))\r\n return 2 /* zip */;\r\n else\r\n return null;\r\n }\r\n static getMusicXmlStringFromUrl(url, type = null, userToken = null) {\r\n return new Promise((resolve, reject) => {\r\n if (type == null) {\r\n if (url.endsWith(\".xml\"))\r\n type = 0 /* xml */;\r\n else if (url.endsWith(\".mxl\"))\r\n type = 1 /* mxl */;\r\n else if (url.endsWith(\".zip\"))\r\n type = 2 /* zip */;\r\n else\r\n reject(MusicXmlError.INVALID_FILE_TYPE);\r\n }\r\n if (url == null)\r\n resolve(null);\r\n try {\r\n if (type === 0 /* xml */) {\r\n HttpUtils.get(url, { userToken }).then((request) => {\r\n let xmlString = request.responseText;\r\n let cleanString = _MusicXmlUtils._verifyAndCleanMusicXmlString(xmlString);\r\n resolve(cleanString ?? MusicXmlError.INVALID_FORMAT);\r\n }).catch((e) => {\r\n reject(e);\r\n });\r\n } else if (type === 1 /* mxl */ || type === 2 /* zip */) {\r\n HttpUtils.get(url, {\r\n userToken,\r\n responseType: \"arraybuffer\"\r\n }).then(async (request) => {\r\n let ab = request.response;\r\n let xml = await _MusicXmlUtils.decompressMusicXml(ab);\r\n let cleanXml = xml != null ? _MusicXmlUtils._verifyAndCleanMusicXmlString(xml) : null;\r\n resolve(cleanXml ?? MusicXmlError.INVALID_FORMAT);\r\n }).catch((e) => {\r\n reject(e);\r\n });\r\n } else {\r\n reject(MusicXmlError.INVALID_FILE_TYPE);\r\n }\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n }\r\n /**reads a .xml or .mxl MusicXML file provided as a html.File object (this\r\n * typically comes from an HTML file selection Input control). Returns a\r\n * future that upon completion delivers the verified and cleaned MusicXML\r\n * as a String*/\r\n static getMusicXmlStringFromFile(file) {\r\n return new Promise(async (resolve, reject) => {\r\n try {\r\n let xml;\r\n let fname = file.name.toLowerCase();\r\n if (fname.length <= 4) {\r\n reject(MusicXmlError.INVALID_FILE_TYPE);\r\n }\r\n if (fname.lastIndexOf(\".xml\") === fname.length - 4) {\r\n xml = await ConversionUtils.getStringFromTextBlob(file);\r\n } else if (fname.lastIndexOf(\".mxl\") === fname.length - 4 || fname.lastIndexOf(\".zip\") === fname.length - 4) {\r\n let ab = await ConversionUtils.getArrayBufferFromBinaryBlob(\r\n file\r\n );\r\n xml = await _MusicXmlUtils.decompressMusicXml(ab);\r\n } else {\r\n reject(MusicXmlError.INVALID_FILE_TYPE);\r\n }\r\n let cleanXml = _MusicXmlUtils._verifyAndCleanMusicXmlString(xml);\r\n resolve(cleanXml);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n });\r\n }\r\n /**decompresses MusicXML ArrayBuffer into MusicXML string*/\r\n static async decompressMusicXml(data) {\r\n let entries = await CompressionUtils.unzip(data);\r\n if (entries == null)\r\n return null;\r\n for (let entry of entries) {\r\n let fileName = entry.filename.toLowerCase();\r\n if (!fileName.includes(\"meta-inf/\") && fileName.lastIndexOf(\".xml\") == fileName.length - 4) {\r\n let xml = await CompressionUtils.getStringFromEntry(entry);\r\n return xml;\r\n }\r\n }\r\n return null;\r\n }\r\n /**verifies string is valid MusicXML and cleans up unrecognized characters*/\r\n static _verifyAndCleanMusicXmlString(xmlString) {\r\n if (xmlString.indexOf(\"score-partwise\") === -1) {\r\n return null;\r\n }\r\n return xmlString.replace(/[\\x03\\x00]/g, \"\");\r\n }\r\n};\r\nvar MusicXmlFileType = /* @__PURE__ */ ((MusicXmlFileType2) => {\r\n MusicXmlFileType2[MusicXmlFileType2[\"xml\"] = 0] = \"xml\";\r\n MusicXmlFileType2[MusicXmlFileType2[\"mxl\"] = 1] = \"mxl\";\r\n MusicXmlFileType2[MusicXmlFileType2[\"zip\"] = 2] = \"zip\";\r\n return MusicXmlFileType2;\r\n})(MusicXmlFileType || {});\r\nvar MusicXmlError = class {\r\n};\r\nMusicXmlError.INVALID_FILE_TYPE = \"invalidFileType\";\r\nMusicXmlError.INVALID_FORMAT = \"invalidFormat\";\r\n\r\n// src/utils/instruments/Range.ts\r\nvar Range = class _Range {\r\n constructor(min, comfort, max, type) {\r\n this.min = min;\r\n this.comfort = comfort;\r\n this.max = max;\r\n this.type = type;\r\n }\r\n static getRangeString(type) {\r\n switch (type) {\r\n case 0 /* easy */:\r\n return \"Easy\";\r\n case 1 /* medium */:\r\n return \"Medium\";\r\n case 2 /* advanced */:\r\n return \"Advanced\";\r\n case 3 /* off */:\r\n return \"Off\";\r\n default:\r\n throw \"invalid range!\";\r\n }\r\n }\r\n clone() {\r\n let clone = new _Range();\r\n clone.min = this.min;\r\n clone.comfort = this.comfort;\r\n clone.max = this.max;\r\n clone.type = this.type;\r\n return clone;\r\n }\r\n};\r\nvar RangeType = /* @__PURE__ */ ((RangeType2) => {\r\n RangeType2[RangeType2[\"easy\"] = 0] = \"easy\";\r\n RangeType2[RangeType2[\"medium\"] = 1] = \"medium\";\r\n RangeType2[RangeType2[\"advanced\"] = 2] = \"advanced\";\r\n RangeType2[RangeType2[\"off\"] = 3] = \"off\";\r\n RangeType2[RangeType2[\"custom\"] = 4] = \"custom\";\r\n return RangeType2;\r\n})(RangeType || {});\r\n\r\n// src/utils/instruments/InstrumentDO.ts\r\nvar InstrumentDO = class {\r\n constructor(id, name, clef, transposition, minKey, maxKey, {\r\n easyRange,\r\n mediumRange,\r\n advancedRange,\r\n offRange,\r\n fingeringMode = null\r\n }) {\r\n //null means no fingerings\r\n ///can be used to indicate alternative fingering sets, such German. 0 by\r\n ///convention should be the default.\r\n this.fingeringSet = 0;\r\n this.id = id;\r\n this.name = name;\r\n this.clef = clef;\r\n this.transposition = transposition;\r\n this.minKey = minKey;\r\n this.maxKey = maxKey;\r\n this.easyRange = easyRange;\r\n this.mediumRange = mediumRange;\r\n this.advancedRange = advancedRange;\r\n this.offRange = offRange;\r\n this.fingeringMode = fingeringMode;\r\n }\r\n getRangeByType(type) {\r\n switch (type) {\r\n case 0 /* easy */:\r\n return this.easyRange;\r\n case 1 /* medium */:\r\n return this.mediumRange;\r\n case 2 /* advanced */:\r\n return this.advancedRange;\r\n case 3 /* off */:\r\n return this.offRange;\r\n default:\r\n throw \"unsupported RangeType: \" + type;\r\n }\r\n }\r\n get label() {\r\n return this.name;\r\n }\r\n};\r\n\r\n// src/utils/instruments/InstrumentUtils.ts\r\nvar _InstrumentUtils = class _InstrumentUtils {\r\n static getInstrumentByID(id) {\r\n for (let inst of _InstrumentUtils.instruments) {\r\n if (inst.id === id) {\r\n return inst;\r\n }\r\n }\r\n return _InstrumentUtils.instruments[0];\r\n }\r\n static isRecorder(id) {\r\n return id === 3 || id === 4 || id >= 300 && id <= 303;\r\n }\r\n};\r\n_InstrumentUtils.instruments = [\r\n new InstrumentDO(3, \"Soprano Recorder\", \"treble\", -12, -2, 2, {\r\n easyRange: new Range(60, 69, 74, 0 /* easy */),\r\n mediumRange: new Range(60, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(60, 69, 84, 2 /* advanced */),\r\n offRange: new Range(60, 69, 128, 3 /* off */),\r\n fingeringMode: 0\r\n }),\r\n new InstrumentDO(4, \"Alto Recorder Transposed\", \"treble\", -5, -2, 2, {\r\n easyRange: new Range(60, 69, 74, 0 /* easy */),\r\n mediumRange: new Range(60, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(60, 69, 84, 2 /* advanced */),\r\n offRange: new Range(60, 69, 128, 3 /* off */),\r\n fingeringMode: 0\r\n }),\r\n new InstrumentDO(300, \"Alto Recorder\", \"treble\", 0, -3, 1, {\r\n easyRange: new Range(65, 74, 79, 0 /* easy */),\r\n mediumRange: new Range(65, 74, 84, 1 /* medium */),\r\n advancedRange: new Range(65, 74, 89, 2 /* advanced */),\r\n offRange: new Range(65, 74, 128, 3 /* off */),\r\n fingeringMode: 2\r\n }),\r\n new InstrumentDO(301, \"Tenor Recorder\", \"treble\", 0, -2, 2, {\r\n easyRange: new Range(60, 69, 74, 0 /* easy */),\r\n mediumRange: new Range(60, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(60, 69, 84, 2 /* advanced */),\r\n offRange: new Range(60, 69, 128, 3 /* off */),\r\n fingeringMode: 0\r\n }),\r\n new InstrumentDO(302, \"Bass Recorder Transposed\", \"treble\", 7, -2, 2, {\r\n easyRange: new Range(60, 69, 74, 0 /* easy */),\r\n mediumRange: new Range(60, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(60, 69, 84, 2 /* advanced */),\r\n offRange: new Range(60, 69, 128, 3 /* off */),\r\n fingeringMode: 0\r\n }),\r\n new InstrumentDO(303, \"Bass Recorder\", \"bass\", -12, -3, 1, {\r\n easyRange: new Range(41, 50, 55, 0 /* easy */),\r\n mediumRange: new Range(41, 50, 60, 1 /* medium */),\r\n advancedRange: new Range(41, 50, 65, 2 /* advanced */),\r\n offRange: new Range(41, 50, 128, 3 /* off */),\r\n fingeringMode: 2\r\n }),\r\n new InstrumentDO(400, \"Tin Whistle in D\", \"treble\", -12, -1, 3, {\r\n easyRange: new Range(62, 68, 74, 0 /* easy */),\r\n mediumRange: new Range(62, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(62, 71, 85, 2 /* advanced */),\r\n offRange: new Range(62, 71, 128, 3 /* off */),\r\n fingeringMode: 0\r\n }),\r\n new InstrumentDO(5, \"Piccolo\", \"treble\", -12, -3, 1, {\r\n easyRange: new Range(65, 78, 82, 0 /* easy */),\r\n mediumRange: new Range(65, 78, 87, 1 /* medium */),\r\n advancedRange: new Range(62, 78, 93, 2 /* advanced */),\r\n offRange: new Range(62, 78, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(6, \"Flute\", \"treble\", 0, -3, 1, {\r\n easyRange: new Range(65, 77, 82, 0 /* easy */),\r\n mediumRange: new Range(63, 77, 87, 1 /* medium */),\r\n advancedRange: new Range(60, 77, 93, 2 /* advanced */),\r\n offRange: new Range(60, 77, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(200, \"Alto Flute\", \"treble\", 5, -4, 0, {\r\n easyRange: new Range(65, 77, 82, 0 /* easy */),\r\n mediumRange: new Range(63, 77, 87, 1 /* medium */),\r\n advancedRange: new Range(60, 77, 93, 2 /* advanced */),\r\n offRange: new Range(60, 77, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(7, \"Oboe\", \"treble\", 0, -3, 1, {\r\n easyRange: new Range(65, 74, 79, 0 /* easy */),\r\n mediumRange: new Range(60, 74, 84, 1 /* medium */),\r\n advancedRange: new Range(58, 74, 91, 2 /* advanced */),\r\n offRange: new Range(58, 74, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(210, \"English Horn\", \"treble\", 7, -2, 2, {\r\n easyRange: new Range(65, 74, 79, 0 /* easy */),\r\n mediumRange: new Range(60, 74, 84, 1 /* medium */),\r\n advancedRange: new Range(59, 74, 88, 2 /* advanced */),\r\n offRange: new Range(59, 74, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(8, \"Bassoon\", \"bass\", 0, -3, 1, {\r\n easyRange: new Range(43, 53, 60, 0 /* easy */),\r\n mediumRange: new Range(43, 53, 67, 1 /* medium */),\r\n advancedRange: new Range(34, 53, 74, 2 /* advanced */),\r\n offRange: new Range(34, 53, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(9, \"Clarinet\", \"treble\", 2, -2, 2, {\r\n easyRange: new Range(52, 67, 77, 0 /* easy */),\r\n mediumRange: new Range(52, 72, 86, 1 /* medium */),\r\n advancedRange: new Range(52, 72, 91, 2 /* advanced */),\r\n offRange: new Range(52, 72, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(10, \"Bass Clarinet\", \"treble\", 14, -2, 2, {\r\n easyRange: new Range(52, 67, 77, 0 /* easy */),\r\n mediumRange: new Range(52, 70, 86, 1 /* medium */),\r\n advancedRange: new Range(52, 70, 91, 2 /* advanced */),\r\n offRange: new Range(52, 70, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(11, \"Soprano Sax\", \"treble\", 2, -2, 2, {\r\n easyRange: new Range(62, 72, 79, 0 /* easy */),\r\n mediumRange: new Range(58, 72, 84, 1 /* medium */),\r\n advancedRange: new Range(58, 72, 90, 2 /* advanced */),\r\n offRange: new Range(58, 72, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(12, \"Alto Sax\", \"treble\", 9, -1, 3, {\r\n easyRange: new Range(62, 72, 79, 0 /* easy */),\r\n mediumRange: new Range(58, 72, 84, 1 /* medium */),\r\n advancedRange: new Range(58, 72, 90, 2 /* advanced */),\r\n offRange: new Range(58, 72, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(13, \"Tenor Sax\", \"treble\", 14, -2, 2, {\r\n easyRange: new Range(62, 72, 79, 0 /* easy */),\r\n mediumRange: new Range(58, 72, 84, 1 /* medium */),\r\n advancedRange: new Range(58, 72, 90, 2 /* advanced */),\r\n offRange: new Range(58, 72, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(14, \"Bari Sax\", \"treble\", 21, -1, 3, {\r\n easyRange: new Range(62, 72, 79, 0 /* easy */),\r\n mediumRange: new Range(58, 72, 84, 1 /* medium */),\r\n advancedRange: new Range(58, 72, 90, 2 /* advanced */),\r\n offRange: new Range(58, 72, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(15, \"Trumpet\", \"treble\", 2, -2, 2, {\r\n easyRange: new Range(58, 64, 74, 0 /* easy */),\r\n mediumRange: new Range(54, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(54, 69, 86, 2 /* advanced */),\r\n offRange: new Range(54, 69, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(16, \"Horn in F\", \"treble\", 7, -2, 2, {\r\n easyRange: new Range(55, 64, 74, 0 /* easy */),\r\n mediumRange: new Range(53, 67, 79, 1 /* medium */),\r\n advancedRange: new Range(53, 67, 84, 2 /* advanced */),\r\n offRange: new Range(48, 67, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(17, \"Trombone\", \"bass\", 0, -4, 0, {\r\n easyRange: new Range(44, 53, 60, 0 /* easy */),\r\n mediumRange: new Range(40, 53, 65, 1 /* medium */),\r\n advancedRange: new Range(40, 53, 72, 2 /* advanced */),\r\n offRange: new Range(40, 53, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(18, \"Euphonium TC\", \"treble\", 14, -2, 2, {\r\n easyRange: new Range(58, 64, 74, 0 /* easy */),\r\n mediumRange: new Range(54, 69, 79, 1 /* medium */),\r\n advancedRange: new Range(54, 69, 86, 2 /* advanced */),\r\n offRange: new Range(54, 69, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(19, \"Euphonium BC\", \"bass\", 0, -4, 0, {\r\n easyRange: new Range(44, 50, 60, 0 /* easy */),\r\n mediumRange: new Range(40, 55, 65, 1 /* medium */),\r\n advancedRange: new Range(40, 55, 72, 2 /* advanced */),\r\n offRange: new Range(40, 55, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(20, \"Tuba\", \"bass\", 0, -4, 0, {\r\n easyRange: new Range(32, 38, 48, 0 /* easy */),\r\n mediumRange: new Range(28, 43, 53, 1 /* medium */),\r\n advancedRange: new Range(28, 43, 60, 2 /* advanced */),\r\n offRange: new Range(28, 43, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(21, \"Violin\", \"treble\", 0, -1, 3, {\r\n easyRange: new Range(62, 68, 79, 0 /* easy */),\r\n mediumRange: new Range(55, 72, 86, 1 /* medium */),\r\n advancedRange: new Range(55, 72, 92, 2 /* advanced */),\r\n offRange: new Range(55, 72, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(22, \"Viola\", \"alto\", 0, -1, 3, {\r\n easyRange: new Range(55, 61, 72, 0 /* easy */),\r\n mediumRange: new Range(48, 65, 79, 1 /* medium */),\r\n advancedRange: new Range(48, 65, 85, 2 /* advanced */),\r\n offRange: new Range(48, 65, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(23, \"Cello\", \"bass\", 0, -1, 3, {\r\n easyRange: new Range(43, 49, 60, 0 /* easy */),\r\n mediumRange: new Range(36, 53, 67, 1 /* medium */),\r\n advancedRange: new Range(36, 53, 73, 2 /* advanced */),\r\n offRange: new Range(36, 53, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(24, \"Bass\", \"bass\", 12, -1, 3, {\r\n easyRange: new Range(40, 49, 60, 0 /* easy */),\r\n mediumRange: new Range(40, 51, 67, 1 /* medium */),\r\n advancedRange: new Range(40, 53, 73, 2 /* advanced */),\r\n offRange: new Range(40, 53, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(25, \"Piano\", \"treble\", 0, -2, 2, {\r\n easyRange: new Range(1, 69, 128, 0 /* easy */),\r\n mediumRange: new Range(1, 69, 128, 1 /* medium */),\r\n advancedRange: new Range(1, 69, 128, 2 /* advanced */),\r\n offRange: new Range(1, 69, 128, 3 /* off */)\r\n }),\r\n new InstrumentDO(26, \"Guitar\", \"treble\", 12, -2, 2, {\r\n easyRange: new Range(60, 69, 79, 0 /* easy */),\r\n mediumRange: new Range(52, 64, 84, 1 /* medium */),\r\n advancedRange: new Range(52, 64, 91, 2 /* advanced */),\r\n offRange: new Range(52, 64, 128, 3 /* off */)\r\n })\r\n];\r\nvar InstrumentUtils = _InstrumentUtils;\r\nexport {\r\n AccidentalType,\r\n Arranger,\r\n Articulation,\r\n ArticulationType,\r\n AttachmentFormatter,\r\n Barline,\r\n BarlineLocation,\r\n BarlineStyle,\r\n BaseDataObject,\r\n BeamState,\r\n ChordSymbol,\r\n ChordSymbolDegree,\r\n Clef,\r\n ClefType,\r\n Dlog,\r\n DurationType,\r\n Dynamic,\r\n DynamicType,\r\n DynamicVolumeMap,\r\n EndingType,\r\n InstrumentDO,\r\n InstrumentUtils,\r\n Lyric,\r\n LyricsMode,\r\n Measure,\r\n MeasureAttachment,\r\n MeasureAttachmentType,\r\n MeasureInstruction,\r\n MeasureRegion,\r\n MeasureStack,\r\n MusicAnalyzer,\r\n MusicBeamer,\r\n MusicSpacer,\r\n MusicXmlError,\r\n MusicXmlFileType,\r\n MusicXmlParser2,\r\n MusicXmlUtils,\r\n NotationObject,\r\n Note,\r\n NoteAttachment,\r\n NoteGroup,\r\n NoteGroupContainer,\r\n NoteGroupFormatter,\r\n NoteManager,\r\n Ornament,\r\n OrnamentType,\r\n Page,\r\n Part,\r\n PartData,\r\n PitchNameManager,\r\n PitchUtils,\r\n PlaybackRegion,\r\n PlaybackRegionData,\r\n PlaybackRegionDataType,\r\n PointXY,\r\n Range,\r\n RangeType,\r\n RepeatDO,\r\n RepeatDirection,\r\n ScaleInfo,\r\n Score,\r\n ScoreData,\r\n ScoreFormatter,\r\n ScoreIO,\r\n ScoreManager,\r\n ScorePlaybackInfo,\r\n ScoreProperties,\r\n Slur,\r\n SlurSegment,\r\n Staff,\r\n StaffGroupingStyle,\r\n Stem,\r\n StemDirection,\r\n SyllablePosition,\r\n System,\r\n TempoMarker,\r\n TempoTimeStampDO,\r\n TheoryTools,\r\n TieState,\r\n TransposeDirection,\r\n TranspositionDO,\r\n TranspositionManager,\r\n TranspositionRecord,\r\n TranspositionStatsDO,\r\n TranspositionType,\r\n Tuplet,\r\n Voice\r\n};\r\n","// src/score_render/bitmapRenderer/SystemRenderer.ts\nimport { Container as Container3, Graphics as Graphics3, Point as Point3, Sprite as Sprite4, Text as Text2 } from \"pixi.js\";\nimport {\n BeamState as BeamState2,\n ChordSymbol,\n ClefType,\n Dynamic,\n DynamicType,\n EndingType,\n PitchUtils,\n RepeatDirection,\n StemDirection as StemDirection2,\n TieState\n} from \"score_data\";\n\n// src/score_render/textures/TextureSet.ts\nimport { Rectangle, Sprite, Texture } from \"pixi.js\";\n\n// src/score_render/textures/Symbol.ts\nvar _Symbol = class _Symbol {\n constructor(id, x, y, width, height, svg = null) {\n this.id = id;\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n this._svg = svg;\n }\n get x() {\n return this._x;\n }\n get y() {\n return this._y;\n }\n get scaledX() {\n return Math.floor(_Symbol.coordinateScale * this._x);\n }\n get scaledY() {\n return Math.floor(_Symbol.coordinateScale * this._y);\n }\n get scaledWidth() {\n return Math.ceil(_Symbol.coordinateScale * this._width) + 1;\n }\n get scaledHeight() {\n return Math.ceil(_Symbol.coordinateScale * this._height) + 1;\n }\n get svg() {\n return this._svg;\n }\n};\n_Symbol.coordinateScale = 1;\nvar Symbol = _Symbol;\n\n// src/score_render/textures/MusicSymbolsSvg.ts\nvar _MusicSymbolsSvg = class _MusicSymbolsSvg {\n static setScale(pixelsPerSpace) {\n let promise = new Promise((resolve, reject) => {\n this._currentScale = pixelsPerSpace / _MusicSymbolsSvg._DEFAULT_PIXELS_PER_SPACE;\n Symbol.coordinateScale = this._currentScale * _MusicSymbolsSvg.DEFAULT_COORDINATE_SCALE;\n if (this._scaledAtlases.has(this._currentScale)) {\n this.atlasCanvas = this._scaledAtlases.get(this._currentScale);\n resolve();\n return;\n }\n if (this.symbols == null)\n this._createSymbolsSvg();\n let img = document.createElement(\"img\");\n img.onload = (e) => {\n let canvas = document.createElement(\"canvas\");\n canvas.width = img.width;\n canvas.height = img.height;\n let ctx = canvas.getContext(\"2d\");\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n this._scaledAtlases.set(this._currentScale, canvas);\n this.atlasCanvas = canvas;\n resolve();\n };\n let header = this._getSvgHeader(\n _MusicSymbolsSvg._DEFAULT_SVG_WIDTH * this._currentScale,\n _MusicSymbolsSvg._DEFAULT_SVG_HEIGHT * this._currentScale\n );\n img.src = \"data:image/svg+xml;charset=utf-8,\" + header + this.symbols;\n });\n return promise;\n }\n /**combines all of the symbols' SVG strings into a single string. Each\n * symbol is in its own group element. The closing suffix is\n * appended, but the header svg is left off so that it can be adjusted as\n * needed for scaling.*/\n static _createSymbolsSvg() {\n this.symbols = \"\";\n for (let key in this.symbolsMap) {\n let val = this.symbolsMap[key];\n this.symbols += `${val.svg}`;\n }\n this.symbols += \"\";\n }\n static _getSvgHeader(width, height) {\n return ``;\n }\n};\n_MusicSymbolsSvg.DEFAULT_COORDINATE_SCALE = 1;\n_MusicSymbolsSvg._DEFAULT_PIXELS_PER_SPACE = 10;\n_MusicSymbolsSvg._DEFAULT_SVG_WIDTH = 1200;\n_MusicSymbolsSvg._DEFAULT_SVG_HEIGHT = 600;\n_MusicSymbolsSvg._scaledAtlases = /* @__PURE__ */ new Map();\n_MusicSymbolsSvg._currentScale = 1;\n_MusicSymbolsSvg.symbolsMap = {\n \"TrebleClef\": new Symbol(\"TrebleClef\", 650, 400, 29, 79, ''),\n \"BassClef\": new Symbol(\"BassClef\", 50, 0, 24, 30, ''),\n \"CClef\": new Symbol(\"CClef\", 0, 0, 24, 38, ''),\n \"Sharp\": new Symbol(\"Sharp\", 800, 200, 10, 29, ''),\n \"Natural\": new Symbol(\"Natural\", 250, 200, 7, 25, ''),\n \"DoubleSharp\": new Symbol(\"DoubleSharp\", 200, 300, 10, 10, ''),\n \"QuarterNoteHead\": new Symbol(\"QuarterNoteHead\", 500, 300, 12, 11, ''),\n \"HalfNoteHead\": new Symbol(\"HalfNoteHead\", 450, 300, 12, 11, ''),\n \"WholeNoteHead\": new Symbol(\"WholeNoteHead\", 800, 300, 17, 11, ''),\n \"DoubleWholeNoteHead\": new Symbol(\"DoubleWholeNoteHead\", 800, 400, 24, 13, ''),\n \"DoubleWholeRest\": new Symbol(\"DoubleWholeRest\", 250, 300, 11, 9, ''),\n \"WholeRest\": new Symbol(\"WholeRest\", 850, 300, 13, 5, ''),\n \"HalfRest\": new Symbol(\"HalfRest\", 900, 300, 13, 5, ''),\n \"QuarterRest\": new Symbol(\"QuarterRest\", 200, 200, 9, 27, ''),\n \"EighthRest\": new Symbol(\"EighthRest\", 650, 200, 11, 16, ''),\n \"SixteenthRest\": new Symbol(\"SixteenthRest\", 350, 200, 13, 25, ''),\n \"ThirtySecondRest\": new Symbol(\"ThirtySecondRest\", 150, 200, 15, 33, ''),\n \"SixtyFourthRest\": new Symbol(\"SixtyFourthRest\", 100, 200, 18, 42, ''),\n \"EighthFlagUp\": new Symbol(\"EighthFlagUp\", 400, 200, 10, 27, ''),\n \"SixteenthFlagUp\": new Symbol(\"SixteenthFlagUp\", 600, 200, 10, 31, ''),\n \"ThirtySecondFlagUp\": new Symbol(\"ThirtySecondFlagUp\", 700, 200, 10, 40, ''),\n \"SixtyFourthFlagUp\": new Symbol(\"SixtyFourthFlagUp\", 750, 200, 10, 45, ''),\n \"EighthFlagDown\": new Symbol(\"EighthFlagDown\", 100, 300, 11, 28, ''),\n \"SixteenthFlagDown\": new Symbol(\"SixteenthFlagDown\", 50, 300, 11, 28, ''),\n \"ThirtySecondFlagDown\": new Symbol(\"ThirtySecondFlagDown\", 550, 200, 11, 36, ''),\n \"SixtyFourthFlagDown\": new Symbol(\"SixtyFourthFlagDown\", 500, 200, 11, 41, ''),\n \"DoubleFlat\": new Symbol(\"DoubleFlat\", 350, 300, 14, 23, ''),\n \"Flat\": new Symbol(\"Flat\", 750, 400, 10, 29, ''),\n \"Accent\": new Symbol(\"Accent\", 450, 0, 17, 10, ''),\n \"F\": new Symbol(\"F\", 0, 400, 20, 23, ''),\n \"FF\": new Symbol(\"FF\", 900, 400, 27, 23, ''),\n \"FFF\": new Symbol(\"FFF\", 850, 400, 35, 23, ''),\n \"Tenuto\": new Symbol(\"Tenuto\", 300, 0, 12, 2, ''),\n \"MF\": new Symbol(\"MF\", 950, 0, 31, 23, ''),\n \"MP\": new Symbol(\"MP\", 950, 100, 29, 17, ''),\n \"P\": new Symbol(\"P\", 150, 400, 16, 17, ''),\n \"PP\": new Symbol(\"PP\", 950, 200, 27, 17, ''),\n \"PPP\": new Symbol(\"PPP\", 950, 300, 37, 17, ''),\n \"Staccato\": new Symbol(\"Staccato\", 900, 200, 4, 4, ''),\n \"Trill\": new Symbol(\"Trill\", 100, 400, 18, 14, ''),\n \"Mordent\": new Symbol(\"Mordent\", 700, 400, 22, 10, ''),\n \"MordentInverted\": new Symbol(\"MordentInverted\", 50, 100, 22, 15, '')\n};\nvar MusicSymbolsSvg = _MusicSymbolsSvg;\n\n// src/score_render/textures/NoteheadType.ts\nvar NoteheadType = /* @__PURE__ */ ((NoteheadType2) => {\n NoteheadType2[NoteheadType2[\"QUARTER\"] = 0] = \"QUARTER\";\n NoteheadType2[NoteheadType2[\"HALF\"] = 1] = \"HALF\";\n NoteheadType2[NoteheadType2[\"WHOLE\"] = 2] = \"WHOLE\";\n return NoteheadType2;\n})(NoteheadType || {});\n\n// src/score_render/textures/TextureSet.ts\nvar TextureSet = class {\n constructor() {\n }\n async createTextures(pixelsPerSpace) {\n this._pixelsPerSpace = pixelsPerSpace;\n await MusicSymbolsSvg.setScale(pixelsPerSpace);\n let symbolsBD = Texture.from(MusicSymbolsSvg.atlasCanvas);\n this.wholeRest = this.getTexture(\"WholeRest\", symbolsBD);\n this.halfRest = this.getTexture(\"HalfRest\", symbolsBD);\n this.quarterRest = this.getTexture(\"QuarterRest\", symbolsBD);\n this.eighthRest = this.getTexture(\"EighthRest\", symbolsBD);\n this.sixteenthRest = this.getTexture(\"SixteenthRest\", symbolsBD);\n this.thirtySecondRest = this.getTexture(\"ThirtySecondRest\", symbolsBD);\n this.sixtyFourthRest = this.getTexture(\"SixtyFourthRest\", symbolsBD);\n this.wholeNoteHead = this.getTexture(\"WholeNoteHead\", symbolsBD);\n this.halfNoteHead = this.getTexture(\"HalfNoteHead\", symbolsBD);\n this.quarterNoteHead = this.getTexture(\"QuarterNoteHead\", symbolsBD);\n this.sharp = this.getTexture(\"Sharp\", symbolsBD);\n this.flat = this.getTexture(\"Flat\", symbolsBD);\n this.natural = this.getTexture(\"Natural\", symbolsBD);\n this.doubleSharp = this.getTexture(\"DoubleSharp\", symbolsBD);\n this.doubleFlat = this.getTexture(\"DoubleFlat\", symbolsBD);\n this.eighthFlagUp = this.getTexture(\"EighthFlagUp\", symbolsBD);\n this.eighthFlagDown = this.getTexture(\"EighthFlagDown\", symbolsBD);\n this.sixteenthFlagUp = this.getTexture(\"SixteenthFlagUp\", symbolsBD);\n this.sixteenthFlagDown = this.getTexture(\n \"SixteenthFlagDown\",\n symbolsBD\n );\n this.thirtySecondFlagUp = this.getTexture(\n \"ThirtySecondFlagUp\",\n symbolsBD\n );\n this.thirtySecondFlagDown = this.getTexture(\n \"ThirtySecondFlagDown\",\n symbolsBD\n );\n this.sixtyFourthFlagUp = this.getTexture(\n \"SixtyFourthFlagUp\",\n symbolsBD\n );\n this.sixtyFourthFlagDown = this.getTexture(\n \"SixtyFourthFlagDown\",\n symbolsBD\n );\n this.trebleClef = this.getTexture(\"TrebleClef\", symbolsBD);\n this.bassClef = this.getTexture(\"BassClef\", symbolsBD);\n this.altoClef = this.getTexture(\"CClef\", symbolsBD);\n this.tenorClef = this.getTexture(\"CClef\", symbolsBD);\n this.f = this.getTexture(\"F\", symbolsBD);\n this.ff = this.getTexture(\"FF\", symbolsBD);\n this.fff = this.getTexture(\"FFF\", symbolsBD);\n this.p = this.getTexture(\"P\", symbolsBD);\n this.pp = this.getTexture(\"PP\", symbolsBD);\n this.ppp = this.getTexture(\"PPP\", symbolsBD);\n this.mf = this.getTexture(\"MF\", symbolsBD);\n this.mp = this.getTexture(\"MP\", symbolsBD);\n this.augmentationDot = this.getTexture(\"Staccato\", symbolsBD);\n this.accent = this.getTexture(\"Accent\", symbolsBD);\n this.staccato = this.getTexture(\"Staccato\", symbolsBD);\n this.legato = this.getTexture(\"Tenuto\", symbolsBD);\n this.mordent = this.getTexture(\"Mordent\", symbolsBD);\n this.mordentInverted = this.getTexture(\"MordentInverted\", symbolsBD);\n this.trill = this.getTexture(\"Trill\", symbolsBD);\n }\n getTexture(id, symbolsBD) {\n var sym = MusicSymbolsSvg.symbolsMap[id];\n let scaledTexture = new Texture({\n source: symbolsBD.source,\n frame: new Rectangle(\n sym.scaledX,\n sym.scaledY,\n sym.scaledWidth,\n sym.scaledHeight\n )\n });\n return scaledTexture;\n }\n /**This needs to be rethought because PIXI does not create a copy of\n * original pixels when using clone. Perhaps we can create colored SVG\n * noteheads instead and make them regular symbols.\n */\n /**gets a colored version of a notehead\n * @param noteheadType a value from the NoteheadType enum\n * @param color an int with values for red, green, blue (ex. 0xFF0000)*/\n getColoredNotehead(noteheadType, color) {\n let sprite;\n switch (noteheadType) {\n case 2 /* WHOLE */:\n sprite = new Sprite(this.wholeNoteHead);\n break;\n case 1 /* HALF */:\n sprite = new Sprite(this.halfNoteHead);\n break;\n default:\n sprite = new Sprite(this.quarterNoteHead);\n }\n sprite.tint = color;\n return sprite;\n }\n _disposeOfTextures() {\n }\n};\n\n// src/score_render/textures/MusicTextures.ts\nvar MusicTextures = class {\n static async createTextures(pixelsPerSpace) {\n if (this._textureSets[pixelsPerSpace] != null) {\n return;\n }\n var textureSet = new TextureSet();\n await textureSet.createTextures(pixelsPerSpace);\n this._textureSets[pixelsPerSpace] = textureSet;\n }\n static getTextureSet(pixelsPerSpace) {\n return this._textureSets[pixelsPerSpace];\n }\n};\n//map of pixels per space to matching texture set\nMusicTextures._textureSets = {};\n\n// src/score_render/bitmapRenderer/VisualMeasure.ts\nvar VisualMeasure = class {\n get scoreX() {\n return this.vSystemRef.scoreX + this.x;\n }\n get scoreY() {\n return this.vSystemRef.scoreY + this.y;\n }\n constructor(x = 0, y = 0, width = 0, height = 0, measureRef = null, vNoteGroups) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.measureRef = measureRef;\n this.vNoteGroups = vNoteGroups;\n }\n};\n\n// src/score_render/bitmapRenderer/VisualNoteGroup.ts\nimport {\n AccidentalType,\n ArticulationType,\n BeamState,\n DurationType,\n OrnamentType,\n StemDirection\n} from \"score_data\";\nimport { Container, Graphics, Sprite as Sprite2, Text } from \"pixi.js\";\n\n// src/score_render/bitmapRenderer/VNGContent.ts\nvar VNGContent = class {\n constructor() {\n this.minX = 9999999;\n this.maxX = -9999999;\n this.minY = 9999999;\n this.maxY = -9999999;\n }\n update(minX, maxX, minY, maxY) {\n if (minX < this.minX) {\n this.minX = minX;\n }\n if (maxX > this.maxX) {\n this.maxX = maxX;\n }\n if (minY < this.minY) {\n this.minY = minY;\n }\n if (maxY > this.maxY) {\n this.maxY = maxY;\n }\n }\n};\n\n// src/score_render/bitmapRenderer/VisualNoteGroup.ts\nvar VisualNoteGroup = class extends Container {\n constructor(noteGroup, scoreProps, systemRef) {\n super();\n this._content = new VNGContent();\n this._noteGroup = noteGroup;\n if (this._noteGroup == null) {\n console.log(\"NoteGroup null - VisualNoteGroup()\");\n }\n this._scoreProps = scoreProps;\n this._vSystemRef = systemRef;\n this._init();\n }\n /**sets the color of the note.*/\n setColor(color = 0) {\n if (this._noteheadList == null) {\n return;\n }\n for (let nh of this._noteheadList) {\n nh.tint = color;\n }\n }\n _init() {\n this._visualAttachments = [];\n if (this._noteGroup.visible === false) {\n return;\n }\n this._draw();\n }\n _draw() {\n this._g = new Graphics();\n this.addChild(this._g);\n if (this._noteGroup.isRest) {\n this._drawRest();\n } else {\n this._drawNotes();\n this._drawStem();\n }\n this._addAttachments();\n }\n _drawRest() {\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n let restShape;\n let verticalOffset = 0;\n switch (this._noteGroup.durationType) {\n case DurationType.WHOLE:\n restShape = new Sprite2(textures.wholeRest);\n verticalOffset = -0.75;\n break;\n case DurationType.HALF:\n restShape = new Sprite2(textures.halfRest);\n verticalOffset = -0.25;\n restShape.x = -0.35 * restShape.width;\n break;\n case DurationType.QUARTER:\n restShape = new Sprite2(textures.quarterRest);\n break;\n case DurationType.EIGHTH:\n restShape = new Sprite2(textures.eighthRest);\n break;\n case DurationType.SIXTEENTH:\n restShape = new Sprite2(textures.sixteenthRest);\n break;\n case DurationType.THIRTY_SECOND:\n restShape = new Sprite2(textures.thirtySecondRest);\n break;\n case DurationType.SIXTY_FOURTH:\n restShape = new Sprite2(textures.sixtyFourthRest);\n break;\n default:\n restShape = new Sprite2(textures.quarterRest);\n console.log(`Unsupported rest duration! ${this._noteGroup.durationType} VisualNoteGroup.drawRest()`);\n }\n restShape.y = (this._noteGroup.restVPos + verticalOffset) * px - restShape.height / 2;\n if (this._noteGroup.durationType === DurationType.WHOLE) {\n if (this._noteGroup.qNoteDuration === this._noteGroup.voice.measure.stack.qNoteLength) {\n restShape.x = -0.5 * restShape.width;\n }\n }\n this.addChild(restShape);\n for (let i = 0; i < this._noteGroup.numDots; i++) {\n this._g.circle(\n restShape.x + restShape.width + 3 + px * i,\n restShape.y + 0.3 * restShape.height,\n this._scoreProps.noteheadWidth * px / 5\n );\n this._g.fill(0);\n }\n if (restShape.x < this.content.minX) {\n this.content.minX = restShape.x;\n }\n if (restShape.x + restShape.width > this.content.maxX) {\n this.content.maxX = restShape.x + restShape.width;\n }\n this.content.update(\n restShape.x,\n restShape.x + restShape.width,\n restShape.y,\n restShape.y + restShape.height\n );\n }\n _drawNotes() {\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n let bottomNote;\n let topNote;\n this._noteheadList = [];\n for (let note of this._noteGroup.notes) {\n if (note.visible === false) {\n continue;\n }\n if (bottomNote == null) {\n bottomNote = note;\n }\n topNote = note;\n let noteShape;\n switch (this._noteGroup.durationType) {\n case DurationType.WHOLE:\n noteShape = new Sprite2(textures.wholeNoteHead);\n this._noteheadType = 2 /* WHOLE */;\n noteShape.tint = 0;\n break;\n case DurationType.HALF:\n noteShape = new Sprite2(textures.halfNoteHead);\n this._noteheadType = 1 /* HALF */;\n noteShape.tint = 0;\n break;\n default:\n noteShape = new Sprite2(textures.quarterNoteHead);\n this._noteheadType = 0 /* QUARTER */;\n noteShape.tint = 0;\n }\n this._noteheadList.push(noteShape);\n if (this._noteGroup.isGrace) {\n noteShape.scale.x *= 0.65;\n noteShape.scale.y *= 0.65;\n }\n noteShape.x = this._noteGroup.stemDirection === StemDirection.DOWN ? note.hPos * px - 1 : note.hPos * px;\n noteShape.y = note.vPos * px - noteShape.height / 2;\n this.addChild(noteShape);\n this._content.update(\n noteShape.x,\n noteShape.x + noteShape.width,\n noteShape.y,\n noteShape.y + noteShape.height\n );\n for (let i = 0; i < this._noteGroup.numDots; i++) {\n let x = (note.hPos + 1.6 * this._scoreProps.noteheadWidth + i) * px;\n let y = px * (note.vPos - 0.5 * ((Math.abs(note.stepsFromTopStaffLine) + 1) % 2));\n let radius = this._scoreProps.noteheadWidth * px / 5;\n this._g.circle(x, y, radius);\n this._g.fill(0);\n this._content.update(\n x - radius / 2,\n x + radius / 2,\n y - radius / 2,\n y + radius / 2\n );\n }\n let accidental = null;\n let vertOffset = 0;\n if (note.showAccidental) {\n switch (note.accidental) {\n case AccidentalType.NONE:\n break;\n case AccidentalType.SHARP:\n accidental = new Sprite2(textures.sharp);\n vertOffset = -0.1;\n break;\n case AccidentalType.FLAT:\n accidental = new Sprite2(textures.flat);\n vertOffset = -0.5;\n break;\n case AccidentalType.NATURAL:\n accidental = new Sprite2(textures.natural);\n vertOffset = -0.1;\n break;\n case AccidentalType.DOUBLE_SHARP:\n accidental = new Sprite2(textures.doubleSharp);\n vertOffset = 0.2;\n break;\n case AccidentalType.DOUBLE_FLAT:\n accidental = new Sprite2(textures.doubleFlat);\n vertOffset = -0.5;\n break;\n case AccidentalType.TRIPLE_SHARP:\n accidental = new Sprite2();\n let sharp = new Sprite2(textures.sharp);\n sharp.x = -2.5 * px;\n let doubSharp = new Sprite2(textures.doubleSharp);\n doubSharp.y = 1.3 * px;\n accidental.addChild(sharp);\n accidental.addChild(doubSharp);\n break;\n case AccidentalType.TRIPLE_FLAT:\n accidental = new Sprite2();\n let flat = new Sprite2(textures.flat);\n flat.x = -1;\n let doubFlat = new Sprite2(textures.doubleFlat);\n accidental.addChild(flat);\n accidental.addChild(doubFlat);\n vertOffset = -0.5;\n break;\n default:\n console.log(`Unrecognized accidental! ${note.accidental} VisualNoteGroup.drawNotes()`);\n }\n }\n if (accidental != null) {\n accidental.scale.x = noteShape.scale.x;\n accidental.scale.y = noteShape.scale.y;\n accidental.y = noteShape.y - accidental.height / 4 + vertOffset * px;\n accidental.x = note.accidentalPos * px;\n this.addChild(accidental);\n this._content.update(\n accidental.x,\n accidental.x + accidental.width,\n accidental.y,\n accidental.y + accidental.height\n );\n }\n }\n if (bottomNote == null) {\n return;\n }\n if (bottomNote.legerLines > 0) {\n let legerWidth = Math.max(\n this._scoreProps.legerLineWidth * px,\n 1\n );\n this._g.setStrokeStyle({ width: legerWidth, color: 0 });\n for (let i = 0; i < bottomNote.legerLines; i++) {\n let x1 = -0.2 * this._scoreProps.noteheadWidth * px;\n let y = px * (5 + i);\n this._g.moveTo(x1, y);\n let x2 = (1.2 * this._scoreProps.noteheadWidth + bottomNote.hPos) * px;\n this._g.lineTo(x2, y);\n this._g.stroke();\n this._content.update(x1, x2, y, y + legerWidth);\n }\n }\n if (topNote.legerLines < 0) {\n let legerWidth = Math.max(\n this._scoreProps.legerLineWidth * px,\n 1\n );\n this._g.setStrokeStyle({ width: legerWidth, color: 0 });\n let i = 0;\n while (i > topNote.legerLines) {\n let x1 = -0.2 * this._scoreProps.noteheadWidth * px;\n let y = px * (-1 + i);\n this._g.moveTo(x1, y);\n let x2 = (1.2 * this._scoreProps.noteheadWidth + topNote.hPos) * px;\n this._g.lineTo(x2, y);\n this._g.stroke();\n i--;\n this._content.update(x1, x2, y, y + legerWidth);\n }\n }\n }\n _drawStem() {\n if (this._noteGroup.stemDirection === StemDirection.NO_STEM) {\n return;\n }\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n let stemWidth = Math.max(this._scoreProps.stemWidth * px, 1);\n this._g.setStrokeStyle({ width: stemWidth, color: 0 });\n let x = this._noteGroup.stemHPos * px;\n let y1 = this._noteGroup.stemStartPos * px;\n this._g.moveTo(x, y1);\n let y2 = this._noteGroup.stemEndPos * px;\n this._g.lineTo(x, y2);\n this._g.stroke();\n if (y2 > y1) {\n this._content.update(x, x + stemWidth, y1, y2);\n } else {\n this._content.update(x, x + stemWidth, y2, y1);\n }\n if (this._noteGroup.beamStates.length === 0 || this._noteGroup.beamStates[0] === BeamState.NONE) {\n let flagShape = null;\n switch (this._noteGroup.durationType) {\n case DurationType.EIGHTH:\n flagShape = this._noteGroup.stemDirection === StemDirection.UP ? new Sprite2(textures.eighthFlagUp) : new Sprite2(textures.eighthFlagDown);\n break;\n case DurationType.SIXTEENTH:\n flagShape = this._noteGroup.stemDirection === StemDirection.UP ? new Sprite2(textures.sixteenthFlagUp) : new Sprite2(textures.sixteenthFlagDown);\n break;\n case DurationType.THIRTY_SECOND:\n flagShape = this._noteGroup.stemDirection === StemDirection.UP ? new Sprite2(textures.thirtySecondFlagUp) : new Sprite2(textures.thirtySecondFlagDown);\n break;\n case DurationType.SIXTY_FOURTH:\n flagShape = this._noteGroup.stemDirection === StemDirection.UP ? new Sprite2(textures.sixteenthFlagUp) : new Sprite2(textures.sixteenthFlagDown);\n break;\n case DurationType.QUARTER:\n break;\n case DurationType.HALF:\n break;\n case DurationType.WHOLE:\n break;\n default:\n console.log(`Unknown duration! ${this._noteGroup.durationType} VisualNoteGroup.drawStem()`);\n }\n if (flagShape != null) {\n if (this._noteGroup.isGrace) {\n flagShape.scale.y = flagShape.scale.x = 0.6;\n }\n flagShape.x = this._noteGroup.stemHPos * px;\n flagShape.y = this._noteGroup.stemDirection === StemDirection.UP ? this._noteGroup.stemEndPos * px : this._noteGroup.stemEndPos * px - flagShape.height;\n this.addChild(flagShape);\n this._content.update(\n flagShape.x,\n flagShape.x + flagShape.width,\n flagShape.y,\n flagShape.y + flagShape.height\n );\n }\n }\n }\n _addAttachments() {\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n if (this._noteGroup.lyric != null) {\n let lyric = this._noteGroup.lyric;\n if (lyric.text != null && lyric.text !== \"\") {\n let lyricTF = new Text({\n text: lyric.text,\n style: {\n fontFamily: \"arial\",\n fontSize: px * 2,\n fill: 0,\n align: \"left\"\n }\n });\n lyricTF.y = -1 * lyric.vPos * px - lyricTF.height + 4;\n lyricTF.x = lyricTF.width / -2 + this._scoreProps.noteheadWidth * px / 2;\n this.addChild(lyricTF);\n this._visualAttachments.push(lyricTF);\n }\n }\n if (this._noteGroup.articulations != null) {\n for (let artic of this._noteGroup.articulations) {\n let articBmp;\n switch (artic.type) {\n case ArticulationType.STACCATO:\n articBmp = new Sprite2(textures.staccato);\n break;\n case ArticulationType.ACCENT:\n articBmp = new Sprite2(textures.accent);\n break;\n case ArticulationType.LEGATO:\n articBmp = new Sprite2(textures.legato);\n break;\n default:\n continue;\n }\n if (articBmp != null) {\n articBmp.x = artic.hPos * px;\n articBmp.y = artic.vPos * px;\n this.addChild(articBmp);\n this._visualAttachments.push(articBmp);\n }\n }\n }\n if (this._noteGroup.ornaments != null) {\n for (let orn of this._noteGroup.ornaments) {\n let ornBmp;\n switch (orn.type) {\n case OrnamentType.INVERTED_MORDENT:\n ornBmp = new Sprite2(textures.mordentInverted);\n break;\n case OrnamentType.MORDENT:\n ornBmp = new Sprite2(textures.mordent);\n break;\n case OrnamentType.TRILL_MARK:\n ornBmp = new Sprite2(textures.trill);\n break;\n default:\n continue;\n }\n if (ornBmp != null) {\n ornBmp.x = orn.hPos * px;\n ornBmp.y = orn.vPos * px;\n this.addChild(ornBmp);\n this._visualAttachments.push(ornBmp);\n }\n }\n }\n }\n get noteGroup() {\n return this._noteGroup;\n }\n get vSystemRef() {\n return this._vSystemRef;\n }\n set vSystemRef(value) {\n this._vSystemRef = value;\n }\n get visualAttachments() {\n return this._visualAttachments;\n }\n set visualAttachments(value) {\n this._visualAttachments = value;\n }\n get scoreX() {\n return this._vSystemRef.scoreX + this.x;\n }\n get scoreY() {\n return this._vSystemRef.scoreY + this.y;\n }\n /**The content object lists positioning info of elements in this\n * VisualNoteGroup relative to an origin that starts on the top staff line.\n * The elements of the NoteGroup may begin above, below, to the left or\n * to the right of that point. To determine the score position of the\n * elements or bounds of this notegroup, combine these values with the\n * VisualNoteGroup's scoreX and scoreY. */\n get content() {\n return this._content;\n }\n get noteheadList() {\n return this._noteheadList.slice(0);\n }\n get noteheadType() {\n return this._noteheadType;\n }\n /**the X/Y position of the VisualNoteGroup as it is originally set. This can\n * be used to save the note's position before it gets moved during \n * assessment, etc.*/\n get originalPosition() {\n return this._originalPosition;\n }\n set originalPosition(value) {\n this._originalPosition = value;\n }\n};\n\n// src/score_render/bitmapRenderer/VisualSystem.ts\nimport {\n Container as Container2,\n Graphics as Graphics2,\n MSAA_QUALITY,\n Rectangle as Rectangle2,\n Sprite as Sprite3\n} from \"pixi.js\";\nvar VisualSystem = class extends Container2 {\n constructor(visualScore, system, scoreProperties) {\n super();\n this._visualMeasures = [];\n this._visualSystemStaves = [];\n this._visualScore = visualScore;\n this._systemRef = system;\n this._scoreProps = scoreProperties;\n this._visNoteGroups = [];\n this.g = new Graphics2();\n this.addChild(this.g);\n this.container = new Container2();\n this.addChild(this.container);\n this._textureSprite = new Sprite3();\n }\n /**\n * gets the VisualMeasure object that lies under the passed in Point\n * @param point a Point object relative to the system origin with\n * coordinates of the point to check against each measure in the system\n * @return a VisualMeasure if one is found, otherwise null\n */\n getVisualMeasureUnderPoint(point) {\n for (let vStaff of this._visualSystemStaves) {\n if (vStaff.y <= point.y && vStaff.y + vStaff.height > point.y) {\n for (let vMeas of vStaff.vMeasures) {\n if (vMeas.x <= point.x && vMeas.x + vMeas.width > point.x && vMeas.y <= point.y && vMeas.y + vMeas.height > point.y) {\n return vMeas;\n }\n }\n }\n }\n return null;\n }\n /**\n * gets the VisualNoteGroup object that lies under the passed in Point\n * @param point a Point object relative to the system origin with\n * coordinates of the point to check against each NoteGroup in the system\n * @return a VisualNoteGroup if one is found, otherwise null\n */\n getVisualNoteGroupUnderPoint(point) {\n for (let vng of this._visNoteGroups) {\n if (vng.x <= point.x && vng.x + vng.width > point.x && vng.y <= point.y && vng.y + vng.height > point.y) {\n return vng;\n }\n }\n return null;\n }\n /**gets a Sprite object with the cached system graphics, creating the cache\n * if it doesn't exist.*/\n getTextureSprite() {\n if (this._renderTexture == null) {\n this._generateTexture();\n }\n let sprite = new Sprite3(this._renderTexture);\n sprite.x = this._graphicsBounds.x;\n sprite.y = this._graphicsBounds.y;\n return sprite;\n }\n /**creates or refreshes the texture of cached system graphics.*/\n createOrRefreshTexture() {\n let wasDisplayed = this._textureSprite?.parent === this;\n this.deleteTexture();\n this._generateTexture();\n if (wasDisplayed) {\n this.displayTexture();\n }\n }\n /**displays the texture for this system instead of the live graphics. If\n * the texture doesn't exist, it is created. If it does exist, it is\n * resused.*/\n displayTexture() {\n if (this._renderTexture == null) {\n this._generateTexture();\n }\n if (this.g.parent === this) {\n this.removeChild(this.g);\n }\n if (this.container.parent === this) {\n this.removeChild(this.container);\n }\n if (this._textureSprite.parent !== this) {\n this.addChild(this._textureSprite);\n }\n }\n /**displays the live graphics for this system instead of the cached\n * texture*/\n displayGraphics() {\n if (this._textureSprite.parent === this) {\n this.removeChild(this._textureSprite);\n }\n if (this.g.parent !== this) {\n this.addChildAt(this.g, 0);\n }\n if (this.container.parent !== this) {\n this.addChildAt(this.container, 1);\n }\n }\n /**disposes of all textures that have been generated for this system. */\n deleteTexture() {\n if (this._textureSprite != null) {\n if (this._textureSprite.parent === this) {\n this.removeChild(this._textureSprite);\n }\n this._textureSprite.destroy(true);\n this._textureSprite = null;\n this._renderTexture = null;\n this._graphicsBounds = null;\n }\n }\n ///adds an extra notehead, as for assessment, to the system\n addExtraNotehead(xPos, yPos, color) {\n }\n ///removes any extra noteheads that were added (as for assessment). If any\n ///were present, true is returned, otherwise false.\n removeExtraNoteheads() {\n return true;\n }\n _generateTexture() {\n let bounds = this.getLocalBounds();\n let rect = new Rectangle2(\n Math.floor(bounds.x) - 1,\n Math.floor(bounds.y) - 1,\n Math.ceil(bounds.width) + 2,\n Math.ceil(bounds.height) + 2\n );\n let renderer = this._visualScore.pixiAppHelper.app.renderer;\n this._renderTexture = renderer.generateTexture(this);\n this._textureSprite.texture = this._renderTexture;\n this._textureSprite.x = rect.x;\n this._textureSprite.y = rect.y;\n this._graphicsBounds = rect;\n }\n get visNoteGroups() {\n return this._visNoteGroups;\n }\n get pageRef() {\n return this._pageRef;\n }\n set pageRef(value) {\n this._pageRef = value;\n }\n get scoreX() {\n return this.x + this._pageRef.x;\n }\n get scoreY() {\n return this.y + this._pageRef.y;\n }\n /**\n * the System object used to generate this VisualSystem\n */\n get systemRef() {\n return this._systemRef;\n }\n /**\n * a list of Rectangles containing the dimensions and positions of the\n * measures in the system (positions relative to system origin). Rectangles\n * are ordered one row at a time (all measures of first row, then second\n * row, etc.). */\n get visualMeasures() {\n return this._visualMeasures;\n }\n /**an array of conceptual containers of the VisualMeasures for this system.\n * This is used for faster point searching.\t*/\n get visualSystemStaves() {\n return this._visualSystemStaves;\n }\n /**The bounds calculated during caching of the Graphics object for this\n * system.*/\n get graphicsBounds() {\n return this._graphicsBounds.clone();\n }\n};\nVisualSystem.renderTextureQuality = MSAA_QUALITY.HIGH;\n\n// src/score_render/bitmapRenderer/VisualSystemStaff.ts\nvar VisualSystemStaff = class {\n constructor(y, height, vSystem, vMeasures) {\n this.y = y;\n this.height = height;\n this.vSystemRef = vSystem;\n this.vMeasures = vMeasures;\n }\n};\n\n// src/score_render/bitmapRenderer/SystemRenderer.ts\nvar _SystemRenderer = class _SystemRenderer {\n constructor(scoreProps) {\n this._scoreProps = scoreProps;\n this._legacyVNGIndex = 0;\n }\n renderSystem(visualScore, system, parts, addedObjects, removedObjects) {\n let visualSystem = new VisualSystem(\n visualScore,\n system,\n this._scoreProps\n );\n system.visibleParts = parts;\n let staffVPosOffsets = system.staffVPosOffsets;\n let numStaves = staffVPosOffsets.length;\n let staffGroupings = system.staffGroupings;\n let stacks = system.measureStacks;\n let numStacks = stacks.length;\n let systemIndent = system.indent;\n let systemWidth = system.systemWidth;\n let staffSpacing = 4 + system.staffSpacing;\n let vStaffPos = 0;\n let px = this._scoreProps.pixelsPerSpace;\n for (let i = 0; i < numStaves; i++) {\n if (parts.indexOf(stacks[0].measures[i].staff.partRef) === -1 || stacks[0].measures[i].staff.visible === false) {\n continue;\n }\n vStaffPos += staffVPosOffsets[i];\n let horizMeasPos = systemIndent;\n this._drawStaff(systemWidth, visualSystem, systemIndent, vStaffPos);\n let vMeasuresOnStaff = [];\n let vngLists = [];\n for (let j = 0; j < numStacks; j++) {\n let cStack = stacks[j];\n let cMeasure = cStack.measures[i];\n let vNoteGroupsInMeasure = this._drawNotes(\n cMeasure,\n systemIndent,\n vngLists,\n visualSystem,\n vStaffPos,\n addedObjects,\n removedObjects\n );\n this._addClefKeyTime(\n cMeasure,\n systemIndent,\n vStaffPos,\n visualSystem,\n vngLists\n );\n this._addAttachments(\n cMeasure,\n systemIndent,\n vStaffPos,\n visualSystem\n );\n if (i === 0) {\n cStack.needsRendering = false;\n }\n let clefOffset = 0;\n if (j + 1 < numStacks && stacks[j + 1].newClef) {\n clefOffset = this._scoreProps.clefWidth + this._scoreProps.clefDistanceFromBarline;\n } else if (cStack.newClef && j > 0) {\n clefOffset = -1 * (this._scoreProps.clefWidth + this._scoreProps.clefDistanceFromBarline);\n }\n let vMeasure = new VisualMeasure(\n horizMeasPos * px,\n vStaffPos * px,\n (cStack.width + clefOffset) * px,\n 4 * px,\n cMeasure,\n vNoteGroupsInMeasure\n );\n vMeasure.vSystemRef = visualSystem;\n visualSystem.visualMeasures.push(vMeasure);\n vMeasuresOnStaff.push(vMeasure);\n horizMeasPos += cStack.width + clefOffset;\n }\n let vSystemStaff = new VisualSystemStaff(\n vStaffPos * px,\n 4 * px,\n visualSystem,\n vMeasuresOnStaff\n );\n visualSystem.visualSystemStaves.push(vSystemStaff);\n this._drawBeams(vngLists, systemIndent, vStaffPos, visualSystem);\n this._drawTuplets(vngLists, vStaffPos, visualSystem);\n this._drawTies(vngLists, vStaffPos, visualSystem);\n vStaffPos += staffSpacing;\n }\n this._renderVerticalBarlines(\n staffGroupings,\n systemIndent,\n visualSystem,\n vStaffPos - staffSpacing,\n stacks,\n systemWidth\n );\n this._drawRepeats(\n staffGroupings,\n systemIndent,\n visualSystem,\n vStaffPos - staffSpacing,\n stacks\n );\n this._drawSlurs(system, visualSystem, parts);\n return visualSystem;\n }\n _drawStaff(systemWidth, vSystem, systemIndent, vStaffPos) {\n let px = this._scoreProps.pixelsPerSpace;\n let g = vSystem.g;\n g.setStrokeStyle({\n color: 0,\n width: Math.max(this._scoreProps.staffLineWidth * px, 1)\n });\n for (let i = 0; i < 5; i++) {\n g.moveTo(systemIndent * px, (i + vStaffPos) * px);\n g.lineTo(systemWidth * px, (i + vStaffPos) * px);\n }\n g.stroke();\n }\n _drawNotes(measure, systemIndent, vngLists, vSystem, vStaffPos, addedObjects, removedObjects) {\n let vng;\n let px = this._scoreProps.pixelsPerSpace;\n let vNoteGroupsInMeasure = [];\n if (!measure.notesNeedRendering) {\n let numLegacyVNGs = this._legacyVNoteGroups.length;\n for (let i = 0; i < measure.voices.length; i++) {\n if (vngLists.length < i + 1) {\n vngLists.push(new Array());\n }\n for (let noteGroup of measure.voices[i].noteGroups) {\n let loopedOnce = false;\n while (this._legacyVNGIndex < numLegacyVNGs && this._legacyVNoteGroups[this._legacyVNGIndex].noteGroup !== noteGroup) {\n this._legacyVNGIndex++;\n if (this._legacyVNGIndex >= numLegacyVNGs) {\n if (!loopedOnce) {\n loopedOnce = true;\n this._legacyVNGIndex = 0;\n }\n }\n }\n if (this._legacyVNGIndex >= numLegacyVNGs) {\n throw \"Looking for a VisualNoteGroup that is not available for re-render! This probably means a Measure with a new note was not marked for re-rendering.\";\n }\n vng = this._legacyVNoteGroups[this._legacyVNGIndex];\n let attachments = [];\n for (let attachment of vng.visualAttachments) {\n if (attachment instanceof Graphics3) {\n attachments.push(attachment);\n }\n }\n vng.visualAttachments = attachments;\n vng.spx = systemIndent + measure.stack.startPosition + noteGroup.hPos;\n vng.x = vng.spx * px;\n vng.spy = vStaffPos;\n vng.y = vng.spy * px;\n vng.originalPosition.x = vng.x;\n vng.originalPosition.y = vng.y;\n vSystem.container.addChild(vng);\n vng.vSystemRef = vSystem;\n vSystem.visNoteGroups.push(vng);\n vngLists[i].push(vng);\n vNoteGroupsInMeasure.push(vng);\n }\n }\n } else {\n for (let i = 0; i < measure.voices.length; i++) {\n if (vngLists.length < i + 1) {\n vngLists.push(new Array());\n }\n for (let noteGroup of measure.voices[i].noteGroups) {\n vng = new VisualNoteGroup(\n noteGroup,\n this._scoreProps,\n vSystem\n );\n vng.spx = systemIndent + measure.stack.startPosition + noteGroup.hPos;\n vng.x = vng.spx * px;\n vng.spy = vStaffPos;\n vng.y = vng.spy * px;\n vng.originalPosition = new Point3(vng.x, vng.y);\n vSystem.container.addChild(vng);\n vSystem.visNoteGroups.push(vng);\n vngLists[i].push(vng);\n vNoteGroupsInMeasure.push(vng);\n addedObjects.push(vng);\n }\n }\n if (this._legacyVNoteGroups != null && this._legacyVNoteGroups.length > 0) {\n while (this._legacyVNGIndex < this._legacyVNoteGroups.length && this._legacyVNoteGroups[this._legacyVNGIndex].noteGroup.voice.measure === measure) {\n removedObjects.push(\n this._legacyVNoteGroups[this._legacyVNGIndex]\n );\n this._legacyVNGIndex++;\n }\n }\n measure.notesNeedRendering = false;\n }\n return vNoteGroupsInMeasure;\n }\n _drawBeams(vngLists, systemIndent, vStaffPos, vSystem) {\n let px = this._scoreProps.pixelsPerSpace;\n let currentBeams = {};\n let beamWidth = this._scoreProps.beamWidth;\n let stemEndPos = 0;\n let hPos = 0;\n let vPos = 0;\n let g = vSystem.g;\n for (let vngList of vngLists) {\n for (let vng of vngList) {\n let noteGroup = vng.noteGroup;\n if (!noteGroup.visible) {\n currentBeams = {};\n continue;\n }\n let scale = !noteGroup.isGrace ? 1 : 0.65;\n let stackPos = noteGroup.voice.measure.stack.startPosition;\n beamWidth = this._scoreProps.beamWidth * scale;\n for (let i = 0; i < noteGroup.beamStates.length; i++) {\n if (noteGroup.beamStates[i] !== BeamState2.CONTINUE && noteGroup.beamStates[i] !== BeamState2.NONE) {\n stemEndPos = noteGroup.stemEndPos;\n hPos = systemIndent + stackPos + noteGroup.hPos + noteGroup.stemHPos;\n vPos = noteGroup.stemDirection === StemDirection2.UP ? stemEndPos + beamWidth * 2 * i : stemEndPos - beamWidth * 2 * i;\n vPos += vStaffPos;\n }\n switch (noteGroup.beamStates[i]) {\n case BeamState2.BEGIN:\n currentBeams[i] = new Point3(hPos, vPos);\n break;\n case BeamState2.END:\n let startingPoint = currentBeams[i];\n if (startingPoint != null) {\n g.setStrokeStyle({\n color: 0,\n width: beamWidth * px,\n join: \"round\",\n cap: \"butt\"\n });\n g.moveTo(\n startingPoint.x * px,\n startingPoint.y * px\n );\n g.lineTo(hPos * px, vPos * px);\n g.stroke();\n }\n break;\n case BeamState2.CONTINUE:\n break;\n case BeamState2.FORWARD_HOOK:\n g.setStrokeStyle({\n color: 0,\n width: beamWidth * px,\n join: \"round\",\n cap: \"butt\"\n });\n g.moveTo(hPos * px, vPos * px);\n g.lineTo(\n (hPos + this._scoreProps.noteheadWidth / 1.5) * px,\n vPos * px\n );\n g.stroke();\n break;\n case BeamState2.BACKWARD_HOOK:\n g.setStrokeStyle({\n color: 0,\n width: beamWidth * px,\n join: \"round\",\n cap: \"butt\"\n });\n g.moveTo(hPos * px, vPos * px);\n g.lineTo((hPos - this._scoreProps.noteheadWidth / 1.5) * px, vPos * px);\n g.stroke();\n break;\n case BeamState2.NONE:\n break;\n default:\n console.log(`Unrecognized Beam State! VisualSystem.drawBeams ${noteGroup.beamStates[i]}`);\n }\n }\n }\n }\n }\n _drawTuplets(vngLists, vStaffPos, vSystem) {\n let px = this._scoreProps.pixelsPerSpace;\n let g = vSystem.g;\n let bracketWidth = Math.max(\n 1,\n this._scoreProps.tupletBracketWidth * px\n );\n for (let vngList of vngLists) {\n for (let vng of vngList) {\n if (vng.noteGroup.tuplets == null) {\n continue;\n }\n let noteGroup = vng.noteGroup;\n for (let tuplet of noteGroup.tuplets) {\n if (tuplet.firstNote.visible === false || tuplet.endNote.visible === false) {\n continue;\n }\n if (tuplet.firstNote === noteGroup) {\n let tupletTF = new Text2({\n text: tuplet.numerator.toString(),\n style: {\n fontFamily: \"Arial\",\n align: \"center\",\n fontSize: 1.7 * px,\n fill: 0\n }\n });\n tupletTF.text = tuplet.numerator.toString();\n let centerX = vng.spx + (tuplet.endNote.hPos - vng.noteGroup.hPos) / 2 + tuplet.firstNote.stemHPos / 2;\n tupletTF.x = centerX * px;\n let vPos = tuplet.vPos + vStaffPos;\n tupletTF.y = vPos * px - tupletTF.height / 2;\n if (tuplet.showBracket) {\n g.setStrokeStyle({\n color: 0,\n width: bracketWidth,\n join: \"round\",\n cap: \"butt\"\n });\n let startX = vng.spx;\n let endX = vng.spx + (tuplet.endNote.hPos - vng.noteGroup.hPos) + this._scoreProps.noteheadWidth;\n let hookEndVPos = tuplet.above ? vPos + 1 / 2 : vPos - 1 / 2;\n g.moveTo(startX * px, hookEndVPos * px);\n g.lineTo(startX * px, vPos * px);\n g.lineTo((centerX - 0.3) * px, vPos * px);\n g.moveTo((centerX + 1.2) * px, vPos * px);\n g.lineTo(endX * px, vPos * px);\n g.lineTo(endX * px, hookEndVPos * px);\n g.stroke();\n }\n vSystem.container.addChild(tupletTF);\n }\n }\n }\n }\n }\n _addClefKeyTime(measure, systemIndent, vStaffPos, vSystem, vngLists) {\n let hInsertPos = measure.stack.startPosition + systemIndent;\n let clefList = measure.clefs;\n let clefType = clefList[0].type;\n if (clefList[0].show) {\n hInsertPos += this._scoreProps.clefDistanceFromBarline;\n this._drawClef(\n clefType,\n clefList[0].smallSize,\n hInsertPos,\n vStaffPos,\n vSystem\n );\n hInsertPos += this._scoreProps.clefWidth;\n } else if (measure.stack.newClef) {\n hInsertPos += this._scoreProps.clefDistanceFromBarline + this._scoreProps.clefWidth;\n }\n let i = 1;\n while (i < clefList.length) {\n let clef = clefList[i];\n let breakMiddle = false;\n for (let vngList of vngLists) {\n let numVNGs = vngList.length;\n for (let j = 0; j < numVNGs; j++) {\n if (vngList[j].noteGroup.clef === clef) {\n this._drawClef(\n clef.type,\n clef.smallSize,\n vngList[j].x - this._scoreProps.clefWidth - this._scoreProps.clefDistanceFromBarline,\n vStaffPos,\n vSystem\n );\n breakMiddle = true;\n break;\n }\n }\n if (breakMiddle) {\n break;\n }\n }\n i++;\n }\n if (measure.showKey) {\n hInsertPos += this._scoreProps.clefDistanceFromBarline;\n let displayKey = measure.displayKey;\n let outgoingKey = measure.outgoingKey;\n let sharpPositions = _SystemRenderer.TC_SHARP_POSITIONS;\n let flatPositions = _SystemRenderer.TC_FLAT_POSITIONS;\n switch (clefType) {\n case ClefType.TREBLE:\n sharpPositions = _SystemRenderer.TC_SHARP_POSITIONS;\n flatPositions = _SystemRenderer.TC_FLAT_POSITIONS;\n break;\n case ClefType.BASS:\n sharpPositions = _SystemRenderer.BC_SHARP_POSITIONS;\n flatPositions = _SystemRenderer.BC_FLAT_POSITIONS;\n break;\n case ClefType.TENOR:\n sharpPositions = _SystemRenderer.TENOR_SHARP_POSITIONS;\n flatPositions = _SystemRenderer.TENOR_FLAT_POSITIONS;\n break;\n case ClefType.ALTO:\n sharpPositions = _SystemRenderer.ALTO_SHARP_POSITIONS;\n flatPositions = _SystemRenderer.ALTO_FLAT_POSITIONS;\n break;\n default:\n console.log(`unrecognized clef type! ${clefType} VisualSystem.addClefKeyTime()`);\n }\n let accidentalList = PitchUtils.getAccidentalsForNewKeySignature(displayKey, outgoingKey);\n let numAccidentals = 0;\n let textures = MusicTextures.getTextureSet(\n this._scoreProps.pixelsPerSpace\n );\n for (let i2 = 0; i2 < 7; i2++) {\n if (accidentalList[i2] === 1) {\n this._drawAccidental(\n textures.natural,\n hInsertPos + numAccidentals * this._scoreProps.keySigWidth,\n flatPositions[i2],\n vStaffPos,\n vSystem\n );\n numAccidentals++;\n }\n }\n for (let i2 = 7; i2 < 14; i2++) {\n if (accidentalList[i2] === 1) {\n this._drawAccidental(\n textures.natural,\n hInsertPos + numAccidentals * this._scoreProps.keySigWidth,\n sharpPositions[i2 - 7],\n vStaffPos,\n vSystem\n );\n numAccidentals++;\n }\n }\n for (let i2 = 14; i2 < 21; i2++) {\n if (accidentalList[i2] === 1) {\n this._drawAccidental(\n textures.flat,\n hInsertPos + numAccidentals * this._scoreProps.keySigWidth,\n flatPositions[i2 - 14],\n vStaffPos,\n vSystem,\n -0.1\n );\n numAccidentals++;\n } else if (accidentalList[i2] === 2) {\n this._drawAccidental(\n textures.doubleFlat,\n hInsertPos + numAccidentals * this._scoreProps.keySigWidth,\n flatPositions[i2 - 14],\n vStaffPos,\n vSystem,\n -0.1\n );\n numAccidentals++;\n }\n }\n for (let i2 = 21; i2 < 28; i2++) {\n if (accidentalList[i2] === 1) {\n this._drawAccidental(\n textures.sharp,\n hInsertPos + numAccidentals * this._scoreProps.keySigWidth,\n sharpPositions[i2 - 21],\n vStaffPos,\n vSystem\n );\n numAccidentals++;\n } else if (accidentalList[i2] === 2) {\n this._drawAccidental(\n textures.doubleSharp,\n hInsertPos + numAccidentals * this._scoreProps.keySigWidth,\n sharpPositions[i2 - 21],\n vStaffPos,\n vSystem\n );\n numAccidentals++;\n }\n }\n hInsertPos += this._scoreProps.keySigWidth * measure.stack.maxKeySize;\n }\n if (measure.showTime) {\n let px = this._scoreProps.pixelsPerSpace;\n hInsertPos += this._scoreProps.clefDistanceFromBarline;\n let text = measure.displayNumBeats == null ? measure.numBeats.toString() + \"\\n\" + measure.beatType.toString() : measure.displayNumBeats.toString() + \"\\n\" + measure.displayBeatType.toString();\n let timeTF = new Text2({\n text,\n style: {\n fontFamily: \"Arial\",\n align: \"center\",\n fontSize: 2.8 * px,\n fill: 0,\n leading: -0.8 * px * this._scoreProps.noteheadWidth\n }\n });\n timeTF.x = hInsertPos * px;\n timeTF.y = vStaffPos * px - 0.8 * px;\n vSystem.container.addChild(timeTF);\n }\n }\n _drawClef(clefType, smallSize, xPos, vStaffPos, vSystem) {\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n let clefShape;\n switch (clefType) {\n case ClefType.TREBLE:\n clefShape = new Sprite4(textures.trebleClef);\n clefShape.y = smallSize ? (vStaffPos - 1) * px : (vStaffPos - 2) * px;\n break;\n case ClefType.BASS:\n clefShape = new Sprite4(textures.bassClef);\n clefShape.y = smallSize ? (vStaffPos + 1 / 6) * px : vStaffPos * px;\n break;\n case ClefType.TENOR:\n clefShape = new Sprite4(textures.tenorClef);\n clefShape.y = smallSize ? (vStaffPos + 1 / 6) * px : vStaffPos * px;\n break;\n case ClefType.ALTO:\n clefShape = new Sprite4(textures.altoClef);\n clefShape.y = smallSize ? (vStaffPos + 1 / 6) * px : vStaffPos * px;\n break;\n default:\n console.log(`unrecognized clef type! ${clefType} VisualSystem.addClefKeyTime()`);\n clefShape = new Sprite4(textures.trebleClef);\n }\n clefShape.x = xPos * this._scoreProps.pixelsPerSpace;\n if (smallSize) {\n clefShape.scale.x = clefShape.scale.y *= 0.75;\n }\n vSystem.container.addChild(clefShape);\n }\n _drawAccidental(accidentalBD, hInsertPos, stepsFromTopStaffLine, vStaffPos, vSystem, vertOffset = 0) {\n let px = this._scoreProps.pixelsPerSpace;\n let accidentalShape = new Sprite4(accidentalBD);\n accidentalShape.x = hInsertPos * px;\n accidentalShape.y = (vStaffPos + stepsFromTopStaffLine * (1 / 2) + vertOffset) * px - accidentalShape.height / 2;\n vSystem.container.addChild(accidentalShape);\n }\n _addAttachments(cMeasure, systemIndent, vStaffPos, visualSystem) {\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n let hOffset = systemIndent + cMeasure.stack.startPosition;\n let attachments = cMeasure.attachments;\n if (attachments != null) {\n let numAttachments = attachments.length;\n for (let i = 0; i < numAttachments; i++) {\n let attachment = attachments[i];\n let visualAttachment = null;\n if (attachment instanceof Dynamic) {\n switch (attachment.type) {\n case DynamicType.F:\n visualAttachment = new Sprite4(textures.f);\n break;\n case DynamicType.FF:\n visualAttachment = new Sprite4(textures.ff);\n break;\n case DynamicType.FFF:\n visualAttachment = new Sprite4(textures.fff);\n break;\n case DynamicType.FFFF:\n visualAttachment = new Sprite4(textures.fff);\n break;\n case DynamicType.P:\n visualAttachment = new Sprite4(textures.p);\n break;\n case DynamicType.PP:\n visualAttachment = new Sprite4(textures.pp);\n break;\n case DynamicType.PPP:\n visualAttachment = new Sprite4(textures.ppp);\n break;\n case DynamicType.PPPP:\n visualAttachment = new Sprite4(textures.ppp);\n break;\n case DynamicType.MF:\n visualAttachment = new Sprite4(textures.mf);\n break;\n case DynamicType.MP:\n visualAttachment = new Sprite4(textures.mp);\n break;\n default:\n }\n } else if (attachment instanceof ChordSymbol) {\n visualAttachment = this._drawChordSymbol(attachment);\n }\n if (visualAttachment != null) {\n visualAttachment.x = (attachment.hPos + hOffset) * px;\n visualAttachment.y = (attachment.vPos + vStaffPos) * px;\n visualSystem.container.addChild(visualAttachment);\n }\n }\n }\n }\n _drawChordSymbol(symbol) {\n let fontHeight = this._scoreProps.chordSymbolFontHeight;\n let px = this._scoreProps.pixelsPerSpace;\n let textures = MusicTextures.getTextureSet(px);\n let size = fontHeight * px;\n let dividerWidth = Math.max(px * 0.25, 1);\n let container = new Container3();\n let rootTf = new Text2({\n text: symbol.rootName,\n style: {\n fontFamily: \"Arial\",\n fontSize: size,\n fill: 0,\n align: \"left\"\n }\n });\n container.addChild(rootTf);\n let containerWidth = rootTf.width;\n if (symbol.rootAlteration === 1) {\n let sharp = new Sprite4(textures.sharp);\n sharp.scale.set(0.75, 0.75);\n sharp.x = containerWidth;\n container.addChild(sharp);\n containerWidth = containerWidth + sharp.width;\n } else if (symbol.rootAlteration === -1) {\n let flat = new Sprite4(textures.flat);\n flat.scale.set(0.75, 0.75);\n flat.x = containerWidth;\n container.addChild(flat);\n containerWidth = containerWidth + flat.width;\n }\n if (symbol.displayType != null && symbol.displayType !== \"\") {\n let typeTf = new Text2({\n text: symbol.displayType,\n style: {\n fontFamily: \"Arial\",\n fontSize: size * 0.75,\n fill: 0,\n align: \"left\"\n }\n });\n typeTf.x = containerWidth;\n typeTf.y = 0.5 * px;\n container.addChild(typeTf);\n containerWidth += typeTf.width;\n }\n if (symbol.bassName != null) {\n let g = new Graphics3();\n container.addChild(g);\n g.setStrokeStyle({ color: 0, width: dividerWidth });\n g.moveTo(containerWidth + 0.1 * px, px * fontHeight);\n g.lineTo(containerWidth + 0.5 * px, px * 1);\n g.stroke();\n let bassTf = new Text2({\n text: symbol.bassName,\n style: {\n fontFamily: \"Arial\",\n fontSize: size * 0.75,\n fill: 0,\n align: \"left\"\n }\n });\n containerWidth += 0.5 * px;\n bassTf.x = containerWidth + 0.25 * px;\n bassTf.y = 0.75 * px;\n container.addChild(bassTf);\n containerWidth += bassTf.width + 0.25 * px;\n if (symbol.bassAlteration === 1) {\n let sharp = new Sprite4(textures.sharp);\n sharp.scale.set(0.75, 0.75);\n sharp.x = containerWidth;\n sharp.y = 0.75 * px;\n container.addChild(sharp);\n containerWidth += sharp.width;\n } else if (symbol.bassAlteration === -1) {\n let flat = new Sprite4(textures.flat);\n flat.scale.set(0.75, 0.75);\n flat.x = containerWidth;\n flat.y = 0.75 * px;\n container.addChild(flat);\n containerWidth += flat.width;\n }\n }\n container.pivot.x = Math.min(containerWidth / 3, 2 * px);\n return container;\n }\n /// draws the vertical barlines for the system - should only be called after\n /// all staves/parts have been added\n _renderVerticalBarlines(staffGroupings, systemIndent, vSystem, vStaffPos, stacks, systemWidth) {\n let px = this._scoreProps.pixelsPerSpace;\n let g = vSystem.g;\n let lightBarlineWidth = Math.max(\n 1,\n this._scoreProps.lightBarlineWidth * px\n );\n let heavyBarlineWidth = Math.max(\n 1,\n this._scoreProps.heavyBarlineWidth * px\n );\n if (staffGroupings.length > 1 || staffGroupings.length > 0 && staffGroupings[0] > 1) {\n g.setStrokeStyle({ color: 0, width: lightBarlineWidth });\n g.moveTo(systemIndent * px, 0);\n g.lineTo(systemIndent * px, (vStaffPos + 4) * px);\n g.stroke();\n }\n if (stacks[stacks.length - 1].next == null) {\n g.setStrokeStyle({\n color: 0,\n width: heavyBarlineWidth,\n join: \"round\",\n cap: \"butt\"\n });\n g.moveTo(systemWidth * px, 0);\n g.lineTo(systemWidth * px, (vStaffPos + 4) * px);\n g.stroke();\n g.setStrokeStyle({ color: 0, width: lightBarlineWidth });\n g.moveTo((systemWidth - 1) * px, 0);\n g.lineTo(\n (systemWidth - 1) * px,\n (vStaffPos + 4) * px\n );\n g.stroke();\n } else {\n g.setStrokeStyle({ color: 0, width: lightBarlineWidth });\n g.moveTo(systemWidth * px, 0);\n g.lineTo(systemWidth * px, (vStaffPos + 4) * px);\n g.stroke();\n }\n g.setStrokeStyle({ color: 0, width: lightBarlineWidth });\n let vertStartPos = 0;\n for (let stavesInGroup of staffGroupings) {\n let vertEndPos = vertStartPos + (stavesInGroup - 1) * (4 + this._scoreProps.staffSpacing) + 4;\n let horizPos = systemIndent;\n for (let i = 0; i < stacks.length - 1; i++) {\n horizPos += stacks[i].width;\n let clefOffset = stacks[i + 1].newClef ? this._scoreProps.clefWidth + this._scoreProps.clefDistanceFromBarline : 0;\n g.moveTo((horizPos + clefOffset) * px, vertStartPos * px);\n g.lineTo((horizPos + clefOffset) * px, vertEndPos * px);\n }\n vertStartPos += stavesInGroup * (4 + this._scoreProps.staffSpacing);\n }\n g.stroke();\n }\n _drawRepeats(staffGroupings, systemIndent, vSystem, vStaffPos, stacks) {\n let px = this._scoreProps.pixelsPerSpace;\n let g = vSystem.g;\n let vertStartPos = 0;\n for (let stavesInGroup of staffGroupings) {\n let vertEndPos = vertStartPos + (stavesInGroup - 1) * (4 + this._scoreProps.staffSpacing) + 4;\n let horizPos = systemIndent;\n for (let i = 0; i < stacks.length; i++) {\n let stack = stacks[i];\n if (stack.repeatDOs != null) {\n for (let rdo of stack.repeatDOs) {\n let heavyPos;\n let lightPos;\n let dotsPos;\n if (rdo.repeatDirection === RepeatDirection.FORWARD) {\n heavyPos = horizPos - 2 * this._scoreProps.measureLeadIn + (i === 0 ? stack.indentAsSystemLeader : stack.indent);\n if (heavyPos > horizPos) {\n heavyPos += 1;\n }\n lightPos = heavyPos + 1;\n dotsPos = lightPos + 0.5;\n } else if (rdo.repeatDirection === RepeatDirection.BACKWARD) {\n heavyPos = horizPos + stack.width;\n lightPos = heavyPos - 1;\n dotsPos = lightPos - 0.5;\n } else if (rdo.endingType != null) {\n let leftPos = horizPos - this._scoreProps.measureLeadIn + (i === 0 ? stack.indentAsSystemLeader : stack.indent);\n let rightPos = horizPos + stack.width;\n let vPos = rdo.endingVPos;\n g.setStrokeStyle({ color: 0, width: this._scoreProps.lightBarlineWidth * px });\n g.moveTo(leftPos * px, vPos * px);\n g.lineTo(rightPos * px, vPos * px);\n g.stroke();\n if (rdo.endingType === EndingType.START) {\n g.moveTo(leftPos * px, vPos * px);\n g.lineTo(leftPos * px, (vPos + 1.5) * px);\n g.stroke();\n if (rdo.endingNumber != null) {\n let textPos = leftPos + 1;\n let tf = new Text2({\n text: rdo.endingNumber,\n style: {\n fontFamily: \"arial\",\n fontSize: 12 * px / 12,\n fill: 0\n }\n });\n tf.x = textPos * px;\n tf.y = (vPos + 1 / 4) * px;\n vSystem.container.addChild(tf);\n }\n } else if (rdo.endingType === EndingType.STOP) {\n g.moveTo(rightPos * px, vPos * px);\n g.lineTo(rightPos * px, (vPos + 1.5) * px);\n g.stroke();\n }\n }\n if (heavyPos != null) {\n g.setStrokeStyle({\n color: 0,\n width: this._scoreProps.heavyBarlineWidth * px,\n join: \"round\",\n cap: \"butt\"\n });\n g.moveTo(heavyPos * px, vertStartPos * px);\n g.lineTo(heavyPos * px, vertEndPos * px);\n g.stroke();\n g.closePath();\n g.setStrokeStyle({ color: 0, width: this._scoreProps.lightBarlineWidth * px });\n g.moveTo(lightPos * px, vertStartPos * px);\n g.lineTo(lightPos * px, vertEndPos * px);\n g.stroke();\n for (let j = 0; j < stavesInGroup; j++) {\n let vPos = vertStartPos + j * (4 + this._scoreProps.staffSpacing);\n g.circle(\n dotsPos * px,\n (vPos + 1.5) * px,\n px / 5\n );\n g.circle(\n dotsPos * px,\n (vPos + 2.5) * px,\n px / 5\n );\n g.fill();\n }\n }\n }\n }\n horizPos += stacks[i].width;\n }\n vertStartPos += stavesInGroup * (4 + this._scoreProps.staffSpacing);\n }\n }\n /// add the ties for the notes on the current staff\n /// @param\tvngLists a list of lists of VisualNoteGroups (each voice is a \n /// list)\n /// @param\tvStaffPos the offset from the top of the system that the current\n /// staff begins\n _drawTies(vngLists, vStaffPos, vSystem) {\n let noteheadWidth = this._scoreProps.noteheadWidth;\n let tieStartOffset = 0.8 * noteheadWidth;\n let tieEndOffset = 0.3 * noteheadWidth;\n let nextVNG;\n for (let i = 0; i < vngLists.length; i++) {\n let vngList = vngLists[i];\n let numNotes = vngList.length;\n for (let j = 0; j < numNotes; j++) {\n let cVNG = vngList[j];\n if (cVNG.noteGroup.visible === false) {\n continue;\n }\n for (let note of cVNG.noteGroup.notes) {\n if (note.visible === false) {\n continue;\n }\n switch (note.tieState) {\n case TieState.START:\n if (j < numNotes - 1) {\n nextVNG = vngList[j + 1];\n let nextNote = nextVNG.noteGroup.notes.find(\n (e) => e.displayCents === note.displayCents\n );\n if (nextVNG.noteGroup.visible && nextNote != null && nextNote.visible) {\n this._drawTie(\n cVNG.spx + note.hPos + tieStartOffset,\n nextVNG.spx + tieEndOffset,\n note.vPos + vStaffPos,\n vSystem,\n cVNG,\n note.vPos\n );\n }\n } else {\n this._drawTie(\n cVNG.spx + note.hPos + tieStartOffset,\n vSystem.systemRef.systemWidth,\n note.vPos + vStaffPos,\n vSystem,\n cVNG,\n note.vPos\n );\n }\n break;\n case TieState.CONTINUE:\n if (j < numNotes - 1) {\n nextVNG = vngList[j + 1];\n let nextNote = nextVNG.noteGroup.notes.find(\n (e) => e.pitchName === note.pitchName\n );\n if (nextVNG.noteGroup.visible && nextNote != null && nextNote.visible) {\n this._drawTie(\n cVNG.spx + note.hPos + tieStartOffset,\n nextVNG.spx + tieEndOffset,\n note.vPos + vStaffPos,\n vSystem,\n cVNG,\n note.vPos\n );\n }\n if (j === 0) {\n this._drawTie(\n cVNG.spx - 2,\n cVNG.spx + tieEndOffset,\n note.vPos + vStaffPos,\n vSystem,\n cVNG,\n note.vPos\n );\n }\n } else {\n this._drawTie(\n cVNG.spx + tieStartOffset,\n vSystem.systemRef.systemWidth,\n note.vPos + vStaffPos,\n vSystem,\n cVNG,\n note.vPos\n );\n }\n break;\n case TieState.STOP:\n if (j === 0) {\n this._drawTie(\n cVNG.spx - 2,\n cVNG.spx + tieEndOffset,\n note.vPos + vStaffPos,\n vSystem,\n cVNG,\n note.vPos\n );\n }\n break;\n default:\n }\n }\n }\n }\n }\n _drawTie(x1Val, x2Val, yVal, vSystem, vng, vPosInStaff) {\n let px = this._scoreProps.pixelsPerSpace;\n let curveDown = false;\n if (vng.noteGroup.stemDirection === StemDirection2.UP || vng.noteGroup.stemDirection === StemDirection2.NO_STEM && vPosInStaff > 3) {\n curveDown = true;\n }\n let tieShape = new Graphics3();\n tieShape.setStrokeStyle({ color: 0, width: 1 });\n let yControl = curveDown ? 0.7 : -0.7;\n let length = x2Val - x1Val;\n tieShape.moveTo(0, 0);\n tieShape.bezierCurveTo(\n length * px / 3,\n yControl * px,\n 2 * length * px / 3,\n yControl * px,\n length * px,\n 0\n );\n tieShape.moveTo(0, 0);\n tieShape.bezierCurveTo(\n length * px / 3,\n yControl * px - 1,\n 2 * length * px / 3,\n yControl * px - 1,\n length * px,\n 0\n );\n tieShape.moveTo(0, 0);\n tieShape.bezierCurveTo(\n length * px / 3,\n yControl * px - 2,\n 2 * length * px / 3,\n yControl * px - 2,\n length * px,\n 0\n );\n tieShape.stroke();\n tieShape.x = curveDown ? x1Val * px - 1 : x1Val * px - 0;\n tieShape.y = curveDown ? yVal * px + 6 : yVal * px - 6;\n vSystem.container.addChild(tieShape);\n vng.visualAttachments.push(tieShape);\n }\n _drawSlurs(system, vSystem, parts) {\n if (system.slurSegments == null) {\n return;\n }\n let px = this._scoreProps.pixelsPerSpace;\n let g = vSystem.g;\n g.setStrokeStyle({ color: 0, width: 1 });\n for (let segment of system.slurSegments) {\n if (parts.indexOf(segment.slur.firstNote.voice.measure.staff.partRef) === -1) {\n continue;\n }\n if (segment.slur.firstNote.visible === false || segment.slur.endNote.visible === false) {\n continue;\n }\n let points = segment.points;\n g.moveTo(points[0].x * px, points[0].y * px);\n g.bezierCurveTo(\n points[1].x * px,\n points[1].y * px,\n points[2].x * px,\n points[2].y * px,\n points[3].x * px,\n points[3].y * px\n );\n g.moveTo(points[0].x * px, points[0].y * px);\n g.bezierCurveTo(\n points[1].x * px,\n points[1].y * px - 1,\n points[2].x * px,\n points[2].y * px - 1,\n points[3].x * px,\n points[3].y * px\n );\n g.moveTo(points[0].x * px, points[0].y * px);\n g.bezierCurveTo(\n points[1].x * px,\n points[1].y * px - 2,\n points[2].x * px,\n points[2].y * px - 2,\n points[3].x * px,\n points[3].y * px\n );\n g.stroke();\n }\n }\n /// These are the VisualNoteGroup objects from the previous render session. \n /// They are re-used when possible.\n get legacyVNoteGroups() {\n return this._legacyVNoteGroups;\n }\n set legacyVNoteGroups(value) {\n this._legacyVNoteGroups = value;\n this._legacyVNGIndex = 0;\n }\n};\n///positions of accidentals in key signature for each clef, in steps from \n///top staff line\n_SystemRenderer.TC_FLAT_POSITIONS = [4, 1, 5, 2, 6, 3, 7];\n_SystemRenderer.BC_FLAT_POSITIONS = [6, 3, 7, 4, 8, 5, 9];\n_SystemRenderer.TC_SHARP_POSITIONS = [0, 3, -1, 2, 5, 1, 4];\n_SystemRenderer.BC_SHARP_POSITIONS = [2, 5, 1, 4, 7, 3, 6];\n_SystemRenderer.TENOR_FLAT_POSITIONS = [3, 0, 4, 1, 5, 2, 6];\n_SystemRenderer.TENOR_SHARP_POSITIONS = [6, 2, 5, 1, 4, 0, 3];\n_SystemRenderer.ALTO_FLAT_POSITIONS = [5, 2, 6, 3, 7, 4, 8];\n_SystemRenderer.ALTO_SHARP_POSITIONS = [1, 4, 0, 3, 6, 2, 5];\nvar SystemRenderer = _SystemRenderer;\n\n// src/score_render/bitmapRenderer/VisualPage.ts\nimport { Container as Container4 } from \"pixi.js\";\nimport { ScoreProperties as ScoreProperties3 } from \"score_data\";\nvar _VisualPage = class _VisualPage extends Container4 {\n constructor(visualScore, scoreProps) {\n super();\n this._visualScore = visualScore;\n this._scoreProps = scoreProps;\n this._currentVSystemPos = 0;\n this._visualSystems = [];\n }\n _addSystem(visualSystem) {\n visualSystem.x = this._scoreProps.leftPageMargin;\n visualSystem.y = this._currentVSystemPos;\n this.addChild(visualSystem);\n visualSystem.pageRef = this;\n let scale = this._scoreProps.pixelsPerSpace / ScoreProperties3.DEFAULT_PIXELS_PER_SPACE;\n this._currentVSystemPos += visualSystem.height + _VisualPage.DISTANCE_BETWEEN_SYSTEMS * scale;\n this._visualSystems.push(visualSystem);\n }\n /**\n * removes all VisualSystems from the page\n */\n _removeAllSystems() {\n for (let vSystem of this._visualSystems) {\n if (vSystem.parent === this) {\n this.removeChild(vSystem);\n }\n }\n this._visualSystems = [];\n this._currentVSystemPos = 0;\n }\n /**\n * Replaces one VisualSystem with another\n * @param originalVSystem the VisualSystem you want to replace\n * @param newVSystem the VisualSystem you want to replace it with\n */\n _replaceSystem(originalVSystem, newVSystem) {\n newVSystem.x = originalVSystem.x;\n newVSystem.y = originalVSystem.y;\n this.removeChild(originalVSystem);\n this.addChild(newVSystem);\n newVSystem.pageRef = this;\n for (let i = 0; i < this._visualSystems.length; i++) {\n if (this._visualSystems[i] === originalVSystem) {\n this._visualSystems[i] = newVSystem;\n break;\n }\n }\n }\n get visualSystems() {\n return this._visualSystems;\n }\n get pageHeight() {\n return this._currentVSystemPos - _VisualPage.DISTANCE_BETWEEN_SYSTEMS * (this._scoreProps.pixelsPerSpace / ScoreProperties3.DEFAULT_PIXELS_PER_SPACE);\n }\n};\n_VisualPage.DISTANCE_BETWEEN_SYSTEMS = 50;\nvar VisualPage = _VisualPage;\n\n// src/score_render/bitmapRenderer/VisualScore.ts\nimport { Container as Container5, Graphics as Graphics4, Point as Point4 } from \"pixi.js\";\nimport { ScoreProperties as ScoreProperties4 } from \"score_data\";\n\n// src/score_render/bitmapRenderer/ClickRegion.ts\nvar ClickRegion = class {\n constructor(scoreX, scoreY, width, height) {\n this.scoreX = scoreX;\n this.scoreY = scoreY;\n this.width = width;\n this.height = height;\n }\n};\n\n// src/score_render/bitmapRenderer/VisualScore.ts\nvar _VisualScore = class _VisualScore extends Container5 {\n constructor(pixiAppHelper, score) {\n super();\n this._clickRegions = [];\n this.debugShowClicks = false;\n this._pah = pixiAppHelper;\n this._score = score;\n this._scoreProps = score.scoreProperties;\n this._visualPages = [];\n this._firstPageVerticalOffset = score.scoreProperties.pixelsPerSpace * score.scoreProperties.firstPageVerticalOffset;\n this._currentVPagePos = this._firstPageVerticalOffset;\n this._init();\n }\n get graphics() {\n return this._g;\n }\n _init() {\n this._g = new Graphics4();\n }\n deleteSystemTextures() {\n let vSystems = this.getVisualSystems();\n for (let vsys of vSystems) {\n vsys.deleteTexture();\n }\n }\n /**\n * adds a single invisible pixel to each of the four corners of the score so\n * that it can be resized properly\n */\n addWidthHeightMarkers() {\n throw \"not implemented\";\n this._g.setStrokeStyle({ width: 1, color: 0 });\n this._g.lineTo(0, 1);\n this._g.moveTo(this._scoreProps.pageWidth, 0);\n this._g.lineTo(this._scoreProps.pageWidth, 1);\n }\n /**\n * Gets all of the VisualSystem objects in the VisualScore\n * @return\n */\n getVisualSystems() {\n let vSystems = [];\n for (let page of this._visualPages) {\n let systems = page.visualSystems;\n for (let system of systems) {\n vSystems.push(system);\n }\n }\n return vSystems;\n }\n createMeasureToVisualMeasureMap() {\n this._visualMeasuresMap = /* @__PURE__ */ new Map();\n for (let page of this._visualPages) {\n for (let system of page.visualSystems) {\n for (let vm of system.visualMeasures) {\n this._visualMeasuresMap.set(vm.measureRef, vm);\n }\n }\n }\n }\n getVisualMeasureForMeasure(measure) {\n if (this._visualMeasuresMap == null) {\n this.createMeasureToVisualMeasureMap();\n }\n return this._visualMeasuresMap.get(measure);\n }\n /**\n * Gets all of the VisualNoteGroup objects in the score\n */\n getVisualNoteGroups() {\n if (this._visualNoteGroupsCache != null) {\n return this._visualNoteGroupsCache;\n }\n let vNoteGroups = new Array();\n for (let page of this._visualPages) {\n let vsystems = page.visualSystems;\n for (let vsystem of vsystems) {\n let vnoteGroups = vsystem.visNoteGroups;\n for (let vng of vnoteGroups) {\n vNoteGroups.push(vng);\n }\n }\n }\n this._visualNoteGroupsCache = vNoteGroups;\n return vNoteGroups;\n }\n clearVisualNoteGroupCache() {\n this._visualNoteGroupsCache = null;\n }\n ///returns a [Map] of the [NoteGroups] in the score to their VisualNoteGroup\n ///counterparts.\n getNgToVngMap() {\n let vngList = this.getVisualNoteGroups();\n let map = /* @__PURE__ */ new Map();\n for (let vng of vngList) {\n map.set(vng.noteGroup, vng);\n }\n return map;\n }\n /**\n * gets the VisualSystem object that lies under the passed in Point\n * @param point a Point object relative to the score origin with coordinates\n * of the point to check against each system in the score\n * @return a VisualSystem if one is found, otherwise null\n */\n getVisualSystemUnderPoint(point) {\n for (let page of this.visualPages) {\n if (page.y <= point.y && page.y + page.pageHeight > point.y && page.x <= point.x && page.x + this.scoreWidth > point.x) {\n for (let visSystem of page.visualSystems) {\n if (visSystem.scoreX <= point.x && visSystem.scoreX + visSystem.width > point.x && visSystem.scoreY <= point.y && visSystem.scoreY + visSystem.height > point.y) {\n return visSystem;\n }\n }\n }\n }\n return null;\n }\n /**\n * gets the VisualMeasure object that lies under the passed in Point\n * @param point a Point object relative to the score origin with\n * coordinates of the point to check against each measure in the system\n * @return a VisualMeasure if one is found, otherwise null\n * \n * Note - in general gridSearch will be faster\n */\n getVisualMeasureUnderPoint(point) {\n let sys = this.getVisualSystemUnderPoint(point);\n if (sys == null) {\n return null;\n }\n let sysPoint = new Point4(point.x - sys.scoreX, point.y - sys.scoreY);\n return sys.getVisualMeasureUnderPoint(sysPoint);\n }\n /**\n * gets the VisualNoteGroup object that lies under the passed in Point\n * @param point a Point object relative to the score origin with\n * coordinates of the point to check against each measure in the system\n * @return a VisualMeasure if one is found, otherwise null\n * \n * Note - in general gridSearch will be much faster\n */\n getVisualNoteGroupUnderPoint(point) {\n for (let vSys of this.getVisualSystems()) {\n let sysPoint = new Point4(\n point.x - vSys.scoreX,\n point.y - vSys.scoreY\n );\n let vng = vSys.getVisualNoteGroupUnderPoint(sysPoint);\n if (vng != null) {\n return vng;\n }\n }\n }\n addClickRegion(region, invalidateGrid) {\n this._clickRegions.push(region);\n if (invalidateGrid) {\n this._grid = null;\n }\n }\n removeClickRegion(region, invalidateGrid) {\n for (let i = this._clickRegions.length - 1; i >= 0; i--) {\n if (this._clickRegions[i] === region) {\n this._clickRegions.splice(i, 1);\n }\n }\n if (invalidateGrid) {\n this._grid = null;\n }\n }\n /**checks the score for a VisualSystem, VisualMeasure, VisualNoteGroup and\n * ClickRegion under the point indicated in the PointDetails.scorePoint\n * property. Set PointDetails.matchMeasure and PointDetails.matchNoteGroup\n * to indicate whether the search should include those types of objects. The\n * details are added to the passed in object.\n * \n * This search uses a grid for fast searching, but the grid must be created\n * once after the score has been rendered, and this operation is expensive.\n * It's a good idea to run this method once after a render whenever there\n * isn't much going on. If the details param is null, no search will occur,\n * but the grid will be created if it doesn't exist yet.\n */\n gridSearch(details = null) {\n if (this._grid == null) {\n this._createSearchGrid();\n }\n if (details == null) {\n return;\n }\n let x = details.scorePoint.x;\n let y = details.scorePoint.y;\n if (this.debugShowClicks) {\n var circle = new Graphics4();\n circle.circle(0, 0, 3);\n circle.fill(16711680);\n circle.x = x;\n circle.y = y;\n this.addChild(circle);\n }\n let cellRow = Math.floor(y / _Cell.cellHeight);\n let cellCol = Math.floor(x / _Cell.cellWidth);\n if (cellRow >= this._grid.length || cellCol >= this._grid[0].length || cellRow < 0 || cellCol < 0) {\n return;\n }\n let cell = this._grid[cellRow][cellCol];\n for (let vSys of cell.vSystems) {\n if (vSys.scoreX <= x && vSys.scoreX + vSys.width > x && vSys.scoreY <= y && vSys.scoreY + vSys.height > y) {\n details.visualSystem = vSys;\n break;\n }\n }\n if (details.matchMeasure) {\n for (let vMeas of cell.vMeasures) {\n if (vMeas.scoreX <= x && vMeas.scoreX + vMeas.width > x && vMeas.scoreY <= y && vMeas.scoreY + vMeas.height > y) {\n details.visualMeasure = vMeas;\n break;\n }\n }\n }\n if (details.matchNoteGroup) {\n for (let vng of cell.vNoteGroups) {\n if (vng.scoreX + vng.content.minX <= x && vng.scoreX + vng.content.maxX > x && vng.scoreY + vng.content.minY <= y && vng.scoreY + vng.content.maxY > y) {\n details.visualNoteGroup = vng;\n break;\n }\n if (this.debugShowClicks) {\n var rect = new Graphics4();\n rect.setStrokeStyle({ color: 16711680, width: 1 });\n let c = vng.content;\n rect.rect(0, 0, c.maxX - c.minX, c.maxY - c.minY);\n rect.x = vng.scoreX + c.minX;\n rect.y = vng.scoreY + c.minY;\n this.addChild(rect);\n }\n }\n }\n if (details.matchClickRegions) {\n for (let region of cell.regions) {\n if (region.scoreX <= x && region.scoreX + region.width > x && region.scoreY <= y && region.scoreY + region.height > y) {\n details.clickRegion = region;\n break;\n }\n }\n }\n }\n _addPage(page) {\n page.x = 0;\n page.y = this._currentVPagePos;\n this.addChild(page);\n let scale = this._scoreProps.pixelsPerSpace / ScoreProperties4.DEFAULT_PIXELS_PER_SPACE;\n this._currentVPagePos += page.pageHeight + _VisualScore.DISTANCE_BETWEEN_PAGES * scale;\n this._visualPages.push(page);\n }\n _removeAllPages() {\n for (let page of this._visualPages) {\n if (page.parent === this) {\n this.removeChild(page);\n }\n }\n this._visualPages = [];\n this._currentVPagePos = this._firstPageVerticalOffset;\n }\n /**\n * adds mouse over note name labels to the notes\n */\n //\tvoid addNoteNameLabels() {\n //\t\t_noteLabeler = new NoteLabeler(this);\n //\t}\n /**\n * removes mouse over note name labels\n */\n //\tvoid removeNoteNameLabels() {\n //\t\t_noteLabeler.kill();\n //\t\t_noteLabeler = null;\n //\t}\n /**\n * performs cleanup tasks\n */\n prepareForRemoval() {\n this.deleteSystemTextures();\n this.destroy({\n children: true,\n texture: true,\n context: true\n });\n }\n _createSearchGrid() {\n let numCols = Math.ceil(this.scoreWidth / _Cell.cellWidth);\n let numRows = Math.ceil(this.scoreHeight / _Cell.cellHeight);\n this._grid = [];\n for (let row = 0; row < numRows; row++) {\n let rowOfCells = [];\n this._grid.push(rowOfCells);\n for (let col = 0; col < numCols; col++) {\n rowOfCells.push(new _Cell());\n }\n }\n let minX;\n let maxX;\n let minY;\n let maxY;\n let vSystems = this.getVisualSystems();\n for (let vSys of vSystems) {\n minX = vSys.scoreX;\n maxX = vSys.scoreX + vSys.width;\n minY = vSys.scoreY;\n maxY = vSys.scoreY + vSys.height;\n this._setCellMatches(minX, maxX, minY, maxY, vSys);\n for (let vMeas of vSys.visualMeasures) {\n minX = vSys.scoreX + vMeas.x;\n maxX = minX + vMeas.width;\n minY = vSys.scoreY + vMeas.y;\n maxY = minY + vMeas.height;\n this._setCellMatches(minX, maxX, minY, maxY, vMeas);\n }\n for (let vng of vSys.visNoteGroups) {\n minX = vSys.scoreX + vng.x;\n maxX = minX + vng.width;\n minY = vSys.scoreY + vng.y;\n maxY = minY + vng.height;\n this._setCellMatches(minX, maxX, minY, maxY, vng);\n }\n }\n for (let region of this._clickRegions) {\n minX = region.scoreX;\n maxX = minX + region.width;\n minY = region.scoreY;\n maxY = minY + region.height;\n this._setCellMatches(minX, maxX, minY, maxY, region);\n }\n }\n _setCellMatches(minX, maxX, minY, maxY, obj) {\n if (minX < 0) {\n minX = 0;\n }\n if (minY < 0) {\n minY = 0;\n }\n if (maxX > this.scoreWidth) {\n maxX = this.scoreWidth;\n }\n if (maxY > this.scoreHeight) {\n maxY = this.scoreHeight;\n }\n if (minX >= maxX || minY >= maxY) {\n return;\n }\n let isVNG = obj instanceof VisualNoteGroup;\n let isVMeas = !isVNG && obj instanceof VisualMeasure;\n let isVSys = !isVNG && !isVMeas && obj instanceof VisualSystem;\n let isReg = !isVNG && !isVMeas && !isVSys && obj instanceof ClickRegion;\n let grid = this._grid;\n let startCellRow = Math.floor(minY / _Cell.cellHeight);\n let startCellCol = Math.floor(minX / _Cell.cellWidth);\n let row = startCellRow;\n while (row * _Cell.cellHeight < maxY) {\n let col = startCellCol;\n while (col * _Cell.cellWidth < maxX) {\n if (isVNG) {\n grid[row][col].vNoteGroups.add(obj);\n } else if (isVMeas) {\n grid[row][col].vMeasures.add(obj);\n } else if (isVSys) {\n grid[row][col].vSystems.add(obj);\n } else if (isReg) {\n grid[row][col].regions.add(obj);\n }\n col++;\n }\n row++;\n }\n }\n get pixiAppHelper() {\n return this._pah;\n }\n /**\n * The visual pages that are children of this VisualScore\n */\n get visualPages() {\n return this._visualPages;\n }\n set visualPages(value) {\n this._visualPages = value;\n }\n /**\n * The ScoreProperties object from the Score\n */\n get scoreProps() {\n return this._scoreProps;\n }\n /**\n * The Score object used to generate this VisualScore\n */\n get score() {\n return this._score;\n }\n /**gets the width of the score in pixels using the pageWidth from\n * ScoreProperties */\n get scoreWidth() {\n return this._score.scoreProperties.pageWidth * this._score.scoreProperties.pixelsPerSpace;\n }\n /**gets the calculated height of the rendered score in pixels */\n get scoreHeight() {\n return this._currentVPagePos - _VisualScore.DISTANCE_BETWEEN_PAGES;\n }\n get firstPageVerticalOffset() {\n return this._firstPageVerticalOffset;\n }\n set firstPageVerticalOffset(value) {\n this._firstPageVerticalOffset = value;\n }\n};\n//displays note name tool tips on notes upon mouseover\n//NoteLabeler _noteLabeler;\n_VisualScore.DISTANCE_BETWEEN_PAGES = 50;\nvar VisualScore = _VisualScore;\nvar _Cell = class {\n constructor() {\n this.vSystems = /* @__PURE__ */ new Set();\n this.vMeasures = /* @__PURE__ */ new Set();\n this.vNoteGroups = /* @__PURE__ */ new Set();\n this.regions = /* @__PURE__ */ new Set();\n }\n};\n_Cell.cellWidth = 200;\n_Cell.cellHeight = 200;\n\n// src/score_render/bitmapRenderer/BitmapMusicRenderer.ts\nvar _BitmapMusicRenderer = class _BitmapMusicRenderer {\n constructor(pixiAppHelper) {\n _BitmapMusicRenderer._renderersInUse++;\n if (_BitmapMusicRenderer._renderersInUse > _BitmapMusicRenderer.maxRenderers) {\n throw \"Max number of BitmapMusicRenderers exceeded\";\n }\n this._pah = pixiAppHelper;\n }\n /**\n * Creates a VisualScore object from the passed in Score object\n * @param\tscore the Score object that provides the source\n * @param\tpartNames the list of parts you want rendered\n * @return\ta VisualScore object that can be displayed\n */\n renderScore(score, parts = null) {\n if (this._visualScore != null) {\n this._visualScore.prepareForRemoval();\n }\n this._score = score;\n this._visualScore = new VisualScore(this._pah, score);\n this._addedObjects = [];\n this._removedObjects = [];\n this._parts = parts == null ? score.parts : parts;\n let systems = score.getSystems();\n this._systemRenderer = new SystemRenderer(score.scoreProperties);\n let vPages = [];\n let cVPage = null;\n for (let system of systems) {\n let vSystem = this._systemRenderer.renderSystem(\n this._visualScore,\n system,\n this._parts,\n this._addedObjects,\n this._removedObjects\n );\n if (system.newPage) {\n cVPage = new VisualPage(\n this._visualScore,\n score.scoreProperties\n );\n vPages.push(cVPage);\n }\n if (cVPage != null) {\n cVPage._addSystem(vSystem);\n }\n system.needsRendering = false;\n }\n for (let i = 0; i < vPages.length; i++) {\n this._visualScore._addPage(vPages[i]);\n }\n return this._visualScore;\n }\n reRender() {\n if (this._visualScore != null) {\n this._visualScore.deleteSystemTextures();\n }\n this._addedObjects = [];\n this._removedObjects = [];\n let systems = this._score.getSystems();\n let vSystems = this._visualScore.getVisualSystems();\n let vPages = this._visualScore.visualPages;\n this._systemRenderer.legacyVNoteGroups = this._visualScore.getVisualNoteGroups();\n this._visualScore.clearVisualNoteGroupCache();\n for (let vPage of vPages) {\n vPage._removeAllSystems();\n }\n this._visualScore._removeAllPages();\n let numSystems = systems.length;\n let pageIndex = -1;\n systems[0].newPage = true;\n for (let i2 = 0; i2 < numSystems; i2++) {\n let cSystem = systems[i2];\n if (cSystem.newPage) {\n pageIndex++;\n if (pageIndex >= vPages.length) {\n vPages[pageIndex] = new VisualPage(\n this._visualScore,\n this._score.scoreProperties\n );\n }\n }\n if (!cSystem.needsRendering) {\n let vSystemFound = false;\n for (let vSystem of vSystems) {\n if (vSystem.systemRef === cSystem) {\n vPages[pageIndex]._addSystem(vSystem);\n vSystemFound = true;\n break;\n }\n }\n if (!vSystemFound) {\n vPages[pageIndex]._addSystem(\n this._systemRenderer.renderSystem(\n this._visualScore,\n cSystem,\n this._parts,\n this._addedObjects,\n this._removedObjects\n )\n );\n }\n } else {\n vPages[pageIndex]._addSystem(this._systemRenderer.renderSystem(\n this._visualScore,\n cSystem,\n this._parts,\n this._addedObjects,\n this._removedObjects\n ));\n cSystem.needsRendering = false;\n }\n }\n let i = vPages.length - 1;\n while (i >= 0) {\n if (vPages[i].visualSystems.length === 0) {\n vPages.pop();\n } else {\n break;\n }\n i--;\n }\n for (let i2 = 0; i2 < vPages.length; i2++) {\n this._visualScore._addPage(vPages[i2]);\n }\n }\n /**\n * returns all VisualNoteGroup objects in the score (a means of accessing\n * all notes in the song)\n * @return Vector of VisualNoteGroup objects\n */\n getVisualNoteGroups() {\n return this._visualScore.getVisualNoteGroups();\n }\n /**\n * contains DisplayObjects that were added during the latest render\n */\n get addedObjects() {\n return this._addedObjects;\n }\n set addedObjects(value) {\n this._addedObjects = value;\n }\n /**\n * contains DisplayObjects that were removed during the latest render\n */\n get removedObjects() {\n return this._removedObjects;\n }\n set removedObjects(value) {\n this._removedObjects = value;\n }\n};\n/**The maximum instances of this class that are allowed to be created. This\n * exists for memory management purposes. When renderScore is called,\n * existing VisualSystem texture images are disposed of to start fresh\n * with the new render. The BitmapMusicRenderer handles this, so if a new\n * renderer is created each time a score is rendered, it could prevent this\n * cleanup. In general it's best to re-use the same BitmapMusicRenderer over\n * and over. An exception would be if you need to have more than one\n * VisualScore visible at a time.\n*/\n_BitmapMusicRenderer.maxRenderers = 1;\n_BitmapMusicRenderer._renderersInUse = 0;\nvar BitmapMusicRenderer = _BitmapMusicRenderer;\n\n// src/score_render/bitmapRenderer/PointDetails.ts\nvar PointDetails = class {\n constructor(scorePoint, matchMeasure, matchNoteGroup) {\n this.scorePoint = scorePoint;\n this.matchMeasure = matchMeasure;\n this.matchNoteGroup = matchNoteGroup;\n }\n};\n\n// src/score_render/pixi/PixiAppHelper.ts\nimport { UPDATE_PRIORITY } from \"pixi.js\";\nvar PixiAppHelper = class {\n /**\n * Create and initialize the pixiApp before passing to the PixiAppHelper.\n * \n * Call stopTicker() to stop the app Ticker and startTicker to restart.\n * Generally we leave it on, set renderOnRequest = true, and call\n * requestRender if we want to manage drawing.\n * \n * To stop the other Tickers, use\n * Ticker.shared.stop();\n * Ticker.system.stop();\n * \n * Notes when calling pixiApp.init()...\n * 1. leave sharedTicker false and generally avoid using it. Use\n * app.ticker instead.\n * 2. Leave resizeTo null and instead call resizeCanvas or resizeToParent.\n * Call these from a window resize handler (or other times needed). Listen\n * for renderer's resize event to respond to the resize completion. (Only\n * one class should listen to the window resize and call resize methods.) If\n * you want automatic resizing, use setAutoResizeElement(),\n * enableAutoResize() and disableAutoResize(). These will enable the window\n * resize event handler and dispatch the same resize event from the\n * renderer.\n * 3. Set autoDensity to true to make resizing set both the canvas and css\n * width/height. It's best to leave this false if CSS is auto resizing the\n * canvas.\n */\n constructor(pixiApp) {\n this._renderOnRequest = false;\n this._needsRender = false;\n this._autoResizeEnabled = false;\n this._app = pixiApp;\n this._onAppTick = this._onAppTick.bind(this);\n this._app.ticker.remove(this._app.render, this._app);\n this._app.ticker.add(this._onAppTick, this, UPDATE_PRIORITY.LOW);\n }\n get app() {\n return this._app;\n }\n get renderOnRequest() {\n return this._renderOnRequest;\n }\n set renderOnRequest(value) {\n this._renderOnRequest = value;\n }\n resizeCanvas(width, height) {\n this._app.renderer.resize(width, height);\n }\n resizeToParent() {\n let parent = this._app.canvas.parentElement;\n if (parent == null) {\n return;\n }\n this.resizeCanvas(parent.clientWidth, parent.clientHeight);\n }\n /**usually this is called automatically when the window resizes. But if\n * the canvas resizes without a window resize, it may not get triggered, so\n * you can call this manually. */\n resizeToAutoResizeElement() {\n if (this._autoResizeElement != null) {\n this.resizeCanvas(\n this._autoResizeElement.clientWidth,\n this._autoResizeElement.clientHeight\n );\n }\n }\n setAutoResizeElement(el) {\n this._autoResizeElement = el;\n if (this._autoResizeEnabled) {\n this._app.resizeTo = el;\n }\n }\n enableAutoResize() {\n this._autoResizeEnabled = true;\n if (this._autoResizeElement != null) {\n this._app.resizeTo = this._autoResizeElement;\n }\n }\n disableAutoResize() {\n this._autoResizeEnabled = false;\n this._app.resizeTo = null;\n }\n startTicker() {\n this._app.ticker.start();\n }\n stopTicker() {\n this._app.ticker.stop();\n }\n requestRender() {\n this._needsRender = true;\n }\n _onAppTick() {\n if (!this._renderOnRequest || this._needsRender) {\n this._app.render();\n this._needsRender = false;\n }\n }\n};\nexport {\n BitmapMusicRenderer,\n ClickRegion,\n MusicSymbolsSvg,\n MusicTextures,\n NoteheadType,\n PixiAppHelper,\n PointDetails,\n Symbol,\n SystemRenderer,\n TextureSet,\n VNGContent,\n VisualMeasure,\n VisualNoteGroup,\n VisualPage,\n VisualScore,\n VisualSystem\n};\n","// src/mimeTypesAndCodecs.ts\nvar supportMap;\nfunction createMimeCodecSupportList() {\n supportMap = /* @__PURE__ */ new Map();\n supportMap.set(\n \"audio/webm;codecs=opus\" /* audioWebmOpus */,\n MediaRecorder.isTypeSupported(\"audio/webm;codecs=opus\" /* audioWebmOpus */)\n );\n supportMap.set(\n \"audio/mp4;codecs=avc1\" /* audioMp4Avc1 */,\n MediaRecorder.isTypeSupported(\"audio/mp4;codecs=avc1\" /* audioMp4Avc1 */)\n );\n supportMap.set(\n \"video/webm;codecs=avc1\" /* videoWebmAvc1 */,\n MediaRecorder.isTypeSupported(\"video/webm;codecs=avc1\" /* videoWebmAvc1 */)\n );\n supportMap.set(\n \"video/webm;codecs=avc1,opus\" /* videoWebmAvc1Opus */,\n MediaRecorder.isTypeSupported(\"video/webm;codecs=avc1,opus\" /* videoWebmAvc1Opus */)\n );\n supportMap.set(\n \"video/x-matroska;codecs=avc1\" /* videoXMatroskaAvc1 */,\n MediaRecorder.isTypeSupported(\"video/x-matroska;codecs=avc1\" /* videoXMatroskaAvc1 */)\n );\n supportMap.set(\n \"video/mp4;codecs=avc1\" /* videoMp4Avc1 */,\n MediaRecorder.isTypeSupported(\"video/mp4;codecs=avc1\" /* videoMp4Avc1 */)\n );\n supportMap.set(\n \"video/webm;codecs=vp8\" /* videoWebmVp8 */,\n MediaRecorder.isTypeSupported(\"video/webm;codecs=vp8\" /* videoWebmVp8 */)\n );\n supportMap.set(\n \"video/webm;codecs=vp9\" /* videoWebmVp9 */,\n MediaRecorder.isTypeSupported(\"video/webm;codecs=vp9\" /* videoWebmVp9 */)\n );\n supportMap.set(\n \"video/webm;codecs=av1\" /* videoWebmAv1 */,\n MediaRecorder.isTypeSupported(\"video/webm;codecs=av1\" /* videoWebmAv1 */)\n );\n}\nvar MediaFileUtils = class {\n /**Returns the file extension without period for a media file matching a\n * mimetype codec string constant from MimeCodecsString.\n * example: \"audio/webm;codecs=opus\" */\n static getFileExtension(mimeCodecString) {\n switch (mimeCodecString) {\n case \"audio/webm;codecs=opus\" /* audioWebmOpus */:\n return \"webm\";\n case \"audio/mp4;codecs=avc1\" /* audioMp4Avc1 */:\n return \"mp4\";\n case \"video/webm;codecs=avc1\" /* videoWebmAvc1 */:\n return \"webm\";\n case \"video/webm;codecs=avc1,opus\" /* videoWebmAvc1Opus */:\n return \"webm\";\n case \"video/x-matroska;codecs=avc1\" /* videoXMatroskaAvc1 */:\n return \"mkv\";\n case \"video/mp4;codecs=avc1\" /* videoMp4Avc1 */:\n return \"mp4\";\n case \"video/webm;codecs=vp8\" /* videoWebmVp8 */:\n return \"webm\";\n case \"video/webm;codecs=vp9\" /* videoWebmVp9 */:\n return \"webm\";\n case \"video/webm;codecs=av1\" /* videoWebmAv1 */:\n return \"webm\";\n default:\n throw \"Unsupported audioInfo string\";\n }\n }\n /**Returns the mimetype for a media file matching a mimetype codec string\n * constant from MimeCodecsString.*/\n static getMimeType(mimeCodecString) {\n switch (mimeCodecString) {\n case \"audio/webm;codecs=opus\" /* audioWebmOpus */:\n return \"audio/webm\";\n case \"audio/mp4;codecs=avc1\" /* audioMp4Avc1 */:\n return \"audio/mp4\";\n case \"video/webm;codecs=avc1\" /* videoWebmAvc1 */:\n return \"video/webm\";\n case \"video/webm;codecs=avc1,opus\" /* videoWebmAvc1Opus */:\n return \"video/webm\";\n case \"video/x-matroska;codecs=avc1\" /* videoXMatroskaAvc1 */:\n return \"video/x-matroska\";\n case \"video/mp4;codecs=avc1\" /* videoMp4Avc1 */:\n return \"video/mp4\";\n case \"video/webm;codecs=vp8\" /* videoWebmVp8 */:\n return \"video/webm\";\n case \"video/webm;codecs=vp9\" /* videoWebmVp9 */:\n return \"video/webm\";\n case \"video/webm;codecs=av1\" /* videoWebmAv1 */:\n return \"video/webm\";\n default:\n throw \"Unsupported audioInfo string\";\n }\n }\n /**returns true if the current browser can record the requested type */\n static isMimeCodecSupported(type) {\n if (supportMap == null) {\n createMimeCodecSupportList();\n }\n return supportMap.get(type);\n }\n /**returns true if the current browser can play back (but not necessarily\n * record) content with this MimeCodecString type */\n static canPlayMimeCodec(mimeCodecString) {\n switch (mimeCodecString) {\n case \"audio/webm;codecs=opus\" /* audioWebmOpus */: {\n return true;\n }\n case \"audio/mp4;codecs=avc1\" /* audioMp4Avc1 */: {\n return true;\n }\n case \"video/webm;codecs=avc1\" /* videoWebmAvc1 */: {\n return supportMap.get(\"video/webm;codecs=avc1\" /* videoWebmAvc1 */);\n }\n case \"video/webm;codecs=avc1,opus\" /* videoWebmAvc1Opus */: {\n return supportMap.get(\"video/webm;codecs=avc1\" /* videoWebmAvc1 */);\n }\n case \"video/x-matroska;codecs=avc1\" /* videoXMatroskaAvc1 */: {\n return supportMap.get(\"video/webm;codecs=avc1\" /* videoWebmAvc1 */);\n }\n case \"video/mp4;codecs=avc1\" /* videoMp4Avc1 */: {\n return true;\n }\n case \"video/webm;codecs=vp8\" /* videoWebmVp8 */: {\n return supportMap.get(\"video/webm;codecs=vp8\" /* videoWebmVp8 */);\n }\n case \"video/webm;codecs=vp9\" /* videoWebmVp9 */: {\n return supportMap.get(\"video/webm;codecs=vp9\" /* videoWebmVp9 */);\n }\n case \"video/webm;codecs=av1\" /* videoWebmAv1 */: {\n return supportMap.get(\"video/webm;codecs=av1\" /* videoWebmAv1 */);\n }\n default:\n throw \"Unsupported audioInfo string\";\n }\n }\n};\nvar MimeCodecsString = /* @__PURE__ */ ((MimeCodecsString2) => {\n MimeCodecsString2[\"audioWebmOpus\"] = \"audio/webm;codecs=opus\";\n MimeCodecsString2[\"audioMp4Avc1\"] = \"audio/mp4;codecs=avc1\";\n MimeCodecsString2[\"videoWebmAvc1\"] = \"video/webm;codecs=avc1\";\n MimeCodecsString2[\"videoWebmAvc1Opus\"] = \"video/webm;codecs=avc1,opus\";\n MimeCodecsString2[\"videoXMatroskaAvc1\"] = \"video/x-matroska;codecs=avc1\";\n MimeCodecsString2[\"videoMp4Avc1\"] = \"video/mp4;codecs=avc1\";\n MimeCodecsString2[\"videoWebmVp8\"] = \"video/webm;codecs=vp8\";\n MimeCodecsString2[\"videoWebmVp9\"] = \"video/webm;codecs=vp9\";\n MimeCodecsString2[\"videoWebmAv1\"] = \"video/webm;codecs=av1\";\n return MimeCodecsString2;\n})(MimeCodecsString || {});\n\n// src/analysis/AssessmentInstrumentDO.ts\nvar AssessmentInstrumentDO = class {\n get label() {\n return this.name;\n }\n constructor(id, name, {\n assessmentType,\n transposition,\n minFreq,\n maxFreq,\n yinQuality,\n windowWidth,\n sampleRate,\n pRecMethod,\n pRecQuality,\n overSampTimes,\n requiredPitchesPerSecond,\n tuningWindow,\n ignoreOctave,\n checkNoteStartTimes,\n timeBucketLeft,\n timeBucketRight,\n minAmplPerc,\n psMinPitchStabilityThresh,\n psPitchesToConsider,\n psMinStablePitches,\n psMinTotalPitchJump,\n asMinAmplPercRise,\n asMaxAmplRiseTime,\n spMinTimeBetweenSplits,\n minTimeBetweenClaps,\n minAmplRatioToFloor,\n minConsecutiveQuietPeaks,\n minAmplSlopeScore,\n qNoteNudge,\n qNoteBucket\n }) {\n this.id = id;\n this.name = name;\n this.assessmentType = assessmentType;\n this.transposition = transposition;\n this.minFreq = minFreq;\n this.maxFreq = maxFreq;\n this.yinQuality = yinQuality;\n this.windowWidth = windowWidth;\n this.sampleRate = sampleRate;\n this.pRecMethod = pRecMethod;\n this.pRecQuality = pRecQuality;\n this.overSampTimes = overSampTimes;\n this.requiredPitchesPerSecond = requiredPitchesPerSecond;\n this.tuningWindow = tuningWindow;\n this.ignoreOctave = ignoreOctave;\n this.checkNoteStartTimes = checkNoteStartTimes;\n this.timeBucketLeft = timeBucketLeft;\n this.timeBucketRight = timeBucketRight;\n this.minAmplPerc = minAmplPerc;\n this.psMinStablePitches = psMinStablePitches;\n this.psPitchesToConsider = psPitchesToConsider;\n this.psMinTotalPitchJump = psMinTotalPitchJump;\n this.psMinPitchStabilityThresh = psMinPitchStabilityThresh;\n this.asMinAmplPercRise = asMinAmplPercRise;\n this.asMaxAmplRiseTime = asMaxAmplRiseTime;\n this.spMinTimeBetweenSplits = spMinTimeBetweenSplits;\n this.minTimeBetweenClaps = minTimeBetweenClaps;\n this.minAmplRatioToFloor = minAmplRatioToFloor;\n this.minConsecutiveQuietPeaks = minConsecutiveQuietPeaks;\n this.minAmplSlopeScore = minAmplSlopeScore;\n this.qNoteNudge = qNoteNudge;\n this.qNoteBucket = qNoteBucket;\n }\n};\n\n// src/analysis/AssessmentInstrumentUtils.ts\nvar _AssessmentInstrumentUtils = class _AssessmentInstrumentUtils {\n static getInstrumentByID(id) {\n for (let inst of _AssessmentInstrumentUtils.instruments) {\n if (inst.id === id) {\n return inst;\n }\n }\n return null;\n }\n};\n_AssessmentInstrumentUtils.instruments = [\n new AssessmentInstrumentDO(3, \"Soprano Recorder\", {\n assessmentType: 1,\n transposition: -12,\n minFreq: 400,\n maxFreq: 2500,\n yinQuality: 1,\n windowWidth: 256,\n pRecMethod: 1,\n pRecQuality: 10,\n overSampTimes: 2,\n requiredPitchesPerSecond: 30,\n tuningWindow: 50,\n ignoreOctave: false,\n checkNoteStartTimes: true,\n timeBucketLeft: 0.3,\n timeBucketRight: 0.45,\n psMinStablePitches: 6,\n psPitchesToConsider: 9,\n psMinTotalPitchJump: 60,\n psMinPitchStabilityThresh: 50,\n asMinAmplPercRise: 1,\n asMaxAmplRiseTime: 0.05,\n spMinTimeBetweenSplits: 0.1,\n minAmplPerc: 0.05\n }),\n new AssessmentInstrumentDO(4, \"Alto Recorder Transposed\", {\n assessmentType: 1,\n transposition: -5,\n minFreq: 300,\n maxFreq: 2e3,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(300, \"Alto Recorder\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 300,\n maxFreq: 2e3,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(301, \"Tenor Recorder\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 200,\n maxFreq: 1250,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(302, \"Bass Recorder Transposed\", {\n assessmentType: 1,\n transposition: 7,\n minFreq: 150,\n maxFreq: 1e3,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(303, \"Bass Recorder\", {\n assessmentType: 1,\n transposition: -12,\n minFreq: 150,\n maxFreq: 1e3,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(400, \"Tin Whistle in D\", {\n assessmentType: 1,\n transposition: -12,\n minFreq: 400,\n maxFreq: 2500,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(5, \"Piccolo\", {\n assessmentType: 1,\n transposition: -12,\n minFreq: 500,\n maxFreq: 4500,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(6, \"Flute\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 200,\n maxFreq: 2500,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(200, \"Alto Flute\", {\n assessmentType: 1,\n transposition: 5,\n minFreq: 150,\n maxFreq: 2200,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(7, \"Oboe\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 200,\n maxFreq: 2200,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(210, \"English Horn\", {\n assessmentType: 1,\n transposition: 7,\n minFreq: 130,\n maxFreq: 1700,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(8, \"Bassoon\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 50,\n maxFreq: 1200,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(9, \"Clarinet\", {\n assessmentType: 1,\n transposition: 2,\n minFreq: 120,\n maxFreq: 2e3,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(10, \"Bass Clarinet\", {\n assessmentType: 1,\n transposition: 14,\n minFreq: 60,\n maxFreq: 1e3,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(11, \"Soprano Sax\", {\n assessmentType: 1,\n transposition: 2,\n minFreq: 140,\n maxFreq: 1800,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(12, \"Alto Sax\", {\n assessmentType: 1,\n transposition: 9,\n minFreq: 100,\n maxFreq: 1200,\n yinQuality: 3\n }),\n new AssessmentInstrumentDO(13, \"Tenor Sax\", {\n assessmentType: 1,\n transposition: 14,\n minFreq: 70,\n maxFreq: 1e3,\n yinQuality: 3\n }),\n new AssessmentInstrumentDO(14, \"Bari Sax\", {\n assessmentType: 1,\n transposition: 21,\n minFreq: 50,\n maxFreq: 600,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(15, \"Trumpet\", {\n assessmentType: 1,\n transposition: 2,\n minFreq: 140,\n maxFreq: 2e3,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(16, \"Horn in F\", {\n assessmentType: 1,\n transposition: 7,\n minFreq: 90,\n maxFreq: 1400,\n yinQuality: 3\n }),\n new AssessmentInstrumentDO(17, \"Trombone\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 60,\n maxFreq: 1e3,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(18, \"Euphonium TC\", {\n assessmentType: 1,\n transposition: 14,\n minFreq: 60,\n maxFreq: 1e3,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(19, \"Euphonium BC\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 60,\n maxFreq: 1e3,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(20, \"Tuba\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 30,\n maxFreq: 500,\n yinQuality: 6\n }),\n new AssessmentInstrumentDO(21, \"Violin\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 150,\n maxFreq: 2500,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(22, \"Viola\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 110,\n maxFreq: 1800,\n yinQuality: 2\n }),\n new AssessmentInstrumentDO(23, \"Cello\", {\n assessmentType: 1,\n transposition: 0,\n minFreq: 55,\n maxFreq: 1e3,\n yinQuality: 4\n }),\n new AssessmentInstrumentDO(24, \"Bass\", {\n assessmentType: 1,\n transposition: 12,\n minFreq: 30,\n maxFreq: 600,\n yinQuality: 6\n }),\n new AssessmentInstrumentDO(25, \"Piano\", {\n assessmentType: 0,\n transposition: 0,\n minFreq: 20,\n maxFreq: 4400,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(26, \"Guitar\", {\n assessmentType: 0,\n transposition: 12,\n minFreq: 70,\n maxFreq: 1300,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(30, \"Bells\", {\n assessmentType: 1,\n transposition: -24,\n minFreq: 520,\n maxFreq: 4200,\n yinQuality: 1\n }),\n new AssessmentInstrumentDO(101, \"Clap\", {\n assessmentType: 2,\n minTimeBetweenClaps: 80,\n minAmplRatioToFloor: 5,\n minConsecutiveQuietPeaks: 0,\n minAmplSlopeScore: 1.5,\n qNoteNudge: -0.15,\n qNoteBucket: 0.25\n }),\n new AssessmentInstrumentDO(102, \"Rhythm Voice\", {\n assessmentType: 2,\n minTimeBetweenClaps: 120,\n minAmplRatioToFloor: 4,\n minConsecutiveQuietPeaks: 0,\n minAmplSlopeScore: 1.5,\n qNoteNudge: -0.2,\n qNoteBucket: 0.25\n })\n];\nvar AssessmentInstrumentUtils = _AssessmentInstrumentUtils;\n\n// src/analysis/DelayInfo.ts\nvar DelayInfo = class {\n};\n\n// src/analysis/DelayTester.ts\nimport { SoundLoader } from \"audio_utils\";\n\n// src/mic/MicManager.ts\nimport { createEmitter as createEmitter3 } from \"ts_utils\";\n\n// src/audio_worklets/MicDataNode.ts\nimport { createEmitter } from \"ts_utils\";\nvar _MicDataNode = class _MicDataNode extends AudioWorkletNode {\n constructor(context) {\n super(context, \"micData-worklet\");\n this._micDataEmitter = createEmitter();\n this._onProcessorMessage = (ev) => {\n this._micDataEmitter.emit(ev.data);\n };\n if (!_MicDataNode.workletRegistered) {\n throw \"call registerWorklet() before instantiating\";\n }\n this._context = context;\n this._init();\n }\n get micData() {\n return this._micDataEmitter.event;\n }\n static async registerWorklet(context) {\n if (_MicDataNode.workletRegistered) {\n return true;\n }\n try {\n let blob = new Blob([micDataWorklet], { type: \"text/javascript\" });\n let url = window.URL.createObjectURL(blob);\n await context.audioWorklet.addModule(url);\n _MicDataNode.workletRegistered = true;\n return true;\n } catch (err) {\n console.log(err);\n return false;\n }\n }\n setWindowSize(windowSize) {\n this.port.postMessage({\n type: \"setWindowSize\",\n windowSize\n });\n }\n _init() {\n this.port.onmessage = this._onProcessorMessage;\n }\n};\n_MicDataNode.workletRegistered = false;\nvar MicDataNode = _MicDataNode;\nvar micDataWorklet = `\nclass MicDataProcessor extends AudioWorkletProcessor {\n\twindowSize = 128;\n\twindowPosition = 0;\n\twindowData;\n\t\n\tconstructor(){\n\t\tsuper();\n\t\tthis.port.onmessage = this._handleMessage;\n\t\tthis.windowData = new Float32Array(this.windowSize);\n\t\tthis.windowPosition = 0;\n\t}\n\t\n\tprocess(inputs, outputs) {\n\t\t// By default, the node has single input and output.\n\t\t//input[0][0] is the Float32Array of left channel data\n\t\t\n\t\tconst newData = inputs[0][0];\n\t\tif (newData == null){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tlet newDataPos = 0;\n\t\twhile(true){\n\t\t\tlet windowSpotsRemaining = this.windowSize - this.windowPosition;\n\t\t\tlet newSamplesRemaining = newData.length - newDataPos;\n\t\t\t\n\t\t\tif (newSamplesRemaining >= windowSpotsRemaining){\n\t\t\t\tlet numSamplesToCopy = windowSpotsRemaining;\n\t\t\t\tthis.windowData.set(newData.subarray(newDataPos, newDataPos +\n\t\t\t\t\tnumSamplesToCopy), this.windowPosition);\n\t\t\t\tnewDataPos += numSamplesToCopy;\n\t\t\t\t\n\t\t\t\tthis.port.postMessage(this.windowData);\n\t\t\t\tthis.windowData = new Float32Array(this.windowSize);\n\t\t\t\tthis.windowPosition = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet numSamplesToCopy = newSamplesRemaining;\n\t\t\t\tthis.windowData.set(newData.subarray(newDataPos, newDataPos +\n\t\t\t\t\tnumSamplesToCopy), this.windowPosition);\n\t\t\t\tthis.windowPosition += numSamplesToCopy\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n\t\n\t_handleMessage = (ev) => {\n\t\tif (ev.data.type === \"setWindowSize\"){\n\t\t\tthis.windowSize = ev.data.windowSize;\n\t\t\tthis.windowData = new Float32Array(this.windowSize);\n\t\t\tthis.windowPosition = 0;\n\t\t}\n\t}\n}\n\nregisterProcessor('micData-worklet', MicDataProcessor);\n`;\n\n// src/devices/devices.ts\nimport { createEmitter as createEmitter2 } from \"ts_utils\";\n\n// src/mic/MicOptions.ts\nvar MicOptions = class {\n constructor() {\n this.channelCount = 1;\n this.autoGainControl = false;\n this.echoCancellation = false;\n this.latency = 0;\n this.noiseSuppression = false;\n }\n toMap(deviceId) {\n let settings = {\n \"channelCount\": this.channelCount,\n \"autoGainControl\": this.autoGainControl,\n \"echoCancellation\": this.echoCancellation,\n \"latency\": this.latency,\n \"noiseSuppression\": this.noiseSuppression\n };\n if (deviceId != null) {\n settings[\"deviceId\"] = deviceId;\n }\n return settings;\n }\n};\n\n// src/video/VideoOptions.ts\nvar VideoOptions = class {\n constructor(width = 320, height = 240, idealFrameRate = 12, maxFrameRate = 15, bitRate = 1e6, recordingBlobSize = 100) {\n this.mimeCodecsString = \"video/webm;codecs=avc1,opus\" /* videoWebmAvc1Opus */;\n this.width = width;\n this.height = height;\n this.idealFrameRate = idealFrameRate;\n this.maxFrameRate = maxFrameRate;\n this.bitRate = bitRate;\n this.recordingBlobSize = recordingBlobSize;\n }\n toMap(deviceId) {\n let settings = {\n \"width\": { \"ideal\": this.width },\n \"height\": { \"ideal\": this.height },\n \"frameRate\": {\n \"ideal\": this.idealFrameRate\n }\n };\n if (deviceId != null) {\n settings[\"deviceId\"] = deviceId;\n }\n return settings;\n }\n};\n\n// src/devices/devices.ts\nvar Device = class {\n};\nvar DeviceType = /* @__PURE__ */ ((DeviceType2) => {\n DeviceType2[DeviceType2[\"audioInput\"] = 0] = \"audioInput\";\n DeviceType2[DeviceType2[\"videoInput\"] = 1] = \"videoInput\";\n DeviceType2[DeviceType2[\"audioOutput\"] = 2] = \"audioOutput\";\n return DeviceType2;\n})(DeviceType || {});\nvar MediaDeviceManagerEvent = class {\n};\nvar MediaDeviceManagerEventType = /* @__PURE__ */ ((MediaDeviceManagerEventType2) => {\n MediaDeviceManagerEventType2[MediaDeviceManagerEventType2[\"deviceChange\"] = 0] = \"deviceChange\";\n return MediaDeviceManagerEventType2;\n})(MediaDeviceManagerEventType || {});\nvar MediaDeviceManager = class _MediaDeviceManager {\n constructor() {\n this._micPermissionGranted = false;\n this._cameraPermissionGranted = false;\n this._isInitialized = false;\n this._eventEmitter = createEmitter2();\n this._onDeviceChange = async (e) => {\n await this.getDevices();\n let micChanged = this._currentMic != null && !this.deviceAvailable(this._currentMic.id);\n let cameraChanged = this._currentCamera != null && !this.deviceAvailable(this._currentCamera.id);\n if (micChanged || cameraChanged) {\n this._dispatchDeviceChangeEvent(micChanged, cameraChanged);\n }\n };\n }\n get devices() {\n return this._devices.slice();\n }\n /**returns the currently specified audio input [Device]. Use [isMicReady]\n * to ensure the [currentMic] has been set and permission has been granted\n * to use it.*/\n get currentMic() {\n return this._currentMic;\n }\n /**returns the currently specified video input [Device]. Use [isCameraReady]\n * to ensure the [currentCamera] has been set and permission has been \n * granted to use it.*/\n get currentCamera() {\n return this._currentCamera;\n }\n /**returns true if the user has granted permission to use the microphone in\n * this session or a previous session. Use [isMicReady] instead to ensure\n * the [currentMic] has also been set in addition to permission being\n * granted.*/\n get micPermissionGranted() {\n return this._micPermissionGranted;\n }\n /**returns true if the user has granted permission to use the camera in\n * this session or a previous session. Use [isCameraReady] instead to ensure\n * the [currentCamera] has also been set in addition to permission being\n * granted.*/\n get cameraPermissionGranted() {\n return this._cameraPermissionGranted;\n }\n /**returns true if the user has granted permission to use the microphone\n * and the [currentMic] has been specified. This must be [true] in order\n * to initiate a mic stream.*/\n get isMicReady() {\n return this._micPermissionGranted && this._currentMic != null;\n }\n /**returns true if the user has granted permission to use the microphone\n * and the [currentCamera] has been specified. This must be [true] in order\n * to initiate a camera stream.*/\n get isCameraReady() {\n return this._cameraPermissionGranted && this._currentCamera != null;\n }\n static get isInitialized() {\n return this._ref != null && this._ref._isInitialized;\n }\n get event() {\n return this._eventEmitter.event;\n }\n static get() {\n if (!_MediaDeviceManager._ref) {\n _MediaDeviceManager._ref = new _MediaDeviceManager();\n }\n return _MediaDeviceManager._ref;\n }\n /**Gets the current state of permissions without prompting the user for \n * permission or choosing mic/camera devices. You must separately call:\n * [getPermissions] - and request mic and/or camera permissions\n * [getDevices] - to list the available devices\n * [setMic] / [setCamera] - set a current device*/\n async init() {\n if (this._isInitialized) {\n return;\n }\n await this._checkIfPermissionGranted();\n window.navigator.mediaDevices.addEventListener(\n \"devicechange\",\n this._onDeviceChange\n );\n this._isInitialized = true;\n }\n /**Initializes the list of devices and sets the mic and/or camera to the\n * operating system default devices. The user will be prompted if permission\n * has not already been obtained.*/\n async initWithDefaultDevices(initMic, initCamera) {\n if (!initMic && !initCamera) {\n throw \"initWithDefaultDevices should only be used when initiating the mic and/or camera. Alternatively use init()\";\n }\n await this.init();\n let success = await this.getPermissions(initMic, initCamera);\n if (!success) {\n return false;\n }\n await this.getDevices();\n let micSuccess = !initMic || this.setMic();\n let cameraSuccess = !initCamera || this.setCamera();\n return micSuccess && cameraSuccess;\n }\n /**Gets permission to use the microphone and/or camera.*/\n async getPermissions(mic, camera) {\n let options = {};\n if (mic && !this._micPermissionGranted) {\n options.audio = new MicOptions().toMap(null);\n }\n if (camera && !this._cameraPermissionGranted) {\n options.video = new VideoOptions().toMap(null);\n }\n if (!options.audio && !options.video) {\n return true;\n }\n let success = await this._createStreams(options);\n if (success) {\n if (!this._micPermissionGranted) {\n this._micPermissionGranted = options.audio != null;\n }\n if (!this._cameraPermissionGranted) {\n this._cameraPermissionGranted = options.video != null;\n }\n }\n success = (!mic || this._micPermissionGranted) && (!camera || this._cameraPermissionGranted);\n return success;\n }\n async getDevices() {\n this._devices = [];\n try {\n let deviceObjects = await navigator.mediaDevices.enumerateDevices();\n for (let dev of deviceObjects) {\n let device = new Device();\n device.id = dev.deviceId;\n device.name = dev.label;\n if (device.id == null) {\n continue;\n }\n switch (dev.kind) {\n case \"audioinput\":\n device.type = 0 /* audioInput */;\n break;\n case \"videoinput\":\n device.type = 1 /* videoInput */;\n break;\n case \"audiooutput\":\n device.type = 2 /* audioOutput */;\n break;\n default:\n continue;\n }\n device.isDefault = !this._devices.some((d) => d.type === device.type);\n this._devices.push(device);\n }\n } catch (err) {\n console.log(err);\n }\n return this._devices;\n }\n /**returns [true] if the requested [deviceId] matches a currently available\n * device*/\n deviceAvailable(deviceId) {\n if (this._devices == null) {\n throw \"You must call getDevices() before devices will be available\";\n }\n return this._devices.some((d) => d.id == deviceId);\n }\n /**sets the mic device without intializing the mic or asking for permission.\n * If deviceId is left null, the default device will be used.\n * Dispatches an event of type [MediaDeviceManagerEventType.deviceChange] if\n * the device is successfully set.*/\n setMic(deviceId = null) {\n if (!this._micPermissionGranted) {\n throw \"You must call getPermissions() and getDevices() before setting a microphone device\";\n }\n if (deviceId == null) {\n deviceId = this._devices.find((d) => d.type == 0 /* audioInput */ && d.isDefault)?.id;\n }\n if (deviceId == null || !this.deviceAvailable(deviceId)) {\n return false;\n }\n this._currentMic = this._devices.find((d) => d.id == deviceId);\n this._dispatchDeviceChangeEvent(true, false);\n return true;\n }\n /**sets the mic device to null and dispatches an event of type\n * [MediaDeviceManagerEventType.deviceChange]*/\n clearMic() {\n this._currentMic = null;\n this._dispatchDeviceChangeEvent(true, false);\n }\n /**sets the camera device without intializing the camera or asking for \n * permission. If deviceId is left null, the default device will be used.\n * Dispatches an event of type [MediaDeviceManagerEventType.deviceChange] if\n * the device is successfully set.*/\n setCamera(deviceId = null) {\n if (!this._cameraPermissionGranted) {\n throw \"You must call getPermissions() and getDevices() before setting a camera device\";\n }\n if (deviceId == null) {\n deviceId = this._devices.find((d) => d.type == 1 /* videoInput */ && d.isDefault)?.id;\n }\n if (deviceId == null || !this.deviceAvailable(deviceId)) {\n return false;\n }\n this._currentCamera = this._devices.find((d) => d.id == deviceId);\n this._dispatchDeviceChangeEvent(false, true);\n return true;\n }\n /**sets the camera device to null and dispatches an event of type\n * [MediaDeviceManagerEventType.deviceChange]*/\n clearCamera() {\n this._currentCamera = null;\n this._dispatchDeviceChangeEvent(false, true);\n }\n async _createStreams(options) {\n try {\n let stream = await navigator.mediaDevices.getUserMedia(options);\n let tracks = stream.getTracks();\n for (let track of tracks) {\n track.stop();\n track.enabled = false;\n stream.removeTrack(track);\n }\n stream = null;\n return true;\n } catch (err) {\n console.log(err.toString() + \"could not enable mic and/or camera\");\n return false;\n }\n }\n async _checkIfPermissionGranted() {\n try {\n let status = await navigator.permissions.query(\n { name: \"microphone\" }\n );\n if (status.state === \"granted\") {\n this._micPermissionGranted = true;\n }\n status = await navigator.permissions.query(\n { name: \"camera\" }\n );\n if (status.state === \"granted\") {\n this._cameraPermissionGranted = true;\n }\n } catch (err) {\n }\n }\n _dispatchDeviceChangeEvent(micChanged, cameraChanged) {\n let ev = new MediaDeviceManagerEvent();\n ev.type = 0 /* deviceChange */;\n ev.micChanged = micChanged;\n ev.cameraChanged = cameraChanged;\n this._eventEmitter.emit(ev);\n }\n};\n\n// src/mic/AudioOptions.ts\nvar AudioOptions = class {\n constructor() {\n this.bitRate = 128e3;\n this.mimeCodecsString = \"audio/webm;codecs=opus\" /* audioWebmOpus */;\n }\n};\n\n// src/mic/MicManager.ts\nvar _MicManager = class _MicManager {\n constructor(context, options) {\n this._micDataEmitter = createEmitter3();\n this._eventEmitter = createEmitter3();\n this._recordingBufferSize = 1024;\n this._isCapturing = false;\n this._micOptions = new MicOptions();\n this._onMicData = (data) => {\n if (data.length < 1) {\n return;\n } else {\n this._micDataEmitter.emit(data);\n }\n };\n this._onMediaDeviceManagerEvent = (e) => {\n if (e.micChanged || this.includesVideo && e.cameraChanged) {\n this.killStream();\n }\n };\n this._context = context;\n this._audioOptions = options != null ? options : new AudioOptions();\n this._init();\n }\n get micData() {\n return this._micDataEmitter.event;\n }\n get event() {\n return this._eventEmitter.event;\n }\n /**Creates/gets a [MicManager] singleton. [context] is only necessary the\n * first time the constructor is called and will be ignored on future calls.\n * */\n static get(context, options) {\n if (!_MicManager._ref) {\n _MicManager._ref = new _MicManager(context, options);\n }\n return _MicManager._ref;\n }\n _init() {\n if (this._context == null) {\n throw \"AudioContext must be specified the first time you callMicManager.get().\";\n }\n if (!MediaDeviceManager.isInitialized) {\n throw \"You must instantiate and initialize a MediaDeviceManager before creating the MicManager\";\n }\n MediaDeviceManager.get().event.on(this._onMediaDeviceManagerEvent);\n }\n /**kills any existing media stream and initializes a new one. If successful,\n * resolves true, otherwise false. If [VideoOptions] is null, only audio\n * input is initialized. This can also be used to disable video recording.*/\n async initMicMediaStream(micOptions = null, videoOptions = null) {\n let deviceManager = MediaDeviceManager.get();\n if (!deviceManager.isMicReady) {\n throw \"You must set a mic device in the MediaDeviceManager and get permission to use it before creating media streams.\";\n }\n if (videoOptions != null && !deviceManager.isCameraReady) {\n throw \"You must set a camera device in the MediaDeviceManager and get permission to use it before adding a video stream.\";\n }\n await this._setupWorklets();\n this.killStream();\n if (micOptions != null) {\n this._micOptions = micOptions;\n }\n this._videoOptions = videoOptions;\n let video;\n if (this._videoOptions != null) {\n video = this._videoOptions.toMap(deviceManager.currentCamera.id);\n }\n try {\n this._stream = await navigator.mediaDevices.getUserMedia({\n audio: this._micOptions.toMap(deviceManager.currentMic.id),\n video: video ?? false\n });\n let ev = new MicManagerEvent(0 /* streamCreated */);\n this._eventEmitter.emit(ev);\n return true;\n } catch (err) {\n console.log(err.toString() + \" ...maybe make sure mic is enabled.\");\n return false;\n }\n }\n async addFiltering() {\n let wasCapturing = this._isCapturing;\n this._micOptions.echoCancellation = true;\n this._micOptions.noiseSuppression = true;\n await this.initMicMediaStream(null, this._videoOptions);\n if (wasCapturing) {\n this.startCapture();\n }\n }\n async removeFiltering() {\n let wasCapturing = this._isCapturing;\n this._micOptions.echoCancellation = false;\n this._micOptions.noiseSuppression = false;\n await this.initMicMediaStream(null, this._videoOptions);\n if (wasCapturing) {\n this.startCapture();\n }\n }\n killStream() {\n if (this._stream != null) {\n this.stopCapture();\n let tracks = this._stream.getTracks();\n for (let track of tracks) {\n track.stop();\n track.enabled = false;\n this._stream.removeTrack(track);\n }\n this._stream = null;\n let ev = new MicManagerEvent(1 /* streamClosed */);\n this._eventEmitter.emit(ev);\n }\n }\n startCapture() {\n if (this._isCapturing) {\n return;\n }\n if (this._context == null) {\n throw \"AudioContext must be set first!\";\n }\n this._inputNode = this._context.createMediaStreamSource(this._stream);\n this._micDataNode = new MicDataNode(this._context);\n this._micDataNode.setWindowSize(this._recordingBufferSize);\n this._micDataNode.micData.on(this._onMicData);\n this._inputNode.connect(this._micDataNode);\n if (this._micMonitorOutput != null) {\n this._inputNode.connect(this._micMonitorOutput);\n }\n this._micDataNode.connect(this._context.destination);\n this._isCapturing = true;\n }\n stopCapture() {\n if (this._isCapturing) {\n this._micDataNode.disconnect();\n this._inputNode.disconnect();\n this._micDataNode.micData.off(this._onMicData);\n this._isCapturing = false;\n }\n }\n /**attempts to check and return the number of mic channels on the current\n * audio MediaStreamTrack. Returns null if the check fails. */\n getNumAudioChannels() {\n if (!this._stream) {\n return null;\n }\n let tracks = this._stream.getAudioTracks();\n if (tracks && tracks.length > 0) {\n let settings = tracks[0].getSettings();\n let count = settings.channelCount;\n if (count !== void 0 && typeof count === \"number\") {\n return count;\n }\n }\n return null;\n }\n async _setupWorklets() {\n if (!MicDataNode.workletRegistered) {\n await MicDataNode.registerWorklet(this._context);\n }\n }\n get audioContext() {\n return this._context;\n }\n set audioContext(value) {\n this._context = value;\n }\n /**Gets the number of samples in each recording buffer (ex. 1024)*/\n get recordingBufferSize() {\n return this._recordingBufferSize;\n }\n set recordingBufferSize(value) {\n if (value !== 256 && value !== 512 && value !== 1024 && value !== 2048 && value !== 4096 && value !== 8192 && value !== 16384) {\n throw \"value must be a power of 2 from 256 - 16384\";\n }\n this._recordingBufferSize = value;\n }\n get audioOptions() {\n return this._audioOptions;\n }\n /**Gets the [VideoOptions] that was set via [initMicAndGetPermission] or\n * [initMicMediaStream]. If this is null, [VideoOptions] were not passed\n * in when initializing the microphone. To disable video, pass null for \n * the video options to either of those methods.*/\n get videoOptions() {\n return this._videoOptions;\n }\n /**true if video streams are created, in addition to the required audio\n * input stream*/\n get includesVideo() {\n return this._videoOptions != null;\n }\n /**[true] if the microphone is currently dispatching mic data through the \n * [onMicData] stream. The audio is not saved in the [MicManager], so a\n * separate class for recording or analyzing the data should listen to those\n * events.*/\n get isCapturing() {\n return this._isCapturing;\n }\n /**when using capture (via [startCapture]), if the [micMonitorOutput] is\n * not null, the captured mic data will be sent to this node as well. It's\n * intended to be used for mic audio monitoring.*/\n get micMonitorOutput() {\n return this._micMonitorOutput;\n }\n set micMonitorOutput(node) {\n if (this._inputNode != null) {\n if (this._micMonitorOutput != null) {\n try {\n this._inputNode.disconnect(this._micMonitorOutput);\n } catch (err) {\n }\n }\n if (node != null) {\n this._inputNode.connect(node);\n }\n }\n this._micMonitorOutput = node;\n }\n get isStreamActive() {\n return this._stream != null;\n }\n get stream() {\n return this._stream;\n }\n /**returns the [MediaStreamTrack] for the microphone audio*/\n get micAudioTrack() {\n return this._stream?.getAudioTracks()[0];\n }\n};\n_MicManager.useOldChromeSettings = false;\nvar MicManager = _MicManager;\nvar MicManagerEvent = class {\n constructor(type) {\n this.type = type;\n }\n};\nvar MicManagerEventType = /* @__PURE__ */ ((MicManagerEventType2) => {\n MicManagerEventType2[MicManagerEventType2[\"streamCreated\"] = 0] = \"streamCreated\";\n MicManagerEventType2[MicManagerEventType2[\"streamClosed\"] = 1] = \"streamClosed\";\n return MicManagerEventType2;\n})(MicManagerEventType || {});\n\n// src/mic/AudioRecorder2.ts\nimport ysFixWebmDuration from \"fix-webm-duration\";\nvar AudioRecorder2 = class _AudioRecorder2 {\n constructor(micManager) {\n this._isRecording = false;\n this._fixWebmDuration = false;\n // void _onRecordingStart(html.Event e){\n //This does not seem to be a reliable indicator of exactly when\n //recording begins, possibly because the handler call can be delayed\n //if there is heavy js processing.\n // number cTime = _micManager.audioContext.currentTime;\n // print('rec start time: $_recordStartTime, rec started: $cTime');\n // _recordStartTime = cTime;\n // }\n this._onDataAvailable = (e) => {\n this._recordingBlobs.push(e.data);\n if (!this._isRecording) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._recordingComplete = true;\n this._completeBlobReturn();\n }\n };\n this._onMicManagerEvent = (e) => {\n switch (e.type) {\n case 1 /* streamClosed */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._killMediaRecorder();\n break;\n case 0 /* streamCreated */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._createMediaRecorder();\n break;\n }\n };\n this._micManager = micManager;\n this._init();\n }\n /**\n * start recording.\n * set startMicCapture to true if you aren't initializing it elsewhere\n * (for pitch rec, etc.).\n */\n record() {\n if (!_AudioRecorder2.isSupported) {\n return false;\n }\n if (this._mediaRecorder == null) {\n if (!this._createMediaRecorder()) {\n throw \"MediaRecorder could not be created. Make sure to call MicManager.initMicMediaStream before using the AudioRecorder2\";\n }\n }\n this._recordingBlobs = [];\n this._mediaRecorder.addEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder.start();\n this._recordStartTime = this._micManager.audioContext.currentTime;\n this._isRecording = true;\n this._recordingComplete = false;\n return true;\n }\n /**stops recording. If stopMicCapture is true, the microphone capture is\n * also stopped in the MicManager.*/\n stop() {\n if (!_AudioRecorder2.isSupported) {\n return;\n }\n if (this._isRecording) {\n this._mediaRecorder.stop();\n this._recordStopTime = this._micManager.audioContext.currentTime;\n this._isRecording = false;\n }\n }\n /**gets recording as an html.Blob object that can be saved to a file*/\n getAudioBlob() {\n return new Promise((resolve, reject) => {\n this._returnBlobCompleter = resolve;\n if (this._recordingComplete) {\n this._completeBlobReturn();\n }\n });\n }\n /**Gets an AudioElement with the recorded audio*/\n async getAudioElement() {\n let blob = await this.getAudioBlob();\n if (blob != null) {\n let audioEl = document.createElement(\"audio\");\n audioEl.src = URL.createObjectURL(blob);\n return audioEl;\n }\n return null;\n }\n _init() {\n this._micManager.event.on(this._onMicManagerEvent);\n this._createMediaRecorder();\n }\n _createMediaRecorder() {\n this._killMediaRecorder();\n if (!this._audioStreamIsReady()) {\n return false;\n }\n try {\n let audioOptions = this._micManager.audioOptions;\n let vidOptions = this._micManager.videoOptions;\n let options = this.recordingVideo ? {\n \"mimeType\": vidOptions.mimeCodecsString,\n \"audioBitsPerSecond\": audioOptions.bitRate,\n \"videoBitsPerSecond\": vidOptions.bitRate\n } : {\n \"mimeType\": audioOptions.mimeCodecsString,\n \"audioBitsPerSecond\": audioOptions.bitRate\n };\n this._mediaRecorder = new MediaRecorder(\n this._micManager.stream,\n options\n );\n return true;\n } catch (err) {\n console.log(err.toString());\n return false;\n }\n }\n _audioStreamIsReady() {\n let audioStreams = this._micManager.stream?.getAudioTracks();\n if (audioStreams == null || audioStreams.length < 1 || audioStreams[0].readyState !== \"live\") {\n return false;\n }\n return true;\n }\n _completeBlobReturn() {\n if (this._returnBlobCompleter == null) {\n return;\n }\n if (this._recordingBlobs == null || this._recordingBlobs.length === 0) {\n this._recordingBlobs = null;\n this._returnBlobCompleter(null);\n this._returnBlobCompleter = null;\n } else {\n let mimeType = this.recordingVideo ? \"video/webm\" : \"audio/webm\";\n let blob = new Blob(this._recordingBlobs, { type: mimeType });\n this._recordingBlobs = null;\n if (!this._fixWebmDuration) {\n this._returnBlobCompleter(blob);\n this._returnBlobCompleter = null;\n } else {\n let duration = Math.ceil((this._recordStopTime - this._recordStartTime) * 1e3);\n ysFixWebmDuration(blob, duration, (fixedBlob) => {\n this._returnBlobCompleter(fixedBlob);\n this._returnBlobCompleter = null;\n }, { logger: false });\n }\n }\n }\n _killMediaRecorder() {\n if (this._mediaRecorder != null) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder = null;\n }\n }\n get recordingVideo() {\n return this._micManager.includesVideo;\n }\n /**if true, recording is currently in progress.*/\n get isRecording() {\n return this._isRecording;\n }\n /**returns the AudioContext time, in seconds, when recording starts.*/\n get recordStartTime() {\n return this._recordStartTime;\n }\n /**returns the AudioContext time, in seconds, when recording stops.*/\n get recordStopTime() {\n return this._recordStopTime;\n }\n /**if fixWebmDuration is true, recordings will be processed to add duration\n * metadata */\n get fixWebmDuration() {\n return this._fixWebmDuration;\n }\n set fixWebmDuration(value) {\n this._fixWebmDuration = value;\n }\n /**returns true if the browser supports the MediaRecorder API*/\n static get isSupported() {\n if (_AudioRecorder2._isSupported == null) {\n _AudioRecorder2._isSupported = MediaRecorder != null;\n }\n return _AudioRecorder2._isSupported;\n }\n};\n\n// src/analysis/DelayTester.ts\nvar DelayTester = class _DelayTester {\n constructor(micManager) {\n this._onMicData = (data) => {\n if (this._micSampleData == null) {\n this._micSampleData = data;\n } else {\n let newList = new Float32Array(this._micSampleData.length + data.length);\n newList.set(this._micSampleData, 0);\n newList.set(data, this._micSampleData.length);\n this._micSampleData = newList;\n }\n };\n if (micManager == null) {\n throw \"You must include the MicManager in the first call to DelayTester.get()\";\n }\n this._micManager = micManager;\n }\n static get(micManager) {\n if (_DelayTester._ref == null) {\n _DelayTester._ref = new _DelayTester(micManager);\n }\n return _DelayTester._ref;\n }\n /**Tests the length of the delay between when a user makes a sound and that\n * sound is picked up. To use this test, the mic must pick up the speaker\n * sound. A single short tone will play.*/\n testDelay() {\n return new Promise((resolve, reject) => {\n this._micManager.initMicMediaStream().then((_) => {\n let context = this._micManager.audioContext;\n let tone = this._getTestTone(\n 512,\n 880,\n false\n );\n this._testSampleData = tone.buffer.getChannelData(0);\n this._recorder = new AudioRecorder2(this._micManager);\n this._recorder.record();\n let playDelay = 0;\n tone.start(context.currentTime + playDelay);\n setTimeout(async () => {\n this._recorder.stop();\n let blob = await this._recorder.getAudioBlob();\n let arrayBuffer = await this.convertBlobToArrayBuffer(blob);\n SoundLoader.getDownloadLinkForArrayBuffer(\n [arrayBuffer],\n \"audio.webm\"\n );\n let buffer = await SoundLoader.getAudioBufferFromBlob(\n blob,\n this._micManager.audioContext\n );\n let result = this._analyzeData(buffer, playDelay);\n resolve(result);\n }, 2e3);\n });\n });\n }\n /**Tests the length of the delay between when a user makes a sound and that\n * sound is picked up. To use this test, the mic must pick up the speaker\n * sound. A single short tone will play.*/\n testDelayViaPeak() {\n let promise = new Promise((resolve, reject) => {\n this._micManager.initMicMediaStream().then((_) => {\n let context = this._micManager.audioContext;\n let tone = this._getTestTone(\n 1024,\n 880,\n true\n );\n this._recorder = new AudioRecorder2(this._micManager);\n this._recorder.record();\n let playDelay = 0;\n tone.start(context.currentTime + playDelay);\n setTimeout(async () => {\n this._recorder.stop();\n let blob = await this._recorder.getAudioBlob();\n let buffer = await SoundLoader.getAudioBufferFromBlob(\n blob,\n this._micManager.audioContext\n );\n let result = this._analyzeDataPeak(buffer, playDelay);\n resolve(result);\n }, 1e3 + playDelay);\n });\n });\n return promise;\n }\n _getTestTone(numSamples, frequency, fade) {\n let context = this._micManager.audioContext;\n let bs = context.createBuffer(1, numSamples, context.sampleRate);\n let cdata = bs.getChannelData(0);\n let sampleRate = context.sampleRate;\n if (fade) {\n for (let i = 0; i < cdata.length; i++) {\n let fac = 1 * ((cdata.length - i) / cdata.length);\n cdata[i] = fac * Math.sin(i * frequency * 2 * Math.PI / sampleRate);\n }\n } else {\n for (let i = 0; i < cdata.length; i++) {\n cdata[i] = 1 * Math.sin(i * frequency * 2 * Math.PI / sampleRate);\n }\n }\n let bsn = context.createBufferSource();\n bsn.buffer = bs;\n bsn.connect(context.destination);\n return bsn;\n }\n _getSquareTone(numSamples, frequency) {\n let context = this._micManager.audioContext;\n let bs = context.createBuffer(1, numSamples, context.sampleRate);\n let cdata = bs.getChannelData(0);\n let sampleRate = context.sampleRate;\n for (let i = 0; i < cdata.length; i++) {\n let val = Math.sin(i * frequency * 2 * Math.PI / sampleRate);\n if (val > 0) {\n cdata[i] = 0.5;\n } else if (val < 0) {\n cdata[i] = -0.5;\n } else {\n cdata[i] = 0;\n }\n }\n let bsn = context.createBufferSource();\n bsn.buffer = bs;\n bsn.connect(context.destination);\n return bsn;\n }\n _analyzeData(buffer, playDelay) {\n let samples = buffer.getChannelData(0);\n this._normalizeMicSampleData(samples);\n let bestScore = -9999999;\n let bestScoreIndex = -1;\n let i = 0;\n for (i; i < samples.length - this._testSampleData.length; i += 1) {\n let score = 0;\n for (let j = 0; j < this._testSampleData.length; j++) {\n let micSample = samples[i + j];\n let testSample = this._testSampleData[j];\n score += micSample * testSample;\n }\n if (score > bestScore) {\n bestScore = score;\n bestScoreIndex = i;\n }\n }\n let delay = bestScoreIndex / this._micManager.audioContext.sampleRate;\n delay -= playDelay;\n let info = new DelayInfo();\n info.testSuccessful = true;\n info.delay = delay;\n return info;\n }\n _analyzeDataPeak(buffer, playDelay) {\n var samples = buffer.getChannelData(0);\n let max = -1;\n let bestScoreIndex = 0;\n for (let i = 0; i < samples.length; i++) {\n if (samples[i] > max) {\n max = samples[i];\n bestScoreIndex = i;\n }\n }\n let delay = bestScoreIndex / this._micManager.audioContext.sampleRate;\n delay -= playDelay;\n delay *= 1e3;\n delay = Math.round(delay);\n delay /= 1e3;\n let info = new DelayInfo();\n info.testSuccessful = true;\n info.delay = delay;\n return info;\n }\n _normalizeMicSampleData(samples) {\n let max = -1;\n for (let i = 0; i < samples.length; i++) {\n if (samples[i] > max) {\n max = samples[i];\n }\n }\n let fac = 0.5 / max;\n for (let i = 0; i < samples.length; i++) {\n samples[i] *= fac;\n }\n }\n /**Tests the length of the delay between when a user makes a sound and that\n * sound is picked up. To use this test, the mic must pick up the speaker\n * sound. Three short tones will play.*/\n async testDelay2() {\n await this._micManager.initMicMediaStream();\n const frequency = 880;\n const playDelay = 0;\n const recordingGap = 1;\n let testTone = this._getSquareTone(\n 512,\n frequency\n );\n let recording1 = await this._test2MakeFirstRecording(\n playDelay,\n testTone\n );\n testTone = this._getSquareTone(512, frequency);\n let recording2 = await this._test2MakeSecondRecording(\n playDelay,\n testTone,\n recording1,\n recordingGap\n );\n let gapTime = this._measureGapBetweenRecordings(\n recording2,\n frequency,\n recordingGap\n );\n let info = new DelayInfo();\n info.testSuccessful = true;\n info.delay = gapTime - recordingGap;\n return info;\n }\n _test2MakeFirstRecording(playDelay, testTone) {\n return new Promise((resolve, reject) => {\n this._micSampleData = null;\n this._micManager.micData.on(this._onMicData);\n this._micManager.startCapture();\n let context = this._micManager.audioContext;\n testTone.start(context.currentTime + playDelay);\n setTimeout(() => {\n this._micManager.micData.off(this._onMicData);\n this._micManager.stopCapture();\n this._normalizeMicSampleData(this._micSampleData);\n let bsn = this._getBufferSourceNodeFromAudio(\n this._micSampleData\n );\n resolve(bsn);\n }, 1e3);\n });\n }\n _test2MakeSecondRecording(playDelay, testTone, recording1, gapBetweenTones) {\n return new Promise((resolve, reject) => {\n this._micSampleData = null;\n this._micManager.micData.on(this._onMicData);\n this._micManager.startCapture();\n let context = this._micManager.audioContext;\n let playDelay2 = 0;\n testTone.start(context.currentTime + playDelay2);\n recording1.start(context.currentTime + playDelay2 + gapBetweenTones);\n setTimeout(() => {\n this._micManager.micData.off(this._onMicData);\n this._micManager.stopCapture();\n this._normalizeMicSampleData(this._micSampleData);\n resolve(this._micSampleData);\n }, 3e3);\n });\n }\n _measureGapBetweenRecordings(sampleData, frequency, gapBetweenTones) {\n let context = this._micManager.audioContext;\n let minSamplesBetweenTones = Math.floor(context.sampleRate * gapBetweenTones);\n let crossings = this._getZeroCrossingIndexes(sampleData);\n let idealGap = context.sampleRate / frequency / 2;\n let lastCrossingIdx = crossings[0];\n let consecutiveMatches = 0;\n let proposedStartIndex = 0;\n let confirmedTestToneIndex = -1;\n let confirmedRecordingIndex = -1;\n for (let i = 1; i < crossings.length; i++) {\n let crossingIdx = crossings[i];\n if (Math.abs(crossingIdx - lastCrossingIdx - idealGap) < 5) {\n consecutiveMatches++;\n if (consecutiveMatches == 1) {\n proposedStartIndex = lastCrossingIdx;\n }\n } else {\n if (consecutiveMatches > 5) {\n if (confirmedTestToneIndex == -1) {\n confirmedTestToneIndex = proposedStartIndex;\n } else if (proposedStartIndex - confirmedTestToneIndex > minSamplesBetweenTones) {\n confirmedRecordingIndex = proposedStartIndex;\n break;\n }\n }\n consecutiveMatches = 0;\n }\n lastCrossingIdx = crossingIdx;\n }\n return (confirmedRecordingIndex - confirmedTestToneIndex) / context.sampleRate;\n }\n _getZeroCrossingIndexes(sampleData) {\n let crossings = [];\n let lastVal = sampleData[0];\n for (let i = 1; i < sampleData.length; i++) {\n let val = sampleData[i];\n if (lastVal >= 0 && val < 0 || lastVal < 0 && val >= 0) {\n crossings.push(i);\n }\n lastVal = val;\n }\n return crossings;\n }\n _getBufferSourceNodeFromAudio(samples) {\n let context = this._micManager.audioContext;\n let buffer = context.createBuffer(\n 1,\n samples.length,\n context.sampleRate\n );\n let channel = buffer.getChannelData(0);\n channel.set(samples, 0);\n let bsn = context.createBufferSource();\n bsn.buffer = buffer;\n bsn.connect(context.destination);\n return bsn;\n }\n convertBlobToArrayBuffer(blob) {\n return new Promise((resolve, reject) => {\n let reader = new FileReader();\n reader.onloadend = (e) => {\n reader.onloadend = null;\n reader.onerror = null;\n resolve(reader.result);\n };\n reader.onerror = (err) => {\n reader.onloadend = null;\n reader.onerror = null;\n reject(err);\n };\n reader.readAsArrayBuffer(blob);\n });\n }\n};\n\n// src/analysis/DelayTester2.ts\nimport { SoundLoader as SoundLoader2 } from \"audio_utils\";\nvar DelayTester2 = class _DelayTester2 {\n constructor(micManager) {\n if (micManager == null) {\n throw \"You must include the MicManager in the first call to DelayTester.get()\";\n }\n this._micManager = micManager;\n }\n static get(micManager) {\n if (_DelayTester2._ref == null) {\n _DelayTester2._ref = new _DelayTester2(micManager);\n }\n return _DelayTester2._ref;\n }\n /**Tests the length of the delay between when a user makes a sound and that\n * sound is picked up. To use this test, the mic must pick up the speaker\n * sound. A single short tone will play.*/\n testDelay() {\n const frequency = 880;\n let promise = new Promise((resolve, reject) => {\n this._micManager.initMicMediaStream().then((_) => {\n let context = this._micManager.audioContext;\n let tone = this._getTestTone(\n ~~(context.sampleRate / 2),\n frequency\n );\n this._recorder = new AudioRecorder2(this._micManager);\n this._recorder.record();\n let playDelay = 0;\n tone.start(context.currentTime + playDelay);\n setTimeout(async () => {\n this._recorder.stop();\n let blob = await this._recorder.getAudioBlob();\n let buffer = await SoundLoader2.getAudioBufferFromBlob(\n blob,\n this._micManager.audioContext\n );\n let result = this._analyzeData(\n buffer,\n tone,\n playDelay,\n frequency\n );\n resolve(result);\n }, 1e3 + playDelay);\n });\n });\n return promise;\n }\n _getTestTone(numSamples, frequency) {\n let context = this._micManager.audioContext;\n let bs = context.createBuffer(1, numSamples, context.sampleRate);\n let cdata = bs.getChannelData(0);\n let sampleRate = context.sampleRate;\n for (let i = 0; i < cdata.length; i++) {\n cdata[i] = 0.8 * Math.sin(i * frequency * 2 * Math.PI / sampleRate);\n }\n let bsn = context.createBufferSource();\n bsn.buffer = bs;\n bsn.connect(context.destination);\n return bsn;\n }\n _analyzeData(recording, testTone, playDelay, frequency) {\n let info = new DelayInfo();\n var samples = recording.getChannelData(0);\n let matchingStartIdx = this._getMatchingStartIndex(samples, frequency);\n if (matchingStartIdx == null) {\n info.testSuccessful = false;\n return info;\n }\n let delay = matchingStartIdx / this._micManager.audioContext.sampleRate;\n delay -= playDelay;\n delay *= 1e3;\n delay = Math.round(delay);\n delay /= 1e3;\n info.testSuccessful = true;\n info.delay = delay;\n return info;\n }\n /**using the frequency to determine expected gaps between zero crossings,\n * verify that we have the expected number of segments and return the time\n * of the first. */\n _getMatchingStartIndex(sampleData, frequency) {\n let context = this._micManager._context;\n let targetPeriod = context.sampleRate / frequency;\n let targetInterval = targetPeriod / 2;\n console.log(targetInterval);\n let positiveStartIndexes = [];\n let posStartIdx = -1;\n for (let i = 0; i < sampleData.length; i++) {\n let val = sampleData[i];\n if (val > 0 && posStartIdx === -1) {\n posStartIdx = i;\n } else if (val < 0 && posStartIdx > -1) {\n let interval = i - 1 - posStartIdx;\n if (targetInterval - interval < 2 && interval - targetInterval < 2) {\n positiveStartIndexes.push(posStartIdx);\n }\n posStartIdx = -1;\n }\n }\n return positiveStartIndexes.length > 0 ? positiveStartIndexes[0] : null;\n }\n};\n\n// src/analysis/HitRecognizer.ts\nimport { createEmitter as createEmitter4 } from \"ts_utils\";\nvar HitRecognizer = class {\n constructor() {\n this._eventEmitter = createEmitter4();\n }\n get event() {\n return this._eventEmitter.event;\n }\n};\nvar HitType = /* @__PURE__ */ ((HitType2) => {\n HitType2[HitType2[\"rhythm_hit\"] = 0] = \"rhythm_hit\";\n HitType2[HitType2[\"rhythm_hit_start\"] = 1] = \"rhythm_hit_start\";\n HitType2[HitType2[\"rhythm_hit_end\"] = 2] = \"rhythm_hit_end\";\n HitType2[HitType2[\"beat_hit\"] = 3] = \"beat_hit\";\n return HitType2;\n})(HitType || {});\nvar HitEvent = class {\n};\n\n// src/analysis/KeyHitRecognizer.ts\nvar KeyHitRecognizer = class _KeyHitRecognizer extends HitRecognizer {\n constructor(context) {\n super();\n this._sendStartEndEvents = true;\n this._sendBeatEvents = false;\n this._beatKey = 32;\n //32 = Spacebar\n this._keyStates = /* @__PURE__ */ new Map();\n this._onKeyDown = (e) => {\n if (this._keyStates.get(e.keyCode) === true) {\n return;\n }\n this._keyStates.set(e.keyCode, true);\n let hEvent = new HitEvent();\n if (e.keyCode === this._beatKey && this._sendBeatEvents) {\n hEvent.hitType = 3 /* beat_hit */;\n } else if (this._sendStartEndEvents) {\n hEvent.hitType = 1 /* rhythm_hit_start */;\n } else {\n return;\n }\n hEvent.keycode = e.keyCode;\n hEvent.time = this._context.currentTime;\n this._eventEmitter.emit(hEvent);\n };\n this._onKeyUp = (e) => {\n this._keyStates.set(e.keyCode, false);\n if (!this._sendStartEndEvents) {\n return;\n }\n if (!this._sendBeatEvents || e.keyCode !== this._beatKey) {\n let hEvent = new HitEvent();\n hEvent.hitType = 2 /* rhythm_hit_end */;\n hEvent.keycode = e.keyCode;\n hEvent.time = this._context.currentTime;\n this._eventEmitter.emit(hEvent);\n }\n };\n if (context == null) {\n throw \"You must pass an AudioContext to KeyHitRecognizer.get() the first time you call it.\";\n }\n this._context = context;\n }\n static get(context) {\n if (_KeyHitRecognizer._ref == null) {\n _KeyHitRecognizer._ref = new _KeyHitRecognizer(context);\n }\n return _KeyHitRecognizer._ref;\n }\n startHitRec() {\n this._removeListeners();\n document.addEventListener(\"keydown\", this._onKeyDown);\n document.addEventListener(\"keyup\", this._onKeyUp);\n }\n stopHitRec() {\n this._removeListeners();\n this._keyStates = /* @__PURE__ */ new Map();\n }\n /**can be used to send a hit without a keypress, such as for a screen\n * tap.*/\n generateHit(type) {\n let hEvent = new HitEvent();\n hEvent.hitType = type;\n hEvent.time = this._context.currentTime;\n this._eventEmitter.emit(hEvent);\n }\n _removeListeners() {\n document.removeEventListener(\"keydown\", this._onKeyDown);\n document.removeEventListener(\"keyup\", this._onKeyUp);\n }\n get sendBeatEvents() {\n return this._sendBeatEvents;\n }\n set sendBeatEvents(value) {\n this._sendBeatEvents = value;\n }\n get sendStartEndEvents() {\n return this._sendStartEndEvents;\n }\n set sendStartEndEvents(value) {\n this._sendStartEndEvents = value;\n }\n get beatKey() {\n return this._beatKey;\n }\n set beatKey(value) {\n this._beatKey = value;\n }\n};\n\n// src/analysis/MicHitRecognizer.ts\nvar MicHitRecognizer = class _MicHitRecognizer extends HitRecognizer {\n constructor(micManager) {\n super();\n this._windowSize = 4096;\n this._onMicData = (data) => {\n let msTime = ~~(this._micManager.audioContext.currentTime * 1e3);\n let msLengthOfData = -~~(1e3 * (data.length / this._micSampleRate));\n if (this._recordDelay === -1) {\n this._recordDelay = msTime - this._recordTimeStamp - msLengthOfData;\n }\n let dataStartTime = msTime - this._recordTimeStamp - msLengthOfData;\n this._processAudioData(data, dataStartTime);\n };\n if (micManager == null) {\n throw \"you must provide a MicManager reference when initializing the MicHitRecognizer. Use the static getInstance() method to do this once per application session.\";\n }\n this._micManager = micManager;\n this._instDO = AssessmentInstrumentUtils.getInstrumentByID(101);\n this._micSampleRate = ~~this._micManager.audioContext.sampleRate;\n }\n static get(micManager) {\n if (_MicHitRecognizer._ref == null) {\n _MicHitRecognizer._ref = new _MicHitRecognizer(micManager);\n }\n return _MicHitRecognizer._ref;\n }\n startHitRec() {\n this._recordDelay = -1;\n this._lastHitTime = 0;\n this._currentSampleIndex = 0;\n this._samples = [];\n this._averagePeakAmpl = 0;\n this._recentPeaks = [];\n this._floorPeakAmpl = 0;\n this._numPeakReadings = 0;\n this._consecutiveQuietPeaks = 0;\n this._micManager.micData.on(this._onMicData);\n this._recordTimeStamp = ~~(this._micManager.audioContext.currentTime * 1e3);\n }\n stopHitRec() {\n this._micManager.micData.off(this._onMicData);\n }\n setInstrument(instDO) {\n this._instDO = instDO;\n }\n _processAudioData(samplesBA, timeStamp) {\n let numSamples = samplesBA.length;\n for (let i = 0; i < numSamples; i++) {\n this._samples.push(samplesBA[i]);\n }\n let startSampleIndex = this._currentSampleIndex;\n while (this._currentSampleIndex + this._windowSize <= this._samples.length) {\n let cTime = timeStamp + ~~((this._currentSampleIndex - startSampleIndex) / 44.1);\n let windowSamples = [];\n let highestAmpl = -2;\n let lowestAmpl = 2;\n for (let i = this._currentSampleIndex; i < this._currentSampleIndex + this._windowSize; i++) {\n let value = this._samples[i];\n if (value > highestAmpl) {\n highestAmpl = value;\n }\n if (value < lowestAmpl) {\n lowestAmpl = value;\n }\n windowSamples.push(this._samples[i]);\n }\n let maxPeak = lowestAmpl * -1 > highestAmpl ? lowestAmpl * -1 : highestAmpl;\n if (maxPeak < Number.MIN_VALUE) {\n maxPeak = Number.MIN_VALUE;\n }\n this._averagePeakAmpl = (this._averagePeakAmpl * this._numPeakReadings + maxPeak) / (this._numPeakReadings + 1);\n if (this._recentPeaks.length >= 10) {\n this._recentPeaks.splice(0, 1);\n }\n this._recentPeaks.push(maxPeak);\n let highestRecentPeak = this._recentPeaks[0];\n for (let i = 1; i < this._recentPeaks.length; i++) {\n if (this._recentPeaks[i] > highestRecentPeak) {\n highestRecentPeak = this._recentPeaks[i];\n }\n }\n if (this._numPeakReadings < 20) {\n this._floorPeakAmpl = (this._floorPeakAmpl * this._numPeakReadings + highestRecentPeak) / (this._numPeakReadings + 1);\n } else if (highestRecentPeak < this._floorPeakAmpl) {\n this._floorPeakAmpl = (this._floorPeakAmpl * 19 + highestRecentPeak) / 20;\n }\n this._numPeakReadings++;\n if (\n /*highestAmpl > 0.05 &&*/\n cTime - this._lastHitTime > this._instDO.minTimeBetweenClaps\n ) {\n let amplSlopeScore = this._detectHitByAmplSlope(\n windowSamples,\n highestAmpl,\n lowestAmpl\n );\n let peakFloorScore = this._numPeakReadings > 20 ? maxPeak / this._floorPeakAmpl : 0;\n if (peakFloorScore >= this._instDO.minAmplRatioToFloor && this._consecutiveQuietPeaks >= this._instDO.minConsecutiveQuietPeaks && amplSlopeScore >= this._instDO.minAmplSlopeScore) {\n this._consecutiveQuietPeaks = 0;\n this._lastHitTime = cTime;\n let hEvent = new HitEvent();\n hEvent.hitType = 0 /* rhythm_hit */;\n hEvent.time = timeStamp / 1e3;\n this._eventEmitter.emit(hEvent);\n } else if (peakFloorScore < this._instDO.minAmplRatioToFloor) {\n this._consecutiveQuietPeaks++;\n }\n }\n this._currentSampleIndex += ~~(this._windowSize / 2);\n }\n }\n _detectHitByAmplSlope(samplesList, highestAmpl, lowestAmpl) {\n let bestJumpRatio = this._recentPeaks.length > 1 ? this._recentPeaks[this._recentPeaks.length - 1] / this._recentPeaks[this._recentPeaks.length - 2] : 0;\n let score = bestJumpRatio;\n return score;\n }\n _detectHitByJerkiness(samplesList, highestAmpl, lowestAmpl) {\n let numSamples = samplesList.length;\n let prevAmpl;\n let cAmpl = samplesList[0];\n let nextAmpl = samplesList[1];\n let biggestJerk = 0;\n for (let i = 1; i < numSamples - 1; i++) {\n prevAmpl = cAmpl;\n cAmpl = nextAmpl;\n nextAmpl = samplesList[i + 1];\n let midPointAmpl = (prevAmpl + nextAmpl) / 2;\n if (midPointAmpl - cAmpl > 0.01 || cAmpl - midPointAmpl > 0.01) {\n if (midPointAmpl - cAmpl > biggestJerk) {\n biggestJerk = midPointAmpl - cAmpl;\n } else if (cAmpl - midPointAmpl > biggestJerk) {\n biggestJerk = cAmpl - midPointAmpl;\n }\n }\n }\n let score = ~~(100 * biggestJerk);\n if (score > 10) {\n score = 10;\n }\n return score;\n }\n};\n\n// src/analysis/PitchRecognizer.ts\nimport { createEmitter as createEmitter5 } from \"ts_utils\";\nvar PitchRecognizer = class {\n constructor(micManager) {\n this._isRunning = false;\n this._eventEmitter = createEmitter5();\n this._onMicData = (data) => {\n let time = this._micManager.audioContext.currentTime;\n let durOfData = data.length / this._micSampleRate;\n if (this._recordDelay === -1) {\n this._recordDelay = time - this._recordTimeStamp - durOfData;\n }\n this._processData(Array.from(data), time - durOfData);\n };\n this._micManager = micManager;\n this._init();\n }\n //in seconds\n get pitchRecMethod() {\n return this._pitchRecMethod;\n }\n /**[true] when pitch rec is running*/\n get isRunning() {\n return this._isRunning;\n }\n get pitchRecEvent() {\n return this._eventEmitter.event;\n }\n _init() {\n this.setInstrument(AssessmentInstrumentUtils.getInstrumentByID(3));\n this._micSampleRate = ~~this._micManager.audioContext.sampleRate;\n }\n /**\n * start pitch rec. \n * set startMicCapture to true if you aren't planning to use the mic data \n * elsewhere (for recording, etc.). If you need to keep the recorded data, \n * you should call MicManager.startCapture() separately and set \n * startMicCapture to false here.\n */\n startPRec(startMicCapture) {\n this._prEvents = [];\n this._leftOverMicData = [];\n this._recordDelay = -1;\n this._recordTimeStamp = this._micManager.audioContext.currentTime;\n this._micManager.micData.on(this._onMicData);\n if (startMicCapture) {\n this._micManager.startCapture();\n }\n this._isRunning = true;\n }\n stopPRec(stopMicCapture) {\n this._micManager.micData.off(this._onMicData);\n if (stopMicCapture) {\n this._micManager.stopCapture();\n }\n this._isRunning = false;\n }\n setInstrument(instDO) {\n this._minFreq = instDO.minFreq;\n this._maxFreq = instDO.maxFreq;\n this._windowWidth = instDO.windowWidth;\n this._resampleDivisor = 1;\n if (instDO.sampleRate != null) {\n let sampleRate = instDO.sampleRate;\n while (sampleRate <= this._micSampleRate / 2) {\n this._resampleDivisor *= 2;\n sampleRate *= 2;\n }\n }\n this._quality = instDO.pRecQuality;\n this._pitchRecMethod = instDO.pRecMethod;\n this._overSampTimes = instDO.overSampTimes;\n }\n _processData(data, timeStamp) {\n if (this._leftOverMicData.length > 0) {\n this._leftOverMicData.push(...data);\n data = this._leftOverMicData;\n }\n let pitchesToRead = ~~(data.length / (this._windowWidth * this._resampleDivisor));\n let secondsPerPitch = this._windowWidth / this._micSampleRate;\n let secondsPerOverSampIteration = secondsPerPitch / this._overSampTimes;\n let dataPos = 0;\n for (let i = 0; i < pitchesToRead; i++) {\n let overSampIteration = 0;\n while (overSampIteration < this._overSampTimes && i < pitchesToRead - 1 || i === pitchesToRead - 1 && overSampIteration === 0) {\n let curData = new Array(this._windowWidth);\n let sum = 0;\n let value;\n let peakAmpl = 0;\n for (let j = 0; j < this._windowWidth; j++) {\n value = data[dataPos];\n sum += value * value;\n if (value > peakAmpl) {\n peakAmpl = value;\n }\n curData[j] = value;\n dataPos += this._resampleDivisor;\n }\n let rms = Math.sqrt(sum / this._windowWidth);\n let adjustedStartTime = timeStamp + i * secondsPerPitch + overSampIteration * secondsPerOverSampIteration;\n let frequency;\n switch (this._pitchRecMethod) {\n case 1:\n frequency = this._autoCorrelateProductDifferenceMethod(\n curData,\n peakAmpl\n );\n break;\n default:\n console.log(\"unsupported method! PitchRecognizer.processData()\");\n }\n if (frequency > 0) {\n this._notifyOfPitch(\n frequency,\n adjustedStartTime,\n rms,\n peakAmpl\n );\n }\n overSampIteration++;\n dataPos = overSampIteration * ~~(this._windowWidth / this._overSampTimes);\n }\n }\n }\n /**method 1\n * product peak and subtraction average sum method*/\n _autoCorrelateProductDifferenceMethod(samplesVector, peakAmpl) {\n let validIValues = this._getValidIntervals(samplesVector);\n if (validIValues.length === 0)\n return 0;\n let bestSinglePeriodInterval = this._findPeriodViaProductSums(samplesVector, validIValues);\n let bestMultiPeriodInterval = this._findAveragePeriodViaAverageDifferenceSums(\n samplesVector,\n bestSinglePeriodInterval\n );\n this._correlationScore = this._getCorrelationScore(\n samplesVector,\n Math.round(bestMultiPeriodInterval),\n peakAmpl\n );\n return this._micSampleRate / this._resampleDivisor / bestMultiPeriodInterval;\n }\n _getValidIntervals(samplesVector) {\n let length = samplesVector.length;\n let validIValues = [];\n let firstPeakIndex = -1;\n let readyForPeak = false;\n let lastValue = samplesVector[0];\n for (let i = 0; i < length; i++) {\n if (samplesVector[i] <= lastValue && readyForPeak) {\n if (firstPeakIndex !== -1) {\n let distance = i - firstPeakIndex;\n let frequencyToCheck = 44100 / distance;\n if (frequencyToCheck >= this._minFreq && frequencyToCheck <= this._maxFreq) {\n validIValues.push(i - firstPeakIndex);\n } else if (frequencyToCheck < this._minFreq) {\n break;\n }\n } else {\n firstPeakIndex = i;\n }\n readyForPeak = false;\n } else if (samplesVector[i] > lastValue) {\n readyForPeak = true;\n }\n lastValue = samplesVector[i];\n }\n return validIValues;\n }\n _findPeriodViaProductSums(samplesVector, validIValues) {\n let length = samplesVector.length;\n let sum;\n let greatestSum = -10;\n let greatestSumsInterval = -1;\n let quality = this._quality;\n for (let interval of validIValues) {\n sum = 0;\n for (let j = 0; j < length - interval; j += quality) {\n sum += samplesVector[j] * samplesVector[j + interval];\n }\n if (sum >= greatestSum) {\n greatestSum = sum;\n greatestSumsInterval = interval;\n }\n }\n return greatestSumsInterval;\n }\n _findAveragePeriodViaAverageDifferenceSums(samplesVector, bestSinglePeriodInterval) {\n let length = samplesVector.length;\n let minBufferSamples = 10;\n let totalPeriods = ~~(length / bestSinglePeriodInterval);\n totalPeriods = length % bestSinglePeriodInterval < minBufferSamples && totalPeriods > 1 ? totalPeriods - 1 : totalPeriods;\n let startingPoint = totalPeriods * bestSinglePeriodInterval;\n let bestAverage = -1;\n let bestIntervalIndex = startingPoint;\n let improvedCorrelation = false;\n let sum;\n let minIValueToCheck = startingPoint - minBufferSamples >= 0 ? startingPoint - minBufferSamples : 0;\n let currentAverage;\n for (let i = startingPoint; i > minIValueToCheck; i--) {\n sum = 0;\n for (let j = 0; j < length - i; j += 1) {\n sum += Math.abs(samplesVector[j] - samplesVector[j + i]);\n }\n currentAverage = sum / (length - i);\n if (currentAverage < bestAverage || i === startingPoint) {\n bestAverage = currentAverage;\n bestIntervalIndex = i;\n improvedCorrelation = i !== startingPoint ? true : false;\n } else {\n break;\n }\n }\n if (improvedCorrelation === false) {\n let maxIValue = startingPoint + minBufferSamples <= length ? startingPoint + minBufferSamples : length;\n for (let i = startingPoint; i < maxIValue; i++) {\n sum = 0;\n for (let j = 0; j < length - i; j += 1) {\n sum += Math.abs(samplesVector[j] - samplesVector[j + i]);\n }\n currentAverage = sum / (length - i);\n if (currentAverage < bestAverage || i === startingPoint) {\n bestAverage = currentAverage;\n bestIntervalIndex = i;\n } else {\n break;\n }\n }\n }\n return bestIntervalIndex / totalPeriods;\n }\n _getCorrelationScore(samplesVector, interval, peakAmpl) {\n if (peakAmpl <= 0)\n return 0;\n let length = samplesVector.length;\n let p1;\n let p2;\n let sum = 0;\n for (let i = 0; i < length - interval; i++) {\n p1 = samplesVector[i];\n p2 = samplesVector[i + interval];\n if (p1 >= p2)\n sum += p1 - p2;\n else\n sum += p2 - p1;\n }\n sum *= 1 / peakAmpl;\n let average = sum / (length - interval);\n let score = 1 - average;\n return score;\n }\n _notifyOfPitch(frequency, time, rms, peakAmpl) {\n let ev = new PitchRecEvent();\n ev.frequency = frequency;\n let midiUnrounded = 69 + 17.3123404907 * Math.log(frequency / 440);\n let roundedCents = 100 * Math.round(midiUnrounded);\n ev.cents = roundedCents;\n ev.pitchName = PitchUtils.getCommonPitchNameFromCents(roundedCents);\n ev.time = time;\n let tuningDelta = Math.round(midiUnrounded * 100) % 100;\n if (tuningDelta >= 50) {\n tuningDelta -= 100;\n }\n ev.tuning = tuningDelta;\n ev.correlationScore = this._correlationScore;\n ev.rms = rms;\n ev.peakAmpl = peakAmpl;\n this._prEvents.push(ev);\n this._eventEmitter.emit(ev);\n }\n};\nvar PitchRecEvent = class {\n constructor() {\n this.pitchSplit = false;\n this.amplSplit = false;\n }\n};\nPitchRecEvent.totalEvents = 0;\nvar _PitchUtils = class _PitchUtils {\n static getCommonPitchNameFromCents(cents) {\n let letter = cents >= 0 ? _PitchUtils.centPitchNames[cents / 100 % 12 * 100] : _PitchUtils.centPitchNames[(cents / 100 % 12 + 12) * 100];\n letter += (~~(cents / 1200) - 1).toString();\n return letter;\n }\n};\n_PitchUtils.centPitchNames = {\n 0: \"C\",\n 100: \"C#\",\n 200: \"D\",\n 300: \"Eb\",\n 400: \"E\",\n 500: \"F\",\n 600: \"F#\",\n 700: \"G\",\n 800: \"Ab\",\n 900: \"A\",\n 1e3: \"Bb\",\n 1100: \"B\"\n};\nvar PitchUtils = _PitchUtils;\n\n// src/analysis/PitchRecognizer2.ts\nimport { createEmitter as createEmitter6 } from \"ts_utils\";\n\n// src/analysis/YinDetector.ts\nvar YinDetector = class {\n constructor() {\n this.threshold = 0.1;\n this.sampleRate = 44100;\n this.probabilityThreshold = 0.1;\n this.quality = 1;\n }\n getFrequency(samples) {\n let minInterval = Math.ceil(this.sampleRate / this.maxFreq) - 3;\n let maxInterval = Math.floor(this.sampleRate / this.minFreq);\n let bufferSize = 2 * maxInterval;\n if (bufferSize > samples.length) {\n return null;\n }\n while (bufferSize + maxInterval < samples.length) {\n bufferSize += maxInterval;\n }\n let yinBufferLength = maxInterval - minInterval + 1;\n let yinBuffer = new Array(yinBufferLength).fill(0);\n let probability = 0;\n let tau;\n for (let t = minInterval; t <= maxInterval; t++) {\n for (let i = 0; i < bufferSize - maxInterval; i += this.quality) {\n let delta = samples[i] - samples[i + t];\n yinBuffer[t - minInterval] += delta * delta;\n }\n }\n yinBuffer[0] = 1;\n yinBuffer[1] = 1;\n let runningSum = 0;\n for (let t = 1; t < yinBufferLength; t++) {\n runningSum += yinBuffer[t];\n yinBuffer[t] *= t / runningSum;\n }\n for (tau = 2; tau < yinBufferLength; tau++) {\n if (yinBuffer[tau] < this.threshold) {\n while (tau + 1 < yinBufferLength && yinBuffer[tau + 1] < yinBuffer[tau]) {\n tau++;\n }\n probability = 1 - yinBuffer[tau];\n break;\n }\n }\n if (tau === yinBufferLength || yinBuffer[tau] >= this.threshold) {\n return null;\n }\n if (probability < this.probabilityThreshold) {\n return null;\n }\n if (tau <= 2) {\n return null;\n }\n let betterTau;\n let x0;\n let x2;\n if (tau < 1) {\n x0 = tau;\n } else {\n x0 = tau - 1;\n }\n if (tau + 1 < yinBufferLength) {\n x2 = tau + 1;\n } else {\n x2 = tau;\n }\n if (x0 === tau) {\n if (yinBuffer[tau] <= yinBuffer[x2]) {\n betterTau = tau;\n } else {\n betterTau = x2;\n }\n } else if (x2 === tau) {\n if (yinBuffer[tau] <= yinBuffer[x0]) {\n betterTau = tau;\n } else {\n betterTau = x0;\n }\n } else {\n let s0 = yinBuffer[x0];\n let s1 = yinBuffer[tau];\n let s2 = yinBuffer[x2];\n betterTau = tau + (s2 - s0) / (2 * (2 * s1 - s2 - s0));\n }\n let result = new YinResult();\n result.frequency = this.sampleRate / (minInterval + betterTau);\n result.probability = probability;\n return result;\n }\n};\nvar YinResult = class {\n};\n\n// src/analysis/PitchRecognizer2.ts\nvar PitchRecognizer2 = class {\n constructor(micManager) {\n /** the number of ms between readings*/\n this._msReadingInterval = 250;\n /** the minimum time period, in ms, that a reading should extend over*/\n this._msAnalysisDuration = 10;\n this._isRunning = false;\n this._eventEmitter = createEmitter6();\n this._onMicData = (data) => {\n this._samples.push(...data);\n let time = this._micManager.audioContext.currentTime;\n let durOfData = data.length / this._micSampleRate;\n if (this._recordDelay == -1) {\n this._recordDelay = time - this._recordTimeStamp - durOfData;\n }\n this._processData(time - durOfData);\n };\n this._micManager = micManager;\n this._init();\n }\n /**[true] when pitch rec is running*/\n get isRunning() {\n return this._isRunning;\n }\n get pitchRecEvent() {\n return this._eventEmitter.event;\n }\n _init() {\n this._yin = new YinDetector();\n this._micSampleRate = ~~this._micManager.audioContext.sampleRate;\n this._yin.sampleRate = this._micSampleRate;\n this.setInstrument(AssessmentInstrumentUtils.getInstrumentByID(3));\n }\n /** start pitch rec. */\n startPRec(startMicCapture, msReadingInterval = 250, msAnalysisDuration = 10) {\n this._msReadingInterval = msReadingInterval;\n this._msAnalysisDuration = msAnalysisDuration;\n this._prEvents = [];\n this._samples = [];\n this._currentStartPos = 0;\n this._recordDelay = -1;\n this._recordTimeStamp = this._micManager.audioContext.currentTime;\n this._micManager.micData.on(this._onMicData);\n if (startMicCapture) {\n this._micManager.startCapture();\n }\n this._isRunning = true;\n }\n stopPRec(stopMicCapture) {\n this._micManager.micData.off(this._onMicData);\n if (stopMicCapture) {\n this._micManager.stopCapture();\n }\n this._isRunning = false;\n }\n setInstrument(instDO) {\n this._minFreq = instDO.minFreq;\n this._maxFreq = instDO.maxFreq;\n this._yin.minFreq = this._minFreq;\n this._yin.maxFreq = this._maxFreq;\n this._yin.quality = instDO.yinQuality;\n }\n _processData(timeStamp) {\n let cTime = timeStamp;\n let maxPeriodSampleLength = Math.ceil(this._micSampleRate / this._minFreq);\n let analysisSampleDuration = Math.ceil(this._msAnalysisDuration / 1e3 * this._micSampleRate);\n if (analysisSampleDuration <= maxPeriodSampleLength) {\n analysisSampleDuration = 2 * maxPeriodSampleLength;\n } else {\n analysisSampleDuration = Math.ceil(analysisSampleDuration / maxPeriodSampleLength) * maxPeriodSampleLength;\n }\n while (this._samples.length - this._currentStartPos > analysisSampleDuration) {\n let startIndex = this._currentStartPos;\n let endIndex = startIndex + analysisSampleDuration;\n this._stats = this._calculateStats(startIndex, endIndex);\n this._stats.startTime = cTime;\n let samples = this._samples.slice(startIndex, endIndex + 1);\n let result = this._yin.getFrequency(samples);\n this._stats.frequency = result?.frequency ?? 0;\n this._stats.correlationScore = result?.probability ?? 0;\n if (this._stats.frequency > 0) {\n this._notifyOfPitch(this._stats);\n }\n cTime += this._msReadingInterval / 1e3;\n this._currentStartPos += Math.floor(\n this._msReadingInterval / 1e3 * this._micSampleRate\n );\n }\n if (this._currentStartPos > 0) {\n let end = Math.min(\n this._currentStartPos - 1,\n this._samples.length - 1\n );\n this._samples.splice(0, end);\n this._currentStartPos = 0;\n }\n }\n _calculateStats(startIndex, endIndex) {\n let sum = 0;\n let value;\n let peakAmpl = 0;\n for (let i = startIndex; i <= endIndex; i++) {\n value = this._samples[i];\n sum += value * value;\n if (value > peakAmpl) {\n peakAmpl = value;\n }\n }\n let stats = new _AnalysisStats();\n stats.peakAmpl = peakAmpl;\n stats.rms = Math.sqrt(sum / (endIndex - startIndex + 1));\n return stats;\n }\n _notifyOfPitch(stats) {\n let ev = new PitchRecEvent();\n ev.frequency = stats.frequency;\n let midiUnrounded = 69 + 17.3123404907 * Math.log(stats.frequency / 440);\n let roundedCents = 100 * Math.round(midiUnrounded);\n ev.cents = roundedCents;\n ev.pitchName = PitchUtils.getCommonPitchNameFromCents(roundedCents);\n ev.time = stats.startTime;\n let tuningDelta = Math.round(midiUnrounded * 100) % 100;\n if (tuningDelta >= 50) {\n tuningDelta -= 100;\n }\n ev.tuning = tuningDelta;\n ev.correlationScore = this._stats.correlationScore;\n ev.rms = stats.rms;\n ev.peakAmpl = stats.peakAmpl;\n this._prEvents.push(ev);\n this._eventEmitter.emit(ev);\n }\n /**Gets the most recent peak amplitude level or 0 if there have been no\n * readings*/\n get peakAmplitude() {\n return this._stats?.peakAmpl ?? 0;\n }\n};\nvar _AnalysisStats = class {\n};\n\n// src/analysis/TuningProvider.ts\nvar _TuningProvider = class _TuningProvider {\n constructor(micManager) {\n this._isActive = false;\n this._isSilent = true;\n this._minAmplitude = 0.05;\n this._onPitchRec = (e) => {\n this._history.push(e);\n if (this._history.length > _TuningProvider.maxHistoryLength) {\n this._history.splice(0, 1);\n }\n if (e.peakAmpl < this._minAmplitude) {\n this._isSilent = true;\n return;\n }\n let numMatches = 0;\n let tuningSum = 0;\n for (let pre of this._history) {\n if (pre.cents == e.cents) {\n numMatches++;\n tuningSum += pre.tuning;\n }\n }\n if (numMatches >= _TuningProvider.minHistoryMatches) {\n let avgTuning = tuningSum / numMatches;\n this._lastPitchName = e.pitchName;\n this._lastCents = e.cents;\n this._lastTuning = Math.round(avgTuning);\n this._lastPitchMsTime = Math.floor(performance.now());\n }\n };\n this._pitchRecognizer = new PitchRecognizer2(micManager);\n this.setInstrument(3);\n }\n /**true if the tuner is currently listening for pitch results*/\n get isActive() {\n return this._isActive;\n }\n /**gets the cents, rounded to the nearest 100, of the most recent solid\n * reading. Will be null if no readings have occurred.*/\n get lastCents() {\n return this._lastCents;\n }\n /**gets the offset in cents, -50 to 50, of the most recent solid reading.\n * Will be null if no readings have occurred.*/\n get lastTuning() {\n return this._lastTuning;\n }\n /**gets the pitch name, with no number, of the most recent solid reading.\n * Will be null if no readings have occurred.*/\n get lastPitchName() {\n return this._lastPitchName;\n }\n /**gets the time, in seconds, since the last reported pitch reading. Can\n * be used to determine when to stop displaying pitch.*/\n get timeSinceLastPitch() {\n return (window.performance.now() - this._lastPitchMsTime) / 1e3;\n }\n /**returns true if the most recent reading registered below the \n * [minAmplutide] level*/\n get isSilent() {\n return this._isSilent;\n }\n /**a value from 0 to 1.0 that sets the minimum microphone level that must\n * be met for tuning readings to be reported.*/\n get minAmplitude() {\n return this._minAmplitude;\n }\n set minAmplitude(value) {\n this._minAmplitude = value;\n }\n /**Gets the most recent peak amplitude level or 0 if there have been no\n * readings*/\n get peakAmplitude() {\n return this._pitchRecognizer.peakAmplitude;\n }\n start() {\n this._history = [];\n this._lastPitchMsTime = 0;\n this._pitchRecognizer.pitchRecEvent.on(this._onPitchRec);\n if (!this._pitchRecognizer.isRunning) {\n this._pitchRecognizer.startPRec(false);\n }\n this._isActive = true;\n }\n stop() {\n this._pitchRecognizer.pitchRecEvent.off(this._onPitchRec);\n this._isActive = false;\n }\n setInstrument(instrumentId) {\n let inst = AssessmentInstrumentUtils.getInstrumentByID(instrumentId);\n if (inst == null) {\n throw \"InstrumentDO.id doesn't match an assessment inst\";\n }\n this._pitchRecognizer.setInstrument(inst);\n }\n};\n_TuningProvider.maxHistoryLength = 10;\n_TuningProvider.minHistoryMatches = 5;\nvar TuningProvider = _TuningProvider;\n\n// src/audio_worklets/PRec2Node.ts\nimport { createEmitter as createEmitter7 } from \"ts_utils\";\nvar _PRec2Node = class _PRec2Node extends AudioWorkletNode {\n constructor() {\n super(MicManager.get().audioContext, \"prec2-worklet\");\n this._pitchRecEmitter = createEmitter7();\n this._onProcessorMessage = (ev) => {\n this._pitchRecEmitter.emit(ev.data);\n };\n if (!_PRec2Node.workletRegistered) {\n throw \"call registerWorklet() before instantiating\";\n }\n this._init();\n }\n get instrument() {\n return this._instrument;\n }\n get pitchRec() {\n return this._pitchRecEmitter.event;\n }\n static async registerWorklet(context) {\n if (_PRec2Node.workletRegistered) {\n return true;\n }\n try {\n let blob = new Blob([pRec2Worklet], { type: \"text/javascript\" });\n let url = window.URL.createObjectURL(blob);\n await context.audioWorklet.addModule(url);\n _PRec2Node.workletRegistered = true;\n return true;\n } catch (err) {\n console.log(err);\n return false;\n }\n }\n resetPRec(msReadingInterval = 250, msAnalysisDuration = 10) {\n this.port.postMessage({\n type: \"reset\",\n msReadingInterval,\n msAnalysisDuration\n });\n }\n setInstrument(instDO) {\n this._instrument = instDO;\n this.port.postMessage({\n type: \"setInstrument\",\n minFreq: instDO.minFreq,\n maxFreq: instDO.maxFreq,\n yinQuality: instDO.yinQuality\n });\n }\n _init() {\n this.port.onmessage = this._onProcessorMessage;\n }\n};\n_PRec2Node.workletRegistered = false;\nvar PRec2Node = _PRec2Node;\nvar pRec2Worklet = `\nclass PRec2Processor extends AudioWorkletProcessor {\n\t_minFreq;\n\t_maxFreq;\n\t\n\t_msReadingInterval = 250;\n\t_msAnalysisDuration = 10;\n\t\n\t_samples = [];\n\t_currentStartPos = 0;\n\t\n\t_lastLowPeakTime = 0;\n\t_lastPeak = 0;\n\t\n\t_yin;\n\t\n\t_centPitchNames = { 0:'C', 100:'C#', 200:'D', 300:'Eb', 400:'E', 500:'F',\n\t\t600:'F#', 700:'G', 800:'Ab', 900:'A', 1000:'Bb', 1100:'B' };\n\t\n\tconstructor(){\n\t\tsuper();\n\t\tthis._yin = new YinDetector();\n\t\tthis._yin.sampleRate = sampleRate;\n\t\tthis.port.onmessage = this._handleMessage;\n\t}\n\t\n\t_handleMessage = (ev) => {\n\t\tswitch(ev.data.type){\n\t\t\tcase \"reset\": {\n\t\t\t\tthis._msReadingInterval = ev.data.msReadingInterval;\n\t\t\t\tthis._msAnalysisDuration = ev.data.msAnalysisDuration;\n\t\t\t\tthis._samples = [];\n\t\t\t\tthis._currentStartPos = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tcase \"setInstrument\": {\n\t\t\t\tthis._minFreq = ev.data.minFreq;\n\t\t\t\tthis._maxFreq = ev.data.maxFreq;\n\t\t\t\tthis._yin.minFreq = ev.data.minFreq;\n\t\t\t\tthis._yin.maxFreq = ev.data.maxFreq;\n\t\t\t\tthis._yin.quality = ev.data.yinQuality;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdefault: {\n\t\t\t\tthrow 'unsupported message type';\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprocess(inputs, outputs){\n\t\tlet data = inputs[0][0];\n\t\tif (data == null){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tthis._samples.push(...data);\n\t\t\n\t\tlet time = currentTime;\n\t\tlet durOfData = data.length / sampleRate;\n\t\t\n\t\tthis._processData(time - durOfData);\n\t\t\n\t\treturn true;\n\t}\n\t\n\t_processData(timeStamp) {\n\t\tlet cTime = timeStamp;\n\t\t\n\t\t//the duration, samples, of the longest possible single period for this\n\t\t//instrument.\n\t\tlet maxPeriodSampleLength = Math.ceil(sampleRate / this._minFreq);\n\t\t//the target duration, in samples, of each chunk of data we'd like to \n\t\t//analyze.\n\t\tlet analysisSampleDuration = Math.ceil(this._msAnalysisDuration / 1000 * \n\t\t\tsampleRate);\n\t\t//We'll increase the duration so that it's evenly divisible by\n\t\t//our maxPeriodSampleLength and ensure that we have at least 2 periods\n\t\t//worth of data to analyze\n\t\tif (analysisSampleDuration <= maxPeriodSampleLength){\n\t\t\tanalysisSampleDuration = 2 * maxPeriodSampleLength;\n\t\t}\n\t\telse {\n\t\t\tanalysisSampleDuration = Math.ceil(analysisSampleDuration / \n\t\t\t\tmaxPeriodSampleLength) * maxPeriodSampleLength;\n\t\t}\n\t\t\n\t\t// console.log(this._samples.length, this._currentStartPos,\n\t\t// \tanalysisSampleDuration);\n\t\t\n\t\twhile ((this._samples.length - this._currentStartPos) > \n\t\t\t\tanalysisSampleDuration){\n\t\t\t// let startTime = html.window.performance.now();\n\t\t\t\n\t\t\tlet startIndex = this._currentStartPos;\n\t\t\tlet endIndex = startIndex + analysisSampleDuration;\n\t\t\t\n\t\t\tthis._stats = this._calculateStats(startIndex, endIndex, cTime);\n\t\t\tthis._stats.startTime = cTime;\n\t\t\t\n\t\t\tlet samples = this._samples.slice(startIndex, endIndex + 1);\n\t\t\tlet result = this._yin.getFrequency(samples);\n\t\t\tif (result != null){\n\t\t\t\tthis._stats.frequency = result.frequency;\n\t\t\t\tthis._stats.correlationScore = result.probability;\n\t\t\t\tthis._stats.hasPitch = true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis._stats.frequency = 0;\n\t\t\t\tthis._stats.correlationScore = 0;\n\t\t\t\tthis._stats.hasPitch = false;\n\t\t\t}\n\t\t\t\n\t\t\tthis._notifyOfPitch(this._stats);\n\t\t\t\n\t\t\t\n\t\t\tcTime += this._msReadingInterval / 1000;\n\t\t\tthis._currentStartPos += Math.floor(\n\t\t\t\t(this._msReadingInterval / 1000) * sampleRate);\n\t\t\t\n\t\t\t// print(html.window.performance.now() - startTime);\n\t\t}\n\t\t\n\t\tif (this._currentStartPos > 0){\n\t\t\tlet end = Math.min(this._currentStartPos - 1,\n\t\t\t\tthis._samples.length - 1);\n\t\t\tthis._samples.splice(0, end);\n\t\t\t// this._samples.removeRange(0, end); //dart version\n\t\t\tthis._currentStartPos = 0;\n\t\t}\n\t}\n\t\n\t_calculateStats(startIndex, endIndex, cTime) {\n\t\tlet sum = 0;\n\t\tlet value;\n\t\tlet peakAmpl = this._samples[startIndex];\n\t\tlet lastValue = this._samples[startIndex];\n\t\tlet peakIndex = startIndex;\n\t\tlet numDescending = 0;\n\t\tfor (let i = startIndex; i <= endIndex; i++) {\n\t\t\tvalue = this._samples[i];\n\t\t\tsum += value * value;\n\t\t\tif (value < lastValue){\n\t\t\t\tnumDescending++;\n\t\t\t\tif (numDescending === 1 && value > 0){\n\t\t\t\t\tif (lastValue > peakAmpl){\n\t\t\t\t\t\tpeakAmpl = lastValue;\n\t\t\t\t\t\tpeakIndex = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (lastValue < this._lastPeak){\n\t\t\t\t\t\tthis._lastLowPeakTime = cTime + ((i - 1) / sampleRate);\n\t\t\t\t\t}\n\t\t\t\t\tthis._lastPeak = lastValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnumDescending = 0;\n\t\t\t}\n\t\t\tlastValue = value;\n\t\t}\n\t\t\n\t\tlet stats = new _AnalysisStats();\n\t\tstats.peakAmpl = peakAmpl;\n\t\tstats.rms = Math.sqrt(sum / (endIndex - startIndex + 1));\n\t\treturn stats;\n\t}\n\t\n\t_notifyOfPitch(stats){\n\t\tlet ev = {};\n\t\tev.frequency = stats.frequency;\n\t\t\n\t\tlet midiUnrounded = 69 + 17.3123404907 * \n\t\t\tMath.log(stats.frequency / 440);\n\t\tlet roundedCents = 100 * Math.round(midiUnrounded);\n\t\tev.cents = roundedCents;\n\t\tev.pitchName = this._getCommonPitchNameFromCents(roundedCents);\n\t\tev.time = stats.startTime;\n\t\t//compute the tuning (distance from 100 cent multiple - ex. 23, -44,\n\t\t//etc.\n\t\tlet tuningDelta = Math.round(midiUnrounded * 100) % 100;\n\t\tif (tuningDelta >= 50) {\n\t\t\ttuningDelta -= 100;\n\t\t}\n\t\tev.tuning = tuningDelta;\n\t\tev.correlationScore = this._stats.correlationScore;\n\t\tev.hasPitch = this._stats.hasPitch;\n\t\tev.rms = stats.rms;\n\t\tev.peakAmpl = stats.peakAmpl;\n\t\tev.lastLowPeakTime = this._lastLowPeakTime;\n\t\t\n\t\tthis.port.postMessage(ev);\n\t}\n\t\n\t_getCommonPitchNameFromCents(cents) {\n\t\t//we really mean Dart's %12... -100 is a B, so -1%12 == 11\n\t\tlet letter = (cents >= 0)\n\t\t\t? this._centPitchNames[(cents / 100) % 12 * 100]\n\t\t\t: this._centPitchNames[((cents / 100) % 12 + 12) * 100]\n\t\tletter += (~~(cents / 1200) - 1).toString();\n\t\treturn letter;\n\t}\n}\n\nclass _AnalysisStats {\n\trms;\n\tpeakAmpl;\n\tstartTime;\n\tfrequency;\n\tcorrelationScore;\n\thasPitch;\n}\n\n\nclass YinDetector {\n\tthreshold = 0.1;\n\tsampleRate = 44100;\n\tprobabilityThreshold = 0.1;\n \n\tminFreq;\n\tmaxFreq;\n\tquality = 1;\n\n\tconstructor() {}\n\t\n\tgetFrequency(samples) {\n\t\t//start with the shortest possible period (the highest frequency)\n\t\tlet minInterval = Math.ceil(this.sampleRate / this.maxFreq) - 3;\n\t\tlet maxInterval = Math.floor(this.sampleRate / this.minFreq);\n\t\n\t\t// Set buffer size to the highest multiple of maxInterval below samples\n\t\t// length\n\t\tlet bufferSize = 2 * maxInterval;\n\t\tif (bufferSize > samples.length){\n\t\t\t//not enough samples to analyze\n\t\t\treturn null;\n\t\t}\n\t\twhile (bufferSize + maxInterval < samples.length){\n\t\t\tbufferSize += maxInterval;\n\t\t}\n\n\t\t// Set up the yinBuffer as described in step one of the YIN paper.\n\t\tlet yinBufferLength = maxInterval - minInterval + 1;\n\t\tlet yinBuffer = new Array(yinBufferLength).fill(0.0);\n\n\t\tlet probability = 0;\n\t\tlet tau;\n\n\t\t// Compute the difference function as described in step 2 of the YIN\n\t\t//paper.\n\t\tfor (let t = minInterval; t <= maxInterval; t++) {\n\t\t\tfor (let i = 0; i < bufferSize - maxInterval; i += this.quality) {\n\t\t\t\tlet delta = samples[i] - samples[i + t];\n\t\t\t\tyinBuffer[t - minInterval] += delta * delta;\n\t\t\t}\n\t\t}\n\n\t\t// Compute the cumulative mean normalized difference as described in\n\t\t//step 3 of the paper.\n\t\tyinBuffer[0] = 1;\n\t\tyinBuffer[1] = 1;\n\t\tlet runningSum = 0;\n\t\tfor (let t = 1; t < yinBufferLength; t++) {\n\t\t\trunningSum += yinBuffer[t];\n\t\t\tyinBuffer[t] *= t / runningSum;\n\t\t}\n\n\t\t// Compute the absolute threshold as described in step 4 of the paper.\n\t\t// Since the first two positions in the array are 1,\n\t\t// we can start at the third position.\n\t\tfor (tau = 2; tau < yinBufferLength; tau++) {\n\t\t\tif (yinBuffer[tau] < this.threshold) {\n\t\t\t\twhile (tau + 1 < yinBufferLength && \n\t\t\t\t\t\tyinBuffer[tau + 1] < yinBuffer[tau]) {\n\t\t\t\t\ttau++;\n\t\t\t\t}\n\t\t\t\t// found tau, exit loop and return\n\t\t\t\t// store the probability\n\t\t\t\t// From the YIN paper: The threshold determines the list of\n\t\t\t\t// candidates admitted to the set, and can be interpreted as the\n\t\t\t\t// proportion of aperiodic power tolerated\n\t\t\t\t// within a periodic signal.\n\t\t\t\t//\n\t\t\t\t// Since we want the periodicity and and not aperiodicity:\n\t\t\t\t// periodicity = 1 - aperiodicity\n\t\t\t\tprobability = 1 - yinBuffer[tau];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// if no pitch found, return null.\n\t\tif (tau === yinBufferLength || yinBuffer[tau] >= this.threshold) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// If probability too low, return -1.\n\t\tif (probability < this.probabilityThreshold) {\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\tif (tau <= 2){\n\t\t\t// 2 seems to be the result we get when the mic is silent and\n\t\t\t// we just have room noise. It's better to lose a little more of\n\t\t\t// our maxFreq range and discard this result.\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Implements step 5 of the AUBIO_YIN paper. It refines the estimated\n\t\t * tau value using parabolic interpolation. This is needed to detect\n\t\t * higher frequencies more precisely. See\n\t\t * http://fizyka.umk.pl/nrbook/c10-2.pdf and for more background\n\t\t * http://fedc.wiwi.hu-berlin.de/xplore/tutorials/xegbohtmlnode62.html\n\t\t */\n\t\tlet betterTau;\n\t\tlet x0;\n\t\tlet x2;\n\t\tif (tau < 1) {\n\t\t\tx0 = tau;\n\t\t} \n\t\telse {\n\t\t\tx0 = tau - 1;\n\t\t}\n\t\tif (tau + 1 < yinBufferLength) {\n\t\t\tx2 = tau + 1;\n\t\t} \n\t\telse {\n\t\t\tx2 = tau;\n\t\t}\n\t\tif (x0 === tau) {\n\t\t\tif (yinBuffer[tau] <= yinBuffer[x2]) {\n\t\t\t\tbetterTau = tau;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tbetterTau = x2;\n\t\t\t}\n\t\t} \n\t\telse if (x2 === tau) {\n\t\t\tif (yinBuffer[tau] <= yinBuffer[x0]) {\n\t\t\t\tbetterTau = tau;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tbetterTau = x0;\n\t\t\t}\n\t\t} \n\t\telse {\n\t\t\tlet s0 = yinBuffer[x0];\n\t\t\tlet s1 = yinBuffer[tau];\n\t\t\tlet s2 = yinBuffer[x2];\n\t\t\t// fixed AUBIO implementation, thanks to Karl Helgason:\n\t\t\t// (2.0f * s1 - s2 - s0) was incorrectly multiplied with -1\n\t\t\tbetterTau = tau + (s2 - s0) / (2 * (2 * s1 - s2 - s0));\n\t\t}\n\t\t\n\t\tlet result = new YinResult();\n\t\tresult.frequency = this.sampleRate / (minInterval + betterTau);\n\t\tresult.probability = probability;\n\n\t\treturn result;\n\t}\n}\n\nclass YinResult {\n\tfrequency;\n\tprobability;\n}\n\nregisterProcessor('prec2-worklet', PRec2Processor);\n`;\n\n// src/analysis/TuningProvider2.ts\nimport { createEmitter as createEmitter8 } from \"ts_utils\";\nvar _TuningProvider2 = class _TuningProvider2 {\n constructor() {\n this._initialized = false;\n this._isActive = false;\n this._readingsActive = false;\n this._isSilent = true;\n this._minAmplitude = 0.05;\n this._sendPitchNoteEvents = false;\n this._emitter = createEmitter8();\n this._onPitchRec = (e) => {\n this._history.push(e);\n if (this._history.length > _TuningProvider2.maxHistoryLength) {\n this._history.splice(0, 1);\n }\n this._averageAmpl = (this._averageAmpl * this._numAmplReadings + e.peakAmpl) / (this._numAmplReadings + 1);\n this._numAmplReadings++;\n if (this._numAmplReadings > 12e4) {\n this._numAmplReadings = 12e4;\n }\n if (e.peakAmpl < this._minAmplitude) {\n this._isSilent = true;\n return;\n }\n if (!e.hasPitch) {\n return;\n }\n let numMatches = 0;\n let tuningSum = 0;\n for (let pre of this._history) {\n if (pre.cents === e.cents) {\n numMatches++;\n tuningSum += pre.tuning;\n }\n }\n if (numMatches >= _TuningProvider2.minHistoryMatches) {\n if (e.cents !== this._lastCents) {\n this._processPitchNote(e.cents);\n }\n let avgTuning = tuningSum / numMatches;\n this._lastPitchName = e.pitchName;\n this._lastCents = e.cents;\n this._lastTuning = Math.round(avgTuning);\n this._lastPitchMsTime = Math.floor(performance.now());\n }\n };\n this._onMicManagerEvent = (e) => {\n switch (e.type) {\n case 0 /* streamCreated */: {\n this.stop();\n this.start();\n break;\n }\n case 1 /* streamClosed */: {\n this._setReadingsStopped();\n break;\n }\n }\n };\n }\n /**true if the tuner is currently listening for pitch results*/\n get isActive() {\n return this._isActive;\n }\n get readingsActive() {\n return this._readingsActive;\n }\n get instrument() {\n return this._prec2Node.instrument;\n }\n /**gets the cents, rounded to the nearest 100, of the most recent solid\n * reading. Will be null if no readings have occurred.*/\n get lastCents() {\n return this._lastCents;\n }\n /**gets the offset in cents, -50 to 50, of the most recent solid reading.\n * Will be null if no readings have occurred.*/\n get lastTuning() {\n return this._lastTuning;\n }\n /**gets the pitch name, with no number, of the most recent solid reading.\n * Will be null if no readings have occurred.*/\n get lastPitchName() {\n return this._lastPitchName;\n }\n /**gets the time, in seconds, since the last reported pitch reading. Can\n * be used to determine when to stop displaying pitch.*/\n get timeSinceLastPitch() {\n return (window.performance.now() - this._lastPitchMsTime) / 1e3;\n }\n /**returns true if the most recent reading registered below the \n * [minAmplutide] level*/\n get isSilent() {\n return this._isSilent;\n }\n /**a value from 0 to 1.0 that sets the minimum microphone level that must\n * be met for tuning readings to be reported.*/\n get minAmplitude() {\n return this._minAmplitude;\n }\n set minAmplitude(value) {\n this._minAmplitude = value;\n }\n /**Gets the most recent peak amplitude level or 0 if there have been no\n * readings*/\n get peakAmplitude() {\n return this._history != null && this._history.length > 0 ? this._history[this._history.length - 1].peakAmpl : 0;\n }\n get sendPitchNoteEvents() {\n return this._sendPitchNoteEvents;\n }\n set sendPitchNoteEvents(value) {\n this._sendPitchNoteEvents = value;\n }\n get averageAmpl() {\n return this._averageAmpl;\n }\n get event() {\n return this._emitter.event;\n }\n async init(context) {\n await PRec2Node.registerWorklet(context);\n this._prec2Node = new PRec2Node();\n this.setInstrument(3);\n this._initialized = true;\n }\n /**calling start() does not guarantee tuning events will immediately begin.\n * Listen for TuningProvider2EventType.readingsStarted/readingsStopped */\n start() {\n if (!this._initialized) {\n throw \"you must call init() before using TuningProvider2 instance\";\n }\n if (!this._isActive) {\n let micManager = MicManager.get();\n micManager.event.on(this._onMicManagerEvent);\n this._history = [];\n this._lastPitchMsTime = 0;\n this._prec2Node.pitchRec.on(this._onPitchRec);\n this._averageAmpl = 0;\n this._numAmplReadings = 0;\n if (micManager.isStreamActive) {\n let context = micManager.audioContext;\n this._sourceNode = context.createMediaStreamSource(\n micManager.stream\n );\n this._prec2Node.resetPRec(250, 10);\n this._sourceNode.connect(this._prec2Node);\n this._prec2Node.connect(context.destination);\n this._setReadingsStarted();\n }\n this._isActive = true;\n }\n }\n stop() {\n if (this._isActive) {\n this._prec2Node.pitchRec.off(this._onPitchRec);\n this._prec2Node.disconnect();\n if (this._sourceNode != null) {\n this._sourceNode.disconnect();\n this._sourceNode = null;\n }\n MicManager.get().event.off(this._onMicManagerEvent);\n this._setReadingsStopped();\n this._isActive = false;\n }\n }\n setInstrument(instrumentId) {\n let inst = AssessmentInstrumentUtils.getInstrumentByID(instrumentId);\n if (inst == null) {\n throw \"InstrumentDO.id doesn't match an assessment inst\";\n }\n this._prec2Node.setInstrument(inst);\n }\n _processPitchNote(cents) {\n let firstEv;\n let peakAmpl = 0;\n for (let i = 0; i < this._history.length; i++) {\n let ev2 = this._history[i];\n if (ev2.cents === cents) {\n if (firstEv == null) {\n firstEv = ev2;\n }\n if (ev2.peakAmpl > peakAmpl) {\n peakAmpl = ev2.peakAmpl;\n }\n }\n }\n let ev = new TuningProvider2Event();\n ev.type = 2 /* newPitchNote */;\n ev.noteStartTime = firstEv.lastLowPeakTime;\n ev.noteCents = cents;\n ev.notePitchName = firstEv.pitchName;\n ev.notePeakAmpl = peakAmpl;\n this._emitter.emit(ev);\n }\n _setReadingsStarted() {\n this._readingsActive = true;\n let ev = new TuningProvider2Event();\n ev.type = 0 /* readingsStarted */;\n this._emitter.emit(ev);\n }\n _setReadingsStopped() {\n this._readingsActive = false;\n let ev = new TuningProvider2Event();\n ev.type = 1 /* readingsStopped */;\n this._emitter.emit(ev);\n }\n};\n_TuningProvider2.maxHistoryLength = 10;\n_TuningProvider2.minHistoryMatches = 5;\nvar TuningProvider2 = _TuningProvider2;\nvar TuningProvider2Event = class {\n};\nvar TuningProvider2EventType = /* @__PURE__ */ ((TuningProvider2EventType2) => {\n TuningProvider2EventType2[TuningProvider2EventType2[\"readingsStarted\"] = 0] = \"readingsStarted\";\n TuningProvider2EventType2[TuningProvider2EventType2[\"readingsStopped\"] = 1] = \"readingsStopped\";\n TuningProvider2EventType2[TuningProvider2EventType2[\"newPitchNote\"] = 2] = \"newPitchNote\";\n return TuningProvider2EventType2;\n})(TuningProvider2EventType || {});\n\n// src/mic/AudioRecorder.ts\nvar AudioRecorder = class {\n constructor(micManager) {\n this._encodeLive = false;\n this._isRecording = false;\n this._onMicData = (data) => {\n if (this._encodeLive)\n this._encoder.encode([data]);\n else {\n this._audioChunks.push(Float32Array.from(data));\n }\n };\n this._micManager = micManager;\n }\n /**\n * start recording.\n * set startMicCapture to true if you aren't initializing it elsewhere\n * (for pitch rec, etc.).\n */\n record(startMicCapture) {\n if (this._encoder != null) {\n this._encoder.cancel();\n }\n if (this._encodeLive) {\n this._initOggEncoder();\n } else\n this._audioChunks = [];\n this._micManager.micData.on(this._onMicData);\n if (startMicCapture) {\n this._micManager.startCapture();\n }\n this._recordStartTime = this._micManager.audioContext.currentTime;\n this._isRecording = true;\n }\n /**stops recording. If stopMicCapture is true, the microphone capture is\n * also stopped in the MicManager.*/\n stop(stopMicCapture) {\n if (this._isRecording) {\n this._micManager.micData.off(this._onMicData);\n if (stopMicCapture) {\n this._micManager.stopCapture();\n }\n this._recordStopTime = this._micManager.audioContext.currentTime;\n this._isRecording = false;\n }\n }\n /**Gets the recorded audio as an AudioBuffer.\n * @stereo - if true, mono recording is copied to both channels\n * @resampleRate - default null means no resampling. If specified, must\n * be a value lower than AudioContext's sample rate.\n * @deleteRecordedAudio - clears audio data from this class so it can be\n * garbage collected.*/\n async getAudioBuffer(stereo, resampleRate = null, deleteRecordedAudio = true) {\n if (this._audioChunks == null || this.encodeLive) {\n return null;\n }\n let length = 0;\n for (let chunk of this._audioChunks) {\n length += chunk.length;\n }\n let context = this._micManager.audioContext;\n let numChannels = stereo ? 2 : 1;\n let buffer = context.createBuffer(\n numChannels,\n length,\n context.sampleRate\n );\n let position = 0;\n for (let chunk of this._audioChunks) {\n for (let i = 0; i < numChannels; i++) {\n buffer.copyToChannel(chunk, i, position);\n }\n position += chunk.length;\n }\n if (deleteRecordedAudio) {\n this._audioChunks = null;\n }\n if (resampleRate == null || resampleRate >= context.sampleRate) {\n return buffer;\n } else {\n let resampleLength = Math.ceil(resampleRate / context.sampleRate * length);\n let oac = new OfflineAudioContext(\n numChannels,\n resampleLength,\n resampleRate\n );\n let bsn = oac.createBufferSource();\n bsn.buffer = buffer;\n bsn.connect(oac.destination);\n bsn.start(0);\n let renderedBuffer = await oac.startRendering();\n bsn.disconnect();\n bsn = null;\n buffer = null;\n oac = null;\n return renderedBuffer;\n }\n }\n /**gets recording as an html.Blob object that can be saved to a file*/\n getOggAudioBlob() {\n let recording;\n if (this._encoder == null) {\n this._initOggEncoder();\n }\n if (this._encoder != null) {\n if (!this._encodeLive && this._audioChunks != null) {\n while (this._audioChunks.length > 0) {\n this._encoder.encode([this._audioChunks.splice(0, 1)[0]]);\n }\n }\n recording = this._encoder.finish(\"audio/ogg\");\n this._encoder = null;\n this._audioChunks = null;\n }\n return recording;\n }\n /**converts an audioBlob (typically from getOggAudioBlob()) into an\n * AudioBuffer object that can be used with an AudioBufferSourceNode.\n * After making a recording (or reloading one from a server), use\n * getOggAudioBlob() to get the recording as an html.Blob object. Then\n * pass that to this getAudioBuffer() method and wait for the result\n * of the future, which will be the AudioBuffer object. To play it, use\n * something like:\n * let playbackNode = context.createBufferSource();\n * _playbackNode.buffer = audioBuffer;\n * _playbackNode.connectNode(context.destination);\n * _playbackNode.start(0);*/\n getAudioBufferFromBlob(audioBlob) {\n return new Promise((resolve, reject) => {\n let reader = new FileReader();\n reader.onloadend = async (e) => {\n reader.onloadend = null;\n reader.onerror = null;\n let context = this._micManager.audioContext;\n let ab = await context.decodeAudioData(\n reader.result\n );\n resolve(ab);\n };\n reader.onerror = (e) => {\n reader.onloadend = null;\n reader.onerror = null;\n reject();\n };\n reader.readAsArrayBuffer(audioBlob);\n });\n }\n _initOggEncoder() {\n this._encoder = new window.OggVorbisEncoder(\n Math.floor(this._micManager.audioContext.sampleRate),\n 1,\n 0.5\n );\n }\n /**default is false. If true, ogg encoding happens in real time as date is\n * received. Could create performance issues (but seems pretty fast)*/\n get encodeLive() {\n return this._encodeLive;\n }\n set encodeLive(value) {\n this._encodeLive = value;\n }\n /**true when recording is active*/\n get isRecording() {\n return this._isRecording;\n }\n /**returns the AudioContext time, in seconds, when recording starts.*/\n get recordStartTime() {\n return this._recordStartTime;\n }\n /**returns the AudioContext time, in seconds, when recording stops.*/\n get recordStopTime() {\n return this._recordStopTime;\n }\n};\n\n// src/mic/AudioRecordJob.ts\nimport ysFixWebmDuration2 from \"fix-webm-duration\";\nvar AudioRecordJob = class _AudioRecordJob {\n constructor(micManager) {\n this._isRecording = false;\n this._fixWebmDuration = false;\n this._onDataAvailable = (e) => {\n this._recordingBlobs.push(e.data);\n if (!this._isRecording) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._recordingComplete = true;\n this._completeBlobReturn();\n }\n };\n this._onMicManagerEvent = (e) => {\n switch (e.type) {\n case 1 /* streamClosed */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._killMediaRecorder();\n break;\n case 0 /* streamCreated */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._createMediaRecorder();\n break;\n }\n };\n this._micManager = micManager;\n this._init();\n }\n /**\n * start recording.\n * set startMicCapture to true if you aren't initializing it elsewhere\n * (for pitch rec, etc.).\n */\n record() {\n if (!_AudioRecordJob.isSupported) {\n return false;\n }\n if (this._mediaRecorder == null) {\n if (!this._createMediaRecorder()) {\n throw \"MediaRecorder could not be created. Make sure to call MicManager.initMicMediaStream before using.\";\n }\n }\n this._recordingBlobs = [];\n this._mediaRecorder.addEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder.start();\n this._recordStartTime = this._micManager.audioContext.currentTime;\n this._isRecording = true;\n this._recordingComplete = false;\n return true;\n }\n /**stops recording.*/\n stop() {\n if (!_AudioRecordJob.isSupported) {\n return;\n }\n if (this._isRecording) {\n this._mediaRecorder.stop();\n this._recordStopTime = this._micManager.audioContext.currentTime;\n this._isRecording = false;\n }\n }\n /**gets recording as an html.Blob object that can be saved to a file*/\n getAudioBlob() {\n return new Promise((resolve, reject) => {\n this._returnBlobCompleter = resolve;\n if (this._recordingComplete) {\n this._completeBlobReturn();\n }\n });\n }\n /**Gets an AudioElement with the recorded audio*/\n async getAudioElement() {\n let blob = await this.getAudioBlob();\n if (blob != null) {\n let audioEl = document.createElement(\"audio\");\n audioEl.src = URL.createObjectURL(blob);\n return audioEl;\n }\n return null;\n }\n dispose() {\n this._micManager.event.off(this._onMicManagerEvent);\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this.stop();\n this._mediaRecorder = null;\n this._recordingBlobs = null;\n this._returnBlobCompleter = null;\n }\n _init() {\n this._micManager.event.on(this._onMicManagerEvent);\n this._createMediaRecorder();\n }\n _createMediaRecorder() {\n if (!this._audioStreamIsReady()) {\n return false;\n }\n try {\n let audioOptions = this._micManager.audioOptions;\n let options = {\n \"mimeType\": audioOptions.mimeCodecsString,\n \"audioBitsPerSecond\": audioOptions.bitRate\n };\n this._mediaRecorder = new MediaRecorder(\n this._micManager.stream,\n options\n );\n return true;\n } catch (err) {\n console.log(err.toString());\n return false;\n }\n }\n _audioStreamIsReady() {\n let audioStreams = this._micManager.stream?.getAudioTracks();\n if (audioStreams == null || audioStreams.length < 1 || audioStreams[0].readyState !== \"live\") {\n return false;\n }\n return true;\n }\n _completeBlobReturn() {\n if (this._returnBlobCompleter == null) {\n return;\n }\n if (this._recordingBlobs == null || this._recordingBlobs.length === 0) {\n this._recordingBlobs = null;\n this._returnBlobCompleter(null);\n this._returnBlobCompleter = null;\n } else {\n let mimeType = MediaFileUtils.getMimeType(\n this._micManager.audioOptions.mimeCodecsString\n );\n let blob = new Blob(this._recordingBlobs, { type: mimeType });\n this._recordingBlobs = null;\n if (!this._fixWebmDuration) {\n this._returnBlobCompleter(blob);\n this._returnBlobCompleter = null;\n } else {\n let duration = Math.ceil((this._recordStopTime - this._recordStartTime) * 1e3);\n ysFixWebmDuration2(blob, duration, (fixedBlob) => {\n this._returnBlobCompleter(fixedBlob);\n this._returnBlobCompleter = null;\n }, { logger: false });\n }\n }\n }\n _killMediaRecorder() {\n if (this._mediaRecorder != null) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder = null;\n }\n }\n /**if true, recording is currently in progress.*/\n get isRecording() {\n return this._isRecording;\n }\n /**returns the AudioContext time, in seconds, when recording starts.*/\n get recordStartTime() {\n return this._recordStartTime;\n }\n /**returns the AudioContext time, in seconds, when recording stops.*/\n get recordStopTime() {\n return this._recordStopTime;\n }\n /**if fixWebmDuration is true, recordings will be processed to add duration\n * metadata */\n get fixWebmDuration() {\n return this._fixWebmDuration;\n }\n set fixWebmDuration(value) {\n this._fixWebmDuration = value;\n }\n /**returns true if the browser supports the MediaRecorder API*/\n static get isSupported() {\n if (_AudioRecordJob._isSupported == null) {\n _AudioRecordJob._isSupported = MediaRecorder != null;\n }\n return _AudioRecordJob._isSupported;\n }\n};\n\n// src/video/VideoManager.ts\nimport { createEmitter as createEmitter9 } from \"ts_utils\";\nvar VideoManager = class _VideoManager {\n /**Creates/gets a [VideoManager] singleton. [context] and [VideoOptions] are\n * only necessary the first time the constructor is called and will be \n * ignored on future calls.*/\n constructor(context, options) {\n this._use720PForCanvasStream = true;\n this._createCanvasSnapshots = false;\n this._eventEmitter = createEmitter9();\n this._onMediaDeviceManagerEvent = (e) => {\n if (e.cameraChanged) {\n this.killStream();\n }\n };\n this._onCanvasTimer = () => {\n let origWidth = this._canvasVideoEl.videoWidth;\n let origHeight = this._canvasVideoEl.videoHeight;\n let targetWidth = this._options.width;\n let targetHeight = this._options.height;\n if (origWidth === 0 || origHeight === 0) {\n this._ctx2d.fillStyle = \"rgba(0,0,0,0)\";\n this._ctx2d.fillRect(0, 0, 1, 1);\n } else {\n if (this._canvasVideoEl.height !== origHeight) {\n this._canvasVideoEl.height = origHeight;\n this._canvasVideoEl.width = origWidth;\n }\n let scale = origHeight / targetHeight;\n let sWidth = targetWidth * scale;\n let sx = (origWidth - sWidth) / 2;\n this._ctx2d.drawImage(\n this._canvasVideoEl,\n sx,\n 0,\n sWidth,\n origHeight,\n 0,\n 0,\n targetWidth,\n targetHeight\n );\n }\n if (this._createCanvasSnapshots) {\n createImageBitmap(this._canvas).then((img) => {\n let ev = new VideoManagerEvent(\n 2 /* canvasSnapshot */\n );\n ev.canvasSnapshot = img;\n this._eventEmitter.emit(ev);\n });\n }\n this._canvasTimerId = window.setTimeout(\n this._onCanvasTimer,\n 1e3 / this._options.idealFrameRate\n );\n };\n this._init(context, options);\n }\n get event() {\n return this._eventEmitter.event;\n }\n static get(context, options) {\n if (!_VideoManager._ref) {\n _VideoManager._ref = new _VideoManager(context, options);\n }\n return _VideoManager._ref;\n }\n _init(context, options) {\n if (context == null) {\n throw \"AudioContext must be specified the first time you call the VideoManager constructor.\";\n }\n if (options == null) {\n throw \"VideoOptions must be specified the first time you call the VideoManager constructor\";\n }\n if (!MediaDeviceManager.isInitialized) {\n throw \"You must instantiate and initialize a MediaDeviceManager before creating the VideoManager\";\n }\n this._context = context;\n this._options = options;\n _VideoManager._ref = this;\n MediaDeviceManager.get().event.on(this._onMediaDeviceManagerEvent);\n }\n /**kills any existing media stream and initializes a new one. If successful,\n * resolves true, otherwise false.*/\n async initVideoMediaStream(width, height) {\n let deviceManager = MediaDeviceManager.get();\n if (!deviceManager.isCameraReady) {\n throw \"You must set a camera device in the MediaDeviceManager and get permission to use it before adding a video stream\";\n }\n this.killStream();\n let options = this._options.toMap(deviceManager.currentCamera.id);\n if (width != null) {\n options[\"width\"] = { \"ideal\": width };\n }\n if (height != null) {\n options[\"height\"] = { \"ideal\": height };\n }\n try {\n this._stream = await navigator.mediaDevices.getUserMedia(\n { video: options }\n );\n if (this._useCanvasStream) {\n await this._startCanvasStream();\n }\n let ev = new VideoManagerEvent(0 /* streamCreated */);\n this._eventEmitter.emit(ev);\n return true;\n } catch (err) {\n console.log(err.toString() + \" ...maybe make sure camera is enabled.\");\n return false;\n }\n }\n killStream() {\n if (this._stream != null) {\n this._stopCanvasStream();\n let tracks = this._stream.getTracks();\n for (let i = tracks.length - 1; i >= 0; i--) {\n let track = tracks[i];\n track.stop();\n track.enabled = false;\n this._stream.removeTrack(track);\n }\n this._stream = null;\n let ev = new VideoManagerEvent(1 /* streamClosed */);\n this._eventEmitter.emit(ev);\n }\n }\n async _startCanvasStream() {\n this._canvas = document.createElement(\"canvas\");\n this._canvas.width = this._options.width;\n this._canvas.height = this._options.height;\n this._ctx2d = this._canvas.getContext(\"2d\");\n this._canvasStream = this._canvas.captureStream(\n this._options.idealFrameRate\n );\n this._canvasVideoEl = document.createElement(\"video\");\n this._canvasVideoEl.srcObject = this._stream;\n await this._canvasVideoEl.play();\n this._onCanvasTimer();\n }\n _stopCanvasStream() {\n if (this._canvasTimerId == null) {\n return;\n }\n window.clearTimeout(this._canvasTimerId);\n this._canvasTimerId = null;\n if (this._canvasVideoEl != null) {\n this._canvasVideoEl.pause();\n this._canvasVideoEl = null;\n }\n this._ctx2d = null;\n this._canvas = null;\n this._canvasStream = null;\n }\n get audioContext() {\n return this._context;\n }\n set audioContext(value) {\n this._context = value;\n }\n get videoOptions() {\n return this._options;\n }\n get stream() {\n return this._stream;\n }\n /**returns the [MediaStreamTrack] for the camera video*/\n get cameraVideoTrack() {\n return this._stream?.getVideoTracks()[0];\n }\n /**if true, whenever a stream is initialized, a second stream will also be\n * generated and accessible via the canvasStream property. This can only\n * be set when no stream is active. Note that when using a canvas stream,\n * it may help to pass a common 16/9 resolution to initVideoMediaStream().\n * For example, 1280 X 720*/\n get useCanvasStream() {\n return this._useCanvasStream;\n }\n set useCanvasStream(value) {\n if (this._stream != null) {\n throw \"can not set while a current video stream exists. Use killStream() first or call before first stream initialization\";\n }\n this._useCanvasStream = value;\n }\n /**a generated stream meant to enforce the exact width, height and framerate\n * from the VideoOptions. */\n get canvasStream() {\n return this._canvasStream;\n }\n /**returns the [MediaStreamTrack] for the canvas video*/\n get canvasVideoTrack() {\n return this._canvasStream?.getVideoTracks()[0];\n }\n /**if true, when the canvas stream is enabled, snapshots will be taken of\n * each frame and dispatched via a VideoManagerEvent. */\n get createCanvasSnapshots() {\n return this._createCanvasSnapshots;\n }\n set createCanvasSnapshots(value) {\n this._createCanvasSnapshots = value;\n }\n};\nvar VideoManagerEvent = class {\n constructor(type) {\n this.type = type;\n }\n};\nvar VideoManagerEventType = /* @__PURE__ */ ((VideoManagerEventType2) => {\n VideoManagerEventType2[VideoManagerEventType2[\"streamCreated\"] = 0] = \"streamCreated\";\n VideoManagerEventType2[VideoManagerEventType2[\"streamClosed\"] = 1] = \"streamClosed\";\n VideoManagerEventType2[VideoManagerEventType2[\"canvasSnapshot\"] = 2] = \"canvasSnapshot\";\n return VideoManagerEventType2;\n})(VideoManagerEventType || {});\n\n// src/video/VideoRecorder.ts\nimport ysFixWebmDuration3 from \"fix-webm-duration\";\nvar VideoRecorder = class _VideoRecorder {\n constructor(videoManager) {\n this._isRecording = false;\n this._fixWebmDuration = false;\n this._onDataAvailable = (e) => {\n this._recordingBlobs.push(e.data);\n if (!this._isRecording) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._recordingComplete = true;\n this._completeBlobReturn();\n }\n };\n this._onVideoManagerEvent = (e) => {\n switch (e.type) {\n case 1 /* streamClosed */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._killMediaRecorder();\n break;\n case 0 /* streamCreated */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._createMediaRecorder();\n break;\n }\n };\n this._videoManager = videoManager;\n this._init();\n }\n /** start recording.*/\n record() {\n if (!_VideoRecorder.isSupported) {\n return false;\n }\n if (this._mediaRecorder == null) {\n if (!this._createMediaRecorder()) {\n throw \"MediaRecorder could not be created. Make sure to call VideoManager.initVideoMediaStream before using the VideoRecorder\";\n }\n }\n this._recordingBlobs = [];\n this._mediaRecorder.addEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._clipEndTime = null;\n this._mediaRecorder.start(\n this._videoManager.videoOptions.recordingBlobSize\n );\n this._recordStartTime = this._videoManager.audioContext.currentTime;\n this._isRecording = true;\n this._recordingComplete = false;\n return true;\n }\n /**stops recording.*/\n stop() {\n if (!_VideoRecorder.isSupported) {\n return;\n }\n if (this._isRecording) {\n this._mediaRecorder.stop();\n this._recordStopTime = this._videoManager.audioContext.currentTime;\n this._isRecording = false;\n }\n }\n /**gets recording as an html.Blob object that can be saved to a file. \n * Optionally set and [endTime] in seconds to clip the video before\n * returning the blob. Clipping resolution will be limited by the\n * [VideoOptions.recordingBlobSize]*/\n getVideoBlob(endTime) {\n return new Promise((resolve, reject) => {\n this._returnBlobCompleter = resolve;\n this._clipEndTime = endTime;\n if (this._recordingComplete) {\n this._completeBlobReturn();\n }\n });\n }\n /**Gets a VideoElement with the recorded video*/\n async getVideoElement() {\n let blob = await this.getVideoBlob();\n if (blob != null) {\n let videoEl = document.createElement(\"video\");\n videoEl.src = URL.createObjectURL(blob);\n return videoEl;\n }\n return null;\n }\n _init() {\n this._videoManager.event.on(this._onVideoManagerEvent);\n this._createMediaRecorder();\n }\n _createMediaRecorder() {\n this._killMediaRecorder();\n if (!this._videoStreamIsReady()) {\n return false;\n }\n try {\n let stream = this._videoManager.useCanvasStream ? this._videoManager.canvasStream : this._videoManager.stream;\n let vidOptions = this._videoManager.videoOptions;\n this._mediaRecorder = new MediaRecorder(stream, {\n \"mimeType\": vidOptions.mimeCodecsString,\n \"videoBitsPerSecond\": vidOptions.bitRate\n });\n return true;\n } catch (err) {\n console.log(err.toString());\n return false;\n }\n }\n _videoStreamIsReady() {\n let stream = this._videoManager.useCanvasStream ? this._videoManager.canvasStream : this._videoManager.stream;\n let videoTracks = stream?.getVideoTracks();\n if (videoTracks == null || videoTracks.length < 1 || videoTracks[0].readyState !== \"live\") {\n return false;\n }\n return true;\n }\n _completeBlobReturn() {\n if (this._returnBlobCompleter == null) {\n return;\n }\n if (this._recordingBlobs == null || this._recordingBlobs.length == 0) {\n this._recordingBlobs = null;\n this._returnBlobCompleter(null);\n this._returnBlobCompleter = null;\n } else {\n let blobSize = this._videoManager.videoOptions.recordingBlobSize / 1e3;\n if (this._clipEndTime != null) {\n let endIndex = Math.ceil(this._clipEndTime / blobSize);\n if (endIndex < this._recordingBlobs.length) {\n this._recordingBlobs.splice(\n endIndex,\n this._recordingBlobs.length\n );\n }\n }\n let blob = new Blob(this._recordingBlobs, { type: \"video/webm\" });\n this._recordingBlobs = null;\n if (!this._fixWebmDuration) {\n this._returnBlobCompleter(blob);\n this._returnBlobCompleter = null;\n } else {\n let duration = Math.ceil((this._recordStopTime - this._recordStartTime) * 1e3);\n ysFixWebmDuration3(blob, duration, (fixedBlob) => {\n this._returnBlobCompleter(fixedBlob);\n this._returnBlobCompleter = null;\n }, { logger: false });\n }\n }\n }\n _killMediaRecorder() {\n if (this._mediaRecorder != null) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder = null;\n }\n }\n /**if true, recording is currently in progress.*/\n get isRecording() {\n return this._isRecording;\n }\n /**returns the AudioContext time, in seconds, when recording starts.*/\n get recordStartTime() {\n return this._recordStartTime;\n }\n /**returns the AudioContext time, in seconds, when recording stops.*/\n get recordStopTime() {\n return this._recordStopTime;\n }\n /**if fixWebmDuration is true, recordings will be processed to add duration\n * metadata */\n get fixWebmDuration() {\n return this._fixWebmDuration;\n }\n set fixWebmDuration(value) {\n this._fixWebmDuration = value;\n }\n /**returns true if the browser supports the MediaRecorder API*/\n static get isSupported() {\n if (_VideoRecorder._isSupported == null) {\n _VideoRecorder._isSupported = MediaRecorder != null;\n }\n return _VideoRecorder._isSupported;\n }\n};\n\n// src/video/VideoRecordJob.ts\nimport ysFixWebmDuration4 from \"fix-webm-duration\";\nvar VideoRecordJob = class _VideoRecordJob {\n constructor(videoManager) {\n this._isRecording = false;\n this._fixWebmDuration = false;\n this._onDataAvailable = (e) => {\n this._recordingBlobs.push(e.data);\n if (!this._isRecording) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._recordingComplete = true;\n this._completeBlobReturn();\n }\n };\n this._onVideoManagerEvent = (e) => {\n switch (e.type) {\n case 1 /* streamClosed */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._killMediaRecorder();\n break;\n case 0 /* streamCreated */:\n if (this._isRecording) {\n this.stop();\n this._recordingBlobs = null;\n }\n this._createMediaRecorder();\n break;\n }\n };\n this._videoManager = videoManager;\n this._init();\n }\n /** start recording.*/\n record() {\n if (!_VideoRecordJob.isSupported) {\n return false;\n }\n if (this._mediaRecorder == null) {\n if (!this._createMediaRecorder()) {\n throw \"MediaRecorder could not be created. Make sure to call VideoManager.initVideoMediaStream before using\";\n }\n }\n this._recordingBlobs = [];\n this._mediaRecorder.addEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._clipEndTime = null;\n this._mediaRecorder.start(\n this._videoManager.videoOptions.recordingBlobSize\n );\n this._recordStartTime = this._videoManager.audioContext.currentTime;\n this._isRecording = true;\n this._recordingComplete = false;\n return true;\n }\n /**stops recording.*/\n stop() {\n if (!_VideoRecordJob.isSupported) {\n return;\n }\n if (this._isRecording) {\n this._mediaRecorder.stop();\n this._recordStopTime = this._videoManager.audioContext.currentTime;\n this._isRecording = false;\n }\n }\n /**gets recording as an html.Blob object that can be saved to a file. \n * Optionally set and [endTime] in seconds to clip the video before\n * returning the blob. Clipping resolution will be limited by the\n * [VideoOptions.recordingBlobSize]*/\n getVideoBlob(endTime) {\n return new Promise((resolve, reject) => {\n this._returnBlobCompleter = resolve;\n this._clipEndTime = endTime;\n if (this._recordingComplete) {\n this._completeBlobReturn();\n }\n });\n }\n /**Gets a VideoElement with the recorded video*/\n async getVideoElement() {\n let blob = await this.getVideoBlob();\n if (blob != null) {\n let videoEl = document.createElement(\"video\");\n videoEl.src = URL.createObjectURL(blob);\n return videoEl;\n }\n return null;\n }\n dispose() {\n this._videoManager.event.off(this._onVideoManagerEvent);\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this.stop();\n this._mediaRecorder = null;\n this._recordingBlobs = null;\n this._returnBlobCompleter = null;\n }\n _init() {\n this._videoManager.event.on(this._onVideoManagerEvent);\n this._createMediaRecorder();\n }\n _createMediaRecorder() {\n if (!this._videoStreamIsReady()) {\n return false;\n }\n try {\n let stream = this._videoManager.useCanvasStream ? this._videoManager.canvasStream : this._videoManager.stream;\n let vidOptions = this._videoManager.videoOptions;\n this._mediaRecorder = new MediaRecorder(stream, {\n \"mimeType\": vidOptions.mimeCodecsString,\n \"videoBitsPerSecond\": vidOptions.bitRate\n });\n return true;\n } catch (err) {\n console.log(err.toString());\n return false;\n }\n }\n _videoStreamIsReady() {\n let stream = this._videoManager.useCanvasStream ? this._videoManager.canvasStream : this._videoManager.stream;\n let videoTracks = stream?.getVideoTracks();\n if (videoTracks == null || videoTracks.length < 1 || videoTracks[0].readyState !== \"live\") {\n return false;\n }\n return true;\n }\n _completeBlobReturn() {\n if (this._returnBlobCompleter == null) {\n return;\n }\n if (this._recordingBlobs == null || this._recordingBlobs.length == 0) {\n this._recordingBlobs = null;\n this._returnBlobCompleter(null);\n this._returnBlobCompleter = null;\n } else {\n let blobSize = this._videoManager.videoOptions.recordingBlobSize / 1e3;\n if (this._clipEndTime != null) {\n let endIndex = Math.ceil(this._clipEndTime / blobSize);\n if (endIndex < this._recordingBlobs.length) {\n this._recordingBlobs.splice(\n endIndex,\n this._recordingBlobs.length\n );\n }\n }\n let mimeType = MediaFileUtils.getMimeType(\n this._videoManager.videoOptions.mimeCodecsString\n );\n let blob = new Blob(this._recordingBlobs, { type: mimeType });\n this._recordingBlobs = null;\n if (!this._fixWebmDuration || !mimeType.includes(\"webm\")) {\n this._returnBlobCompleter(blob);\n this._returnBlobCompleter = null;\n } else {\n let duration = Math.ceil((this._recordStopTime - this._recordStartTime) * 1e3);\n ysFixWebmDuration4(blob, duration, (fixedBlob) => {\n this._returnBlobCompleter(fixedBlob);\n this._returnBlobCompleter = null;\n }, { logger: false });\n }\n }\n }\n _killMediaRecorder() {\n if (this._mediaRecorder != null) {\n this._mediaRecorder.removeEventListener(\n \"dataavailable\",\n this._onDataAvailable\n );\n this._mediaRecorder = null;\n }\n }\n /**if true, recording is currently in progress.*/\n get isRecording() {\n return this._isRecording;\n }\n /**returns the AudioContext time, in seconds, when recording starts.*/\n get recordStartTime() {\n return this._recordStartTime;\n }\n /**returns the AudioContext time, in seconds, when recording stops.*/\n get recordStopTime() {\n return this._recordStopTime;\n }\n /**if fixWebmDuration is true, recordings will be processed to add duration\n * metadata */\n get fixWebmDuration() {\n return this._fixWebmDuration;\n }\n set fixWebmDuration(value) {\n this._fixWebmDuration = value;\n }\n /**returns true if the browser supports the MediaRecorder API*/\n static get isSupported() {\n if (_VideoRecordJob._isSupported == null) {\n _VideoRecordJob._isSupported = MediaRecorder != null;\n }\n return _VideoRecordJob._isSupported;\n }\n};\nexport {\n AssessmentInstrumentDO,\n AssessmentInstrumentUtils,\n AudioOptions,\n AudioRecordJob,\n AudioRecorder,\n AudioRecorder2,\n DelayInfo,\n DelayTester,\n DelayTester2,\n Device,\n DeviceType,\n HitEvent,\n HitRecognizer,\n HitType,\n KeyHitRecognizer,\n MediaDeviceManager,\n MediaDeviceManagerEvent,\n MediaDeviceManagerEventType,\n MediaFileUtils,\n MicHitRecognizer,\n MicManager,\n MicManagerEvent,\n MicManagerEventType,\n MicOptions,\n MimeCodecsString,\n PitchRecEvent,\n PitchRecognizer,\n PitchRecognizer2,\n PitchUtils,\n TuningProvider,\n TuningProvider2,\n TuningProvider2Event,\n TuningProvider2EventType,\n VideoManager,\n VideoManagerEvent,\n VideoManagerEventType,\n VideoOptions,\n VideoRecordJob,\n VideoRecorder,\n YinDetector\n};\n","// src/sound_lib/core/_SoundLibLoader.ts\r\nimport { SoundLoader } from \"audio_utils\";\r\nimport { BrowserUtils, ConversionUtils as ConversionUtils2, HttpUtils, IdxDbManager, JsonUtils } from \"ts_utils\";\r\n\r\n// src/sound_lib/sf2/_Sf2Instrument.ts\r\nvar _Sf2Instrument = class {\r\n constructor() {\r\n this.name = \"\";\r\n this.zones = [];\r\n }\r\n};\r\n\r\n// src/sound_lib/core/presets.ts\r\nvar _BasicPreset = class {\r\n};\r\n\r\n// src/sound_lib/sf2/_Sf2Preset.ts\r\nvar _Sf2Preset = class extends _BasicPreset {\r\n constructor() {\r\n super(...arguments);\r\n this.zones = [];\r\n }\r\n};\r\n\r\n// src/sound_lib/sf2/_Sf2Sample.ts\r\nvar _Sf2Sample = class {\r\n};\r\n\r\n// src/sound_lib/sf2/_Sf2Zone.ts\r\nvar _Sf2Zone = class __Sf2Zone {\r\n constructor() {\r\n this.startLoopAddrsOffset = 0;\r\n this.endLoopAddrsOffset = 0;\r\n this.bottomNote = 0;\r\n this.topNote = 127;\r\n this.bottomVel = 0;\r\n this.topVel = 127;\r\n //the fine tuning in semitones (0.05 would be 5 cents sharp)\r\n this.fineTune = 0;\r\n //the course tuning in semitones (5 would be 5 semitones sharp)\r\n this.courseTune = 0;\r\n //overrides the sample's root key - if -1, it does nothing\r\n this.overridingRootKey = -1;\r\n this.loop = false;\r\n /**volume reduction - in centibels (10 cB per 1 dB). Positive values mean\r\n * reduction.*/\r\n this.initialAttenuation = 0;\r\n /**the frequency of the low pass filter. Above 20,000 or null means\r\n * don't use.*/\r\n this.initialFilterFc = 13500;\r\n //Information for envelope volume. The delay, attack, hold and decay all\r\n //refer to the length of time, in samples, that each phase should last.\r\n //During the attack env, volume ramps up from nothing to full (1.0). During\r\n //the hold, it stays steady, and then it declines during the decay env BY\r\n //THE AMOUNT specified in the sustainVolReduction (not TO, but BY) the\r\n //release env is the amount of time taken to get to 0 after the note is\r\n //released.\r\n this.delayVolEnvTime = 1e-3;\r\n this.attackVolEnvTime = 1e-3;\r\n this.holdVolEnvTime = 1e-3;\r\n this.decayVolEnvTime = 1e-3;\r\n this.sustainVolReduction = 0;\r\n //0 to 1\r\n this.releaseVolEnvTime = 1e-3;\r\n /**added to initialFilterFc according to mod envelope*/\r\n this.modEnvToFilterFc = 0;\r\n this.isGlobal = false;\r\n }\r\n static createForInstrument() {\r\n let zone = new __Sf2Zone();\r\n zone._zoneType = 0 /* instrument */;\r\n return zone;\r\n }\r\n static createForPreset() {\r\n let zone = new __Sf2Zone();\r\n zone._zoneType = 1 /* preset */;\r\n zone.delayVolEnvTime = 1;\r\n zone.attackVolEnvTime = 1;\r\n zone.holdVolEnvTime = 1;\r\n zone.decayVolEnvTime = 1;\r\n zone.sustainVolReduction = 0;\r\n zone.releaseVolEnvTime = 1;\r\n zone.initialFilterFc = 1;\r\n return zone;\r\n }\r\n /**\r\n * creates a duplicate of the zone with all of the same property values\r\n */\r\n clone() {\r\n let zone = this._zoneType === 1 /* preset */ ? __Sf2Zone.createForPreset() : __Sf2Zone.createForInstrument();\r\n zone.instrument = this.instrument;\r\n zone.startLoopAddrsOffset = this.startLoopAddrsOffset;\r\n zone.endLoopAddrsOffset = this.endLoopAddrsOffset;\r\n zone.bottomNote = this.bottomNote;\r\n zone.topNote = this.topNote;\r\n zone.sample = this.sample;\r\n zone.fineTune = this.fineTune;\r\n zone.courseTune = this.courseTune;\r\n zone.overridingRootKey = this.overridingRootKey;\r\n zone.loop = this.loop;\r\n zone.initialAttenuation = this.initialAttenuation;\r\n zone.initialFilterFc = this.initialFilterFc;\r\n zone.delayVolEnvTime = this.delayVolEnvTime;\r\n zone.attackVolEnvTime = this.attackVolEnvTime;\r\n zone.holdVolEnvTime = this.holdVolEnvTime;\r\n zone.decayVolEnvTime = this.decayVolEnvTime;\r\n zone.sustainVolReduction = this.sustainVolReduction;\r\n zone.releaseVolEnvTime = this.releaseVolEnvTime;\r\n zone.modEnvToFilterFc = this.modEnvToFilterFc;\r\n return zone;\r\n }\r\n};\r\n\r\n// src/sound_lib/sf2/_Sf2Parser.ts\r\nvar _Sf2Parser = class {\r\n constructor(context) {\r\n this._context = context;\r\n }\r\n /**parses the SF data.\r\n * @param sfdata the ArrayBuffer containing all of the SF data\r\n * @param audioIsCompressed - only set this for SF3 files that embed\r\n * compressed audio.\r\n * @param samplesPath - leave null unless you are loading audio separately.\r\n * This is the root path for all of the sample audio files, ending in\r\n * a forward slash.\r\n * @param samplesExtension - leave null unless you are loading audio\r\n * separately. This is the 4 character file extension for the audio,\r\n * example: \".ogg\"\r\n * @param samplesRate - leave null unless you are loading audio separately.\r\n * This is the sample rate of the external audio files (all should be the\r\n * same).*/\r\n async parse(sfdata, audioIsCompressed) {\r\n this._sfData = sfdata;\r\n this._audioIsCompressed = audioIsCompressed;\r\n this._createReaders();\r\n await this._createSamples();\r\n this._createInstruments();\r\n this._createPresets();\r\n }\r\n /**\r\n * gets the Preset object with the requested bank and preset numbers\r\n * @param preset the preset number from the SF2 file\r\n * @param bank the bank number from the SF2 file\r\n * @return the Preset object if it is found, otherwise null\r\n */\r\n getPreset(bank, preset) {\r\n if (this._presets == null)\r\n return null;\r\n let numPresets = this._presets.length;\r\n for (let i = 0; i < numPresets; i++) {\r\n if (this._presets[i].presetNumber === preset) {\r\n if (this._presets[i].bankNumber === bank) {\r\n return this._presets[i];\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n _createReaders() {\r\n let _log = (result) => {\r\n };\r\n let dataRdr = new _BinaryListReader(this._sfData);\r\n _log(dataRdr.readString(4));\r\n _log(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n _log(dataRdr.readString(4));\r\n dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n let sdtaLength = dataRdr.readUint(4);\r\n let startOfSdtaSection = dataRdr.position;\r\n _log(\"sdtaLength: $sdtaLength\");\r\n _log(dataRdr.readString(4));\r\n this._samplesSectionByteIndex = dataRdr.position;\r\n _log(dataRdr.readString(4));\r\n dataRdr.position = startOfSdtaSection + sdtaLength;\r\n _log(dataRdr.readString(4));\r\n dataRdr.readUint(4);\r\n _log(dataRdr.readString(4));\r\n _log(dataRdr.readString(4));\r\n this._phdrRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._pbagRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._pmodRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._pgenRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._instRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._ibagRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._imodRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._igenRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n _log(dataRdr.readString(4));\r\n this._shdrRdr = dataRdr.getRangeAsNewReader(dataRdr.readUint(4));\r\n }\r\n async _createSamples() {\r\n let sampleRateConv = 1;\r\n this._samples = [];\r\n while (this._shdrRdr.position < this._shdrRdr.length - 46) {\r\n let cSample = new _Sf2Sample();\r\n cSample.name = this._shdrRdr.readString(20);\r\n cSample.start = Math.trunc(this._shdrRdr.readUint(4) * sampleRateConv);\r\n cSample.end = Math.trunc(this._shdrRdr.readUint(4) * sampleRateConv);\r\n cSample.loopStart = Math.trunc(this._shdrRdr.readUint(4) * sampleRateConv);\r\n cSample.loopEnd = Math.trunc(this._shdrRdr.readUint(4) * sampleRateConv);\r\n cSample.sampleRate = this._shdrRdr.readUint(4);\r\n cSample.originalPitch = this._shdrRdr.readUint(1);\r\n cSample.pitchCorrection = this._shdrRdr.readInt(1);\r\n cSample.sampleLink = this._shdrRdr.readUint(2);\r\n cSample.sampleType = this._shdrRdr.readUint(2);\r\n if (this._audioIsCompressed) {\r\n await this._addSF3AudioDataToSample(cSample);\r\n } else\r\n this._addSF2AudioDataToSample(cSample);\r\n this._samples.push(cSample);\r\n cSample.loopEnd -= cSample.start;\r\n cSample.loopStart -= cSample.start;\r\n cSample.end -= cSample.start;\r\n cSample.start = 0;\r\n }\r\n }\r\n async _addSF3AudioDataToSample(cSample) {\r\n let oggsIndex = this._samplesSectionByteIndex + 8 + cSample.start;\r\n let oggEndIndex = this._samplesSectionByteIndex + 8 + cSample.end;\r\n let oggData = new Int8Array(this._sfData).subarray(\r\n oggsIndex,\r\n oggEndIndex\r\n );\r\n let samplesArray = oggData.slice();\r\n let ab = samplesArray.buffer;\r\n cSample.audioBuffer = await this._context.decodeAudioData(ab);\r\n let sampleRateConv = this._context.sampleRate / cSample.sampleRate;\r\n cSample.start = 0;\r\n cSample.end = cSample.audioBuffer.length;\r\n cSample.loopStart = Math.trunc(sampleRateConv * cSample.loopStart);\r\n cSample.loopEnd = Math.trunc(sampleRateConv * cSample.loopEnd);\r\n }\r\n _addSF2AudioDataToSample(cSample) {\r\n let sByteStartPosition = 2 * cSample.start;\r\n let numSamples = cSample.end - cSample.start;\r\n let buffer = this._context.createBuffer(\r\n 1,\r\n numSamples,\r\n cSample.sampleRate\r\n );\r\n let adjSampleStart = this._samplesSectionByteIndex + sByteStartPosition;\r\n let sdata = new Int16Array(this._sfData, adjSampleStart, numSamples);\r\n let channel = buffer.getChannelData(0);\r\n for (let i = 0; i < sdata.length; i++) {\r\n channel[i] = sdata[i] / 32768;\r\n }\r\n cSample.audioBuffer = buffer;\r\n }\r\n // Promise _pause(){\r\n // \tlet completer = new Completer();\r\n // \tTimer.run(()=> completer.complete());\r\n // \treturn completer.future;\r\n // }\r\n // void _testSound(AudioBuffer buffer){\r\n // \tlet bs = _context.createBufferSource();\r\n // \tbs.buffer = buffer;\r\n // \tbs.connectNode(_context.destination);\r\n // \tbs.start(0);\r\n // }\r\n // void _testSampleSound(Sample sample){\r\n // \tlet bs = _context.createBufferSource();\r\n // \tlet s = sample;\r\n // \tbs.buffer = s.audioBuffer;\r\n // \tbs.loop = s.loopStart > 0;\r\n // \tbs.loopStart = (s.loopStart) / s.sampleRate;\r\n // \tbs.loopEnd = (s.loopEnd) / s.sampleRate;\r\n // \tbs.connectNode(_context.destination);\r\n // \tbs.start(0);\r\n // \tprint('test pitch: ${s.name}');\r\n // }\r\n _createInstruments() {\r\n let cInstrument;\r\n this._instruments = [];\r\n while (this._instRdr.position < this._instRdr.length) {\r\n cInstrument = new _Sf2Instrument();\r\n cInstrument.name = this._instRdr.readString(20).trim();\r\n this._instRdr.readUint(2);\r\n if (cInstrument.name !== \"EOI\" && cInstrument.name !== \"\") {\r\n this._instruments.push(cInstrument);\r\n } else {\r\n break;\r\n }\r\n this._instRdr.position += 20;\r\n let nextInstrumentsBagStartIndex = this._instRdr.readUint(2);\r\n this._instRdr.position -= 22;\r\n while (this._ibagRdr.position < 4 * nextInstrumentsBagStartIndex) {\r\n let cZone;\r\n if (cInstrument.zones.length > 0) {\r\n cZone = cInstrument.zones[0].isGlobal ? cInstrument.zones[0].clone() : _Sf2Zone.createForInstrument();\r\n } else {\r\n cZone = _Sf2Zone.createForInstrument();\r\n }\r\n cInstrument.zones.push(cZone);\r\n this._ibagRdr.readUint(2);\r\n this._ibagRdr.readUint(2);\r\n let nextZonesGenStartIndex = this._ibagRdr.readUint(2);\r\n let nextZonesModStartIndex = this._ibagRdr.readUint(2);\r\n this._ibagRdr.position -= 4;\r\n while (this._igenRdr.position < 4 * nextZonesGenStartIndex) {\r\n let genEnum = this._igenRdr.readUint(2);\r\n let value;\r\n switch (genEnum) {\r\n case 2:\r\n cZone.startLoopAddrsOffset = this._igenRdr.readInt(2);\r\n break;\r\n case 3:\r\n cZone.endLoopAddrsOffset = this._igenRdr.readInt(2);\r\n break;\r\n case 8:\r\n cZone.initialFilterFc = this._igenRdr.readInt(2);\r\n break;\r\n case 11:\r\n cZone.modEnvToFilterFc = this._igenRdr.readInt(2);\r\n break;\r\n case 13:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 16:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 17:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 22:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 24:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 26:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 29:\r\n value = this._igenRdr.readInt(2);\r\n break;\r\n case 33:\r\n value = this._igenRdr.readInt(2);\r\n cZone.delayVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 34:\r\n value = this._igenRdr.readInt(2);\r\n cZone.attackVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 35:\r\n value = this._igenRdr.readInt(2);\r\n cZone.holdVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 36:\r\n value = this._igenRdr.readInt(2);\r\n cZone.decayVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 37:\r\n value = this._igenRdr.readInt(2);\r\n if (value > 1e3) {\r\n value = 1e3;\r\n } else if (value < 0) {\r\n value = 0;\r\n }\r\n cZone.sustainVolReduction = value / 1e3;\r\n break;\r\n case 38:\r\n value = this._igenRdr.readInt(2);\r\n cZone.releaseVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 43:\r\n cZone.bottomNote = this._igenRdr.readInt(1);\r\n cZone.topNote = this._igenRdr.readInt(1);\r\n break;\r\n case 44:\r\n cZone.bottomVel = this._igenRdr.readInt(1);\r\n cZone.topVel = this._igenRdr.readInt(1);\r\n break;\r\n case 48:\r\n cZone.initialAttenuation = this._igenRdr.readInt(2);\r\n break;\r\n case 51:\r\n cZone.courseTune = this._igenRdr.readInt(2);\r\n break;\r\n case 52:\r\n cZone.fineTune = this._igenRdr.readInt(2) / 100;\r\n break;\r\n case 53:\r\n value = this._igenRdr.readUint(2);\r\n if (this._samples.length > value && value >= 0) {\r\n cZone.sample = this._samples[value];\r\n } else {\r\n console.log(\"no sample for me!\");\r\n }\r\n break;\r\n case 54:\r\n let sampleMode = this._igenRdr.readUint(2);\r\n cZone.loop = sampleMode > 0;\r\n break;\r\n case 58:\r\n value = this._igenRdr.readInt(2);\r\n cZone.overridingRootKey = value;\r\n break;\r\n default:\r\n this._igenRdr.position += 2;\r\n }\r\n }\r\n while (this._imodRdr.position < 10 * nextZonesModStartIndex) {\r\n this._imodRdr.position += 10;\r\n }\r\n if (cZone.sample == null && cInstrument.zones.length === 1) {\r\n cZone.isGlobal = true;\r\n }\r\n }\r\n }\r\n }\r\n _createPresets() {\r\n if (this._presets == null)\r\n this._presets = [];\r\n let cPreset;\r\n let bytesRead = 0;\r\n while (bytesRead < this._phdrRdr.length) {\r\n cPreset = new _Sf2Preset();\r\n cPreset.name = this._phdrRdr.readString(20);\r\n cPreset.presetNumber = this._phdrRdr.readUint(2);\r\n cPreset.bankNumber = this._phdrRdr.readUint(2);\r\n cPreset.presetBagIndex = this._phdrRdr.readUint(2);\r\n cPreset.library = this._phdrRdr.readUint(4);\r\n cPreset.genre = this._phdrRdr.readUint(4);\r\n cPreset.morphology = this._phdrRdr.readUint(4);\r\n if (cPreset.name !== \"EOP\" && cPreset.name !== \"\") {\r\n this._presets.push(cPreset);\r\n } else {\r\n break;\r\n }\r\n this._phdrRdr.position += 24;\r\n let nextPresetBagStartIndex;\r\n try {\r\n nextPresetBagStartIndex = this._phdrRdr.readUint(2);\r\n } catch (e) {\r\n console.log(cPreset.name.charCodeAt(0));\r\n break;\r\n }\r\n this._phdrRdr.position -= 26;\r\n bytesRead += 38;\r\n while (this._pbagRdr.position < 4 * nextPresetBagStartIndex) {\r\n let cZone;\r\n if (cPreset.zones.length > 0) {\r\n cZone = cPreset.zones[0].isGlobal ? cPreset.zones[0].clone() : _Sf2Zone.createForPreset();\r\n } else {\r\n cZone = _Sf2Zone.createForPreset();\r\n }\r\n cPreset.zones.push(cZone);\r\n this._pbagRdr.readUint(2);\r\n this._pbagRdr.readUint(2);\r\n let nextZonesGenStartIndex = this._pbagRdr.readUint(2);\r\n let nextZonesModStartIndex = this._pbagRdr.readUint(2);\r\n this._pbagRdr.position -= 4;\r\n while (this._pgenRdr.position < 4 * nextZonesGenStartIndex) {\r\n let genEnum = this._pgenRdr.readUint(2);\r\n let value;\r\n switch (genEnum) {\r\n case 2:\r\n cZone.startLoopAddrsOffset = this._pgenRdr.readInt(2);\r\n break;\r\n case 3:\r\n cZone.endLoopAddrsOffset = this._pgenRdr.readInt(2);\r\n break;\r\n case 8:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.initialFilterFc = Math.pow(2, value / 1200);\r\n break;\r\n case 11:\r\n cZone.modEnvToFilterFc = this._pgenRdr.readInt(2);\r\n break;\r\n case 13:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 16:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 17:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 22:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 24:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 26:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 29:\r\n value = this._pgenRdr.readInt(2);\r\n break;\r\n case 33:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.delayVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 34:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.attackVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 35:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.holdVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 36:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.decayVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 37:\r\n value = this._pgenRdr.readInt(2);\r\n if (value > 1e3) {\r\n value = 1e3;\r\n } else if (value < 0) {\r\n value = 0;\r\n }\r\n cZone.sustainVolReduction = value / 1e3;\r\n break;\r\n case 38:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.releaseVolEnvTime = Math.pow(2, value / 1200);\r\n break;\r\n case 41:\r\n value = this._pgenRdr.readUint(2);\r\n if (value === -68) {\r\n console.log(\"here\");\r\n }\r\n cZone.instrument = this._instruments[value];\r\n break;\r\n case 43:\r\n cZone.bottomNote = this._pgenRdr.readInt(1);\r\n cZone.topNote = this._pgenRdr.readInt(1);\r\n break;\r\n case 44:\r\n cZone.bottomVel = this._pgenRdr.readInt(1);\r\n cZone.topVel = this._pgenRdr.readInt(1);\r\n break;\r\n case 48:\r\n cZone.initialAttenuation = this._pgenRdr.readInt(2);\r\n break;\r\n case 51:\r\n cZone.courseTune = this._pgenRdr.readInt(2);\r\n break;\r\n case 52:\r\n cZone.fineTune = this._pgenRdr.readInt(2) / 100;\r\n break;\r\n case 54:\r\n let sampleMode = this._pgenRdr.readUint(2);\r\n cZone.loop = sampleMode > 0;\r\n break;\r\n case 58:\r\n value = this._pgenRdr.readInt(2);\r\n cZone.overridingRootKey = value;\r\n break;\r\n default:\r\n this._pgenRdr.position += 2;\r\n }\r\n }\r\n while (this._pmodRdr.position < 10 * nextZonesModStartIndex) {\r\n this._pmodRdr.position += 10;\r\n }\r\n if (cZone.instrument == null && cPreset.zones.length === 1) {\r\n cZone.isGlobal = true;\r\n }\r\n }\r\n }\r\n }\r\n get audioContext() {\r\n return this._context;\r\n }\r\n};\r\nvar _BinaryListReader = class __BinaryListReader {\r\n constructor(arrayBuffer, offsetInBytes, length) {\r\n this._arrayBuffer = arrayBuffer;\r\n this._startIndex = offsetInBytes ?? 0;\r\n this._i = this._startIndex;\r\n this._length = length ?? this._arrayBuffer.byteLength - this._startIndex;\r\n this._byteDataView = new DataView(arrayBuffer, 0);\r\n this._uint8List = new Uint8Array(this._arrayBuffer);\r\n this._textDecoder = new TextDecoder();\r\n }\r\n /**reads a string from the list and moves the read position forward\r\n * by the numBytes*/\r\n readString(numBytes = 4) {\r\n let str = this._textDecoder.decode(this._uint8List.subarray(\r\n this._i,\r\n this._i + numBytes\r\n ));\r\n this._i += numBytes;\r\n return str.replace(/[\\u{0}\\u{7}\\u{1}]/gu, \"\");\r\n }\r\n readInt(numBytes = 1) {\r\n let val;\r\n switch (numBytes) {\r\n case 4:\r\n val = this._byteDataView.getInt32(this._i, true);\r\n break;\r\n case 2:\r\n val = this._byteDataView.getInt16(this._i, true);\r\n break;\r\n case 1:\r\n val = this._byteDataView.getInt8(this._i);\r\n break;\r\n default:\r\n throw \"unsupported number of bytes for integer: $numBytes\";\r\n }\r\n this._i += numBytes;\r\n return val;\r\n }\r\n readUint(numBytes = 1) {\r\n let val;\r\n switch (numBytes) {\r\n case 4:\r\n val = this._byteDataView.getUint32(this._i, true);\r\n break;\r\n case 2:\r\n val = this._byteDataView.getUint16(this._i, true);\r\n break;\r\n case 1:\r\n val = this._byteDataView.getUint8(this._i);\r\n break;\r\n default:\r\n throw \"unsupported number of bytes for integer: $numBytes\";\r\n }\r\n this._i += numBytes;\r\n return val;\r\n }\r\n /**creates a new Uint8ListReader from a range selection of this reader's\r\n * list. The read position is moved forward by offset + length.*/\r\n getRangeAsNewReader(length, offset = 0) {\r\n this._i += offset;\r\n let newReaderStartIndex = this._i;\r\n this._i += length;\r\n return new __BinaryListReader(\r\n this._arrayBuffer,\r\n newReaderStartIndex,\r\n length\r\n );\r\n }\r\n /**gets the current read position*/\r\n get position() {\r\n return this._i - this._startIndex;\r\n }\r\n set position(value) {\r\n this._i = value + this._startIndex;\r\n }\r\n /**gets the total length of the list*/\r\n get length() {\r\n return this._length;\r\n }\r\n};\r\n\r\n// src/sound_lib/sfz/_SfzParser.ts\r\nimport { ArrayUtils, CompressionUtils as CompressionUtils2 } from \"ts_utils\";\r\n\r\n// src/sound_lib/sfz/_SfzPreset.ts\r\nvar _SfzPreset = class extends _BasicPreset {\r\n constructor() {\r\n super(...arguments);\r\n this.regions = [];\r\n ///true if audio data has been decoded and loaded for all samples used by\r\n ///this preset.\r\n this.samplesLoaded = false;\r\n }\r\n};\r\n\r\n// src/sound_lib/sfz/_SfzRegion.ts\r\nvar _SfzRegion = class __SfzRegion {\r\n constructor() {\r\n ///////INPUT CONTROLS FOR TRIGGERING REGION/////////\r\n /**minimum MIDI key 0-127*/\r\n this.lokey = 0;\r\n /**maximum MIDI key 0-127*/\r\n this.hikey = 127;\r\n /**minimum velocity level 0-127*/\r\n this.lovel = 0;\r\n /**maximum velocity level 0-127*/\r\n this.hivel = 127;\r\n /**minimum MIDI channel 1-16*/\r\n this.lochan = 1;\r\n /**maximum MIDI channel 1-16*/\r\n this.hichan = 16;\r\n /**/\r\n ///PERFORMANCE PARAMETERS////////\r\n ///start time, in samples\r\n this.offset = 0;\r\n /**end time, in samples. If -1, sample will not play. If 0 (default), entire \r\n * sample will play.*/\r\n this.end = 0;\r\n /**loop start time, in samples.*/\r\n this.loopStart = 0;\r\n /**loop end time, in samples.*/\r\n this.loopEnd = 0;\r\n /**the loop behavior*/\r\n this.loopMode = 0 /* noLoop */;\r\n /**root key for the sample (60 == C4)*/\r\n this.pitchKeycenter = 60;\r\n /**defines how much the pitch changes with every note in relation to\r\n * [pitchKeycenter]. -1200 to 1200 cents. Defaults to 100*/\r\n this.pitchKeytrack = 100;\r\n /**fine tuning, in cents (-100 to 100)*/\r\n this.tune = 0;\r\n /**transposition in semitones*/\r\n this.transpose = 0;\r\n /**volume in decibels. Max in SFZ is 6, which would result in 2.0 with scale\r\n * calculation below. But converted SF2 files will likely have max of 0, \r\n * which converts to 1.0.\r\n * use 10^(dbVolume/20) to convert to 0.0-1.0 percent scale*/\r\n this.dbVolume = 0;\r\n /**duration, in seconds, before note attack starts*/\r\n this.ampegDelay = 0;\r\n /**start volume (0.0-1.0) (before attack ramp-up)*/\r\n this.ampegStart = 0;\r\n /**duration, in seconds, of attack ramp-up*/\r\n this.ampegAttack = 0;\r\n //duration, in seconds, of steady hold at max percentage\r\n this.ampegHold = 0;\r\n //duration, in seconds, of decay in volume percentage to sustain level\r\n this.ampegDecay = 0;\r\n /**sustain volume (0.0-1.0) (after decay and until note release)*/\r\n this.ampegSustain = 1;\r\n /**duration, in seconds, of fall to 0 volume percentage after note release*/\r\n this.ampegRelease = 0;\r\n /**Filter type*/\r\n this.filType = 0 /* lpf1p */;\r\n /**The filter cutoff resonance value, in decibels.*/\r\n this.resonance = 0;\r\n /**duration, in seconds, before filter attack starts*/\r\n this.filegDelay = 0;\r\n /**start filter % (0.0-1.0) (before attack ramp-up)*/\r\n this.filegStart = 0;\r\n /**duration, in seconds, of attack ramp-up phase for filter*/\r\n this.filegAttack = 0;\r\n //duration, in seconds, of steady hold at max percentage for filter\r\n this.filegHold = 0;\r\n //duration, in seconds, of decay in filter percentage to sustain level\r\n this.filegDecay = 0;\r\n /**sustain filter % (0.0-1.0) (after decay and until note release)*/\r\n this.filegSustain = 1;\r\n /**duration, in seconds, of fall to 0 filter percentage after note release*/\r\n this.filegRelease = 0;\r\n /**depth for the filter EG, in cents (-12000 to 12000)*/\r\n this.filegDepth = 0;\r\n }\r\n clone() {\r\n let r = new __SfzRegion();\r\n r.sample = this.sample;\r\n r.lokey = this.lokey;\r\n r.hikey = this.hikey;\r\n r.lovel = this.lovel;\r\n r.hivel = this.hivel;\r\n r.lochan = this.lochan;\r\n r.hichan = this.hichan;\r\n r.offset = this.offset;\r\n r.end = this.end;\r\n r.loopStart = this.loopStart;\r\n r.loopEnd = this.loopEnd;\r\n r.loopMode = this.loopMode;\r\n r.pitchKeycenter = this.pitchKeycenter;\r\n r.pitchKeytrack = this.pitchKeytrack;\r\n r.tune = this.tune;\r\n r.transpose = this.transpose;\r\n r.ampegDelay = this.ampegDelay;\r\n r.ampegStart = this.ampegStart;\r\n r.ampegAttack = this.ampegAttack;\r\n r.ampegHold = this.ampegHold;\r\n r.ampegDecay = this.ampegDecay;\r\n r.ampegSustain = this.ampegSustain;\r\n r.ampegRelease = this.ampegRelease;\r\n r.filType = this.filType;\r\n r.cutoff = this.cutoff;\r\n r.resonance = this.resonance;\r\n r.filegDelay = this.filegDelay;\r\n r.filegStart = this.filegStart;\r\n r.filegAttack = this.filegAttack;\r\n r.filegHold = this.filegHold;\r\n r.filegDecay = this.filegDecay;\r\n r.filegSustain = this.filegSustain;\r\n r.filegRelease = this.filegRelease;\r\n r.filegDepth = this.filegDepth;\r\n return r;\r\n }\r\n setLoopModeFromSfzValue(sfzLoopValue) {\r\n switch (sfzLoopValue) {\r\n case \"no_loop\":\r\n this.loopMode = 0 /* noLoop */;\r\n return;\r\n case \"one_shot\":\r\n this.loopMode = 1 /* oneShot */;\r\n return;\r\n case \"loop_continuous\":\r\n this.loopMode = 2 /* loopContinuous */;\r\n return;\r\n case \"loop_sustain\":\r\n this.loopMode = 3 /* loopSustain */;\r\n return;\r\n default:\r\n console.log(`unknown loop mode: ${sfzLoopValue}`);\r\n }\r\n }\r\n setFilterTypeFromSfzValue(sfzLoopValue) {\r\n switch (sfzLoopValue) {\r\n case \"lpf_1p\":\r\n this.filType = 0 /* lpf1p */;\r\n return;\r\n case \"hpf_1p\":\r\n this.filType = 1 /* hpf1p */;\r\n return;\r\n case \"lpf_2p\":\r\n this.filType = 2 /* lpf2p */;\r\n return;\r\n case \"hpf_2p\":\r\n this.filType = 3 /* hpf2p */;\r\n return;\r\n case \"bpf_2p\":\r\n this.filType = 4 /* bpf2p */;\r\n return;\r\n case \"brf_2p\":\r\n this.filType = 5 /* brf2p */;\r\n return;\r\n }\r\n }\r\n};\r\n\r\n// src/sound_lib/sfz/_SfzSample.ts\r\nimport { CompressionUtils, ConversionUtils } from \"ts_utils\";\r\nvar _SfzSample = class {\r\n async loadAudio(context) {\r\n if (this._buffer != null)\r\n return;\r\n try {\r\n let blob = await CompressionUtils.getBlobFromEntry(this._zipEntry);\r\n let ab = await ConversionUtils.getArrayBufferFromBinaryBlob(blob);\r\n this._getSampleRate(ab);\r\n this._buffer = await context.decodeAudioData(ab);\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n }\r\n _getSampleRate(arrayBuffer) {\r\n if (this._path.endsWith(\".ogg\")) {\r\n let dataView = new DataView(arrayBuffer, 40, 4);\r\n this._sampleRate = dataView.getInt32(0, true);\r\n } else if (this._path.endsWith(\".wav\")) {\r\n let dataView = new DataView(arrayBuffer, 24, 4);\r\n this._sampleRate = dataView.getInt32(0, true);\r\n }\r\n }\r\n};\r\n\r\n// src/sound_lib/sfz/_SfzParser.ts\r\nvar _SfzParser = class {\r\n constructor() {\r\n this._presets = [];\r\n this._samples = [];\r\n }\r\n /**/\r\n ////////////////////////////////////*/\r\n _SfzParser() {\r\n }\r\n /**Performs initial unpacking of Sfz.zip file, creating initial preset and \r\n * sample objects. Instruments are not completely parsed or loaded to save \r\n * processing. Use [parseAndLoadAllPresets] or [parseAndLoadPreset] to load \r\n * instruments for playback.*/\r\n async initSfz(sfzZip) {\r\n let entries = await CompressionUtils2.unzip(sfzZip);\r\n await this._getPresetsAndSamplesFromEntries(entries);\r\n }\r\n async parseAndLoadAllPresets() {\r\n for (let preset of this._presets) {\r\n await this.parseAndLoadPreset(preset);\r\n }\r\n }\r\n async parseAndLoadPreset(preset) {\r\n if (preset.samplesLoaded)\r\n return;\r\n this._parsePreset(preset);\r\n await this._loadSamples(preset);\r\n }\r\n getPreset(bank, presetNumber) {\r\n return ArrayUtils.lastWhere(this._presets, (p) => {\r\n return p.bankNumber === bank && p.presetNumber === presetNumber;\r\n });\r\n }\r\n async _getPresetsAndSamplesFromEntries(entries) {\r\n entries.sort((e1, e2) => e1.filename.localeCompare(e2.filename));\r\n let currentBank = 0;\r\n for (let e of entries) {\r\n if (e.directory) {\r\n let path = e.filename;\r\n if (path.length >= 5) {\r\n let end = path.substring(path.length - 5);\r\n if (/\\/\\d\\d\\d\\//.test(end)) {\r\n currentBank = Number.parseInt(end.substring(1, 4));\r\n }\r\n }\r\n } else if (e.filename.endsWith(\".wav\") || e.filename.endsWith(\"ogg\") || e.filename.endsWith(\".mp3\")) {\r\n var sample = new _SfzSample();\r\n sample._path = e.filename;\r\n sample._zipEntry = e;\r\n this._samples.push(sample);\r\n } else if (e.filename.endsWith(\".sfz\")) {\r\n let sfz = await CompressionUtils2.getStringFromEntry(e);\r\n var preset = new _SfzPreset();\r\n preset.sfz = sfz;\r\n preset.bankNumber = currentBank;\r\n let index = e.filename.lastIndexOf(\"/\") + 1;\r\n preset.presetNumber = Number.parseInt(e.filename.substring(index, index + 3));\r\n this._presets.push(preset);\r\n }\r\n }\r\n }\r\n _parsePreset(preset) {\r\n this._currentPreset = preset;\r\n let data = preset.sfz.replace(/\\/\\/.*/g, \"\");\r\n let lines = data.split(/[\\n\\r]/);\r\n for (let line of lines) {\r\n let i = 0;\r\n let length = line.length;\r\n while (i < length) {\r\n let char = line[i];\r\n if (char === \" \" || char === \"\t\") {\r\n i++;\r\n continue;\r\n } else if (char === \"<\") {\r\n let endIndex = this._processHeader(line, i);\r\n if (endIndex === -1) {\r\n break;\r\n }\r\n i = endIndex + 1;\r\n } else {\r\n let endIndex = this._processOpcode(line, i);\r\n if (endIndex === -1) {\r\n break;\r\n }\r\n i = endIndex + 1;\r\n }\r\n }\r\n }\r\n }\r\n _processHeader(line, startIndex) {\r\n let endIndex = line.indexOf(\">\", startIndex + 1);\r\n if (endIndex === -1)\r\n return -1;\r\n let header = line.substring(startIndex + 1, endIndex);\r\n switch (header) {\r\n case \"global\":\r\n this._global = new _SfzRegion();\r\n this._group = null;\r\n this._region = null;\r\n break;\r\n case \"group\":\r\n this._group = this._global != null ? this._global.clone() : new _SfzRegion();\r\n this._region = null;\r\n break;\r\n case \"region\":\r\n if (this._group != null) {\r\n this._region = this._group.clone();\r\n } else if (this._global != null) {\r\n this._region = this._global.clone();\r\n } else {\r\n this._region = new _SfzRegion();\r\n }\r\n this._currentPreset.regions.push(this._region);\r\n break;\r\n default:\r\n console.log(\"unsupported header: $header\");\r\n }\r\n return endIndex;\r\n }\r\n _processOpcode(line, startIndex) {\r\n let equalsIndex = line.indexOf(\"=\", startIndex);\r\n if (equalsIndex === -1 || equalsIndex >= line.length - 1) {\r\n return -1;\r\n }\r\n let reg = this._region;\r\n if (reg == null) {\r\n reg = this._group || this._global;\r\n }\r\n let opcode = line.substring(startIndex, equalsIndex);\r\n let value = line.substring(equalsIndex + 1);\r\n let endIndex = line.length - 1;\r\n if (opcode !== \"sample\") {\r\n let spaceIndex = value.search(/\\s/);\r\n if (spaceIndex > -1 && spaceIndex < value.length - 1) {\r\n value = value.substring(0, spaceIndex);\r\n endIndex = equalsIndex + 1 + spaceIndex;\r\n }\r\n }\r\n switch (opcode) {\r\n case \"sample\":\r\n value = value.replace(/\\\\/g, \"/\");\r\n let index = value.lastIndexOf(\"../\");\r\n index = index > -1 ? index + 3 : 0;\r\n let filePath = value.substring(index, value.length - 3);\r\n let sample = this._samples.find((s) => {\r\n return s._path.includes(filePath);\r\n });\r\n if (sample != null)\r\n reg.sample = sample;\r\n break;\r\n case \"lokey\":\r\n reg.lokey = Number.parseInt(value);\r\n break;\r\n case \"hikey\":\r\n reg.hikey = Number.parseInt(value);\r\n break;\r\n case \"lovel\":\r\n reg.lovel = Number.parseInt(value);\r\n break;\r\n case \"hivel\":\r\n reg.hivel = Number.parseInt(value);\r\n break;\r\n case \"lochan\":\r\n reg.lochan = Number.parseInt(value);\r\n break;\r\n case \"hichan\":\r\n reg.hichan = Number.parseInt(value);\r\n break;\r\n case \"group\":\r\n break;\r\n case \"off_by\":\r\n break;\r\n case \"offset\":\r\n reg.offset = Number.parseInt(value);\r\n break;\r\n case \"end\":\r\n reg.end = Number.parseInt(value);\r\n break;\r\n case \"loop_start\":\r\n reg.loopStart = Number.parseInt(value);\r\n break;\r\n case \"loop_end\":\r\n reg.loopEnd = Number.parseInt(value) + 1;\r\n break;\r\n case \"loop_mode\":\r\n reg.setLoopModeFromSfzValue(value);\r\n break;\r\n case \"pitch_keycenter\":\r\n reg.pitchKeycenter = Number.parseInt(value);\r\n break;\r\n case \"pitch_keytrack\":\r\n reg.pitchKeytrack = Number.parseInt(value);\r\n break;\r\n case \"tune\":\r\n reg.tune = Number.parseInt(value);\r\n break;\r\n case \"transpose\":\r\n reg.transpose = Number.parseInt(value);\r\n break;\r\n case \"ampeg_delay\":\r\n reg.ampegDelay = Number.parseFloat(value);\r\n break;\r\n case \"ampeg_start\":\r\n reg.ampegStart = Number.parseFloat(value) / 100;\r\n break;\r\n case \"ampeg_attack\":\r\n reg.ampegAttack = Number.parseFloat(value);\r\n break;\r\n case \"ampeg_hold\":\r\n reg.ampegHold = Number.parseFloat(value);\r\n break;\r\n case \"ampeg_decay\":\r\n reg.ampegDecay = Number.parseFloat(value);\r\n break;\r\n case \"ampeg_sustain\":\r\n reg.ampegSustain = Number.parseFloat(value) / 100;\r\n break;\r\n case \"ampeg_release\":\r\n reg.ampegRelease = Number.parseFloat(value);\r\n break;\r\n case \"ampeg_holdcc133\":\r\n break;\r\n case \"ampeg_decaycc133\":\r\n break;\r\n case \"pitcheg_delay\":\r\n break;\r\n case \"pitcheg_attack\":\r\n break;\r\n case \"pitcheg_hold\":\r\n break;\r\n case \"pitcheg_decay\":\r\n break;\r\n case \"pitcheg_sustain\":\r\n break;\r\n case \"pitcheg_release\":\r\n break;\r\n case \"pitcheg_depth\":\r\n break;\r\n case \"pitcheg_holdcc133\":\r\n break;\r\n case \"pitcheg_decaycc133\":\r\n break;\r\n case \"fileg_delay\":\r\n reg.filegDelay = Number.parseFloat(value);\r\n break;\r\n case \"fileg_start\":\r\n reg.filegStart = Number.parseFloat(value) / 100;\r\n break;\r\n case \"fileg_attack\":\r\n reg.filegAttack = Number.parseFloat(value);\r\n break;\r\n case \"fileg_hold\":\r\n reg.filegHold = Number.parseFloat(value);\r\n break;\r\n case \"fileg_decay\":\r\n reg.filegDecay = Number.parseFloat(value);\r\n break;\r\n case \"fileg_sustain\":\r\n reg.filegSustain = Number.parseFloat(value) / 100;\r\n break;\r\n case \"fileg_release\":\r\n reg.filegRelease = Number.parseFloat(value);\r\n break;\r\n case \"fileg_depth\":\r\n reg.filegDepth = Number.parseInt(value);\r\n break;\r\n case \"fileg_holdcc133\":\r\n break;\r\n case \"fileg_decaycc133\":\r\n break;\r\n case \"fil_type\":\r\n reg.setFilterTypeFromSfzValue(value);\r\n break;\r\n case \"cutoff\":\r\n reg.cutoff = Number.parseFloat(value);\r\n break;\r\n case \"resonance\":\r\n reg.resonance = Number.parseFloat(value);\r\n break;\r\n case \"volume\":\r\n reg.dbVolume = Number.parseFloat(value);\r\n break;\r\n case \"pan\":\r\n break;\r\n case \"amplfo_delay\":\r\n break;\r\n case \"amplfo_freq\":\r\n break;\r\n case \"amplfo_depth\":\r\n break;\r\n case \"fillfo_delay\":\r\n break;\r\n case \"fillfo_freq\":\r\n break;\r\n case \"fillfo_depth\":\r\n break;\r\n case \"pitchlfo_delay\":\r\n break;\r\n case \"pitchlfo_freq\":\r\n break;\r\n case \"pitchlfo_depth\":\r\n break;\r\n case \"effect1\":\r\n break;\r\n case \"effect2\":\r\n break;\r\n default:\r\n console.log(\"unsupported opcode: $opcode\");\r\n }\r\n return endIndex;\r\n }\r\n async _loadSamples(preset) {\r\n if (preset.samplesLoaded)\r\n return;\r\n let context = SoundLibManager.get().context;\r\n for (let reg of preset.regions) {\r\n await reg.sample.loadAudio(context);\r\n }\r\n preset.samplesLoaded = true;\r\n }\r\n};\r\n\r\n// src/sound_lib/core/SoundLibEvent.ts\r\nvar SoundLibEvent = class {\r\n constructor(type) {\r\n this.type = type;\r\n }\r\n};\r\nvar SoundLibEventType = /* @__PURE__ */ ((SoundLibEventType2) => {\r\n SoundLibEventType2[SoundLibEventType2[\"loadingSoundMap\"] = 0] = \"loadingSoundMap\";\r\n SoundLibEventType2[SoundLibEventType2[\"soundMapLoaded\"] = 1] = \"soundMapLoaded\";\r\n SoundLibEventType2[SoundLibEventType2[\"loadProgress\"] = 2] = \"loadProgress\";\r\n SoundLibEventType2[SoundLibEventType2[\"parsing\"] = 3] = \"parsing\";\r\n SoundLibEventType2[SoundLibEventType2[\"libraryReady\"] = 4] = \"libraryReady\";\r\n SoundLibEventType2[SoundLibEventType2[\"playbackFinished\"] = 5] = \"playbackFinished\";\r\n SoundLibEventType2[SoundLibEventType2[\"noteSetComplete\"] = 6] = \"noteSetComplete\";\r\n return SoundLibEventType2;\r\n})(SoundLibEventType || {});\r\n\r\n// src/sound_lib/core/SoundLibType.ts\r\nvar SoundLibType = /* @__PURE__ */ ((SoundLibType2) => {\r\n SoundLibType2[SoundLibType2[\"SF\"] = 0] = \"SF\";\r\n SoundLibType2[SoundLibType2[\"SFZ\"] = 1] = \"SFZ\";\r\n return SoundLibType2;\r\n})(SoundLibType || {});\r\n\r\n// src/sound_lib/core/_SoundMapFileEntry.ts\r\nvar _SoundMapFileEntry = class {\r\n constructor() {\r\n this._loaded = false;\r\n this._presets = [];\r\n }\r\n};\r\n\r\n// src/sound_lib/core/_SoundMapPresetEntry.ts\r\nvar _SoundMapPresetEntry = class {\r\n};\r\n\r\n// src/sound_lib/core/_SoundMap.ts\r\nvar _SoundMap = class {\r\n /**Constructs a new [_SoundMap]. The [_mapUrl] should be the path to the\r\n * json map file. The [json] should be formatted as follows:\r\n * ```\r\n * {\r\n * \t\"id\": \"pianosDrums\", \"type\": \"sfz\", \"files\":\r\n * \t[\r\n * \t\t{ \"name\": \"pianos_ogg.zip\", \"version\": 1, \"presets\": \r\n * \t\t\t[\r\n * \t\t\t\t{ \"bank\": 0, \"preset\": 0 },\r\n * \t\t\t\t{ \"bank\": 0, \"preset\": 1 }\r\n * \t\t\t]\r\n * \t\t},\r\n * \t\t{ \"name\": \"drums_ogg.zip\", \"version\": 1, \"presets\": \r\n * \t\t\t[\r\n * \t\t\t\t{ \"bank\": 128, \"preset\": 0 }\r\n * \t\t\t]\r\n * \t\t}\r\n * \t]\r\n * }\r\n * ```\r\n * The id should be unique so it can act as a db prefix for files.\r\n * Each file entry in the json points to a .zip file or .sf2/.sf3 file. In\r\n * the case of .zip files for SFZ libraries, the folder structure should\r\n * place presets in folders named by their bank numbers. Samples can be\r\n * in a folder anywhere, but typically the samples folder will be at the\r\n * top level of the folder. SFZ folder/file example for map above: \r\n * ```\r\n * [sfzMap]\r\n * \t[map.json]\r\n * \t[pianos_ogg.zip]\r\n * \t\t[000]\r\n * \t\t\t[000_Stereo Grand.sfz]\r\n * \t\t\t[001_Bright Grand.sfz]\r\n * \t\t[samples]\r\n * \t\t\t[Grand Piano-A#1.ogg]\r\n * \t\t\t...\r\n * \t[drums_ogg.zip]\r\n * \t\t[128]\r\n * \t\t\t[000_Standard+Orch.sfz]\r\n * \t\t[samples]\r\n * \t\t\t[Agogo.ogg]\r\n * \t\t\t...\r\n * ```\r\n * \r\n * SF example:\r\n * ```\r\n * [sf2Map]\r\n * \t[map.json]\r\n * \t[pianos.sf2]\r\n * \t[drums.sf2]\r\n * ```\r\n * */\r\n constructor(mapUrl, json) {\r\n /**package internal use */\r\n this._fileEntries = [];\r\n this._mapUrl = mapUrl;\r\n try {\r\n this._id = json[\"id\"];\r\n if (!this._id) {\r\n throw \"a unique sound map id must be provided!\";\r\n }\r\n let libType = json[\"type\"].toLowerCase();\r\n if (libType === \"sfz\") {\r\n this._type = 1 /* SFZ */;\r\n } else if (libType === \"sf\") {\r\n this._type = 0 /* SF */;\r\n } else {\r\n this._isValid = false;\r\n throw \"type in sound lib json must be sf or sfz\";\r\n }\r\n for (let fileJson of json[\"files\"]) {\r\n let fileEntry = new _SoundMapFileEntry();\r\n fileEntry._name = fileJson[\"name\"];\r\n fileEntry._version = fileJson[\"version\"];\r\n for (let presetJson of fileJson[\"presets\"]) {\r\n let preset = new _SoundMapPresetEntry();\r\n preset._bank = presetJson[\"bank\"];\r\n preset._preset = presetJson[\"preset\"];\r\n fileEntry._presets.push(preset);\r\n }\r\n this._fileEntries.push(fileEntry);\r\n }\r\n this._isValid = true;\r\n } catch (err) {\r\n console.log(err);\r\n this._isValid = false;\r\n }\r\n }\r\n /**Gets the first [_SoundMapFileEntry] containing a preset that matches the\r\n * requested [bank] and [preset]. If none is found, null is returned;*/\r\n _getFileMatchingPreset(bank, preset) {\r\n for (let fileEntry of this._fileEntries) {\r\n for (let presetEntry of fileEntry._presets) {\r\n if (presetEntry._bank === bank && presetEntry._preset === preset) {\r\n return fileEntry;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n};\r\n\r\n// src/sound_lib/core/_SoundLibLoader.ts\r\nvar _SoundLibLoader = class {\r\n constructor() {\r\n this._idbConfig = {\r\n \"dbName\": \"\",\r\n //must be provided via _dbName\r\n \"version\": 1,\r\n \"deleteOldVersionStores\": true,\r\n \"objectStores\": [\r\n {\r\n \"name\": \"soundlibfiles\",\r\n \"keypath\": \"id\",\r\n \"indexes\": [\r\n {\r\n \"name\": \"filename\",\r\n \"keypath\": \"filename\",\r\n \"unique\": false\r\n },\r\n {\r\n \"name\": \"version\",\r\n \"keypath\": \"version\",\r\n \"unique\": false\r\n },\r\n {\r\n \"name\": \"blob\",\r\n \"keypath\": \"blob\",\r\n \"unique\": false\r\n }\r\n ]\r\n }\r\n ]\r\n };\r\n this._slm = SoundLibManager.get();\r\n this._init();\r\n }\r\n async loadSoundMap(path) {\r\n let ev = new SoundLibEvent(0 /* loadingSoundMap */);\r\n this._slm._dispatch(ev);\r\n try {\r\n let jsonString = await HttpUtils.getString(path);\r\n let json = JsonUtils.decode(jsonString);\r\n this._soundMap = new _SoundMap(path, json);\r\n if (this._soundMap._isValid) {\r\n if (this._slm._libType === this._soundMap._type) {\r\n this._slm._dispatch(new SoundLibEvent(\r\n 1 /* soundMapLoaded */\r\n ));\r\n } else {\r\n throw \"sound lib json type does not match SoundLibManager\";\r\n }\r\n } else {\r\n throw \"invalid sound map file\";\r\n }\r\n } catch (err) {\r\n console.log(err.toString());\r\n }\r\n }\r\n async loadLibrary(path, loadSfzPresets = true, fileVersion = null) {\r\n this._checkType(path);\r\n let bb = await this._getSfxFile(path, fileVersion);\r\n this._slm._dispatch(new SoundLibEvent(3 /* parsing */));\r\n if (this._slm._libType === 1 /* SFZ */) {\r\n await this._parser.initSfz(bb);\r\n if (loadSfzPresets) {\r\n await this._parser.parseAndLoadAllPresets();\r\n }\r\n } else if (this._slm._libType === 0 /* SF */) {\r\n let compressed = path.endsWith(\".sf3\") || path.endsWith(\".sf4\");\r\n await this._parser.parse(bb, compressed);\r\n }\r\n this._slm._dispatch(new SoundLibEvent(4 /* libraryReady */));\r\n }\r\n async loadPresets(bankPresetPairs) {\r\n let mapDir;\r\n if (this._soundMap != null) {\r\n mapDir = BrowserUtils.getFolderPathToFile(this._soundMap._mapUrl);\r\n }\r\n for (let i = 0; i < bankPresetPairs.length - 1; i += 2) {\r\n let bankNum = bankPresetPairs[i];\r\n let presetNum = bankPresetPairs[i + 1];\r\n let preset = this._parser.getPreset(bankNum, presetNum);\r\n if (preset != null) {\r\n if (this._slm._libType === 1 /* SFZ */) {\r\n if (!preset.samplesLoaded) {\r\n await this._parser.parseAndLoadPreset(preset);\r\n }\r\n }\r\n } else {\r\n let fileEntry = this._soundMap?._getFileMatchingPreset(\r\n bankNum,\r\n presetNum\r\n );\r\n if (fileEntry != null) {\r\n await this.loadLibrary(\r\n `${mapDir}${fileEntry._name}`,\r\n true,\r\n fileEntry._version\r\n );\r\n fileEntry._loaded = true;\r\n } else {\r\n throw `bank: ${bankNum}, preset: ${presetNum} is not available`;\r\n }\r\n }\r\n }\r\n }\r\n async loadAllPresets() {\r\n if (this._slm._libType === 1 /* SFZ */) {\r\n let presets = this._parser._presets;\r\n for (let p of presets) {\r\n if (!p.samplesLoaded) {\r\n await this._parser.parseAndLoadPreset(p);\r\n }\r\n }\r\n }\r\n if (this._soundMap != null) {\r\n let mapDir = BrowserUtils.getFolderPathToFile(\r\n this._soundMap._mapUrl\r\n );\r\n for (let fileEntry of this._soundMap._fileEntries) {\r\n if (!fileEntry._loaded) {\r\n await this.loadLibrary(\r\n `${mapDir}${fileEntry._name}`,\r\n true,\r\n fileEntry._version\r\n );\r\n fileEntry._loaded = true;\r\n }\r\n }\r\n }\r\n }\r\n hasPreset(bankNumber, presetNumber) {\r\n return this._parser.getPreset(bankNumber, presetNumber) != null;\r\n }\r\n getPreset(bankNumber, presetNumber) {\r\n return this._parser.getPreset(bankNumber, presetNumber);\r\n }\r\n _init() {\r\n if (this._slm._libType === 0 /* SF */) {\r\n this._parser = new _Sf2Parser(this._slm.context);\r\n } else if (this._slm._libType === 1 /* SFZ */) {\r\n this._parser = new _SfzParser();\r\n }\r\n }\r\n async _getSfxFile(path, fileVersion) {\r\n let progressCallback;\r\n SoundLoader.downloadProgress.on(progressCallback = (e) => {\r\n let event = new SoundLibEvent(2 /* loadProgress */);\r\n event.progress = e;\r\n this._slm._dispatch(event);\r\n });\r\n let ab;\r\n if (this._dbName != null && IdxDbManager.isSupported) {\r\n ab = await this._loadFromDb(path, fileVersion);\r\n } else {\r\n ab = await this._downloadArrayBuffer(path);\r\n }\r\n SoundLoader.downloadProgress.off(progressCallback);\r\n return ab;\r\n }\r\n _checkType(libPath) {\r\n if (this._slm._libType === 1 /* SFZ */) {\r\n if (!libPath.endsWith(\".zip\")) {\r\n throw \"Invalid SFZ file name - must end in .zip\";\r\n }\r\n } else if (this._slm._libType === 0 /* SF */) {\r\n if (!libPath.endsWith(\".sf2\") && !libPath.endsWith(\".sf3\") && !libPath.endsWith(\".sf4\")) {\r\n throw \"Invalid SF file name - must end in .sf2, .sf3, or .sf4\";\r\n }\r\n }\r\n }\r\n async _downloadArrayBuffer(path) {\r\n return await SoundLoader.getArrayBufferFromUrl(path);\r\n }\r\n async _loadFromDb(path, fileVersion) {\r\n if (this._idbManager == null) {\r\n this._idbConfig[\"dbName\"] = this._dbName;\r\n this._idbManager = new IdxDbManager(this._idbConfig);\r\n }\r\n try {\r\n let response = await this._idbManager.open();\r\n if (!response.success) {\r\n return await this._downloadArrayBuffer(path);\r\n }\r\n let blob;\r\n let key = `${this._soundMap._id}_${path}`;\r\n response = await this._idbManager.getRecord(\"soundlibfiles\", key);\r\n if (!response.success) {\r\n console.log(response.error);\r\n return await this._downloadArrayBuffer(path);\r\n } else if (response.record == null) {\r\n let bb = await this._downloadArrayBuffer(path);\r\n blob = new Blob([bb]);\r\n await this._createRecord(blob, key, fileVersion);\r\n } else if (response.record[\"version\"] !== fileVersion) {\r\n let bb = await this._downloadArrayBuffer(path);\r\n blob = new Blob([bb]);\r\n await this._updateRecord(blob, response.record, fileVersion);\r\n } else {\r\n blob = response.record[\"blob\"];\r\n }\r\n return await ConversionUtils2.getArrayBufferFromBinaryBlob(blob);\r\n } catch (err) {\r\n console.log(err);\r\n return await this._downloadArrayBuffer(path);\r\n }\r\n }\r\n async _createRecord(blob, key, version) {\r\n let record = {\r\n \"id\": key,\r\n \"filename\": key,\r\n \"version\": version,\r\n \"blob\": blob\r\n };\r\n await this._idbManager.addRecord(\"soundlibfiles\", record);\r\n }\r\n async _updateRecord(blob, record, version) {\r\n record[\"blob\"] = blob;\r\n record[\"version\"] = version;\r\n await this._idbManager.updateRecord(\"soundlibfiles\", record);\r\n }\r\n};\r\n\r\n// src/sound_lib/playback/PerformanceNoteDO.ts\r\nvar PerformanceNoteDO = class _PerformanceNoteDO {\r\n constructor() {\r\n /**in seconds, from the beginning of the performance*/\r\n this.startTime = 0;\r\n /**in seconds, from the beginning of the performance. The endTime includes\r\n * the release, so endTime - startTime will typically be > \r\n * durationRequested*/\r\n this.endTime = 0;\r\n /**the start position of this note's sample data in the loaded SoundFont\r\n * audio file*/\r\n this.sfAudioStartPos = 0;\r\n /**the end position of this note's sample data in the loaded SoundFont audio\r\n * file*/\r\n this.sfAudioEndPos = 0;\r\n this.position = 0;\r\n //int sampleRate = 44100;\r\n /**added 8/10/2017 - the factor the playback rate will need to be multiplied\r\n * by to transpose the sample's original pitch to the desired pitch*/\r\n this.pitchStretchRatio = 1;\r\n this.sampleDebt = 0;\r\n /**in samples. Not truncated to number, because player converts this to\r\n * seconds*/\r\n this.loopStartPos = 0;\r\n /**in samples. Not truncated to number, because player converts this to\r\n * seconds*/\r\n this.loopEndPos = 0;\r\n this.leftVolume = 0;\r\n this.rightVolume = 0;\r\n this.fadeInSamples = 0;\r\n this.fadeOutSamples = 0;\r\n this.loop = false;\r\n //values used for envelope volume calculation\r\n /**the total amount of time the note has been played, in seconds -\r\n * does not reset with loop*/\r\n this.totalTimePlayed = 0;\r\n this.attackStartTime = 0;\r\n this.holdStartTime = 0;\r\n this.decayStartTime = 0;\r\n this.decayEndTime = 0;\r\n this.sustainVolReduction = 0;\r\n //0 to 1\r\n /**the volume we were at before the release phase started - must be tracked\r\n * in case a note ends before its envelopes finish*/\r\n this.preReleaseVol = 0;\r\n this.releaseStartTime = 0;\r\n this.amplitude = 1;\r\n this.pan = 0;\r\n /** if the player supports multiple mixing tracks, as in for per-track\r\n * volume settings, the [trackId] associates the note with a track.*/\r\n this.trackId = 0;\r\n }\r\n /** creates one or more performance notes\r\n * @param\tmidiNote 0-127 - 60 is middle C\r\n * @param\tstartTime start time, in seconds\r\n * @param\tduration duration, in seconds\r\n * @param\tamplitude a value from 0 to 1 representing base volume level\r\n * @param\tpan a value from 0 to 1 representing pan (0 is all the way to\r\n * \tthe left, 1 is all the way to the right)*/\r\n static createPerformanceNote(ndo, preset) {\r\n let notes = [];\r\n let midiVel = Math.round(ndo.amplitude * 127);\r\n for (let pZone of preset.zones) {\r\n if (pZone.bottomNote > ndo.midiNote || pZone.topNote < ndo.midiNote || pZone.instrument == null || pZone.bottomVel > midiVel || pZone.topVel < midiVel) {\r\n continue;\r\n }\r\n for (let iZone of pZone.instrument.zones) {\r\n if (iZone.bottomNote > ndo.midiNote || iZone.topNote < ndo.midiNote || iZone.sample == null || iZone.bottomVel > midiVel || iZone.topVel < midiVel) {\r\n continue;\r\n }\r\n notes.push(_PerformanceNoteDO._getNoteFromZones(\r\n pZone,\r\n iZone,\r\n ndo,\r\n preset\r\n ));\r\n }\r\n }\r\n return notes;\r\n }\r\n static _getNoteFromZones(pz, iz, ndo, preset) {\r\n let sample = iz.sample;\r\n let pNoteDO = new _PerformanceNoteDO();\r\n pNoteDO.preset = preset;\r\n pNoteDO.startTime = ndo.startTime;\r\n pNoteDO.endTime = ndo.startTime + ndo.duration;\r\n pNoteDO.durationRequested = ndo.duration;\r\n pNoteDO.audioBuffer = sample.audioBuffer;\r\n pNoteDO.sfAudioStartPos = sample.start;\r\n pNoteDO.sfAudioEndPos = sample.end;\r\n pNoteDO.position = pNoteDO.sfAudioStartPos;\r\n pNoteDO.trackId = ndo.trackId ?? 0;\r\n let sampleRootPitch = sample.originalPitch - sample.pitchCorrection / 100;\r\n if (pz.overridingRootKey > 0) {\r\n sampleRootPitch = pz.overridingRootKey;\r\n } else if (iz.overridingRootKey > 0) {\r\n sampleRootPitch = iz.overridingRootKey;\r\n }\r\n pNoteDO.pitchStretchRatio = Math.pow(2, (ndo.midiNote + iz.fineTune + pz.fineTune + iz.courseTune + pz.courseTune - sampleRootPitch) / 12);\r\n if (iz.loop) {\r\n pNoteDO.loopStartPos = iz.startLoopAddrsOffset + pz.startLoopAddrsOffset + sample.loopStart;\r\n pNoteDO.loopEndPos = iz.endLoopAddrsOffset + pz.endLoopAddrsOffset + sample.loopEnd;\r\n }\r\n pNoteDO.loop = iz.loop;\r\n let lowpassCents = iz.initialFilterFc + iz.modEnvToFilterFc + pz.modEnvToFilterFc;\r\n let delta = (lowpassCents - 6900) / 100;\r\n let lowpassFreq = Math.pow(2, delta / 12) * 440;\r\n lowpassFreq *= pz.initialFilterFc;\r\n if (lowpassFreq >= 20 && lowpassFreq <= 2e4) {\r\n pNoteDO.lowpassFreq = lowpassFreq;\r\n pNoteDO.filterMap = /* @__PURE__ */ new Map([[0, lowpassFreq]]);\r\n }\r\n let dbVelocityAmplitude = 20 * Math.log(ndo.amplitude);\r\n let dbPeakAmplitude = dbVelocityAmplitude - (iz.initialAttenuation + pz.initialAttenuation) / 10;\r\n let peakAmplitude = Math.pow(10, dbPeakAmplitude / 20);\r\n if (peakAmplitude > 1) {\r\n peakAmplitude = 1;\r\n }\r\n let fullDecayDur = iz.decayVolEnvTime * pz.decayVolEnvTime;\r\n let dbVolReduction = (iz.sustainVolReduction + pz.sustainVolReduction) * 100;\r\n let dbSustainLevel = -dbVolReduction;\r\n let releaseTime = iz.releaseVolEnvTime * pz.releaseVolEnvTime;\r\n let map = this._createTimeValueMap(\r\n 0,\r\n pz.delayVolEnvTime * iz.delayVolEnvTime,\r\n 0,\r\n pz.attackVolEnvTime * iz.attackVolEnvTime,\r\n peakAmplitude,\r\n pz.holdVolEnvTime * iz.holdVolEnvTime,\r\n fullDecayDur,\r\n Math.pow(10, dbSustainLevel / 20),\r\n Math.min(releaseTime, 4),\r\n ndo.duration,\r\n 0\r\n );\r\n for (let k of map.keys()) {\r\n let v = map.get(k);\r\n if (v > 1 || v < 0 || Number.isNaN(v)) {\r\n console.log(`volume:${v}`);\r\n }\r\n if (k < 0 || k > 10) {\r\n console.log(`time:${k}`);\r\n }\r\n }\r\n pNoteDO.endTime = pNoteDO.startTime + ndo.duration + releaseTime;\r\n pNoteDO.volumeMap = map;\r\n pNoteDO.leftVolume = 2 * (1 - ndo.pan);\r\n pNoteDO.rightVolume = 2 * ndo.pan;\r\n if (pNoteDO.leftVolume > 1) {\r\n pNoteDO.leftVolume = 1;\r\n }\r\n if (pNoteDO.rightVolume > 1) {\r\n pNoteDO.rightVolume = 1;\r\n }\r\n pNoteDO.amplitude = ndo.amplitude;\r\n pNoteDO.pan = ndo.pan * 2 - 1;\r\n return pNoteDO;\r\n }\r\n clone() {\r\n let pdo = new _PerformanceNoteDO();\r\n pdo.durationRequested = this.durationRequested;\r\n pdo.startTime = this.startTime;\r\n pdo.endTime = this.endTime;\r\n pdo.audioBuffer = this.audioBuffer;\r\n pdo.sfAudioStartPos = this.sfAudioStartPos;\r\n pdo.sfAudioEndPos = this.sfAudioEndPos;\r\n pdo.position = this.position;\r\n pdo.pitchStretchRatio = this.pitchStretchRatio;\r\n pdo.sampleDebt = this.sampleDebt;\r\n pdo.loopStartPos = this.loopStartPos;\r\n pdo.loopEndPos = this.loopEndPos;\r\n pdo.leftVolume = this.leftVolume;\r\n pdo.rightVolume = this.rightVolume;\r\n pdo.fadeInSamples = this.fadeInSamples;\r\n pdo.fadeOutSamples = this.fadeOutSamples;\r\n pdo.loop = this.loop;\r\n pdo.lowpassFreq = this.lowpassFreq;\r\n pdo.filterMap = this.filterMap;\r\n pdo.volumeMap = this.volumeMap;\r\n pdo.totalTimePlayed = this.totalTimePlayed;\r\n pdo.attackStartTime = this.attackStartTime;\r\n pdo.holdStartTime = this.holdStartTime;\r\n pdo.decayStartTime = this.decayStartTime;\r\n pdo.decayEndTime = this.decayEndTime;\r\n pdo.sustainVolReduction = this.sustainVolReduction;\r\n pdo.preReleaseVol = this.preReleaseVol;\r\n pdo.releaseStartTime = this.releaseStartTime;\r\n pdo.amplitude = this.amplitude;\r\n pdo.pan = this.pan;\r\n pdo.preset = this.preset;\r\n pdo.trackId = this.trackId;\r\n return pdo;\r\n }\r\n /** creates one or more performance notes using an [_SfzPreset]*/\r\n static createNotesSfz(ndo, preset) {\r\n let notes = [];\r\n let vel = Math.round(ndo.amplitude * 127);\r\n for (let reg of preset.regions) {\r\n if (ndo.midiNote < reg.lokey || ndo.midiNote > reg.hikey || vel < reg.lovel || vel > reg.hivel) {\r\n continue;\r\n }\r\n let sample = reg.sample;\r\n let srRatio = sample._buffer.sampleRate / sample._sampleRate;\r\n let pdo = new _PerformanceNoteDO();\r\n pdo.sfzPreset = preset;\r\n pdo.startTime = ndo.startTime;\r\n pdo.endTime = ndo.startTime + ndo.duration;\r\n pdo.durationRequested = ndo.duration;\r\n pdo.audioBuffer = sample._buffer;\r\n pdo.sfAudioStartPos = Math.floor(reg.offset * srRatio);\r\n pdo.sfAudioEndPos = Math.floor(reg.end * srRatio);\r\n pdo.position = pdo.sfAudioStartPos;\r\n pdo.trackId = ndo.trackId ?? 0;\r\n let rootNote = reg.pitchKeycenter;\r\n let noteDelta = (ndo.midiNote - rootNote) * reg.pitchKeytrack / 100;\r\n noteDelta += reg.transpose + reg.tune / 100;\r\n pdo.pitchStretchRatio = Math.pow(2, noteDelta / 12);\r\n if (reg.loopMode === 2 /* loopContinuous */ || reg.loopMode === 3 /* loopSustain */) {\r\n pdo.loop = true;\r\n pdo.loopStartPos = reg.loopStart * srRatio;\r\n pdo.loopEndPos = reg.loopEnd * srRatio;\r\n if (pdo.loopEndPos >= sample._buffer.length) {\r\n pdo.loopEndPos = sample._buffer.length - 1;\r\n }\r\n }\r\n if (reg.cutoff != null) {\r\n if (reg.filType === 0 /* lpf1p */ || reg.filType === 2 /* lpf2p */) {\r\n pdo.lowpassFreq = reg.cutoff;\r\n let depth = reg.filegDepth / 1200;\r\n pdo.filterMap = this._createTimeValueMap(\r\n pdo.lowpassFreq * Math.pow(2, reg.filegStart * depth),\r\n reg.filegDelay,\r\n pdo.lowpassFreq * Math.pow(2, reg.filegStart * depth),\r\n reg.filegAttack,\r\n pdo.lowpassFreq * Math.pow(2, depth),\r\n reg.filegHold,\r\n reg.filegDecay,\r\n pdo.lowpassFreq * Math.pow(2, reg.filegSustain * depth),\r\n reg.filegRelease,\r\n ndo.duration,\r\n //final filter value ... make same as sustain?\r\n pdo.lowpassFreq * Math.pow(2, reg.filegSustain * depth)\r\n );\r\n }\r\n }\r\n let regVolAsPerc = (reg.dbVolume + 150.6) / 150.6;\r\n let peakAmplitude = ndo.amplitude * regVolAsPerc;\r\n if (peakAmplitude > 1)\r\n peakAmplitude = 1;\r\n let map = this._createTimeValueMap(\r\n 0,\r\n reg.ampegDelay,\r\n reg.ampegStart * peakAmplitude,\r\n reg.ampegAttack,\r\n peakAmplitude,\r\n reg.ampegHold,\r\n reg.ampegDecay,\r\n reg.ampegSustain * peakAmplitude,\r\n reg.ampegRelease,\r\n ndo.duration,\r\n 0\r\n );\r\n pdo.endTime = pdo.startTime + ndo.duration + reg.ampegRelease;\r\n pdo.volumeMap = map;\r\n pdo.leftVolume = 2 * (1 - ndo.pan);\r\n pdo.rightVolume = 2 * ndo.pan;\r\n if (pdo.leftVolume > 1) {\r\n pdo.leftVolume = 1;\r\n }\r\n if (pdo.rightVolume > 1) {\r\n pdo.rightVolume = 1;\r\n }\r\n pdo.amplitude = ndo.amplitude;\r\n pdo.pan = ndo.pan * 2 - 1;\r\n notes.push(pdo);\r\n }\r\n return notes;\r\n }\r\n static _createTimeValueMap(preDelayVal, delay, startVal, attack, peakVal, hold, decay, sustainVal, release, noteDuration, finalVal) {\r\n let envTime = 0;\r\n let map = /* @__PURE__ */ new Map([[envTime, preDelayVal]]);\r\n envTime += delay;\r\n if (envTime > 11e-5) {\r\n map.set(envTime - 1e-4, preDelayVal);\r\n }\r\n map.set(envTime, startVal);\r\n envTime += attack;\r\n map.set(envTime, peakVal);\r\n envTime += hold;\r\n map.set(envTime, peakVal);\r\n envTime += decay;\r\n map.set(envTime, sustainVal);\r\n if (noteDuration >= envTime) {\r\n map.set(noteDuration, sustainVal);\r\n } else {\r\n let prevTime = 0;\r\n let keys = Array.from(map.keys());\r\n for (let time of keys) {\r\n if (time > noteDuration) {\r\n let val = map.get(time);\r\n let prevVal = map.get(prevTime);\r\n let tratio = (noteDuration - prevTime) / (time - prevTime);\r\n map.set(noteDuration, prevVal * Math.pow((val + 0.01) / (prevVal + 0.01), tratio));\r\n break;\r\n }\r\n prevTime = time;\r\n }\r\n for (let time of keys) {\r\n if (time > noteDuration) {\r\n map.delete(time);\r\n }\r\n }\r\n }\r\n let finalEnvTime = noteDuration + release;\r\n map.set(finalEnvTime, finalVal);\r\n return map;\r\n }\r\n};\r\n\r\n// src/sound_lib/playback/_NoteBuilder.ts\r\nvar _NoteBuilder = class {\r\n constructor() {\r\n this._slm = SoundLibManager.get();\r\n this._init();\r\n }\r\n /**\r\n * removes all notes from the sequence\r\n */\r\n clearSequence() {\r\n this._sequence = [];\r\n }\r\n createPerformanceNotes(ndoList) {\r\n let pNotes = [];\r\n for (let ndo of ndoList) {\r\n pNotes.push(...this._createPerformanceNotes(ndo));\r\n }\r\n return pNotes;\r\n }\r\n /** adds a note to the performance. Access the complete list of notes in the\r\n * sequence property.*/\r\n addNoteToSequence(ndo) {\r\n let notes = this._createPerformanceNotes(ndo);\r\n if (notes != null) {\r\n this._sequence.push(...notes);\r\n }\r\n }\r\n _createPerformanceNotes(ndo) {\r\n if (ndo.preset != null && ndo.bank != null) {\r\n this._slm.setPreset(ndo.bank, ndo.preset);\r\n }\r\n if (this._slm._libType === 0 /* SF */) {\r\n return PerformanceNoteDO.createPerformanceNote(\r\n ndo,\r\n this._preset\r\n );\r\n } else if (this._slm._libType === 1 /* SFZ */) {\r\n return PerformanceNoteDO.createNotesSfz(\r\n ndo,\r\n this._preset\r\n );\r\n }\r\n return null;\r\n }\r\n _init() {\r\n this._sequence = [];\r\n }\r\n /**\r\n * the notes to be performed - give these to the player/performer object\r\n */\r\n get sequence() {\r\n this._sequence.sort((pn1, pn2) => pn1.startTime <= pn2.startTime ? -1 : 1);\r\n return this._sequence;\r\n }\r\n /** the Preset object that contains the zones and Instrument you want to use\r\n * to build the sequence*/\r\n get preset() {\r\n return this._preset;\r\n }\r\n set preset(value) {\r\n this._preset = value;\r\n }\r\n};\r\n\r\n// src/sound_lib/SoundLibManager.ts\r\nimport { createEmitter } from \"ts_utils\";\r\n\r\n// src/sound_lib/playback/NoteInfoDO.ts\r\nvar NoteInfoDO = class _NoteInfoDO {\r\n constructor() {\r\n }\r\n static create(midiNote, startTime, duration, amplitude, pan, bank, preset) {\r\n let ndo = new _NoteInfoDO();\r\n ndo.midiNote = midiNote;\r\n ndo.startTime = startTime;\r\n ndo.duration = duration;\r\n ndo.amplitude = amplitude;\r\n ndo.pan = pan;\r\n ndo.bank = bank;\r\n ndo.preset = preset;\r\n return ndo;\r\n }\r\n static fromLiveNote(ldo) {\r\n let ndo = new _NoteInfoDO();\r\n ndo.midiNote = ldo.midiNote;\r\n ndo.amplitude = ldo.amplitude;\r\n ndo.pan = 0.5;\r\n ndo.bank = ldo.bank;\r\n ndo.preset = ldo.preset;\r\n return ndo;\r\n }\r\n};\r\n\r\n// src/sound_lib/playback/_StringNoteParser.ts\r\nvar _StringNoteParser = class {\r\n constructor() {\r\n this._volume = 0.5;\r\n this._pan = 0.5;\r\n this._hold = 1;\r\n this._time = 0;\r\n this._slm = SoundLibManager.get();\r\n }\r\n /**interprets a string to create [_PerformanceNoteDO] objects. string must be\r\n * structured as a sequence of space-delimited commands, each beginning with\r\n * a prefix and then an equals sign. Example commands are as follows:\r\n * \r\n * tempo=96 (in bpm)\r\n * preset=0:23 (bank:preset)\r\n * volume=0.8 (0 - 1)\r\n * pan=0.5 (0 - 1)\r\n * hold=0.95 (0 - 1 or > 1 for overlap ... sets the style of connecting or\r\n * separating notes. 1.0 means notes will be held for exact duration value.)\r\n * \r\n * n=60:5 or n=60:5:0.2 (pitch:duration:+/-Vol ... 7=whole, 5=quarter...)\r\n * r=4 (a duration from 1-8 where 5 is a quarter note)\r\n * c=60:5 (pitch:duration:+/-Vol) For chords. Identical to notes, but time\r\n * does not advance. For the last note of a chord, use n= so time will\r\n * advance.\r\n * \r\n * For notes and rests, you can append a time ratio to the duration to\r\n * create a tuplet effect. Add an underscore after the duration type and\r\n * then specify the ratio as a fraction. Example, 3 eighth note triplets:\r\n * n=60:4_2/3 n=62:4_2/3 n=64:4_2/3\r\n * \r\n * qntime=20 (overrides the current time based on the tempo by setting the\r\n * time in terms of elapsed quarter notes. You could use this to ensure\r\n * tuplet rounding doesn't cause issues or to jump forward/back in time)\r\n * */\r\n createNotes(notes) {\r\n this._reset();\r\n notes = notes.trim();\r\n let commands = notes.split(/\\s+/);\r\n for (let cmdString of commands) {\r\n let cmd = cmdString.split(\"=\");\r\n if (cmd.length !== 2)\r\n throw \"invalid command string: $cmdString\";\r\n switch (cmd[0]) {\r\n case \"tempo\":\r\n this._tempo = this._readNum(cmd[1]);\r\n break;\r\n case \"volume\":\r\n this._volume = this._readNum(cmd[1]);\r\n break;\r\n case \"pan\":\r\n this._pan = this._readNum(cmd[1]);\r\n break;\r\n case \"hold\":\r\n this._hold = this._readNum(cmd[1]);\r\n break;\r\n case \"preset\":\r\n this._readPreset(cmd[1]);\r\n break;\r\n case \"n\":\r\n this._readNote(cmd[1], true);\r\n break;\r\n case \"r\":\r\n this._readRest(cmd[1]);\r\n break;\r\n case \"c\":\r\n this._readNote(cmd[1], false);\r\n break;\r\n case \"qntime\":\r\n this._time = this._readNum(cmd[1]) * 60 / this._tempo;\r\n break;\r\n default:\r\n console.log(\"Invalid command: ${cmd[0]}\");\r\n }\r\n }\r\n }\r\n _reset() {\r\n this._tempo = 90;\r\n this._volume = 0.5;\r\n this._pan = 0.5;\r\n this._hold = 1;\r\n this._time = 0;\r\n this._slm.clearSequence();\r\n }\r\n _readNum(cmd) {\r\n try {\r\n return Number.parseFloat(cmd);\r\n } catch (err) {\r\n throw \"invalid number value\";\r\n }\r\n }\r\n _readPreset(cmd) {\r\n let parts = cmd.split(\":\");\r\n if (parts.length !== 2)\r\n throw \"invalid preset command: $cmd\";\r\n this._slm.setPreset(\r\n Number.parseInt(parts[1]),\r\n Number.parseInt(parts[0])\r\n );\r\n }\r\n _readNote(cmd, advanceTime) {\r\n let parts = cmd.split(\":\");\r\n if (parts.length !== 2 && parts.length !== 3) {\r\n throw \"invalid note command: $cmd\";\r\n }\r\n try {\r\n let pitch = Number.parseInt(parts[0]);\r\n let duration = this._convertNoteTypeToTime(parts[1]);\r\n let volume = this._volume;\r\n if (parts.length === 3) {\r\n volume += Number.parseFloat(parts[2]);\r\n if (volume > 1)\r\n volume = 1;\r\n else if (volume < 0)\r\n volume = 0;\r\n }\r\n this._slm.addNoteToSequence(NoteInfoDO.create(\r\n pitch,\r\n this._time,\r\n duration * this._hold,\r\n volume,\r\n this._pan\r\n ));\r\n if (advanceTime)\r\n this._time += duration;\r\n } catch (err) {\r\n throw \"invalid note command: $cmd\";\r\n }\r\n }\r\n _readRest(cmd) {\r\n try {\r\n let duration = this._convertNoteTypeToTime(cmd);\r\n this._time += duration;\r\n } catch (err) {\r\n throw \"invalid rest command: $cmd\";\r\n }\r\n }\r\n _convertNoteTypeToTime(durationType) {\r\n try {\r\n let prefix = Number.parseInt(durationType[0]);\r\n let ratio = 1;\r\n if (durationType.length >= 5 && durationType.indexOf(\"_\") === 1 && durationType.indexOf(\"/\") !== -1) {\r\n let ratioStr = durationType.substring(2);\r\n let parts = ratioStr.split(\"/\");\r\n let numerator = Number.parseFloat(parts[0]);\r\n let denominator = Number.parseFloat(parts[1]);\r\n ratio = numerator / denominator;\r\n }\r\n switch (prefix) {\r\n case 8:\r\n return 60 / this._tempo * 8 * ratio;\r\n case 7:\r\n return 60 / this._tempo * 4 * ratio;\r\n case 6:\r\n return 60 / this._tempo * 2 * ratio;\r\n case 5:\r\n return 60 / this._tempo * ratio;\r\n case 4:\r\n return 60 / this._tempo * 0.5 * ratio;\r\n case 3:\r\n return 60 / this._tempo * 0.25 * ratio;\r\n case 2:\r\n return 60 / this._tempo * 0.125 * ratio;\r\n case 1:\r\n return 60 / this._tempo * 0.0625 * ratio;\r\n default:\r\n throw \"invalid durationType: $durationType\";\r\n }\r\n } catch (err) {\r\n throw \"invalid duration type: $durationType\";\r\n }\r\n }\r\n};\r\n\r\n// src/sound_lib/playback/_SoundLibPlayer.ts\r\nimport { AudioComponent } from \"audio_output\";\r\nimport { BrowserUtils as BrowserUtils2 } from \"ts_utils\";\r\nvar _SoundLibPlayer = class extends AudioComponent {\r\n // StreamController _notesCompleteController = \r\n // \tnew StreamController.broadcast();\r\n constructor() {\r\n super();\r\n this._noteSets = [];\r\n //the AudioContext.currentTime value at start of play\r\n this._playStartTime = 0;\r\n this._timerInterval = 0.5;\r\n //in seconds\r\n this._window = 1;\r\n //in seconds\r\n this._phTimeSubs = [];\r\n this._isPlaying = false;\r\n this._trackGains = /* @__PURE__ */ new Map();\r\n this._trackPanners = /* @__PURE__ */ new Map();\r\n /**the value the _masterGain is set to at beginning of playback*/\r\n this._masterGainValue = 1;\r\n this._noteNodes = [];\r\n //stores the time of the note that ends the latest in the song so that\r\n //playback can be terminated when it's finished.\r\n this._lastNoteEndTime = -1;\r\n this._onTimer = () => {\r\n let phTime = this.currentPlayTime;\r\n for (let sub of this._phTimeSubs) {\r\n if (phTime >= sub.phTriggerTime) {\r\n sub.phTriggerTime = sub.callback(phTime);\r\n if (sub.phTriggerTime == null) {\r\n this.removePhTimeSub(sub.callback);\r\n }\r\n }\r\n }\r\n };\r\n this._getNotesInWindow = (phTime) => {\r\n let currentTime = this._context.currentTime;\r\n if (phTime < 0) {\r\n return Number.MIN_SAFE_INTEGER;\r\n }\r\n this._removeFinishedNodes(currentTime);\r\n let activePNotes = [];\r\n let windowCutoff = phTime + this._window;\r\n for (let i = this._noteSets.length - 1; i >= 0; i--) {\r\n let set = this._noteSets[i];\r\n while (set.noteIndex < set.notes.length && set.startTime + set.notes[set.noteIndex].startTime <= windowCutoff) {\r\n let origNote = set.notes[set.noteIndex];\r\n let noteStartTime = origNote.startTime + set.startTime;\r\n let setEndTime = noteStartTime + origNote.durationRequested;\r\n if (setEndTime > set.endTime) {\r\n set.endTime = setEndTime;\r\n }\r\n set.noteIndex++;\r\n if (origNote.startTime + set.startTime < phTime || set.iterationCanceled) {\r\n continue;\r\n }\r\n let note = origNote.clone();\r\n note.startTime = noteStartTime;\r\n note.endTime += set.startTime;\r\n activePNotes.push(note);\r\n }\r\n if (set.noteIndex === set.notes.length) {\r\n if (set.loop) {\r\n set.noteIndex = 0;\r\n set.startTime = set.endTime;\r\n set.iterationCanceled = false;\r\n i++;\r\n } else if (set.enableRescheduling) {\r\n if (set.schedule.length > 0) {\r\n set.noteIndex = 0;\r\n set.startTime = set.schedule.shift();\r\n set.iterationCanceled = false;\r\n i++;\r\n }\r\n } else {\r\n this._noteSets.splice(i, 1);\r\n let ms = ~~((set.endTime - phTime) * 1e3);\r\n let ev = new SoundLibEvent(\r\n 6 /* noteSetComplete */\r\n );\r\n ev.noteSetId = set.id;\r\n window.setTimeout(() => {\r\n if (this._isPlaying)\r\n this._slm._dispatch(ev);\r\n }, ms);\r\n }\r\n }\r\n }\r\n if (activePNotes.length === 0) {\r\n this._checkAllNotesFinished(phTime);\r\n if (this._firstSoundTime == null) {\r\n this._firstSoundTime = this._context.currentTime;\r\n }\r\n return Number.MIN_SAFE_INTEGER;\r\n }\r\n let newNodes = this._processNotes(activePNotes, this._playStartTime);\r\n this._noteNodes.push(...newNodes);\r\n if (this._firstSoundTime == null) {\r\n this._firstSoundTime = this._context.currentTime;\r\n }\r\n return Number.MIN_SAFE_INTEGER;\r\n };\r\n this._slm = SoundLibManager.get();\r\n this._context = this._slm.context;\r\n if (this._context == null) {\r\n throw \"AudioContext not set\";\r\n }\r\n this._init();\r\n }\r\n /**plays notes immediately (or whenever their startTime indicates)*/\r\n playNotes(notes) {\r\n this._processNotes(notes, this._context.currentTime);\r\n }\r\n /**starts the audio playback - use prepareAudio first to generate the audio\r\n * The optional [startTime] can be used to adjust the start position\r\n * of playback. A positive value (in seconds) causes */\r\n play(startTime = 0) {\r\n if (this._isPlaying) {\r\n return;\r\n }\r\n for (let set of this._noteSets) {\r\n set.noteIndex = 0;\r\n set.resetStartTime();\r\n }\r\n this._playStartTime = this._context.currentTime - startTime;\r\n this._firstSoundTime = null;\r\n this._lastNoteEndTime = -1;\r\n this._isPlaying = true;\r\n this._masterGain.gain.cancelScheduledValues(0);\r\n this._masterGain.gain.setValueAtTime(this._masterGainValue, 0);\r\n this.addPhTimeSub(this._getNotesInWindow, Number.MIN_SAFE_INTEGER);\r\n this._timerId = window.setInterval(\r\n this._onTimer,\r\n this._timerInterval * 1e3\r\n );\r\n this._onTimer();\r\n this._playSilentNote();\r\n }\r\n /**stops playback. There is a 50ms delay after stop is called for volume\r\n * to be ramped to 0, and a Promise is returned after 0 is reached. But\r\n * it should be okay to call play again without waiting for this to\r\n * complete.*/\r\n stop() {\r\n return new Promise((resolve, reject) => {\r\n if (this._isPlaying) {\r\n if (this._timerId != null) {\r\n window.clearInterval(this._timerId);\r\n this._timerId = null;\r\n }\r\n if (this._playbackCompleteIntervalId == null) {\r\n window.clearInterval(this._playbackCompleteIntervalId);\r\n this._playbackCompleteIntervalId = null;\r\n }\r\n this._phTimeSubs = [];\r\n this._isPlaying = false;\r\n this._masterGain.gain.setValueAtTime(\r\n this._masterGainValue,\r\n this._context.currentTime\r\n );\r\n this._masterGain.gain.linearRampToValueAtTime(\r\n 0,\r\n this._context.currentTime + 0.05\r\n );\r\n this._clearAllNoteSetSchedules();\r\n let noteNodesCopy = this._noteNodes.slice();\r\n this._noteNodes = [];\r\n window.setTimeout(() => {\r\n for (let noteNode of noteNodesCopy) {\r\n noteNode.disconnectNodes();\r\n }\r\n noteNodesCopy = null;\r\n resolve();\r\n }, 50);\r\n } else {\r\n resolve();\r\n }\r\n });\r\n }\r\n /**prepares notes for playback. If [loop] is true, the sequence will\r\n * be repeated continuously. Setting the [performanceTime] to a value \r\n * greater than 0 will cause the sequence to be delayed until the time from\r\n * the start of playback has passed (not AudioContext.currentTime). If\r\n * adding notes during playback, use the [currentPlayTime] getter to check\r\n * the elapsed time (playhead time). If enableRescheduling is true, the note\r\n * set will not be disposed after its playback completes, and you can use\r\n * the scheduleNoteSet() and clearNoteSetSchedule() methods to update it for\r\n * repeated use.*/\r\n prepareAudio(notes, loop = false, performanceTime = 0, enableRescheduling = false) {\r\n let set = new _NoteSet(\r\n notes,\r\n loop,\r\n performanceTime,\r\n enableRescheduling\r\n );\r\n this._noteSets.push(set);\r\n return set.id;\r\n }\r\n clearNotes() {\r\n this._noteSets = [];\r\n }\r\n removeNoteSet(noteSetId) {\r\n let idx = this._noteSets.findIndex((n) => n.id === noteSetId);\r\n if (idx !== -1) {\r\n this._noteSets.splice(idx, 1);\r\n if (this._noteSets.length === 0) {\r\n this.stop();\r\n }\r\n }\r\n }\r\n /**stops playback of the requested NoteSet if it is currently playing.\r\n * This does not remove the NoteSet or prevent its next scheduled or\r\n * repeated entrance from playing. Use clearNoteSetSchedule() in\r\n * combination for that.*/\r\n stopNoteSetPlayback(noteSetId) {\r\n let set = this._noteSets.find((ns) => ns.id === noteSetId);\r\n if (set != null) {\r\n set.iterationCanceled = true;\r\n }\r\n }\r\n /**Schedules an additional time for the requested NoteSet to play. The\r\n * performanceTime is the number of seconds after the start of player\r\n * playback. Use [currentPlayTime] to get the current position.\r\n */\r\n scheduleNoteSet(noteSetId, performanceTime) {\r\n let set = this._noteSets.find((ns) => ns.id === noteSetId);\r\n if (set != null) {\r\n if (!set.enableRescheduling) {\r\n throw \"This NoteSet was not enabled for rescheduling in the call to prepareAudio()\";\r\n }\r\n set.schedule.push(performanceTime);\r\n }\r\n }\r\n /**clears the play schedule for the requested NoteSet */\r\n clearNoteSetSchedule(noteSetId, performanceTime = null) {\r\n let noteSet = this._noteSets.find((ns) => ns.id === noteSetId);\r\n if (noteSet != null) {\r\n if (performanceTime != null) {\r\n let idx = noteSet.schedule.indexOf(performanceTime);\r\n if (idx !== -1) {\r\n noteSet.schedule.splice(idx, 1);\r\n }\r\n if (noteSet.startTime === performanceTime) {\r\n noteSet.noteIndex = noteSet.notes.length;\r\n }\r\n } else {\r\n noteSet.schedule = [];\r\n }\r\n }\r\n }\r\n /**Sets the gain for a track that's associated with [NoteInfoDO.trackId]\r\n * (and thus [_PerformanceNoteDO.trackId]) value. If a gain node has not\r\n * been created yet for this index, ie. because playback hasn't been called\r\n * yet, it is created here. A [trackId] of 0 is meant to refer to the\r\n * first, default track. [volume] must be from 0.0 to 1.0.*/\r\n setTrackVolume(trackId, volume) {\r\n if (volume < 0)\r\n throw `invalid gain volume: ${volume}`;\r\n let trackGain = this._getOrCreateTrackGain(trackId);\r\n trackGain.gain.setValueAtTime(volume, 0);\r\n }\r\n /**Sets the pan for a track that's associated with [NoteInfoDO.trackId]\r\n * (and thus [_PerformanceNoteDO.trackId]) value. If a pan node has not\r\n * been created yet for this index, ie. because playback hasn't been called\r\n * yet, it is created here. A [trackId] of 0 is meant to refer to the\r\n * first, default track. [pan] must be from -1.0 to 1.0.*/\r\n setTrackPan(trackId, pan) {\r\n if (this._isSafari)\r\n return;\r\n if (pan < -1 || pan > 1)\r\n throw `invalid gain volume: ${pan}`;\r\n let trackPanner = this._getOrCreateTrackPanner(trackId);\r\n trackPanner.pan.setValueAtTime(pan, 0);\r\n }\r\n /**sets the gain for the master output. Default is 1.0. Must always be >= 0\r\n */\r\n setMasterVolume(volume) {\r\n if (volume < 0)\r\n throw `invalid gain volume: ${volume}`;\r\n this._masterGainValue = volume;\r\n this._masterGain.gain.setValueAtTime(volume, 0);\r\n }\r\n /**Adjusts the [_SoundLibPlayer]'s playback forward or back the requested\r\n * amount of time.*/\r\n shiftPlayerTime(timeDelta) {\r\n if (this._isPlaying) {\r\n let ctxTime = this._context.currentTime;\r\n for (let node of this._noteNodes) {\r\n node.gainNode.gain.cancelScheduledValues(ctxTime);\r\n node.gainNode.gain.linearRampToValueAtTime(0, ctxTime + 0.01);\r\n }\r\n this._playStartTime -= timeDelta;\r\n }\r\n }\r\n /**Adds a callback you want called when the player passes a PlayheadTime.\r\n * The player checks for passed trigger times on a regular interval of\r\n * about 500ms, so this call could be up to around that much after the\r\n * phTriggerTime you pass. To compensate, set the phTriggerTime to an\r\n * earlier value if you need to receive the event by that time. All subs\r\n * are removed when playback stops.\r\n * @param callback The function to call. It should take the current phTime\r\n * as an argument. It can optionally return a new phTriggerTime so you can\r\n * reuse this. If null is returned, the sub will be removed. If you set\r\n * the value to Number.MIN_SAFE_INTEGER, or any value less than or equal\r\n * to the current playhead time, it will ensure the callback is called on\r\n * the next iteration.\r\n * @param phTriggerTime The phTime in the player that you want the callback\r\n * to be called _after_.*/\r\n addPhTimeSub(callback, phTriggerTime) {\r\n if (this._phTimeSubs.some((pts) => pts.callback === callback)) {\r\n return;\r\n }\r\n let sub = new _PhTimeSub();\r\n sub.callback = callback;\r\n sub.phTriggerTime = phTriggerTime;\r\n this._phTimeSubs.push(sub);\r\n }\r\n /**Removes a Playhead time subscription via its callback.\r\n * @returns true if the callback was found and removed. */\r\n removePhTimeSub(callback) {\r\n let idx = this._phTimeSubs.findIndex((pts) => pts.callback === callback);\r\n if (idx !== -1) {\r\n this._phTimeSubs.splice(idx, 1);\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n _init() {\r\n this._masterGain = this._context.createGain();\r\n this._isSafari = BrowserUtils2.isSafari();\r\n }\r\n _playSilentNote() {\r\n let bs = this._context.createBufferSource();\r\n bs.buffer = this._context.createBuffer(\r\n 1,\r\n 1024,\r\n this._context.sampleRate\r\n );\r\n bs.start(this._context.currentTime);\r\n }\r\n _removeFinishedNodes(currentTime) {\r\n for (let i = this._noteNodes.length - 1; i >= 0; i--) {\r\n let nodeGroup = this._noteNodes[i];\r\n if (nodeGroup.endContextTime < currentTime) {\r\n nodeGroup.disconnectNodes();\r\n this._noteNodes.splice(i, 1);\r\n }\r\n }\r\n }\r\n _checkAllNotesFinished(elapsedTime) {\r\n let finished = true;\r\n for (let set of this._noteSets) {\r\n if (set.noteIndex < set.notes.length || set.loop || set.enableRescheduling) {\r\n finished = false;\r\n break;\r\n }\r\n }\r\n if (finished) {\r\n window.clearInterval(this._timerId);\r\n let msUntilPlaybackComplete = ~~((this._lastNoteEndTime - elapsedTime) * 1e3);\r\n this._playbackCompleteIntervalId = window.setTimeout(async () => {\r\n if (this._isPlaying) {\r\n await this.stop();\r\n this._slm._dispatch(new SoundLibEvent(\r\n 5 /* playbackFinished */\r\n ));\r\n }\r\n }, msUntilPlaybackComplete);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**plays a list of [_PerformanceNoteDO] objects. Notes will be offset\r\n * in time by their startTime from a baseline playStartTime value\r\n * that is usually set when AudioContext.currentTime is recorded\r\n * at the beginning of playback. If you just want to play notes\r\n * immediately, initialize playStartTime to AudioContext.currentTime.\r\n * @param pNoteDOs the list of notes to play\r\n * @param playStartTime a value associated with the beginning of\r\n * playback - all notes will have this value added to their start\r\n * time.*/\r\n _processNotes(pNoteDOs, playStartTime) {\r\n let noteNodes = [];\r\n for (let note of pNoteDOs) {\r\n if (note.startTime + note.durationRequested > this._lastNoteEndTime) {\r\n this._lastNoteEndTime = note.startTime + note.durationRequested;\r\n }\r\n if (note.amplitude === 0) {\r\n continue;\r\n }\r\n let noteContextTime = note.startTime + playStartTime;\r\n let duration = note.endTime - note.startTime;\r\n let bs = this._context.createBufferSource();\r\n bs.buffer = note.audioBuffer;\r\n let gainNode = _NoteNodes.gainNodesPool.length > _NoteNodes.minPoolSize ? _NoteNodes.gainNodesPool.shift() : this._context.createGain();\r\n let lastTimeKey = 0;\r\n for (let timeKey of note.volumeMap.keys()) {\r\n let vol = note.volumeMap.get(timeKey);\r\n if (vol === 0)\r\n vol = 1e-4;\r\n try {\r\n if (timeKey - lastTimeKey < 0.1) {\r\n gainNode.gain.linearRampToValueAtTime(\r\n vol,\r\n noteContextTime + timeKey\r\n );\r\n } else {\r\n gainNode.gain.exponentialRampToValueAtTime(\r\n vol,\r\n noteContextTime + timeKey\r\n );\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n lastTimeKey = timeKey;\r\n }\r\n bs.connect(gainNode);\r\n let trackNode = this._isSafari ? this._getOrCreateTrackGain(note.trackId) : this._getOrCreateTrackPanner(note.trackId);\r\n let filterNode;\r\n if (note.lowpassFreq != null) {\r\n if (_NoteNodes.filterNodesPool.length > _NoteNodes.minPoolSize) {\r\n filterNode = _NoteNodes.filterNodesPool.shift();\r\n } else {\r\n filterNode = this._context.createBiquadFilter();\r\n }\r\n filterNode.type = \"lowpass\";\r\n for (let timeKey of note.filterMap.keys()) {\r\n let frq = note.filterMap.get(timeKey);\r\n if (frq === 0)\r\n frq = 1e-4;\r\n else if (frq > 2e4)\r\n frq = 2e4;\r\n filterNode.frequency.setValueAtTime(frq, noteContextTime + timeKey);\r\n }\r\n gainNode.connect(filterNode);\r\n filterNode.connect(trackNode);\r\n } else {\r\n gainNode.connect(trackNode);\r\n }\r\n bs.playbackRate.setValueAtTime(note.pitchStretchRatio, 0);\r\n if (note.loop) {\r\n bs.loopStart = note.loopStartPos / bs.buffer.sampleRate;\r\n bs.loopEnd = note.loopEndPos / bs.buffer.sampleRate;\r\n bs.loop = bs.loopEnd < duration;\r\n }\r\n bs.start(\r\n noteContextTime\r\n /* , 0, duration */\r\n );\r\n bs.stop(noteContextTime + duration);\r\n noteNodes.push(new _NoteNodes(\r\n noteContextTime + duration,\r\n bs,\r\n gainNode,\r\n filterNode\r\n ));\r\n }\r\n return noteNodes;\r\n }\r\n _getOrCreateTrackGain(trackId) {\r\n let trackGain = this._trackGains.get(trackId);\r\n if (trackGain == null) {\r\n trackGain = this._context.createGain();\r\n this._trackGains.set(trackId, trackGain);\r\n trackGain.connect(this._masterGain);\r\n }\r\n return trackGain;\r\n }\r\n _getOrCreateTrackPanner(trackId) {\r\n let trackPan = this._trackPanners.get(trackId);\r\n if (trackPan == null) {\r\n trackPan = this._context.createStereoPanner();\r\n this._trackPanners.set(trackId, trackPan);\r\n let trackGain = this._getOrCreateTrackGain(trackId);\r\n trackPan.connect(trackGain);\r\n }\r\n return trackPan;\r\n }\r\n _clearAllNoteSetSchedules() {\r\n for (let noteSet of this._noteSets) {\r\n noteSet.schedule = [];\r\n }\r\n }\r\n get isPlaying() {\r\n return this._isPlaying;\r\n }\r\n /**returns the AudioContext time when play is called.*/\r\n get playStartTime() {\r\n return this._playStartTime;\r\n }\r\n /**the AudioContext.currentTime value after the first audio processing call\r\n * completes*/\r\n get firstSoundTime() {\r\n return this._firstSoundTime;\r\n }\r\n /**returns the amount of time in seconds that has elapsed since the start\r\n * of playback.*/\r\n get currentPlayTime() {\r\n return this._isPlaying ? this._context.currentTime - this._playStartTime : 0;\r\n }\r\n get outputNode() {\r\n return this._masterGain;\r\n }\r\n};\r\nvar __NoteNodes = class __NoteNodes {\r\n constructor(endContextTime, bufferSourceNode, gainNode, filterNode) {\r\n this.endContextTime = endContextTime;\r\n this.bufferSourceNode = bufferSourceNode;\r\n this.gainNode = gainNode;\r\n this.filterNode = filterNode;\r\n }\r\n disconnectNodes() {\r\n this.bufferSourceNode.disconnect(0);\r\n this.gainNode.disconnect(0);\r\n this.gainNode.gain.cancelScheduledValues(0);\r\n __NoteNodes.gainNodesPool.push(this.gainNode);\r\n if (this.filterNode != null) {\r\n this.filterNode.disconnect(0);\r\n this.filterNode.frequency.cancelScheduledValues(0);\r\n __NoteNodes.filterNodesPool.push(this.filterNode);\r\n }\r\n }\r\n};\r\n__NoteNodes.gainNodesPool = [];\r\n__NoteNodes.filterNodesPool = [];\r\n//it seems as if there may be a delay when using cancelScheduledValues to\r\n//ready a gain node for reuse. When nodes are reused immediately after\r\n//disconnected, they are sometimes silent. The minPoolSize is meant to\r\n//generally afford a little time between when a node is \"readied\" and when\r\n//it is actually used again.\r\n__NoteNodes.minPoolSize = 10;\r\nvar _NoteNodes = __NoteNodes;\r\nvar __NoteSet = class __NoteSet {\r\n constructor(notes, loop, startTime, enableScheduling) {\r\n /**the context time that the last note finishes (before looping if \r\n * applicable). This is updated dynamically as notes are played.*/\r\n this.endTime = 0;\r\n /**index of the next note that will be added to the playback que*/\r\n this.noteIndex = 0;\r\n /**array of start time second values in terms of player.currentPlayTime.\r\n * When set playback completes, if times have been added to this schedule,\r\n * the note set will start again when the time at schedule[0] is reached.\r\n * That time will then be removed from the array.*/\r\n this.schedule = [];\r\n /**if true, the current iteration of the NoteSet should not be played. This\r\n * gets reset to false upon loop or the next scheduled entrance. */\r\n this.iterationCanceled = false;\r\n this.notes = notes;\r\n this.loop = loop;\r\n this.startTime = startTime;\r\n this.enableRescheduling = enableScheduling;\r\n if (enableScheduling) {\r\n this.schedule = [];\r\n }\r\n this._originalStartTime = startTime;\r\n this.id = __NoteSet.idCounter;\r\n __NoteSet.idCounter++;\r\n }\r\n /**if this [_NoteSet] has looped during playback, its [startTime] may no \r\n * longer be what it originally was. This resets it for a new play session.\r\n * */\r\n resetStartTime() {\r\n this.startTime = this._originalStartTime;\r\n this.endTime = 0;\r\n }\r\n};\r\n__NoteSet.idCounter = 0;\r\nvar _NoteSet = __NoteSet;\r\nvar _PhTimeSub = class {\r\n};\r\n\r\n// src/sound_lib/playback/_LiveNotePlayer.ts\r\nimport { AudioComponent as AudioComponent2 } from \"audio_output\";\r\nimport { BrowserUtils as BrowserUtils3 } from \"ts_utils\";\r\nvar _LiveNotePlayer = class extends AudioComponent2 {\r\n constructor(noteBuilder) {\r\n super();\r\n this._isEnabled = false;\r\n /**the value the _masterGain is initialized to*/\r\n this._masterGainValue = 0.3;\r\n this._notesMap = /* @__PURE__ */ new Map();\r\n this._onCleanupTime = () => {\r\n let ldoList = Array.from(this._notesMap.keys());\r\n let cTime = this._context.currentTime;\r\n for (let i = ldoList.length - 1; i >= 0; i--) {\r\n let ldo = ldoList[i];\r\n let noteNodes = this._notesMap.get(ldo);\r\n if (noteNodes.endContextTime <= cTime) {\r\n noteNodes.disconnectNodes();\r\n this._notesMap.delete(ldo);\r\n }\r\n }\r\n };\r\n this._slm = SoundLibManager.get();\r\n this._noteBuilder = noteBuilder;\r\n this._context = this._slm.context;\r\n if (this._context == null)\r\n throw \"AudioContext not set\";\r\n this._init();\r\n }\r\n get isEnabled() {\r\n return this._isEnabled;\r\n }\r\n enable() {\r\n if (this._isEnabled) {\r\n return;\r\n }\r\n this._cleanupIntervalId = window.setInterval(this._onCleanupTime, 5e3);\r\n this._isEnabled = true;\r\n }\r\n disable() {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n this.stopAllLiveNotes();\r\n window.clearInterval(this._cleanupIntervalId);\r\n this._cleanupIntervalId = null;\r\n this._isEnabled = false;\r\n }\r\n startLiveNote(ldo) {\r\n let ndo = NoteInfoDO.fromLiveNote(ldo);\r\n ndo.startTime = this._context.currentTime;\r\n ndo.duration = 100;\r\n let pNotes = this._noteBuilder.createPerformanceNotes([ndo]);\r\n this._notesMap.set(ldo, this._playNote(pNotes[0]));\r\n }\r\n stopLiveNote(ldo, fadeDuration = 0.05) {\r\n let noteNodes = this._notesMap.get(ldo);\r\n if (noteNodes != null) {\r\n let cTime = this._context.currentTime;\r\n noteNodes.stopBufferSource(cTime + fadeDuration + 0.01);\r\n noteNodes.endContextTime = cTime + fadeDuration + 0.01;\r\n noteNodes.gainNode.gain.cancelScheduledValues(0);\r\n noteNodes.gainNode.gain.linearRampToValueAtTime(0, cTime + fadeDuration);\r\n }\r\n }\r\n stopAllLiveNotes() {\r\n let ldoList = Array.from(this._notesMap.keys());\r\n for (let i = ldoList.length - 1; i >= 0; i--) {\r\n let ldo = ldoList[i];\r\n let noteNodes = this._notesMap.get(ldo);\r\n noteNodes.stopBufferSource(this._context.currentTime);\r\n noteNodes.disconnectNodes();\r\n this._notesMap.delete(ldo);\r\n }\r\n }\r\n _init() {\r\n this._masterGain = this._context.createGain();\r\n this._masterGain.gain.cancelScheduledValues(0);\r\n this._masterGain.gain.setValueAtTime(this._masterGainValue, 0);\r\n this._isSafari = BrowserUtils3.isSafari();\r\n }\r\n /**plays a list of [_PerformanceNoteDO] objects. Notes will be offset\r\n * in time by their startTime from a baseline playStartTime value\r\n * that is usually set when AudioContext.currentTime is recorded\r\n * at the beginning of playback. If you just want to play notes\r\n * immediately, initialize playStartTime to AudioContext.currentTime.\r\n * @param pNoteDOs the list of notes to play\r\n * @param playStartTime a value associated with the beginning of\r\n * playback - all notes will have this value added to their start\r\n * time.*/\r\n _playNote(note) {\r\n let noteContextTime = note.startTime;\r\n let duration = note.endTime - note.startTime;\r\n let bs = this._context.createBufferSource();\r\n bs.buffer = note.audioBuffer;\r\n let gainNode = _LiveNoteNodes.gainNodesPool.length > 0 ? _LiveNoteNodes.gainNodesPool.pop() : this._context.createGain();\r\n let lastTimeKey = 0;\r\n for (let timeKey of note.volumeMap.keys()) {\r\n let vol = note.volumeMap.get(timeKey);\r\n if (vol === 0)\r\n vol = 1e-4;\r\n try {\r\n if (timeKey - lastTimeKey < 0.1) {\r\n gainNode.gain.linearRampToValueAtTime(\r\n vol,\r\n noteContextTime + timeKey\r\n );\r\n } else {\r\n gainNode.gain.exponentialRampToValueAtTime(\r\n vol,\r\n noteContextTime + timeKey\r\n );\r\n }\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n lastTimeKey = timeKey;\r\n }\r\n bs.connect(gainNode);\r\n let filterNode;\r\n if (note.lowpassFreq != null) {\r\n if (_LiveNoteNodes.filterNodesPool.length > 0) {\r\n filterNode = _LiveNoteNodes.filterNodesPool.pop();\r\n } else {\r\n filterNode = this._context.createBiquadFilter();\r\n }\r\n filterNode.type = \"lowpass\";\r\n for (let timeKey of note.filterMap.keys()) {\r\n let frq = note.filterMap.get(timeKey);\r\n if (frq === 0)\r\n frq = 1e-4;\r\n else if (frq > 2e4)\r\n frq = 2e4;\r\n filterNode.frequency.setValueAtTime(frq, noteContextTime + timeKey);\r\n }\r\n gainNode.connect(filterNode);\r\n filterNode.connect(this._masterGain);\r\n } else {\r\n gainNode.connect(this._masterGain);\r\n }\r\n bs.playbackRate.setValueAtTime(note.pitchStretchRatio, 0);\r\n if (note.loop) {\r\n bs.loopStart = note.loopStartPos / bs.buffer.sampleRate;\r\n bs.loopEnd = note.loopEndPos / bs.buffer.sampleRate;\r\n bs.loop = bs.loopEnd < duration;\r\n }\r\n bs.start(noteContextTime);\r\n return new _LiveNoteNodes(\r\n noteContextTime + duration,\r\n bs,\r\n gainNode,\r\n filterNode\r\n );\r\n }\r\n get outputNode() {\r\n return this._masterGain;\r\n }\r\n};\r\nvar __LiveNoteNodes = class __LiveNoteNodes {\r\n constructor(endContextTime, bufferSourceNode, gainNode, filterNode) {\r\n this._bufferSourceNodeStopped = false;\r\n this.endContextTime = endContextTime;\r\n this.bufferSourceNode = bufferSourceNode;\r\n this.gainNode = gainNode;\r\n this.filterNode = filterNode;\r\n }\r\n disconnectNodes() {\r\n this.bufferSourceNode.disconnect(0);\r\n this.gainNode.disconnect(0);\r\n this.gainNode.gain.cancelScheduledValues(0);\r\n __LiveNoteNodes.gainNodesPool.push(this.gainNode);\r\n if (this.filterNode != null) {\r\n this.filterNode.disconnect(0);\r\n this.filterNode.frequency.cancelScheduledValues(0);\r\n __LiveNoteNodes.filterNodesPool.push(this.filterNode);\r\n }\r\n }\r\n stopBufferSource(stopTime) {\r\n if (!this._bufferSourceNodeStopped) {\r\n this.bufferSourceNode.stop(stopTime);\r\n this._bufferSourceNodeStopped = true;\r\n }\r\n }\r\n};\r\n__LiveNoteNodes.gainNodesPool = [];\r\n__LiveNoteNodes.filterNodesPool = [];\r\nvar _LiveNoteNodes = __LiveNoteNodes;\r\n\r\n// src/sound_lib/SoundLibManager.ts\r\nvar SoundLibManager = class _SoundLibManager {\r\n constructor(context, soundLibType, outputTarget) {\r\n this._eventEmitter = createEmitter();\r\n this._phTimeEmitter = createEmitter();\r\n if (context == null) {\r\n throw \"AudioContext must be set.\";\r\n }\r\n if (soundLibType == null) {\r\n throw \"SoundLibType must be set\";\r\n }\r\n _SoundLibManager._ref = this;\r\n this._context = context;\r\n this._libType = soundLibType;\r\n this._init();\r\n if (outputTarget != null) {\r\n this.setOutputTarget(outputTarget);\r\n }\r\n }\r\n /**Gets a stream of different types of events the [SoundLibManager] \r\n * dispatches. Check the [SoundLibEvent.type] property.*/\r\n get soundLibEvent() {\r\n return this._eventEmitter.event;\r\n }\r\n get phTimeEvent() {\r\n return this._phTimeEmitter.event;\r\n }\r\n /**Retrieves the SoundLibManager instance, creating if necessary. Parameters\r\n * only need to be passed on first creation.\r\n * @param context AudioContext used for loading and playing the sound\r\n * presets.\r\n * @param soundLibType supports either SF or SFZ.\r\n * @param outputTarget refers to the destination for the audio from the \r\n * _SoundLibPlayer. This must be set to hear audio.*/\r\n static get(context, soundLibType, outputTarget) {\r\n if (_SoundLibManager._ref == null) {\r\n new _SoundLibManager(context, soundLibType, outputTarget);\r\n }\r\n return _SoundLibManager._ref;\r\n }\r\n /**Sets the destination of the audio from the [_SoundLibPlayer]. The\r\n * [outputTarget] must override the [AudioComponent.inputNode] getter.*/\r\n setOutputTarget(outputTarget) {\r\n this._player.disconnectAll();\r\n this._player.connect(outputTarget);\r\n this._outputTarget = outputTarget;\r\n }\r\n /////////////////////LIBRARY LOADING//////////////////////////\r\n /**\r\n * Loads a sound map that identifies the path to preset files. The [path]\r\n * should point to the json map file. For details on the format, see the\r\n * [_SoundMap.fromJson] constructor.*/\r\n async loadSoundMap(path) {\r\n await this._loader.loadSoundMap(path);\r\n }\r\n /**Loads and parses a SoundFont (Sf2, Sf3) or SFZ file. In the case of an\r\n * SFZ file, the library should be a zip archive containing folders named\r\n * according to bank number, each containing preset files that begin with\r\n * the preset number. Example SFZ folder structure:\r\n * ```\r\n * [pianos_ogg.zip]\r\n * \t[000]\r\n * \t\t[000_Stereo Grand.sfz]\r\n * \t\t[001_Bright Grand.sfz]\r\n * \t[samples]\r\n * \t\t[Grand Piano-A#1.ogg]\r\n * \t\t...\r\n * ```*/\r\n async loadLibrary(path, loadSfzPresets = true) {\r\n await this._loader.loadLibrary(path, loadSfzPresets);\r\n }\r\n /**Loads or completes the loading of presets. If [loadLibrary] was already\r\n * used to load an SFZ zip archive and presets have been initialized but\r\n * not completely parsed, this completes the process for those presets. If\r\n * there are additional requested presets, this method next looks for a\r\n * map file loaded with [loadSoundMap]. If one exists, it is checked for\r\n * presets matching the requested presets. The [bankPresetPairs] is ordered\r\n * by bank/preset pairs (bank,preset,bank,preset, etc.). If \r\n * [bankPresetPairs] is null, this loads (or finishes loading) all presets.\r\n * \r\n * By default, sounds will be downloaded from the server unless you have\r\n * specified a [dbName] for an indexedDb.*/\r\n async loadPresets(bankPresetPairs) {\r\n if (bankPresetPairs == null) {\r\n await this._loader.loadAllPresets();\r\n } else {\r\n await this._loader.loadPresets(bankPresetPairs);\r\n }\r\n }\r\n /**Checks to see if a preset matching the requested [bankNumber] and\r\n * [presetNumber] exists.*/\r\n hasPreset(bankNumber, presetNumber) {\r\n return this._loader.hasPreset(bankNumber, presetNumber);\r\n }\r\n /**/\r\n //////////////////NOTE SEQUENCING/////////////////////////*/\r\n setPreset(bankNumber, presetNumber) {\r\n let preset = this._loader.getPreset(bankNumber, presetNumber);\r\n if (preset == null) {\r\n throw `Preset ${presetNumber} in bank ${bankNumber} doesn't exist.`;\r\n }\r\n this._sequenceBuilder.preset = preset;\r\n }\r\n /**adds a single note to the sequence. When finished adding notes to your\r\n * sequence, call [prepareSequencedPlayback] to add them to the player\r\n * as a note set.*/\r\n addNoteToSequence(noteDO) {\r\n this._sequenceBuilder.addNoteToSequence(noteDO);\r\n }\r\n /**removes notes from the sequence builder so that calling \r\n * [addNoteToSequence] will begin creating a new set of notes. This does not\r\n * remove notes from the player. Use [clearNotes] to accomplish that.*/\r\n clearSequence() {\r\n this._sequenceBuilder.clearSequence();\r\n }\r\n /**returns a list of PerformanceNoteDO objects that have been created via\r\n * calls to addNoteToSequence(). In most cases you can skip this step and\r\n * use prepareSequencedPlayback() to send the sequenced notes to the\r\n * player.*/\r\n getPerformanceNotes() {\r\n return this._sequenceBuilder.sequence;\r\n }\r\n createNotesFromString(notes) {\r\n this._stringNoteMaker.createNotes(notes);\r\n }\r\n ///////////////////PLAYBACK////////////////////////\r\n /**Converts NoteInfoDOs to PerformanceNoteDOs and sends them to the player\r\n * for immediate playback (or whenever their startTimes indicate)*/\r\n playNotes(notes) {\r\n let pNotes = this._sequenceBuilder.createPerformanceNotes(notes);\r\n this._player.playNotes(pNotes);\r\n }\r\n enableLiveNotePlayer() {\r\n if (this._outputTarget == null) {\r\n throw \"An output AudioComponent must be set before enabling the LiveNotePlayer\";\r\n }\r\n if (this._liveNotePlayer == null) {\r\n this._liveNotePlayer = new _LiveNotePlayer(this._sequenceBuilder);\r\n this._liveNotePlayer.connect(this._outputTarget);\r\n }\r\n this._liveNotePlayer.enable();\r\n }\r\n disableLiveNotePlayer() {\r\n this._liveNotePlayer.disable();\r\n }\r\n /**starts playing a note. Use [stopNote] to terminate.*/\r\n startLiveNote(ldo) {\r\n if (this._liveNotePlayer == null || !this._liveNotePlayer.isEnabled) {\r\n throw \"you must call SoundLibManager.enableLiveNotePlayer() before\";\r\n \"using it\";\r\n }\r\n this._liveNotePlayer.startLiveNote(ldo);\r\n }\r\n /**stops playing a note started with [startNote].*/\r\n stopLiveNote(ldo, fadeDuration = 0.05) {\r\n if (this._liveNotePlayer == null || !this._liveNotePlayer.isEnabled) {\r\n throw \"you must call SoundLibManager.enableLiveNotePlayer() before using it\";\r\n }\r\n this._liveNotePlayer.stopLiveNote(ldo, fadeDuration);\r\n }\r\n /**stops all live notes immediately, with no fade out*/\r\n stopAllLiveNotes() {\r\n this._liveNotePlayer.stopAllLiveNotes();\r\n }\r\n /**starts the audio playback - use prepareAudio first to generate the audio\r\n * The optional [startTime] can be used to adjust the start position\r\n * of playback. A positive value (in seconds) causes */\r\n play(startTime = 0) {\r\n this._player.play(startTime);\r\n }\r\n /**stops playback. There is a 50ms delay after stop is called for volume\r\n * to be ramped to 0, and a Promise is returned after 0 is reached. But\r\n * it should be okay to call play again without waiting for this to\r\n * complete.*/\r\n async stop() {\r\n this._player.stop();\r\n }\r\n /**prepares notes that were added via [addNoteToSequence] for playback. \r\n * If [loop] is true, the sequence will be repeated continuously. \r\n * Setting the [performanceTime] to a value \r\n * greater than 0 will cause the sequence to be delayed until the time from\r\n * the start of playback has passed (not AudioContext.currentTime). If\r\n * adding notes during playback, use the [playStartTime] getter to get the\r\n * time (in seconds) that playback started. You can compare this to\r\n * [AudioContext.currentTime] to figure out how much time has elapsed since\r\n * playback start. If enableRescheduling is true, the note set will not be\r\n * disposed after its playback completes, and you can use the\r\n * scheduleNoteSet() and clearNoteSetSchedule() methods to update it for\r\n * repeated use. Returns an integer id associated with this note set\r\n * sequence which may be used later to remove this note set via\r\n * [removeNoteSet].*/\r\n prepareSequencedPlayback(loop = false, performanceTime = 0, enableRescheduling = false) {\r\n let pNotes = this._sequenceBuilder.sequence;\r\n return this._player.prepareAudio(\r\n pNotes,\r\n loop,\r\n performanceTime,\r\n enableRescheduling\r\n );\r\n }\r\n /**removes all note sequences from the player.*/\r\n clearNotes() {\r\n this._player.clearNotes();\r\n }\r\n /**removes a specific noteset from the player*/\r\n removeNoteSet(notesetId) {\r\n this._player.removeNoteSet(notesetId);\r\n }\r\n /**stops playback of the requested NoteSet if it is currently playing.\r\n * This does not remove the NoteSet or prevent its next scheduled or\r\n * repeated entrance from playing. Use clearNoteSetSchedule() in\r\n * combination for that.*/\r\n stopNoteSetPlayback(noteSetId) {\r\n this._player.stopNoteSetPlayback(noteSetId);\r\n }\r\n /**Adds PerformanceNoteDOs to the player, generating a note set that will\r\n * be added to the process loop.\r\n * If [loop] is true, the sequence will be repeated continuously. \r\n * Setting the [performanceTime] to a value \r\n * greater than 0 will cause the sequence to be delayed until the time from\r\n * the start of playback has passed (not AudioContext.currentTime). If\r\n * adding notes during playback, use the [playStartTime] getter to get the\r\n * time (in seconds) that playback started. You can compare this to\r\n * [AudioContext.currentTime] to figure out how much time has elapsed since\r\n * playback start. If enableRescheduling is true, the note set will not be\r\n * disposed after its playback completes, and you can use the\r\n * scheduleNoteSet() and clearNoteSetSchedule() methods to update it for\r\n * repeated use. Returns an integer id associated with this note set\r\n * sequence which may be used later to remove this note set via\r\n * [removeNoteSet].*/\r\n addPerformanceNotes(notes, loop = false, performanceTime = 0, enableRescheduling = false) {\r\n return this._player.prepareAudio(\r\n notes,\r\n loop,\r\n performanceTime,\r\n enableRescheduling\r\n );\r\n }\r\n /**Schedules an additional time for the requested NoteSet to play. The\r\n * performanceTime is the number of seconds after the start of player\r\n * playback. Use [currentPlayTime] to get the current position.\r\n */\r\n scheduleNoteSet(noteSetId, performanceTime) {\r\n this._player.scheduleNoteSet(noteSetId, performanceTime);\r\n }\r\n /**clears the play schedule for the requested NoteSet. If a performanceTime\r\n * is included, only that time is removed from the schedule */\r\n clearNoteSetSchedule(noteSetId, performanceTime = null) {\r\n this._player.clearNoteSetSchedule(noteSetId, performanceTime);\r\n }\r\n /**Sets the gain for a track that's associated with [NoteInfoDO.trackId]\r\n * (and thus [_PerformanceNoteDO.trackId]) value. If a gain node has not\r\n * been created yet for this index, ie. because playback hasn't been called\r\n * yet, it is created here. A [trackId] of 0 is meant to refer to the\r\n * first, default track. [volume] must be from 0.0 to 1.0.*/\r\n setTrackVolume(trackId, volume) {\r\n this._player.setTrackVolume(trackId, volume);\r\n }\r\n /**Sets the pan for a track that's associated with [NoteInfoDO.trackId]\r\n * (and thus [_PerformanceNoteDO.trackId]) value. If a pan node has not\r\n * been created yet for this index, ie. because playback hasn't been called\r\n * yet, it is created here. A [trackId] of 0 is meant to refer to the\r\n * first, default track. [pan] must be from -1.0 to 1.0.*/\r\n setTrackPan(trackId, pan) {\r\n this._player.setTrackPan(trackId, pan);\r\n }\r\n /**sets the gain for the master output. Default is 0.3. Must always be >= 0\r\n */\r\n setMasterVolume(volume) {\r\n this._player.setMasterVolume(volume);\r\n }\r\n /**Adjusts the [_SoundLibPlayer]'s playback forward or back the requested\r\n * amount of time.*/\r\n shiftPlayerTime(timeDelta) {\r\n this._player.shiftPlayerTime(timeDelta);\r\n }\r\n /**Adds a callback you want called when the player passes a PlayheadTime.\r\n * The player checks for passed trigger times on a regular interval of\r\n * about 500ms, so this call could be up to around that much after the\r\n * phTriggerTime you pass. To compensate, set the phTriggerTime to an\r\n * earlier value if you need to receive the event by that time. All subs\r\n * are removed when playback stops.\r\n * @param callback The function to call. It should take the current phTime\r\n * as an argument. It can optionally return a new phTriggerTime so you can\r\n * reuse this. If null is returned, the sub will be removed. If you set\r\n * the value to Number.MIN_SAFE_INTEGER, or any value less than or equal\r\n * to the current playhead time, it will ensure the callback is called on\r\n * the next iteration.\r\n * @param phTriggerTime The phTime in the player that you want the callback\r\n * to be called _after_.*/\r\n addPhTimeSub(callback, phTriggerTime) {\r\n this._player.addPhTimeSub(callback, phTriggerTime);\r\n }\r\n /**Removes a Playhead time subscription via its callback.\r\n * @returns true if the callback was found and removed. */\r\n removePhTimeSub(callback) {\r\n return this._player.removePhTimeSub(callback);\r\n }\r\n _init() {\r\n this._loader = new _SoundLibLoader();\r\n this._sequenceBuilder = new _NoteBuilder();\r\n this._stringNoteMaker = new _StringNoteParser();\r\n this._player = new _SoundLibPlayer();\r\n }\r\n /**for internal package use */\r\n _dispatch(e) {\r\n this._eventEmitter.emit(e);\r\n }\r\n /**gets the [AudioContext] used for loading and playback.*/\r\n get context() {\r\n return this._context;\r\n }\r\n get isPlaying() {\r\n return this._player.isPlaying;\r\n }\r\n /**returns the AudioContext time when the playback started.*/\r\n get playStartTime() {\r\n return this._player.playStartTime;\r\n }\r\n /**the AudioContext.currentTime value after the first audio processing call\r\n * completes*/\r\n get firstSoundTime() {\r\n return this._player.firstSoundTime;\r\n }\r\n /**returns the amount of time in seconds that has elapsed since the start\r\n * of playback.*/\r\n get currentPlayTime() {\r\n return this._player.currentPlayTime;\r\n }\r\n /**returns the [SoundLibType] that was set for this [SoundLibManager].\r\n * read-only*/\r\n get libType() {\r\n return this._libType;\r\n }\r\n /**returns true if a sound map has been loaded.*/\r\n get soundMapLoaded() {\r\n return this._loader._soundMap != null;\r\n }\r\n /**The name of an indexedDb database. Example: 'odogy_soundsDb'. Map json \r\n * files that specify file versions will attempt to load from this db. If\r\n * null (default), no db will be used and files will always be downloaded.*/\r\n get dbName() {\r\n return this._loader._dbName;\r\n }\r\n set dbName(value) {\r\n this._loader._dbName = value;\r\n }\r\n};\r\n\r\n// src/sound_lib/playback/LiveNoteInfoDO.ts\r\nvar LiveNoteInfoDO = class {\r\n constructor(midiNote, amplitude, bank, preset) {\r\n this.midiNote = midiNote;\r\n this.amplitude = amplitude;\r\n this.bank = bank;\r\n this.preset = preset;\r\n }\r\n};\r\nexport {\r\n LiveNoteInfoDO,\r\n NoteInfoDO,\r\n SoundLibEvent,\r\n SoundLibEventType,\r\n SoundLibManager,\r\n SoundLibType\r\n};\r\n","/**\n * The Ease class provides a collection of easing functions for use with tween.js.\n */\nvar Easing = {\n Linear: {\n None: function (amount) {\n return amount;\n },\n },\n Quadratic: {\n In: function (amount) {\n return amount * amount;\n },\n Out: function (amount) {\n return amount * (2 - amount);\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount;\n }\n return -0.5 * (--amount * (amount - 2) - 1);\n },\n },\n Cubic: {\n In: function (amount) {\n return amount * amount * amount;\n },\n Out: function (amount) {\n return --amount * amount * amount + 1;\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount;\n }\n return 0.5 * ((amount -= 2) * amount * amount + 2);\n },\n },\n Quartic: {\n In: function (amount) {\n return amount * amount * amount * amount;\n },\n Out: function (amount) {\n return 1 - --amount * amount * amount * amount;\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount * amount;\n }\n return -0.5 * ((amount -= 2) * amount * amount * amount - 2);\n },\n },\n Quintic: {\n In: function (amount) {\n return amount * amount * amount * amount * amount;\n },\n Out: function (amount) {\n return --amount * amount * amount * amount * amount + 1;\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount * amount * amount;\n }\n return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);\n },\n },\n Sinusoidal: {\n In: function (amount) {\n return 1 - Math.cos((amount * Math.PI) / 2);\n },\n Out: function (amount) {\n return Math.sin((amount * Math.PI) / 2);\n },\n InOut: function (amount) {\n return 0.5 * (1 - Math.cos(Math.PI * amount));\n },\n },\n Exponential: {\n In: function (amount) {\n return amount === 0 ? 0 : Math.pow(1024, amount - 1);\n },\n Out: function (amount) {\n return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);\n },\n InOut: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n if ((amount *= 2) < 1) {\n return 0.5 * Math.pow(1024, amount - 1);\n }\n return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);\n },\n },\n Circular: {\n In: function (amount) {\n return 1 - Math.sqrt(1 - amount * amount);\n },\n Out: function (amount) {\n return Math.sqrt(1 - --amount * amount);\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return -0.5 * (Math.sqrt(1 - amount * amount) - 1);\n }\n return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);\n },\n },\n Elastic: {\n In: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);\n },\n Out: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;\n },\n InOut: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n amount *= 2;\n if (amount < 1) {\n return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);\n }\n return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;\n },\n },\n Back: {\n In: function (amount) {\n var s = 1.70158;\n return amount * amount * ((s + 1) * amount - s);\n },\n Out: function (amount) {\n var s = 1.70158;\n return --amount * amount * ((s + 1) * amount + s) + 1;\n },\n InOut: function (amount) {\n var s = 1.70158 * 1.525;\n if ((amount *= 2) < 1) {\n return 0.5 * (amount * amount * ((s + 1) * amount - s));\n }\n return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);\n },\n },\n Bounce: {\n In: function (amount) {\n return 1 - Easing.Bounce.Out(1 - amount);\n },\n Out: function (amount) {\n if (amount < 1 / 2.75) {\n return 7.5625 * amount * amount;\n }\n else if (amount < 2 / 2.75) {\n return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;\n }\n else if (amount < 2.5 / 2.75) {\n return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;\n }\n else {\n return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;\n }\n },\n InOut: function (amount) {\n if (amount < 0.5) {\n return Easing.Bounce.In(amount * 2) * 0.5;\n }\n return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;\n },\n },\n};\n\nvar now;\n// Include a performance.now polyfill.\n// In node.js, use process.hrtime.\n// eslint-disable-next-line\n// @ts-ignore\nif (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {\n now = function () {\n // eslint-disable-next-line\n // @ts-ignore\n var time = process.hrtime();\n // Convert [seconds, nanoseconds] to milliseconds.\n return time[0] * 1000 + time[1] / 1000000;\n };\n}\n// In a browser, use self.performance.now if it is available.\nelse if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {\n // This must be bound, because directly assigning this function\n // leads to an invocation exception in Chrome.\n now = self.performance.now.bind(self.performance);\n}\n// Use Date.now if it is available.\nelse if (Date.now !== undefined) {\n now = Date.now;\n}\n// Otherwise, use 'new Date().getTime()'.\nelse {\n now = function () {\n return new Date().getTime();\n };\n}\nvar now$1 = now;\n\n/**\n * Controlling groups of tweens\n *\n * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.\n * In these cases, you may want to create your own smaller groups of tween\n */\nvar Group = /** @class */ (function () {\n function Group() {\n this._tweens = {};\n this._tweensAddedDuringUpdate = {};\n }\n Group.prototype.getAll = function () {\n var _this = this;\n return Object.keys(this._tweens).map(function (tweenId) {\n return _this._tweens[tweenId];\n });\n };\n Group.prototype.removeAll = function () {\n this._tweens = {};\n };\n Group.prototype.add = function (tween) {\n this._tweens[tween.getId()] = tween;\n this._tweensAddedDuringUpdate[tween.getId()] = tween;\n };\n Group.prototype.remove = function (tween) {\n delete this._tweens[tween.getId()];\n delete this._tweensAddedDuringUpdate[tween.getId()];\n };\n Group.prototype.update = function (time, preserve) {\n if (time === void 0) { time = now$1(); }\n if (preserve === void 0) { preserve = false; }\n var tweenIds = Object.keys(this._tweens);\n if (tweenIds.length === 0) {\n return false;\n }\n // Tweens are updated in \"batches\". If you add a new tween during an\n // update, then the new tween will be updated in the next batch.\n // If you remove a tween during an update, it may or may not be updated.\n // However, if the removed tween was added during the current batch,\n // then it will not be updated.\n while (tweenIds.length > 0) {\n this._tweensAddedDuringUpdate = {};\n for (var i = 0; i < tweenIds.length; i++) {\n var tween = this._tweens[tweenIds[i]];\n var autoStart = !preserve;\n if (tween && tween.update(time, autoStart) === false && !preserve) {\n delete this._tweens[tweenIds[i]];\n }\n }\n tweenIds = Object.keys(this._tweensAddedDuringUpdate);\n }\n return true;\n };\n return Group;\n}());\n\n/**\n *\n */\nvar Interpolation = {\n Linear: function (v, k) {\n var m = v.length - 1;\n var f = m * k;\n var i = Math.floor(f);\n var fn = Interpolation.Utils.Linear;\n if (k < 0) {\n return fn(v[0], v[1], f);\n }\n if (k > 1) {\n return fn(v[m], v[m - 1], m - f);\n }\n return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);\n },\n Bezier: function (v, k) {\n var b = 0;\n var n = v.length - 1;\n var pw = Math.pow;\n var bn = Interpolation.Utils.Bernstein;\n for (var i = 0; i <= n; i++) {\n b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);\n }\n return b;\n },\n CatmullRom: function (v, k) {\n var m = v.length - 1;\n var f = m * k;\n var i = Math.floor(f);\n var fn = Interpolation.Utils.CatmullRom;\n if (v[0] === v[m]) {\n if (k < 0) {\n i = Math.floor((f = m * (1 + k)));\n }\n return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);\n }\n else {\n if (k < 0) {\n return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);\n }\n if (k > 1) {\n return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);\n }\n return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);\n }\n },\n Utils: {\n Linear: function (p0, p1, t) {\n return (p1 - p0) * t + p0;\n },\n Bernstein: function (n, i) {\n var fc = Interpolation.Utils.Factorial;\n return fc(n) / fc(i) / fc(n - i);\n },\n Factorial: (function () {\n var a = [1];\n return function (n) {\n var s = 1;\n if (a[n]) {\n return a[n];\n }\n for (var i = n; i > 1; i--) {\n s *= i;\n }\n a[n] = s;\n return s;\n };\n })(),\n CatmullRom: function (p0, p1, p2, p3, t) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n var t2 = t * t;\n var t3 = t * t2;\n return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;\n },\n },\n};\n\n/**\n * Utils\n */\nvar Sequence = /** @class */ (function () {\n function Sequence() {\n }\n Sequence.nextId = function () {\n return Sequence._nextId++;\n };\n Sequence._nextId = 0;\n return Sequence;\n}());\n\nvar mainGroup = new Group();\n\n/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/tweenjs/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\nvar Tween = /** @class */ (function () {\n function Tween(_object, _group) {\n if (_group === void 0) { _group = mainGroup; }\n this._object = _object;\n this._group = _group;\n this._isPaused = false;\n this._pauseStart = 0;\n this._valuesStart = {};\n this._valuesEnd = {};\n this._valuesStartRepeat = {};\n this._duration = 1000;\n this._initialRepeat = 0;\n this._repeat = 0;\n this._yoyo = false;\n this._isPlaying = false;\n this._reversed = false;\n this._delayTime = 0;\n this._startTime = 0;\n this._easingFunction = Easing.Linear.None;\n this._interpolationFunction = Interpolation.Linear;\n this._chainedTweens = [];\n this._onStartCallbackFired = false;\n this._id = Sequence.nextId();\n this._isChainStopped = false;\n this._goToEnd = false;\n }\n Tween.prototype.getId = function () {\n return this._id;\n };\n Tween.prototype.isPlaying = function () {\n return this._isPlaying;\n };\n Tween.prototype.isPaused = function () {\n return this._isPaused;\n };\n Tween.prototype.to = function (properties, duration) {\n // TODO? restore this, then update the 07_dynamic_to example to set fox\n // tween's to on each update. That way the behavior is opt-in (there's\n // currently no opt-out).\n // for (const prop in properties) this._valuesEnd[prop] = properties[prop]\n this._valuesEnd = Object.create(properties);\n if (duration !== undefined) {\n this._duration = duration;\n }\n return this;\n };\n Tween.prototype.duration = function (d) {\n this._duration = d;\n return this;\n };\n Tween.prototype.start = function (time) {\n if (this._isPlaying) {\n return this;\n }\n // eslint-disable-next-line\n this._group && this._group.add(this);\n this._repeat = this._initialRepeat;\n if (this._reversed) {\n // If we were reversed (f.e. using the yoyo feature) then we need to\n // flip the tween direction back to forward.\n this._reversed = false;\n for (var property in this._valuesStartRepeat) {\n this._swapEndStartRepeatValues(property);\n this._valuesStart[property] = this._valuesStartRepeat[property];\n }\n }\n this._isPlaying = true;\n this._isPaused = false;\n this._onStartCallbackFired = false;\n this._isChainStopped = false;\n this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1();\n this._startTime += this._delayTime;\n this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);\n return this;\n };\n Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) {\n for (var property in _valuesEnd) {\n var startValue = _object[property];\n var startValueIsArray = Array.isArray(startValue);\n var propType = startValueIsArray ? 'array' : typeof startValue;\n var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);\n // If `to()` specifies a property that doesn't exist in the source object,\n // we should not set that property in the object\n if (propType === 'undefined' || propType === 'function') {\n continue;\n }\n // Check if an Array was provided as property value\n if (isInterpolationList) {\n var endValues = _valuesEnd[property];\n if (endValues.length === 0) {\n continue;\n }\n // handle an array of relative values\n endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));\n // Create a local copy of the Array with the start value at the front\n _valuesEnd[property] = [startValue].concat(endValues);\n }\n // handle the deepness of the values\n if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {\n _valuesStart[property] = startValueIsArray ? [] : {};\n // eslint-disable-next-line\n for (var prop in startValue) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _valuesStart[property][prop] = startValue[prop];\n }\n _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);\n }\n else {\n // Save the starting value, but only once.\n if (typeof _valuesStart[property] === 'undefined') {\n _valuesStart[property] = startValue;\n }\n if (!startValueIsArray) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings\n }\n if (isInterpolationList) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();\n }\n else {\n _valuesStartRepeat[property] = _valuesStart[property] || 0;\n }\n }\n }\n };\n Tween.prototype.stop = function () {\n if (!this._isChainStopped) {\n this._isChainStopped = true;\n this.stopChainedTweens();\n }\n if (!this._isPlaying) {\n return this;\n }\n // eslint-disable-next-line\n this._group && this._group.remove(this);\n this._isPlaying = false;\n this._isPaused = false;\n if (this._onStopCallback) {\n this._onStopCallback(this._object);\n }\n return this;\n };\n Tween.prototype.end = function () {\n this._goToEnd = true;\n this.update(Infinity);\n return this;\n };\n Tween.prototype.pause = function (time) {\n if (time === void 0) { time = now$1(); }\n if (this._isPaused || !this._isPlaying) {\n return this;\n }\n this._isPaused = true;\n this._pauseStart = time;\n // eslint-disable-next-line\n this._group && this._group.remove(this);\n return this;\n };\n Tween.prototype.resume = function (time) {\n if (time === void 0) { time = now$1(); }\n if (!this._isPaused || !this._isPlaying) {\n return this;\n }\n this._isPaused = false;\n this._startTime += time - this._pauseStart;\n this._pauseStart = 0;\n // eslint-disable-next-line\n this._group && this._group.add(this);\n return this;\n };\n Tween.prototype.stopChainedTweens = function () {\n for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {\n this._chainedTweens[i].stop();\n }\n return this;\n };\n Tween.prototype.group = function (group) {\n this._group = group;\n return this;\n };\n Tween.prototype.delay = function (amount) {\n this._delayTime = amount;\n return this;\n };\n Tween.prototype.repeat = function (times) {\n this._initialRepeat = times;\n this._repeat = times;\n return this;\n };\n Tween.prototype.repeatDelay = function (amount) {\n this._repeatDelayTime = amount;\n return this;\n };\n Tween.prototype.yoyo = function (yoyo) {\n this._yoyo = yoyo;\n return this;\n };\n Tween.prototype.easing = function (easingFunction) {\n this._easingFunction = easingFunction;\n return this;\n };\n Tween.prototype.interpolation = function (interpolationFunction) {\n this._interpolationFunction = interpolationFunction;\n return this;\n };\n Tween.prototype.chain = function () {\n var tweens = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n tweens[_i] = arguments[_i];\n }\n this._chainedTweens = tweens;\n return this;\n };\n Tween.prototype.onStart = function (callback) {\n this._onStartCallback = callback;\n return this;\n };\n Tween.prototype.onUpdate = function (callback) {\n this._onUpdateCallback = callback;\n return this;\n };\n Tween.prototype.onRepeat = function (callback) {\n this._onRepeatCallback = callback;\n return this;\n };\n Tween.prototype.onComplete = function (callback) {\n this._onCompleteCallback = callback;\n return this;\n };\n Tween.prototype.onStop = function (callback) {\n this._onStopCallback = callback;\n return this;\n };\n /**\n * @returns true if the tween is still playing after the update, false\n * otherwise (calling update on a paused tween still returns true because\n * it is still playing, just paused).\n */\n Tween.prototype.update = function (time, autoStart) {\n if (time === void 0) { time = now$1(); }\n if (autoStart === void 0) { autoStart = true; }\n if (this._isPaused)\n return true;\n var property;\n var elapsed;\n var endTime = this._startTime + this._duration;\n if (!this._goToEnd && !this._isPlaying) {\n if (time > endTime)\n return false;\n if (autoStart)\n this.start(time);\n }\n this._goToEnd = false;\n if (time < this._startTime) {\n return true;\n }\n if (this._onStartCallbackFired === false) {\n if (this._onStartCallback) {\n this._onStartCallback(this._object);\n }\n this._onStartCallbackFired = true;\n }\n elapsed = (time - this._startTime) / this._duration;\n elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;\n var value = this._easingFunction(elapsed);\n // properties transformations\n this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);\n if (this._onUpdateCallback) {\n this._onUpdateCallback(this._object, elapsed);\n }\n if (elapsed === 1) {\n if (this._repeat > 0) {\n if (isFinite(this._repeat)) {\n this._repeat--;\n }\n // Reassign starting values, restart by making startTime = now\n for (property in this._valuesStartRepeat) {\n if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {\n this._valuesStartRepeat[property] =\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);\n }\n if (this._yoyo) {\n this._swapEndStartRepeatValues(property);\n }\n this._valuesStart[property] = this._valuesStartRepeat[property];\n }\n if (this._yoyo) {\n this._reversed = !this._reversed;\n }\n if (this._repeatDelayTime !== undefined) {\n this._startTime = time + this._repeatDelayTime;\n }\n else {\n this._startTime = time + this._delayTime;\n }\n if (this._onRepeatCallback) {\n this._onRepeatCallback(this._object);\n }\n return true;\n }\n else {\n if (this._onCompleteCallback) {\n this._onCompleteCallback(this._object);\n }\n for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {\n // Make the chained tweens start exactly at the time they should,\n // even if the `update()` method was called way past the duration of the tween\n this._chainedTweens[i].start(this._startTime + this._duration);\n }\n this._isPlaying = false;\n return false;\n }\n }\n return true;\n };\n Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {\n for (var property in _valuesEnd) {\n // Don't update properties that do not exist in the source object\n if (_valuesStart[property] === undefined) {\n continue;\n }\n var start = _valuesStart[property] || 0;\n var end = _valuesEnd[property];\n var startIsArray = Array.isArray(_object[property]);\n var endIsArray = Array.isArray(end);\n var isInterpolationList = !startIsArray && endIsArray;\n if (isInterpolationList) {\n _object[property] = this._interpolationFunction(end, value);\n }\n else if (typeof end === 'object' && end) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n this._updateProperties(_object[property], start, end, value);\n }\n else {\n // Parses relative end values with start as base (e.g.: +10, -3)\n end = this._handleRelativeValue(start, end);\n // Protect against non numeric properties.\n if (typeof end === 'number') {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _object[property] = start + (end - start) * value;\n }\n }\n }\n };\n Tween.prototype._handleRelativeValue = function (start, end) {\n if (typeof end !== 'string') {\n return end;\n }\n if (end.charAt(0) === '+' || end.charAt(0) === '-') {\n return start + parseFloat(end);\n }\n else {\n return parseFloat(end);\n }\n };\n Tween.prototype._swapEndStartRepeatValues = function (property) {\n var tmp = this._valuesStartRepeat[property];\n var endValue = this._valuesEnd[property];\n if (typeof endValue === 'string') {\n this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);\n }\n else {\n this._valuesStartRepeat[property] = this._valuesEnd[property];\n }\n this._valuesEnd[property] = tmp;\n };\n return Tween;\n}());\n\nvar VERSION = '18.6.4';\n\n/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/tweenjs/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\nvar nextId = Sequence.nextId;\n/**\n * Controlling groups of tweens\n *\n * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.\n * In these cases, you may want to create your own smaller groups of tweens.\n */\nvar TWEEN = mainGroup;\n// This is the best way to export things in a way that's compatible with both ES\n// Modules and CommonJS, without build hacks, and so as not to break the\n// existing API.\n// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881\nvar getAll = TWEEN.getAll.bind(TWEEN);\nvar removeAll = TWEEN.removeAll.bind(TWEEN);\nvar add = TWEEN.add.bind(TWEEN);\nvar remove = TWEEN.remove.bind(TWEEN);\nvar update = TWEEN.update.bind(TWEEN);\nvar exports = {\n Easing: Easing,\n Group: Group,\n Interpolation: Interpolation,\n now: now$1,\n Sequence: Sequence,\n nextId: nextId,\n Tween: Tween,\n VERSION: VERSION,\n getAll: getAll,\n removeAll: removeAll,\n add: add,\n remove: remove,\n update: update,\n};\n\nexport default exports;\nexport { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, getAll, nextId, now$1 as now, remove, removeAll, update };\n","// src/audio_sequencer/AudioSequencer.ts\r\nimport { AudioProcessor } from \"audio_utils\";\r\nvar AudioSequencer = class {\r\n constructor(context) {\r\n this._soundsList = [];\r\n this._nodeCollections = [];\r\n this.isPlaying = false;\r\n this._context = context;\r\n if (this._context == null)\r\n throw \"AudioContext not set\";\r\n this.preEffectsMix = this._context.createGain();\r\n this.masterMix = this._context.createGain();\r\n let wetMix = this._context.createGain();\r\n wetMix.gain.value = 0.1;\r\n let dryMix = this._context.createGain();\r\n dryMix.gain.value = 1;\r\n this.preEffectsMix.connect(wetMix);\r\n this.preEffectsMix.connect(dryMix);\r\n let fxNode = context.createConvolver();\r\n fxNode.buffer = AudioProcessor.generateReverbImpulse(context);\r\n dryMix.connect(this.masterMix);\r\n wetMix.connect(fxNode);\r\n fxNode.connect(this.masterMix);\r\n this.masterMix.connect(this._context.destination);\r\n }\r\n removeSound(ss) {\r\n let idx = this._soundsList.indexOf(ss);\r\n if (idx !== -1) {\r\n this._soundsList.splice(idx, 1);\r\n }\r\n }\r\n addSound(ss) {\r\n this._soundsList.push(ss);\r\n }\r\n ///@param delay - must be >= 0. A period of silence at start of playback\r\n ///which can be used to account for a countoff\r\n ///@param startPosition - the position (in seconds) to begin playback -\r\n ///like a playhead position\r\n play(delay = 0, startPosition = 0) {\r\n if (this.isPlaying)\r\n return;\r\n this.isPlaying = true;\r\n let zeroTime = this._context.currentTime;\r\n startPosition -= delay;\r\n this._nodeCollections = this.createNodeCollections(\r\n this._soundsList,\r\n this._context,\r\n startPosition\r\n );\r\n for (let collection of this._nodeCollections) {\r\n let ss = collection.sequencerSound;\r\n let bsn = collection.bufferSourceNode;\r\n if (startPosition > ss.startTime) {\r\n bsn.start(zeroTime, startPosition - ss.startTime);\r\n } else {\r\n bsn.start(zeroTime + ss.startTime - startPosition);\r\n }\r\n }\r\n this.masterMix.gain.setValueAtTime(0, zeroTime);\r\n this.masterMix.gain.setValueAtTime(1, zeroTime + delay);\r\n }\r\n createNodeCollections(sounds, context, startPosition = 0, overrideOutput) {\r\n let collections = [];\r\n let zeroTime = context.currentTime;\r\n for (let sound of sounds) {\r\n let nodeCollection = new NodeCollection(sound);\r\n collections.push(nodeCollection);\r\n let bs = context.createBufferSource();\r\n bs.buffer = sound.audioBuffer;\r\n nodeCollection.addNode(bs);\r\n let mapGain = context.createGain();\r\n for (let time of sound.volumeMap.keys()) {\r\n let volume = sound.volumeMap.get(time);\r\n let volStartTime = zeroTime + sound.startTime + time - startPosition;\r\n if (volStartTime < zeroTime) {\r\n volStartTime = zeroTime;\r\n }\r\n mapGain.gain.setValueAtTime(volume, volStartTime);\r\n }\r\n nodeCollection.addNode(mapGain);\r\n let gainNode = context.createGain();\r\n gainNode.gain.value = sound.volume;\r\n nodeCollection.addNode(gainNode);\r\n nodeCollection.soundMasterGainNode = gainNode;\r\n let panNode = context.createStereoPanner();\r\n panNode.pan.value = sound.pan;\r\n nodeCollection.addNode(panNode);\r\n nodeCollection.soundMasterPanNode = panNode;\r\n nodeCollection.connectNodes(overrideOutput ?? this.preEffectsMix);\r\n }\r\n return collections;\r\n }\r\n async renderAudio() {\r\n let highestFrameEndTime = 0;\r\n for (let sound of this._soundsList) {\r\n let frameEndTime = sound.audioBuffer.length + 44100 * sound.startTime;\r\n if (frameEndTime > highestFrameEndTime) {\r\n highestFrameEndTime = frameEndTime;\r\n }\r\n }\r\n let context = new OfflineAudioContext(2, highestFrameEndTime, 44100);\r\n let startTime = context.currentTime;\r\n let collections = this.createNodeCollections(\r\n this._soundsList,\r\n context,\r\n 0,\r\n context.destination\r\n );\r\n for (let collection of collections) {\r\n let bs = collection.bufferSourceNode;\r\n bs.start(startTime + collection.sequencerSound.startTime);\r\n }\r\n return new Promise((resolve, reject) => {\r\n context.addEventListener(\"complete\", (e) => {\r\n if (e instanceof OfflineAudioCompletionEvent) {\r\n let buffer = e.renderedBuffer;\r\n resolve(buffer);\r\n } else {\r\n reject(e);\r\n }\r\n });\r\n context.startRendering();\r\n });\r\n }\r\n stop() {\r\n for (let n of this._nodeCollections) {\r\n n.bufferSourceNode.stop(0);\r\n n.removeAllNodes();\r\n }\r\n this.isPlaying = false;\r\n }\r\n getGainNodeForSequencerSound(ss) {\r\n if (this._nodeCollections == null)\r\n return null;\r\n let collection = this._nodeCollections.find((col) => col.sequencerSound === ss);\r\n return collection?.soundMasterGainNode;\r\n }\r\n getPanNodeForSequencerSound(ss) {\r\n let returnNode;\r\n this._nodeCollections.forEach((collection) => {\r\n if (ss === collection.sequencerSound) {\r\n collection.nodes.forEach((node) => {\r\n if (node instanceof StereoPannerNode) {\r\n returnNode = node;\r\n }\r\n });\r\n }\r\n });\r\n return returnNode;\r\n }\r\n};\r\nvar NodeCollection = class {\r\n constructor(sequencerSound) {\r\n this.nodes = [];\r\n this.sequencerSound = sequencerSound;\r\n }\r\n addNode(node) {\r\n this.nodes.push(node);\r\n if (node instanceof AudioBufferSourceNode) {\r\n this.bufferSourceNode = node;\r\n }\r\n }\r\n connectNodes(outputNode) {\r\n for (let i = this.nodes.length - 1; i >= 0; i--) {\r\n this.nodes[i].connect(i < this.nodes.length - 1 ? this.nodes[i + 1] : outputNode);\r\n }\r\n }\r\n removeAllNodes() {\r\n for (let i = 0; i < this.nodes.length; i++) {\r\n this.nodes[i].disconnect();\r\n }\r\n }\r\n};\r\n\r\n// src/audio_sequencer/AudioElementSequencer.ts\r\nimport { AudioComponent } from \"audio_output\";\r\n\r\n// src/audio_sequencer/SequencerSound.ts\r\nimport { createEmitter } from \"ts_utils\";\r\nvar SequencerSound = class _SequencerSound {\r\n // The pan property takes a unitless value between -1 (full left pan) and 1 \r\n // (full right pan). \r\n constructor(audio, startTime, volume = 0.8, pan = 0) {\r\n this._delay = 0;\r\n /**volume in terms of seconds (key) to volume (value, 0.0-1.0)*/\r\n this._volumeMap = /* @__PURE__ */ new Map([[0, 1]]);\r\n this._emitter = createEmitter();\r\n if (audio instanceof AudioBuffer) {\r\n this._audioBuffer = audio;\r\n } else if (audio instanceof HTMLAudioElement) {\r\n this._audioElement = audio;\r\n }\r\n this._startTime = startTime;\r\n this._volume = volume;\r\n this._pan = pan;\r\n }\r\n get event() {\r\n return this._emitter.event;\r\n }\r\n static createSequencerSound(ab, startTime) {\r\n var ss = new _SequencerSound(ab, startTime);\r\n return ss;\r\n }\r\n get volume() {\r\n return this._volume;\r\n }\r\n set volume(volume) {\r\n this._volume = volume;\r\n this._emitter.emit(0 /* volumeChange */);\r\n }\r\n get pan() {\r\n return this._pan;\r\n }\r\n set pan(pan) {\r\n this._pan = pan;\r\n this._emitter.emit(1 /* panChange */);\r\n }\r\n get startTime() {\r\n return this._startTime;\r\n }\r\n set startTime(st) {\r\n this._startTime = st;\r\n }\r\n get delay() {\r\n return this._delay;\r\n }\r\n set delay(value) {\r\n this._delay = value;\r\n this._emitter.emit(2 /* delayChange */);\r\n }\r\n get audioBuffer() {\r\n return this._audioBuffer;\r\n }\r\n set audioBuffer(ab) {\r\n this._audioBuffer = ab;\r\n }\r\n get volumeMap() {\r\n return this._volumeMap;\r\n }\r\n set volumeMap(value) {\r\n this._volumeMap = value;\r\n }\r\n get audioElement() {\r\n return this._audioElement;\r\n }\r\n get audioElementSourceNode() {\r\n return this._audioElementSourceNode;\r\n }\r\n set audioElementSourceNode(value) {\r\n this._audioElementSourceNode = value;\r\n }\r\n};\r\nvar SequencerSoundEvent = /* @__PURE__ */ ((SequencerSoundEvent2) => {\r\n SequencerSoundEvent2[SequencerSoundEvent2[\"volumeChange\"] = 0] = \"volumeChange\";\r\n SequencerSoundEvent2[SequencerSoundEvent2[\"panChange\"] = 1] = \"panChange\";\r\n SequencerSoundEvent2[SequencerSoundEvent2[\"delayChange\"] = 2] = \"delayChange\";\r\n return SequencerSoundEvent2;\r\n})(SequencerSoundEvent || {});\r\n\r\n// src/audio_sequencer/AudioElementSequencer.ts\r\nvar AudioElementSequencer = class extends AudioComponent {\r\n constructor(context) {\r\n super();\r\n this._soundsList = [];\r\n this._nodeCollections = [];\r\n this._masterVolume = 1;\r\n this._isPlaying = false;\r\n this._checkForReadySounds = () => {\r\n let elapsedTime = this._context.currentTime - this._playStartTime;\r\n let playheadPosition = this._playheadStartPosition + elapsedTime;\r\n for (let i = this._unplayedSounds.length - 1; i >= 0; i--) {\r\n let sound = this._unplayedSounds[i];\r\n if (playheadPosition >= sound.startTime - 1) {\r\n this._nodeCollections.push(this._createNodeCollection(\r\n sound,\r\n this._context\r\n ));\r\n sound.audioElement.play();\r\n this._unplayedSounds.splice(i, 1);\r\n }\r\n }\r\n };\r\n this._onSoundPlaying = (e) => {\r\n let el = e.target;\r\n let nc = this._nodeCollections.find((n) => n.sequencerSound.audioElement === el);\r\n let elapsedTime = this._context.currentTime - this._playStartTime;\r\n let playheadPosition = this._playheadStartPosition + elapsedTime;\r\n nc.playOffset = nc.sequencerSound.startTime - playheadPosition;\r\n nc.updateDelay();\r\n };\r\n this._context = context;\r\n if (this._context == null)\r\n throw \"AudioContext not set\";\r\n this._masterMix = this._context.createGain();\r\n }\r\n removeSound(ss) {\r\n if (this._isPlaying) {\r\n throw \"SequencerSound can not be removed during playback\";\r\n }\r\n let idx = this._soundsList.indexOf(ss);\r\n if (idx !== -1) {\r\n this._soundsList.splice(idx, 1);\r\n }\r\n }\r\n addSound(ss) {\r\n if (ss.audioElementSourceNode == null) {\r\n ss.audioElementSourceNode = this._context.createMediaElementSource(ss.audioElement);\r\n }\r\n this._soundsList.push(ss);\r\n }\r\n /**prepares playback by seeking to appropriate time in audio elements and\r\n * choosing which sounds will play based on the [startPosition]. The [delay]\r\n * is in seconds and represents a silent period before playback reaches\r\n * the [startPosition]. It can be used to account for a countoff. The\r\n * [startPosition] is in seconds from the beginning of the song, which \r\n * starts at 0.0. This is where audio will begin to be heard. For example, a \r\n * [delay] of 2.0 seconds with a [startPosition] of 5.0 would be silent for \r\n * 2 seconds and then start at the 5 second position of the song. If you had\r\n * a [SequencerSound] with a startPosition of 6.0, you'd get 2 seconds of\r\n * silence and then 1 more second of playback before the [SequencerSound]\r\n * begins at the 6.0 mark.*/\r\n async preparePlayback(delay = 0, startPosition = 0) {\r\n this._playheadStartPosition = startPosition - delay;\r\n this._delayDuration = delay;\r\n this._unplayedSounds = [];\r\n for (let sound of this._soundsList) {\r\n if (sound.startTime + sound.audioElement.duration > this._playheadStartPosition) {\r\n this._unplayedSounds.push(sound);\r\n sound.audioElement.addEventListener(\r\n \"playing\",\r\n this._onSoundPlaying\r\n );\r\n }\r\n }\r\n await this._seekToStartTimes(this._playheadStartPosition);\r\n }\r\n /**@param delay - must be >= 0. A period of silence at start of playback\r\n * which can be used to account for a countoff\r\n * @param startPosition - the position (in seconds) to begin playback -\r\n * like a playhead position*/\r\n play() {\r\n if (this._isPlaying)\r\n return;\r\n this._isPlaying = true;\r\n this._playStartTime = this._context.currentTime;\r\n this._masterMix.gain.setValueAtTime(0, this._playStartTime);\r\n this._masterMix.gain.setValueAtTime(\r\n this._masterVolume,\r\n this._playStartTime + this._delayDuration\r\n );\r\n this._checkForReadySounds();\r\n this._soundStartIntervalId = window.setInterval(\r\n this._checkForReadySounds,\r\n 500\r\n );\r\n }\r\n stop() {\r\n if (!this._isPlaying) {\r\n return;\r\n }\r\n clearInterval(this._soundStartIntervalId);\r\n this._soundStartIntervalId = null;\r\n for (let n of this._nodeCollections) {\r\n n.cancelEventSub();\r\n n.sequencerSound.audioElement.pause();\r\n n.removeAllNodes();\r\n }\r\n this._nodeCollections = [];\r\n for (let s of this._soundsList) {\r\n s.audioElement.removeEventListener(\"playing\", this._onSoundPlaying);\r\n }\r\n this._isPlaying = false;\r\n }\r\n _seekToStartTimes(startPosition) {\r\n return new Promise((resolve, reject) => {\r\n let quantityToSeek = 0;\r\n let quantitySeeked = 0;\r\n let onAudioElSeeked = (e) => {\r\n let el = e.target;\r\n el.removeEventListener(\"seeked\", onAudioElSeeked);\r\n el.pause();\r\n quantitySeeked++;\r\n if (quantitySeeked === quantityToSeek) {\r\n resolve();\r\n }\r\n };\r\n for (let sound of this._soundsList) {\r\n let seekTime = startPosition > sound.startTime ? startPosition - sound.startTime : 0;\r\n if (sound.audioElement.currentTime !== seekTime) {\r\n quantityToSeek++;\r\n sound.audioElement.addEventListener(\r\n \"seeked\",\r\n onAudioElSeeked\r\n );\r\n sound.audioElement.currentTime = seekTime;\r\n }\r\n }\r\n if (quantityToSeek === 0) {\r\n resolve();\r\n }\r\n });\r\n }\r\n _createNodeCollection(sound, context) {\r\n let zeroTime = this._playStartTime;\r\n let nodeCollection = new AudioElementNodeCollection(sound);\r\n nodeCollection.addNode(sound.audioElementSourceNode);\r\n nodeCollection.delayNode = context.createDelay(2);\r\n nodeCollection.addNode(nodeCollection.delayNode);\r\n let mapGain = context.createGain();\r\n for (let time of sound.volumeMap.keys()) {\r\n let volume = sound.volumeMap.get(time);\r\n let volStartTime = zeroTime + sound.startTime + time - this._playheadStartPosition;\r\n if (volStartTime < zeroTime) {\r\n volStartTime = zeroTime;\r\n }\r\n mapGain.gain.setValueAtTime(volume, volStartTime);\r\n }\r\n nodeCollection.addNode(mapGain);\r\n let gainNode = context.createGain();\r\n gainNode.gain.value = sound.volume;\r\n nodeCollection.addNode(gainNode);\r\n nodeCollection.soundMasterGainNode = gainNode;\r\n let panNode = context.createStereoPanner();\r\n panNode.pan.value = sound.pan;\r\n nodeCollection.addNode(panNode);\r\n nodeCollection.soundMasterPanNode = panNode;\r\n nodeCollection.connectNodes(this._masterMix);\r\n return nodeCollection;\r\n }\r\n get outputNode() {\r\n return this._masterMix;\r\n }\r\n /**the masterVolume for all sounds, from 0.0 to 1.0*/\r\n get masterVolume() {\r\n return this._masterVolume;\r\n }\r\n set masterVolume(value) {\r\n this._masterVolume = value;\r\n if (this._isPlaying) {\r\n this._masterMix.gain.cancelScheduledValues(0);\r\n let playPosition = this._context.currentTime - this._playStartTime;\r\n if (playPosition >= this._delayDuration) {\r\n this._masterMix.gain.setValueAtTime(value, 0);\r\n } else {\r\n this._masterMix.gain.setValueAtTime(value, this._delayDuration - playPosition);\r\n }\r\n }\r\n }\r\n};\r\nvar AudioElementNodeCollection = class {\r\n constructor(sequencerSound) {\r\n this.nodes = [];\r\n this._onSoundEvent = (e) => {\r\n if (e === 0 /* volumeChange */) {\r\n this.soundMasterGainNode.gain.value = this.sequencerSound.volume;\r\n } else if (e === 1 /* panChange */) {\r\n this.soundMasterPanNode.pan.value = this.sequencerSound.pan;\r\n } else if (e === 2 /* delayChange */) {\r\n this.updateDelay();\r\n }\r\n };\r\n this.sequencerSound = sequencerSound;\r\n sequencerSound.event.on(this._onSoundEvent);\r\n }\r\n addNode(node) {\r\n this.nodes.push(node);\r\n if (node instanceof MediaElementAudioSourceNode) {\r\n this.elementSourceNode = node;\r\n }\r\n }\r\n connectNodes(outputNode) {\r\n for (let i = this.nodes.length - 1; i >= 0; i--) {\r\n this.nodes[i].connect(i < this.nodes.length - 1 ? this.nodes[i + 1] : outputNode);\r\n }\r\n }\r\n removeAllNodes() {\r\n for (let i = 0; i < this.nodes.length; i++) {\r\n this.nodes[i].disconnect();\r\n }\r\n }\r\n updateDelay() {\r\n this.delayNode.delayTime.value = this.sequencerSound.delay + this.playOffset;\r\n }\r\n cancelEventSub() {\r\n this.sequencerSound.event.off(this._onSoundEvent);\r\n }\r\n};\r\n\r\n// src/audio_sequencer/looping/AudioLooper.ts\r\nimport { AudioComponent as AudioComponent2 } from \"audio_output\";\r\nimport { createEmitter as createEmitter3 } from \"ts_utils\";\r\nimport { BrowserUtils } from \"ts_utils\";\r\n\r\n// src/audio_sequencer/looping/LoopTrack.ts\r\nimport { createEmitter as createEmitter2 } from \"ts_utils\";\r\nvar LoopTrack = class {\r\n constructor(audioBuffer, startTime, volume = 0.8, pan = 0) {\r\n this._emitter = createEmitter2();\r\n this._audioBuffer = audioBuffer;\r\n this._startTime = startTime;\r\n this._volume = volume;\r\n this._pan = pan;\r\n this._endTime = this._audioBuffer.duration;\r\n }\r\n get audioBuffer() {\r\n return this._audioBuffer;\r\n }\r\n set audioBuffer(value) {\r\n this._audioBuffer = value;\r\n this._emitter.emit(\r\n new LoopTrackEvent(1 /* audioBufferChanged */, this)\r\n );\r\n }\r\n get trackEvent() {\r\n return this._emitter.event;\r\n }\r\n /**takes the index of an entrance and returns true if the following entrance\r\n * happens immediately after it with no gap, based on the [playDuration].*/\r\n isNextEntranceConsecutive(currentEntranceIndex, masterLoopDuration) {\r\n let gap;\r\n if (currentEntranceIndex < this._entrances.length - 1) {\r\n gap = this._entrances[currentEntranceIndex + 1].time - this._entrances[currentEntranceIndex].time;\r\n } else {\r\n gap = masterLoopDuration - this._entrances[currentEntranceIndex].time + this._entrances[0].time;\r\n }\r\n return gap <= this.playDuration;\r\n }\r\n /**value from 0 to 1.0*/\r\n get volume() {\r\n return this._volume;\r\n }\r\n set volume(volume) {\r\n this._volume = volume;\r\n this._emitter.emit(\r\n new LoopTrackEvent(0 /* updated */, this)\r\n );\r\n }\r\n /**value from -1.0 (left) to 1.0 (right)*/\r\n get pan() {\r\n return this._pan;\r\n }\r\n set pan(pan) {\r\n this._pan = pan;\r\n this._emitter.emit(\r\n new LoopTrackEvent(0 /* updated */, this)\r\n );\r\n }\r\n /**The performance start position, in seconds, adjusted to account for the\r\n * countoff duration - recordDelay. Recorded audio typically includes\r\n * countoff samples at the start, so this value becomes the seek position in \r\n * the audio buffer to skip past that period. See the notes in the \r\n * [AudioLooper] class.*/\r\n get startTime() {\r\n return this._startTime;\r\n }\r\n set startTime(value) {\r\n this._startTime = value;\r\n this._emitter.emit(\r\n new LoopTrackEvent(0 /* updated */, this)\r\n );\r\n }\r\n /**The performance end position, in seconds. By default this matches the\r\n * [duration] property pulled from [audioBuffer.duration], but it can be\r\n * set to a shorter value to account for any extra time at the end of the\r\n * [audioBuffer] that should not be played.*/\r\n get endTime() {\r\n return this._endTime;\r\n }\r\n set endTime(value) {\r\n this._endTime = value <= this._audioBuffer.duration ? value : this._audioBuffer.duration;\r\n this._emitter.emit(\r\n new LoopTrackEvent(0 /* updated */, this)\r\n );\r\n }\r\n /**Shifts the track's playback in time by this many seconds. This is used to\r\n * account for mic latency, which we leave out of the [startTime]\r\n * calculation to avoid clipping the beginning of a recording when we seek.\r\n * The AudioLooper applies a DelayNode to each track. To leave room for the\r\n * DelayNode to adjust the track's time forward or back, the track is\r\n * started early by a standard amount, X. The DelayNode is then given X as\r\n * its default initial value so that the track sounds at the same playhead\r\n * time it would have without the early start. This [timeShift] value is\r\n * then subtracted from the DelayNode's value.\r\n * \r\n * Example: A track inserted at the beginning of a song with a timeShift\r\n * value of -0.14. The [AudioLooper] starts the track at -0.5 seconds \r\n * instead of 0 and sets its DelayNode to (0.5 - 0.14 = 0.36)*/\r\n get timeShift() {\r\n return this._timeShift;\r\n }\r\n set timeShift(value) {\r\n this._timeShift = value;\r\n this._emitter.emit(\r\n new LoopTrackEvent(0 /* updated */, this)\r\n );\r\n }\r\n /**the complete duration of the audio in seconds*/\r\n get duration() {\r\n return this._audioBuffer.duration;\r\n }\r\n /**the duration of the section of the audio that's intended to be played,\r\n * from the startTime to the endTime*/\r\n get playDuration() {\r\n return this._endTime - this._startTime;\r\n }\r\n /**a list of the play time stamps, in seconds, within the song that this \r\n * track should start playing. 0 is the beginning of the song.*/\r\n get entrances() {\r\n return this._entrances;\r\n }\r\n set entrances(value) {\r\n this._entrances = value;\r\n }\r\n};\r\nvar LoopTrackEntrance = class {\r\n constructor(time, enabled, info) {\r\n this.time = time;\r\n this.enabled = enabled;\r\n this.info = info;\r\n }\r\n};\r\nvar LoopTrackEvent = class {\r\n constructor(type, track) {\r\n this.type = type;\r\n this.track = track;\r\n }\r\n};\r\nvar LoopTrackEventType = /* @__PURE__ */ ((LoopTrackEventType2) => {\r\n LoopTrackEventType2[LoopTrackEventType2[\"updated\"] = 0] = \"updated\";\r\n LoopTrackEventType2[LoopTrackEventType2[\"audioBufferChanged\"] = 1] = \"audioBufferChanged\";\r\n return LoopTrackEventType2;\r\n})(LoopTrackEventType || {});\r\n\r\n// src/audio_sequencer/looping/AudioLooper.ts\r\nvar AudioLooper = class extends AudioComponent2 {\r\n /**/\r\n ////////Notes on start time vs. delays///////////*/\r\n /**The start time of each track is being set to match the approximate time\r\n * within the track that the countoff completed during its recording. So\r\n * essentially we skip this first part of each track. However, we use a\r\n * delay node for each track to delay it the amount needed for the current\r\n * countoff sent to the sequencer. So for example, if a recording was made\r\n * with a 2 second countoff, we set the start time on its bufferSournceNode\r\n * to 2 seconds. If we then call play in the sequencer with a 1 second\r\n * countoff, the track is given a 1 second delay via a delay node. */\r\n constructor(context) {\r\n super();\r\n this._trackList = [];\r\n this._nodeCollections = [];\r\n this._isPlaying = false;\r\n /**The time, in seconds, between the start of the sequencer's playback and\r\n * the start of the SoundLibPlayer's playback*/\r\n this._soundLibPlayerOffset = 0;\r\n /**The duration in seconds of the countoff period that occurs in playback\r\n * before audio elements should sound. This is set when play is called.*/\r\n this._countoffDuration = 0;\r\n /**loop process interval, in milliseconds*/\r\n this._loopTimerInterval = 500;\r\n this.defaultTrackDelay = 0.5;\r\n this._emitter = createEmitter3();\r\n this._onLoopTimer = () => {\r\n let ctxTime = this._context.currentTime;\r\n let playingTime = ctxTime - this._playStartTime;\r\n let playheadTime = this._playheadStartTime - this._countoffDuration + playingTime;\r\n let loopIteration = Math.floor(playheadTime / this._masterLoopDuration);\r\n let loopTime = playheadTime - this._masterLoopDuration * loopIteration;\r\n let window2 = this.lookAheadWindowSize;\r\n for (let track of this._trackList) {\r\n if (this._nodeCollections.some((nc) => nc.track === track && nc.playheadTime >= playheadTime)) {\r\n continue;\r\n }\r\n let nextEntrance = track.entrances.find((e) => e.time > loopTime);\r\n let nextEntranceTime;\r\n if (nextEntrance == null) {\r\n nextEntrance = track.entrances[0];\r\n nextEntranceTime = this._masterLoopDuration + nextEntrance.time;\r\n } else {\r\n nextEntranceTime = nextEntrance.time;\r\n }\r\n if (!nextEntrance.enabled) {\r\n continue;\r\n }\r\n if (loopTime + window2 >= nextEntranceTime - this.defaultTrackDelay) {\r\n let ncPlayheadTime = nextEntranceTime + loopIteration * this._masterLoopDuration;\r\n let tnc = this._createNodeCollection(track, ncPlayheadTime);\r\n tnc.playheadEndTime = ncPlayheadTime + track.playDuration;\r\n tnc.connectNodes(this._masterMix);\r\n this._updateTrackDelay(tnc);\r\n this._nodeCollections.push(tnc);\r\n let bsnPlayTime = ncPlayheadTime + this._playStartTime - this.defaultTrackDelay;\r\n tnc.bufferNode.start(bsnPlayTime, tnc.track.startTime);\r\n let ev = new AudioLooperEvent();\r\n ev.type = 0 /* entranceScheduled */;\r\n ev.track = track;\r\n ev.entrance = nextEntrance;\r\n ev.startTime = bsnPlayTime + tnc.delay.delayTime.value;\r\n ev.isEntranceBeginning = true;\r\n this._emitter.emit(ev);\r\n }\r\n }\r\n for (let i = this._nodeCollections.length - 1; i >= 0; i--) {\r\n let tnc = this._nodeCollections[i];\r\n if (playheadTime > tnc.playheadTime + tnc.track.playDuration) {\r\n tnc.bufferNode.stop(0);\r\n tnc.disconnectNodes();\r\n tnc.replaceDelayNode(this._context);\r\n this._nodeCollections.splice(i, 1);\r\n }\r\n }\r\n };\r\n this._onTrackEvent = (e) => {\r\n switch (e.type) {\r\n case 0 /* updated */: {\r\n this._handleLoopTrackUpdated(e.track);\r\n break;\r\n }\r\n case 1 /* audioBufferChanged */: {\r\n this._handleLooopTrackAudioBufferChanged(e.track);\r\n break;\r\n }\r\n }\r\n };\r\n this._context = context;\r\n if (this._context == null)\r\n throw \"AudioContext not set\";\r\n this._init();\r\n }\r\n get event() {\r\n return this._emitter.event;\r\n }\r\n _init() {\r\n LoopTrackNodeCollection.defaultTrackDelay = this.defaultTrackDelay;\r\n this._setupAudioGraph();\r\n }\r\n addTrack(track) {\r\n this._trackList.push(track);\r\n track.trackEvent.on(this._onTrackEvent);\r\n if (this._isPlaying) {\r\n this._initTrackPlayback([track]);\r\n this._onLoopTimer();\r\n }\r\n }\r\n removeTrack(track) {\r\n this._stopTrackPlayback(track);\r\n let idx = this._trackList.indexOf(track);\r\n if (idx !== -1) {\r\n this._trackList.splice(idx, 1);\r\n track.trackEvent.off(this._onTrackEvent);\r\n }\r\n }\r\n removeAllTracks() {\r\n for (let i = this._trackList.length - 1; i >= 0; i--) {\r\n this.removeTrack(this._trackList[i]);\r\n }\r\n }\r\n updateSoundLibPlayerOffset(offset) {\r\n this._soundLibPlayerOffset = offset;\r\n for (let nc of this._nodeCollections) {\r\n this._updateTrackDelay(nc);\r\n }\r\n }\r\n /**Starts playback. The [countoffDuration] should be set to the number of\r\n * seconds before audio elements should start playing. The [loopDuration] \r\n * is the duration of the \"master\" loop which all looping tracks fit within.\r\n * The [playheadTime] is the 0 based position in the song/sequence that \r\n * playback should start from. It does not include the countoff. Another\r\n * way to adjust the song start position is to set the \r\n * [overridePlayStartTime]. The looper uses this value to calculate how\r\n * long playback has been running to determine the current position in the\r\n * loop. One strategy is to sync this with another sequencer.*/\r\n play(countoffDuration, loopDuration, {\r\n playheadTime = 0,\r\n overridePlayStartTime = null\r\n }) {\r\n if (this._isPlaying)\r\n return;\r\n this._isPlaying = true;\r\n this._countoffDuration = countoffDuration;\r\n this._masterLoopDuration = loopDuration;\r\n this._soundLibPlayerOffset = 0;\r\n this._playStartTime = overridePlayStartTime ?? this._context.currentTime;\r\n this._playheadStartTime = playheadTime;\r\n let volume = this.masterVolume;\r\n let ctxTime = this._context.currentTime;\r\n this._masterMix.gain.setValueAtTime(0, ctxTime);\r\n this._masterMix.gain.setValueAtTime(volume, ctxTime + countoffDuration);\r\n this._loopIntervalId = window.setInterval(\r\n this._onLoopTimer,\r\n this._loopTimerInterval\r\n );\r\n this._initTrackPlayback(this._trackList);\r\n this._onLoopTimer();\r\n }\r\n stop() {\r\n clearInterval(this._loopIntervalId);\r\n this._loopIntervalId = null;\r\n for (let track of this._trackList) {\r\n this._stopTrackPlayback(track);\r\n }\r\n this._isPlaying = false;\r\n }\r\n /**creates and returns a list of the currently playing [LoopTrack] \r\n * instances. */\r\n getPlayingTracks() {\r\n let playheadTime = this.playheadTime;\r\n let playingTracks = [];\r\n this._nodeCollections.forEach((tnc) => {\r\n if (tnc.isInPlayingWindow(playheadTime)) {\r\n playingTracks.push(tnc.track);\r\n }\r\n });\r\n return playingTracks;\r\n }\r\n _stopTrackPlayback(track) {\r\n for (let i = this._nodeCollections.length - 1; i >= 0; i--) {\r\n let tnc = this._nodeCollections[i];\r\n if (tnc.track === track) {\r\n tnc.bufferNode.stop(0);\r\n tnc.disconnectNodes();\r\n tnc.replaceDelayNode(this._context);\r\n this._nodeCollections.splice(i, 1);\r\n }\r\n }\r\n }\r\n //start playback at playheadTime = passed in playheadTime - countoffDuration\r\n //and set the master volume to 0 for the countoffDuration\r\n _initTrackPlayback(tracks) {\r\n let ctxTime = this._context.currentTime;\r\n let playingTime = ctxTime - this._playStartTime;\r\n let playheadTime = this._playheadStartTime - this._countoffDuration + playingTime;\r\n let insertPlayheadTime = playheadTime + this.defaultTrackDelay;\r\n if (playheadTime < 0) {\r\n return;\r\n }\r\n let loopIteration = Math.floor(insertPlayheadTime / this._masterLoopDuration);\r\n let loopInsertTime = insertPlayheadTime - this._masterLoopDuration * loopIteration;\r\n for (let track of tracks) {\r\n let entrance;\r\n for (let i = track.entrances.length - 1; i >= 0; i--) {\r\n if (track.entrances[i].time <= loopInsertTime) {\r\n entrance = track.entrances[i];\r\n break;\r\n }\r\n }\r\n if (entrance == null || !entrance.enabled) {\r\n continue;\r\n }\r\n if (entrance.time + track.playDuration < loopInsertTime) {\r\n continue;\r\n }\r\n let elapsed = loopInsertTime - entrance.time;\r\n let tnc = this._createNodeCollection(track, playheadTime);\r\n tnc.connectNodes(this._masterMix);\r\n this._updateTrackDelay(tnc);\r\n this._nodeCollections.push(tnc);\r\n tnc.entranceOffset = elapsed;\r\n tnc.playheadEndTime = playheadTime + track.playDuration - elapsed;\r\n tnc.bufferNode.start(ctxTime, tnc.track.startTime + elapsed);\r\n let ev = new AudioLooperEvent();\r\n ev.type = 0 /* entranceScheduled */;\r\n ev.track = track;\r\n ev.entrance = entrance;\r\n ev.startTime = ctxTime + tnc.delay.delayTime.value;\r\n ev.isEntranceBeginning = elapsed <= 0;\r\n this._emitter.emit(ev);\r\n }\r\n }\r\n _createNodeCollection(track, playheadTime) {\r\n let tnc = new LoopTrackNodeCollection(track);\r\n tnc.playheadTime = playheadTime;\r\n tnc.bufferNode = this._context.createBufferSource();\r\n tnc.bufferNode.buffer = tnc.track.audioBuffer;\r\n tnc.delay = this._context.createDelay(20);\r\n this._updateTrackDelay(tnc);\r\n tnc.masterGain = this._context.createGain();\r\n tnc.masterGain.gain.setValueAtTime(track.volume, 0);\r\n if (!BrowserUtils.isSafari()) {\r\n tnc.masterPan = this._context.createStereoPanner();\r\n tnc.masterPan.pan.setValueAtTime(track.pan, 0);\r\n }\r\n return tnc;\r\n }\r\n _updateTrackDelay(nodeCollection) {\r\n let delay = this.defaultTrackDelay + nodeCollection.track.timeShift + this._soundLibPlayerOffset;\r\n if (delay < 0)\r\n delay = 0;\r\n if (nodeCollection.delay.delayTime.value !== delay) {\r\n nodeCollection.delay.delayTime.value = delay;\r\n }\r\n }\r\n _handleLoopTrackUpdated(track) {\r\n let tncList = this._nodeCollections.filter((t) => t.track === track);\r\n for (let tnc of tncList) {\r\n if (tnc.masterGain.gain.value !== track.volume) {\r\n tnc.masterGain.gain.setValueAtTime(track.volume, 0);\r\n }\r\n if (tnc.masterPan != null && tnc.masterPan.pan.value !== track.pan) {\r\n tnc.masterPan.pan.setValueAtTime(track.pan, 0);\r\n }\r\n this._updateTrackDelay(tnc);\r\n }\r\n }\r\n _handleLooopTrackAudioBufferChanged(track) {\r\n if (!this._isPlaying) {\r\n return;\r\n }\r\n for (let i = this._nodeCollections.length - 1; i >= 0; i--) {\r\n let tnc = this._nodeCollections[i];\r\n if (tnc.track === track) {\r\n let playheadTime = this.playheadTime;\r\n if (tnc.isInPlayingWindow(playheadTime)) {\r\n let track2 = tnc.track;\r\n let elapsed = playheadTime - tnc.entrancePlayheadTime;\r\n let playheadEndTime = tnc.playheadEndTime;\r\n this._stopTrackPlayback(tnc.track);\r\n let tnc2 = this._createNodeCollection(track2, playheadTime);\r\n tnc2.entranceOffset = elapsed;\r\n tnc2.playheadEndTime = playheadEndTime;\r\n tnc2.connectNodes(this._masterMix);\r\n this._updateTrackDelay(tnc2);\r\n this._nodeCollections.splice(i, 0, tnc2);\r\n tnc2.bufferNode.start(\r\n this._context.currentTime,\r\n tnc2.track.startTime + elapsed + this.defaultTrackDelay\r\n );\r\n }\r\n }\r\n }\r\n }\r\n _setupAudioGraph() {\r\n this._masterMix = this._context.createGain();\r\n this._masterMix.gain.value = 0.8;\r\n }\r\n /**true if the AudioLooper is currently processing playback, even if no\r\n * tracks are added.*/\r\n get isPlaying() {\r\n return this._isPlaying;\r\n }\r\n /**the AudioContext.currentTime value considered as the start point of\r\n * playback. The loop position is calculated from this. It can be overridden\r\n * in the [play] method.*/\r\n get playStartTime() {\r\n return this._playStartTime;\r\n }\r\n /**The [playheadTime] is the current 0 based position in the song/sequence.\r\n * It does not include the countoff. */\r\n get playheadTime() {\r\n let playingTime = this._context.currentTime - this._playStartTime;\r\n return this._playheadStartTime + playingTime - this._countoffDuration;\r\n }\r\n /**gets the duration of the overall loop. Individual tracks can loop more\r\n * frequently within this. The value is set when calling [play].*/\r\n get masterLoopDuration() {\r\n return this._masterLoopDuration;\r\n }\r\n /**gets the time in seconds if the playback position within the current\r\n * loop iteration. Resets to 0 at start of each iteration.*/\r\n get loopTime() {\r\n let playingTime = this._context.currentTime - this._playStartTime;\r\n let playheadTime = this._playheadStartTime - this._countoffDuration + playingTime;\r\n let loopIteration = Math.floor(playheadTime / this._masterLoopDuration);\r\n let loopTime = playheadTime - this._masterLoopDuration * loopIteration;\r\n return loopTime;\r\n }\r\n /**Iteration index of the master loop, with 0 as the first iteration. Loop \r\n * time resets to 0 with each iteration of master loop*/\r\n get loopIteration() {\r\n let playingTime = this._context.currentTime - this._playStartTime;\r\n let playheadTime = this._playheadStartTime - this._countoffDuration + playingTime;\r\n return Math.floor(playheadTime / this._masterLoopDuration);\r\n }\r\n get masterVolume() {\r\n return this._masterMix.gain.value;\r\n }\r\n set masterVolume(value) {\r\n if (value < 0)\r\n value = 0;\r\n else if (value > 1)\r\n value = 1;\r\n this._masterMix.gain.setValueAtTime(value, 0);\r\n }\r\n /**during playback, a timer is used to load tracks to play at their\r\n * entrances, and any entrances within this window of time are scheduled. If\r\n * you want to adjust whether entrances play or not, you should do so before\r\n * entrances come within this window of time. Note that the window is\r\n * augmented by the [defaultTrackDelay], so the total window is larger. Ex.\r\n * 1 second window + 0.5 second defaultTrackDelay = 1.5 seconds.*/\r\n get lookAheadWindowSize() {\r\n return 2 * this._loopTimerInterval / 1e3;\r\n }\r\n get outputNode() {\r\n return this._masterMix;\r\n }\r\n};\r\nvar LoopTrackNodeCollection = class {\r\n constructor(track) {\r\n /**If an entrance is started after the natural beginning time of its\r\n * occurrence within the master loop, an entrance offset (EO) is passed to\r\n * bufferNode.play(ctxTime, track.startTime + EO) so that playback starts\r\n * further into the audio buffer. This is in addition to the track.startTime\r\n * that already is used to mark the beginning of the desired audio in the\r\n * LoopTrack. We can use this to calculate when the node collection will\r\n * finish. */\r\n this.entranceOffset = 0;\r\n this.track = track;\r\n }\r\n /**the master loop playhead time when the entrance associated with this\r\n * node collection started. The node collection itself may have started\r\n * playing later than this if it was created for an entrance that was\r\n * already past its starting point (see playheadTime)*/\r\n get entrancePlayheadTime() {\r\n return this.playheadTime - this.entranceOffset;\r\n }\r\n connectNodes(outputNode) {\r\n this.bufferNode.connect(this.delay);\r\n this.delay.connect(this.masterGain);\r\n if (this.masterPan != null) {\r\n this.masterGain.connect(this.masterPan);\r\n this.masterPan.connect(outputNode);\r\n } else {\r\n this.masterGain.connect(outputNode);\r\n }\r\n }\r\n disconnectNodes() {\r\n this.masterPan?.disconnect();\r\n this.masterGain.disconnect();\r\n this.delay.disconnect();\r\n this.bufferNode.disconnect();\r\n }\r\n /**replacing the delay node prevents buffered audio from playing when\r\n * restarting playback.*/\r\n replaceDelayNode(context) {\r\n let newDelay = context.createDelay(20);\r\n newDelay.delayTime.value = this.delay.delayTime.value;\r\n this.delay = newDelay;\r\n }\r\n /**calculates and returns the total time audio for this node collection\r\n * should play, adjusting for the track.startTime and entranceOffset. */\r\n getPlayDuration() {\r\n return this.track.playDuration - this.entranceOffset;\r\n }\r\n /**returns true if the current playheadTime of the master loop includes the\r\n * time span of this entrance (playheadTime to playheadEndTime), meaning\r\n * it should be playing.*/\r\n isInPlayingWindow(currentPlayheadTime) {\r\n return this.playheadTime <= currentPlayheadTime && this.playheadEndTime > currentPlayheadTime;\r\n }\r\n};\r\nvar AudioLooperEvent = class {\r\n};\r\nvar AudioLooperEventType = /* @__PURE__ */ ((AudioLooperEventType2) => {\r\n AudioLooperEventType2[AudioLooperEventType2[\"entranceScheduled\"] = 0] = \"entranceScheduled\";\r\n return AudioLooperEventType2;\r\n})(AudioLooperEventType || {});\r\nexport {\r\n AudioElementSequencer,\r\n AudioLooper,\r\n AudioLooperEvent,\r\n AudioLooperEventType,\r\n AudioSequencer,\r\n LoopTrack,\r\n LoopTrackEntrance,\r\n LoopTrackEvent,\r\n LoopTrackEventType,\r\n SequencerSound,\r\n SequencerSoundEvent\r\n};\r\n","// src/score_performance/assessment/assessment.ts\r\nimport { TieState } from \"score_data\";\r\nimport { MusicTextures, NoteheadType } from \"score_render\";\r\nvar Assessor = class {\r\n constructor(scoreViewer, visualizer) {\r\n this._totalCorrect = 0;\r\n this._totalIncorrect = 0;\r\n // ignore: unused_field\r\n this._totalExtra = 0;\r\n this._totalBeatsCorrect = 0;\r\n this._totalBeatsIncorrect = 0;\r\n this._totalBeatsExtra = 0;\r\n /**a list of ints indicating hits (0), misses (1) and extra notes (2)*/\r\n this.history = [];\r\n this._scoreViewer = scoreViewer;\r\n this._visualizer = visualizer;\r\n this._init();\r\n }\r\n _init() {\r\n this.setVisualizer(this._visualizer ?? new NewAssessmentVisualizer());\r\n this._createAssessmentNotes();\r\n this._createAssessmentBeats();\r\n }\r\n setVisualizer(visualizer) {\r\n visualizer.assessor = this;\r\n this._visualizer = visualizer;\r\n }\r\n prepareForRemoval() {\r\n this.stop();\r\n this._visualizer.prepareForRemoval();\r\n this._visualizer = null;\r\n this._scoreViewer = null;\r\n this._noteList = null;\r\n this._ngToAssessNoteMap = null;\r\n this._vngToAssessNoteMap = null;\r\n this._ngToVngMap = null;\r\n this._beatList = null;\r\n this.history = null;\r\n }\r\n reset() {\r\n this.clearAssessmentVisuals();\r\n this._totalCorrect = 0;\r\n this._totalIncorrect = 0;\r\n this._totalExtra = 0;\r\n this._totalBeatsCorrect = 0;\r\n this._totalBeatsIncorrect = 0;\r\n this._totalBeatsExtra = 0;\r\n this.history = [];\r\n }\r\n /**removes extra red notes and sets red/green notes back to black*/\r\n clearAssessmentVisuals() {\r\n this._visualizer.clearAssessmentVisuals();\r\n this.scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n /**returns score for assessment performance, from 0 to 100*/\r\n getScore() {\r\n let numNotes = this._noteList.length;\r\n let extraPenalty = this._totalExtra - (numNotes - this._totalCorrect);\r\n if (extraPenalty < 0)\r\n extraPenalty = 0;\r\n let score = (this._totalCorrect - extraPenalty) / numNotes;\r\n if (score < 0)\r\n score = 0;\r\n return Math.floor(score * 100);\r\n }\r\n /**returns score for beat assessment performance, from 0 to 100*/\r\n getBeatScore() {\r\n let score = this._totalBeatsCorrect / this._beatList.length * 100;\r\n return Math.floor(score);\r\n }\r\n getResults() {\r\n let results = new AssessmentResults();\r\n results.numNotes = this._noteList.length;\r\n results.notesCorrect = this._totalCorrect;\r\n results.notesIncorrect = this._noteList.length - this._totalCorrect;\r\n results.notesExtra = this._totalExtra;\r\n results.history = this.history;\r\n results.percentage = this.getScore();\r\n results.numBeats = this._beatList.length;\r\n results.beatsCorrect = this._totalBeatsCorrect;\r\n results.beatsIncorrect = this._totalBeatsIncorrect;\r\n results.beatsExtra = this._totalBeatsCorrect;\r\n results.beatsPercentage = this.getBeatScore();\r\n return results;\r\n }\r\n /**returns the [AssessmentNote] that corresponds to the requested\r\n * NoteGroup*/\r\n getAssessNoteFromNg(ng) {\r\n return this._ngToAssessNoteMap.get(ng);\r\n }\r\n /**returns the [AssessmentNote] that corresponds to the requested \r\n * VisualNoteGroup*/\r\n getAssessNoteFromVNG(vng) {\r\n return this._vngToAssessNoteMap.get(vng);\r\n }\r\n /**returns the [VisualNoteGroup] that corresponds to the requested\r\n * NoteGroup*/\r\n getVngFromNg(ng) {\r\n return this._ngToVngMap.get(ng);\r\n }\r\n /**override in subclasses to handle instrument changes*/\r\n setInstrument(inst) {\r\n }\r\n _createAssessmentNotes() {\r\n this._ngToAssessNoteMap = /* @__PURE__ */ new Map();\r\n this._vngToAssessNoteMap = /* @__PURE__ */ new Map();\r\n this._ngToVngMap = this._scoreViewer.vScore.getNgToVngMap();\r\n this._noteList = [];\r\n for (let vng of this._scoreViewer.vngList) {\r\n let ng = vng.noteGroup;\r\n if (!ng.isRest && (ng.notes[0].tieState === TieState.NONE || ng.notes[0].tieState === TieState.START)) {\r\n let note = new AssessmentNote();\r\n note.vng = vng;\r\n this._noteList.push(note);\r\n this._ngToAssessNoteMap.set(note.vng.noteGroup, note);\r\n this._vngToAssessNoteMap.set(note.vng, note);\r\n }\r\n }\r\n }\r\n _createAssessmentBeats() {\r\n let beats = this._scoreViewer.vScore.score.getBeatQNotePositions();\r\n this._beatList = [];\r\n for (let qnTime of beats) {\r\n let beat = new AssessmentBeat();\r\n beat.qNoteTime = qnTime;\r\n this._beatList.push(beat);\r\n }\r\n }\r\n _markNoteCorrect(note) {\r\n note.matched = true;\r\n this._totalCorrect++;\r\n this.history.push(0);\r\n this._visualizer.markNoteCorrect(note);\r\n }\r\n _markNoteIncorrect(note) {\r\n note.matched = false;\r\n this._totalIncorrect++;\r\n this.history.push(1);\r\n this._visualizer.markNoteIncorrect(note);\r\n }\r\n /**adds extra performed note to display and tallies it*/\r\n _addExtraNote(qnTime) {\r\n this._totalExtra++;\r\n this.history.push(2);\r\n this._visualizer.addExtraNote(qnTime);\r\n }\r\n _markBeatCorrect(beat) {\r\n beat.matched = true;\r\n this._totalBeatsCorrect++;\r\n this._visualizer.markBeatCorrect(beat);\r\n }\r\n _markBeatIncorrect(beat) {\r\n beat.matched = false;\r\n this._totalBeatsIncorrect++;\r\n this._visualizer.markBeatIncorrect(beat);\r\n }\r\n _addExtraBeat(qnTime) {\r\n }\r\n /**override in subclasses to specify whether microphone is required. If\r\n * true, MicManager's startCapture will be called independently, so you\r\n * don't need to call it in your Assessor subclass.*/\r\n get requiresMicrophone() {\r\n throw \"requiresMicrophone must be overridden\";\r\n }\r\n get scoreViewer() {\r\n return this._scoreViewer;\r\n }\r\n};\r\nvar AssessmentResults = class {\r\n getLongestStreak() {\r\n let max = 0;\r\n let current = 0;\r\n for (let i = 0; i < history.length; i++) {\r\n if (history[i] === 0) {\r\n current++;\r\n if (current > max) {\r\n max = current;\r\n }\r\n } else {\r\n current = 0;\r\n }\r\n }\r\n return max;\r\n }\r\n};\r\nvar AssessmentVisualizerBase = class {\r\n /**set by Abstract [Assessor] class.*/\r\n get assessor() {\r\n return this._assessor;\r\n }\r\n set assessor(value) {\r\n this._assessor = value;\r\n }\r\n constructor() {\r\n }\r\n markNoteCorrect(note) {\r\n }\r\n markNoteIncorrect(note) {\r\n }\r\n /**places a notehead on a system indicating an extra performed note. The\r\n * [qnTime] is the quarter note time in the score where the extra note \r\n * should be placed.*/\r\n addExtraNote(qnTime) {\r\n }\r\n markBeatCorrect(beat) {\r\n }\r\n markBeatIncorrect(beat) {\r\n }\r\n /**resets visuals for new assessment*/\r\n clearAssessmentVisuals() {\r\n }\r\n prepareForRemoval() {\r\n }\r\n};\r\nvar _AssessmentVisualizer = class _AssessmentVisualizer extends AssessmentVisualizerBase {\r\n constructor() {\r\n super();\r\n }\r\n markNoteCorrect(note) {\r\n note.vng.setColor(_AssessmentVisualizer.GREEN);\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n markNoteIncorrect(note) {\r\n note.vng.setColor(_AssessmentVisualizer.RED);\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n /**places a notehead on a system indicating an extra performed note*/\r\n addExtraNote(qnTime) {\r\n let xVal = 0;\r\n let yVal = 0;\r\n let vngList = this._assessor.scoreViewer.vngList;\r\n let numNotes = vngList.length;\r\n let targetSystem;\r\n if (vngList[0].noteGroup.qNoteTime > qnTime) {\r\n xVal = vngList[0].originalPosition.x - 30;\r\n targetSystem = vngList[0].vSystemRef;\r\n } else if (vngList[vngList.length - 1].noteGroup.qNoteTime < qnTime) {\r\n xVal = vngList[vngList.length - 1].originalPosition.x + 30;\r\n targetSystem = vngList[vngList.length - 1].vSystemRef;\r\n } else {\r\n let i = numNotes - 1;\r\n while (i >= 0) {\r\n let cng = vngList[i].noteGroup;\r\n if (cng.qNoteTime <= qnTime) {\r\n let noteBefore = vngList[i];\r\n let noteAfter = i < numNotes - 1 ? vngList[i + 1] : noteBefore;\r\n if (noteAfter.originalPosition.x >= noteBefore.originalPosition.x) {\r\n let posRatio = (qnTime - noteBefore.noteGroup.qNoteTime) / (noteAfter.noteGroup.qNoteTime - noteBefore.noteGroup.qNoteTime);\r\n xVal = noteBefore.originalPosition.x + posRatio * (noteAfter.originalPosition.x - noteBefore.originalPosition.x);\r\n } else {\r\n xVal = noteBefore.originalPosition.x + 30;\r\n }\r\n targetSystem = noteBefore.vSystemRef;\r\n break;\r\n }\r\n i--;\r\n }\r\n targetSystem.addExtraNotehead(xVal, yVal, _AssessmentVisualizer.RED);\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n }\r\n /**removes extra red notes and sets red/green notes back to black*/\r\n clearAssessmentVisuals() {\r\n for (let vng of this._assessor.scoreViewer.vngList) {\r\n vng.setColor(_AssessmentVisualizer.BLACK);\r\n }\r\n let systems = this._assessor.scoreViewer.vScore.getVisualSystems();\r\n for (let sys of systems) {\r\n sys.removeExtraNoteheads();\r\n }\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n prepareForRemoval() {\r\n }\r\n};\r\n_AssessmentVisualizer.GREEN = 65280;\r\n_AssessmentVisualizer.RED = 16711680;\r\n_AssessmentVisualizer.BLACK = 0;\r\nvar AssessmentVisualizer = _AssessmentVisualizer;\r\nvar _NewAssessmentVisualizer = class _NewAssessmentVisualizer extends AssessmentVisualizerBase {\r\n constructor() {\r\n super();\r\n this.autoMarkTiedNotes = true;\r\n }\r\n markNoteCorrect(note) {\r\n this.setNoteColor(note.vng, _NewAssessmentVisualizer.GREEN);\r\n if (this.autoMarkTiedNotes) {\r\n this.markTiedNotes(note, _NewAssessmentVisualizer.GREEN);\r\n }\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n markNoteIncorrect(note) {\r\n this.setNoteColor(note.vng, _NewAssessmentVisualizer.RED);\r\n if (this.autoMarkTiedNotes) {\r\n this.markTiedNotes(note, _NewAssessmentVisualizer.RED);\r\n }\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n /**places a notehead on a system indicating an extra performed note*/\r\n addExtraNote(qnTime) {\r\n let xVal = 0;\r\n let yVal = 0;\r\n let vngList = this._assessor.scoreViewer.vngList;\r\n let numNotes = vngList.length;\r\n let targetSystem;\r\n if (vngList[0].noteGroup.qNoteTime > qnTime) {\r\n xVal = vngList[0].originalPosition.x - 30;\r\n targetSystem = vngList[0].vSystemRef;\r\n } else if (vngList[vngList.length - 1].noteGroup.qNoteTime < qnTime) {\r\n xVal = vngList[vngList.length - 1].originalPosition.x + 30;\r\n targetSystem = vngList[vngList.length - 1].vSystemRef;\r\n } else {\r\n let i = numNotes - 1;\r\n while (i >= 0) {\r\n let cng = vngList[i].noteGroup;\r\n if (cng.qNoteTime <= qnTime) {\r\n let noteBefore = vngList[i];\r\n let noteAfter = i < numNotes - 1 ? vngList[i + 1] : noteBefore;\r\n if (noteAfter.originalPosition.x >= noteBefore.originalPosition.x) {\r\n let posRatio = (qnTime - noteBefore.noteGroup.qNoteTime) / (noteAfter.noteGroup.qNoteTime - noteBefore.noteGroup.qNoteTime);\r\n xVal = noteBefore.originalPosition.x + posRatio * (noteAfter.originalPosition.x - noteBefore.originalPosition.x);\r\n } else {\r\n xVal = noteBefore.originalPosition.x + 30;\r\n }\r\n targetSystem = noteBefore.vSystemRef;\r\n break;\r\n }\r\n i--;\r\n }\r\n }\r\n let props = this._assessor.scoreViewer.vScore.score.scoreProperties;\r\n let textures = MusicTextures.getTextureSet(props.pixelsPerSpace);\r\n let sprite = textures.getColoredNotehead(\r\n NoteheadType.QUARTER,\r\n _NewAssessmentVisualizer.RED\r\n );\r\n sprite.x = xVal + targetSystem.scoreX;\r\n sprite.y = yVal + targetSystem.scoreY;\r\n this._assessor.scoreViewer.assessmentOverlay.addChild(sprite);\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n /**removes extra red notes and sets red/green notes back to black*/\r\n clearAssessmentVisuals() {\r\n this._assessor._scoreViewer.assessmentOverlay.removeChildren(0);\r\n this._assessor.scoreViewer.vScore.pixiAppHelper.requestRender();\r\n }\r\n setNoteColor(vng, color) {\r\n let props = this._assessor.scoreViewer.vScore.score.scoreProperties;\r\n let textures = MusicTextures.getTextureSet(props.pixelsPerSpace);\r\n for (let nh of vng.noteheadList) {\r\n let sprite = textures.getColoredNotehead(vng.noteheadType, color);\r\n sprite.x = vng.scoreX + nh.x;\r\n sprite.y = vng.scoreY + nh.y;\r\n this._assessor.scoreViewer.assessmentOverlay.addChild(sprite);\r\n }\r\n }\r\n markTiedNotes(note, color) {\r\n let ng = note.vng.noteGroup;\r\n let tieState = ng.notes[0].tieState;\r\n while (tieState === TieState.START || tieState === TieState.CONTINUE) {\r\n let nextNg = ng.next;\r\n if (nextNg.isRest) {\r\n break;\r\n }\r\n this.setNoteColor(this._assessor.getVngFromNg(nextNg), color);\r\n ng = nextNg;\r\n tieState = ng.notes[0].tieState;\r\n }\r\n }\r\n prepareForRemoval() {\r\n this.clearAssessmentVisuals();\r\n }\r\n};\r\n_NewAssessmentVisualizer.GREEN = 65280;\r\n_NewAssessmentVisualizer.RED = 16711680;\r\nvar NewAssessmentVisualizer = _NewAssessmentVisualizer;\r\nvar AssessmentNote = class {\r\n constructor() {\r\n this.matched = false;\r\n }\r\n};\r\nvar AssessmentBeat = class {\r\n constructor() {\r\n this.matched = false;\r\n }\r\n};\r\n\r\n// src/score_performance/assessment/AssessmentType.ts\r\nvar AssessmentType = /* @__PURE__ */ ((AssessmentType2) => {\r\n AssessmentType2[AssessmentType2[\"none\"] = 0] = \"none\";\r\n AssessmentType2[AssessmentType2[\"rhythmKeyboard\"] = 1] = \"rhythmKeyboard\";\r\n AssessmentType2[AssessmentType2[\"rhythmClap\"] = 2] = \"rhythmClap\";\r\n AssessmentType2[AssessmentType2[\"pitch\"] = 3] = \"pitch\";\r\n AssessmentType2[AssessmentType2[\"rhythmKeyboardFreetime\"] = 4] = \"rhythmKeyboardFreetime\";\r\n return AssessmentType2;\r\n})(AssessmentType || {});\r\n\r\n// src/score_performance/assessment/FreeTimeRhythmAssessor.ts\r\nimport { HitType, KeyHitRecognizer } from \"audio_input\";\r\nimport { NoteInfoDO, SoundLibManager } from \"sound_lib\";\r\nimport { ScoreProperties } from \"score_data\";\r\nimport { createEmitter } from \"ts_utils\";\r\nvar FreeTimeRhythmAssessor = class extends Assessor {\r\n constructor(scoreViewer) {\r\n super(scoreViewer);\r\n this._defaultWindowSize = 0.25;\r\n this._tempo = ScoreProperties.DEFAULT_TEMPO;\r\n /**with [_dynamicTempo] the current tempo will be updated with each hit*/\r\n this._dynamicTempo = false;\r\n this._isActive = false;\r\n this._assessmentCompleteEmitter = createEmitter();\r\n this._onHit = (e) => {\r\n if (e.hitType === HitType.rhythm_hit_start) {\r\n if (!this._dynamicTempo) {\r\n this._handleRhythmHit(e);\r\n } else {\r\n this._handleRhythmHitDynamicTempo(e);\r\n }\r\n }\r\n };\r\n this._initialize();\r\n }\r\n /**Dispatches whenever assessment completes. Value is the user's score.*/\r\n get assessmentComplete() {\r\n return this._assessmentCompleteEmitter.event;\r\n }\r\n /**starts assessment*/\r\n start() {\r\n this._noteIndex = 0;\r\n this._lastHitTime = null;\r\n this._hitRecognizer.startHitRec();\r\n this._hitRecognizer.event.on(this._onHit);\r\n this._isActive = true;\r\n }\r\n /**stops assessment*/\r\n stop() {\r\n if (this._isActive) {\r\n this._hitRecognizer.stopHitRec();\r\n this._hitRecognizer.event.off(this._onHit);\r\n this._isActive = false;\r\n }\r\n }\r\n //change this if clap support added\r\n get requiresMicrophone() {\r\n return false;\r\n }\r\n _initialize() {\r\n this._slm = SoundLibManager.get();\r\n this._hitRecognizer = KeyHitRecognizer.get(this._slm.context);\r\n this._hitRecognizer.sendBeatEvents = false;\r\n }\r\n _handleRhythmHit(e) {\r\n if (this._noteIndex >= this._noteList.length) {\r\n return;\r\n }\r\n let note = this._noteList[this._noteIndex];\r\n if (this._noteIndex === 0) {\r\n this._markNoteCorrect(note);\r\n } else {\r\n let cng = this._noteList[this._noteIndex].vng.noteGroup;\r\n let png = this._noteList[this._noteIndex - 1].vng.noteGroup;\r\n let qNoteDelta = cng.qNoteTime - png.qNoteTime;\r\n let goalTime = qNoteDelta * 60 / this._tempo + this._lastHitTime;\r\n let minTime = goalTime - 60 / this._tempo * this._defaultWindowSize;\r\n let maxTime = goalTime + 60 / this._tempo * this._defaultWindowSize;\r\n if (e.time >= minTime && e.time <= maxTime) {\r\n this._markNoteCorrect(note);\r\n } else {\r\n this._markNoteIncorrect(note);\r\n }\r\n }\r\n this._playNote(note.vng.noteGroup.notes[0]);\r\n this._lastHitTime = e.time;\r\n this._noteIndex++;\r\n if (this._noteIndex === this._noteList.length) {\r\n this._completeAssessment();\r\n }\r\n }\r\n _handleRhythmHitDynamicTempo(e) {\r\n if (this._noteIndex >= this._noteList.length) {\r\n return;\r\n }\r\n let note = this._noteList[this._noteIndex];\r\n if (this._noteIndex === 0) {\r\n this._markNoteCorrect(note);\r\n } else {\r\n let cng = this._noteList[this._noteIndex].vng.noteGroup;\r\n let png = this._noteList[this._noteIndex - 1].vng.noteGroup;\r\n let qNoteDelta = cng.qNoteTime - png.qNoteTime;\r\n let goalTime = qNoteDelta * 60 / this._tempo + this._lastHitTime;\r\n let minTime = goalTime - 60 / this._tempo * this._defaultWindowSize;\r\n let maxTime = goalTime + 60 / this._tempo * this._defaultWindowSize;\r\n if (this._noteIndex === 1) {\r\n this._markNoteCorrect(note);\r\n } else if (e.time >= minTime && e.time <= maxTime) {\r\n this._markNoteCorrect(note);\r\n } else {\r\n this._markNoteIncorrect(note);\r\n }\r\n let deltaTime = e.time - this._lastHitTime;\r\n this._tempo = qNoteDelta / deltaTime * 60;\r\n }\r\n this._playNote(note.vng.noteGroup.notes[0]);\r\n this._lastHitTime = e.time;\r\n this._noteIndex++;\r\n if (this._noteIndex === this._noteList.length) {\r\n this._completeAssessment();\r\n }\r\n }\r\n _playNote(note) {\r\n if (!this._slm.hasPreset(0, 0)) {\r\n throw \"Preset 0:0 not loaded!\";\r\n }\r\n let part = note.noteGroup.voice.measure.staff.partRef;\r\n let pitch = ~~(note.displayCents / 100) - part.chromaticTransposition;\r\n let startTime = 0;\r\n let duration = note.noteGroup.qNoteDuration * 60 / this._tempo;\r\n this._slm.setPreset(0, 0);\r\n this._slm.playNotes([NoteInfoDO.create(\r\n pitch,\r\n startTime,\r\n duration,\r\n 0.5,\r\n 0.5\r\n )]);\r\n }\r\n _completeAssessment() {\r\n stop();\r\n this._assessmentCompleteEmitter.emit(this.getScore());\r\n }\r\n /**gets/sets the tempo in BPM*/\r\n get tempo() {\r\n return this._tempo;\r\n }\r\n set tempo(value) {\r\n this._tempo = value;\r\n }\r\n /**With dynamicTempo the currentTempo will constantly be recalculated as\r\n * each note is played. */\r\n get dynamicTempo() {\r\n return this._dynamicTempo;\r\n }\r\n set dynamicTempo(value) {\r\n this._dynamicTempo = value;\r\n }\r\n};\r\n\r\n// src/score_performance/assessment/PitchAssessor.ts\r\nimport {\r\n AssessmentInstrumentUtils,\r\n MediaDeviceManager,\r\n MicManager,\r\n PitchRecognizer\r\n} from \"audio_input\";\r\nimport { SoundLibManager as SoundLibManager2 } from \"sound_lib\";\r\n\r\n// src/score_performance/scoreViewer/ScoreViewer.ts\r\nimport { Container as Container2, Graphics as Graphics2 } from \"pixi.js\";\r\nimport { createEmitter as createEmitter3 } from \"ts_utils\";\r\n\r\n// src/score_performance/scoreViewer/ScoreViewerInteractionManager.ts\r\nimport { Point } from \"pixi.js\";\r\nimport {\r\n PointDetails\r\n} from \"score_render\";\r\n\r\n// src/score_performance/scoreViewer/InteractionSettings.ts\r\nvar InteractionSettings = class {\r\n constructor() {\r\n this.enableScrollWheel = false;\r\n this.enableDragScroll = false;\r\n this.enableMeasureClickEvents = false;\r\n this.enableNoteClickEvents = false;\r\n this.enableRegionClickEvents = false;\r\n this.enableMeasureOverEvents = false;\r\n this.enableNoteOverEvents = false;\r\n this.enableRegionOverEvents = false;\r\n /**if the ScoreViewer doesn't move around the */\r\n this.scoreViewerIsStationary = true;\r\n }\r\n get _requiresMouseUpDown() {\r\n return this.enableDragScroll || this.enableMeasureClickEvents || this.enableNoteClickEvents;\r\n }\r\n get _requiresMouseMove() {\r\n return this.enableDragScroll || this.enableMeasureOverEvents || this.enableNoteOverEvents;\r\n }\r\n get _requiresWheel() {\r\n return this.enableScrollWheel;\r\n }\r\n};\r\n\r\n// src/score_performance/scoreViewer/ScoreViewerInteractionManager.ts\r\nvar ScoreViewerInteractionManager = class {\r\n constructor(viewManager, scoreViewer) {\r\n this._enabled = false;\r\n this._mouseDownPotentialClick = false;\r\n this._minDeltaForDragScroll = 10;\r\n this._maxDeltaForClick = 5;\r\n this._lastScrollWheelTime = 0;\r\n this._spaceAboveScore = 0;\r\n this._spaceBelowScore = 100;\r\n this._onMouseDown = (e) => {\r\n this._getMousePositionDetails(e);\r\n if (this._mouseDetails.mouseOutsideViewer) {\r\n return;\r\n }\r\n this._mouseDownPotentialClick = true;\r\n this._mouseDownStartPos = this._mouseDetails.clientMousePos;\r\n if (this._settings.enableDragScroll) {\r\n this._pah.app.ticker.add(this._onTick);\r\n }\r\n };\r\n this._onMouseMove = (e) => {\r\n this._getMousePositionDetails(e);\r\n if (!this._mouseDetails.mouseOutsideViewer) {\r\n this._mouseDownLastPos = this._mouseDetails.clientMousePos;\r\n if (this._settings.enableMeasureOverEvents || this._settings.enableNoteOverEvents || this._settings.enableRegionOverEvents) {\r\n this._getPointDetailsInScore();\r\n let vMeas = this._pointDetails.visualMeasure;\r\n if (vMeas && this._lastMeasureOver != vMeas) {\r\n let ev = new ScoreViewerEvent(\r\n 3 /* measureMouseOver */\r\n );\r\n ev.visualMeasure = vMeas;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n }\r\n this._lastMeasureOver = vMeas;\r\n let vng = this._pointDetails.visualNoteGroup;\r\n if (vng && this._lastNoteGroupOver != vng) {\r\n let ev = new ScoreViewerEvent(\r\n 5 /* noteGroupMouseOver */\r\n );\r\n ev.visualNoteGroup = vng;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n }\r\n this._lastNoteGroupOver = vng;\r\n let region = this._pointDetails.clickRegion;\r\n if (region && this._lastRegionOver != region) {\r\n let ev = new ScoreViewerEvent(\r\n 7 /* regionOver */\r\n );\r\n ev.clickRegion = region;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n }\r\n this._lastRegionOver = region;\r\n }\r\n }\r\n };\r\n this._onTick = () => {\r\n if (this._mouseDownLastPos == null) {\r\n return;\r\n }\r\n let origY = this._mouseDownStartPos.y;\r\n let nowY = this._mouseDownLastPos.y;\r\n let delta = Math.abs(nowY - origY);\r\n if (this._mouseDownPotentialClick && delta > this._maxDeltaForClick) {\r\n this._mouseDownPotentialClick = false;\r\n }\r\n if (delta < this._minDeltaForDragScroll) {\r\n return;\r\n }\r\n const speedFactor = 0.4;\r\n if (nowY > origY) {\r\n let inc = nowY - origY - this._minDeltaForDragScroll;\r\n this._scoreViewer.vScore.y -= inc * speedFactor;\r\n } else {\r\n let dec = origY - nowY - this._minDeltaForDragScroll;\r\n this._scoreViewer.vScore.y += dec * speedFactor;\r\n }\r\n this._fixVerticalScorePosition();\r\n this._vm.updateVisibleSystems();\r\n };\r\n this._onMouseUp = (e) => {\r\n this._getMousePositionDetails(e);\r\n let isClick = !this._mouseDetails.mouseOutsideViewer && this._mouseDownPotentialClick;\r\n this._cancelMouseDownWatch();\r\n if (isClick && (this._settings.enableMeasureClickEvents || this._settings.enableNoteClickEvents || this._settings.enableRegionClickEvents)) {\r\n this._getPointDetailsInScore();\r\n if (this._pointDetails.visualMeasure) {\r\n let ev = new ScoreViewerEvent(\r\n 2 /* measureClicked */\r\n );\r\n ev.visualMeasure = this._pointDetails.visualMeasure;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n }\r\n if (this._pointDetails.visualNoteGroup) {\r\n let ev = new ScoreViewerEvent(\r\n 4 /* noteGroupClicked */\r\n );\r\n ev.visualNoteGroup = this._pointDetails.visualNoteGroup;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n }\r\n if (this._pointDetails.clickRegion) {\r\n let ev = new ScoreViewerEvent(\r\n 6 /* regionClicked */\r\n );\r\n ev.clickRegion = this._pointDetails.clickRegion;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n }\r\n }\r\n };\r\n this._onWheel = (e) => {\r\n let time = performance.now();\r\n if (time - this._lastScrollWheelTime < 10) {\r\n return;\r\n }\r\n this._lastScrollWheelTime = time;\r\n let direction = e.deltaY > 0 ? -1 : 1;\r\n const magnitude = 50;\r\n this._scoreViewer.vScore.y += 50 * direction;\r\n this._fixVerticalScorePosition();\r\n this._vm.updateVisibleSystems();\r\n };\r\n this._vm = viewManager;\r\n this._scoreViewer = scoreViewer;\r\n this._init();\r\n }\r\n _init() {\r\n this._settings = new InteractionSettings();\r\n this._mouseDetails = new _MouseEventDetails();\r\n this._pointDetails = new PointDetails(null, false, false);\r\n }\r\n setNewScore(vScore) {\r\n this._pah = vScore.pixiAppHelper;\r\n }\r\n /**\r\n * enables scroll interaction - must add to stage before calling this\r\n */\r\n enableInteraction() {\r\n if (!this._enabled) {\r\n let canvas = this._pah.app.canvas;\r\n if (this._settings._requiresMouseUpDown) {\r\n canvas.addEventListener(\"mousedown\", this._onMouseDown);\r\n window.addEventListener(\"mouseup\", this._onMouseUp);\r\n }\r\n if (this._settings._requiresMouseMove) {\r\n canvas.addEventListener(\"mousemove\", this._onMouseMove);\r\n }\r\n if (this._settings._requiresWheel) {\r\n canvas.addEventListener(\"wheel\", this._onWheel);\r\n }\r\n this._pointDetails.matchMeasure = this._settings.enableMeasureClickEvents || this._settings.enableMeasureOverEvents;\r\n this._pointDetails.matchNoteGroup = this._settings.enableNoteClickEvents || this._settings.enableNoteOverEvents;\r\n this._pointDetails.matchClickRegions = this._settings.enableRegionClickEvents || this._settings.enableRegionOverEvents;\r\n this._viewerGlobalPos = this._settings.scoreViewerIsStationary ? this._scoreViewer.toGlobal(new Point(0, 0)) : null;\r\n this._enabled = true;\r\n }\r\n }\r\n disableInteraction() {\r\n if (this._enabled) {\r\n let canvas = this._pah.app.canvas;\r\n canvas.removeEventListener(\"mousedown\", this._onMouseDown);\r\n window.removeEventListener(\"mouseup\", this._onMouseUp);\r\n canvas.removeEventListener(\"mousemove\", this._onMouseMove);\r\n canvas.removeEventListener(\"wheel\", this._onWheel);\r\n this._cancelMouseDownWatch();\r\n this._enabled = false;\r\n }\r\n }\r\n /**Sets the interactions that are available when ScoreViewer playback is not\r\n * active.*/\r\n setInteraction(settings) {\r\n this._settings = settings;\r\n if (this._enabled) {\r\n this.disableInteraction();\r\n this.enableInteraction();\r\n }\r\n }\r\n notifyPlaybackStateChange(isPlaying) {\r\n if (isPlaying) {\r\n this.disableInteraction();\r\n } else {\r\n this.enableInteraction();\r\n }\r\n }\r\n prepareForRemoval() {\r\n this.disableInteraction();\r\n }\r\n /**Sets extra scrollable space above and below the score */\r\n setScrollBuffers(aboveScore = 0, belowScore = 100) {\r\n this._spaceAboveScore = aboveScore;\r\n this._spaceBelowScore = belowScore;\r\n }\r\n _cancelMouseDownWatch() {\r\n if (this._mouseDownStartPos != null) {\r\n this._pah.app.ticker.remove(this._onTick);\r\n this._mouseDownStartPos = null;\r\n this._mouseDownLastPos = null;\r\n this._mouseDownPotentialClick = false;\r\n }\r\n }\r\n _fixVerticalScorePosition() {\r\n let vScore = this._scoreViewer.vScore;\r\n if (vScore.y + vScore.scoreHeight < this._vm._viewerHeight - this._spaceBelowScore) {\r\n vScore.y = this._vm._viewerHeight - vScore.scoreHeight - this._spaceBelowScore;\r\n }\r\n if (vScore.y > this._spaceAboveScore) {\r\n vScore.y = this._spaceAboveScore;\r\n }\r\n }\r\n _getMousePositionDetails(e) {\r\n let rect = this._scoreViewer.vScore.pixiAppHelper.app.canvas.getBoundingClientRect();\r\n let x = e.clientX - rect.left;\r\n let y = e.clientY - rect.top;\r\n let details = this._mouseDetails;\r\n details.clientMousePos = new Point(e.clientX, e.clientY);\r\n details.canvasMousePos = new Point(x, y);\r\n details.viewerMousePos = null;\r\n details.scoreMousePos = null;\r\n details.mouseOutsideCanvas = false;\r\n details.mouseOutsideViewer = false;\r\n if (x < 0 || x > rect.width || y < 0 || y > rect.height) {\r\n details.mouseOutsideCanvas = true;\r\n details.mouseOutsideViewer = true;\r\n return;\r\n }\r\n let viewerGlobalPos = this._viewerGlobalPos || this._scoreViewer.toGlobal(new Point(0, 0));\r\n let viewerMousePos = new Point(x - viewerGlobalPos.x, y - viewerGlobalPos.y);\r\n details.viewerMousePos = viewerMousePos;\r\n if (viewerMousePos.x < 0 || viewerMousePos.x > this._vm._viewerWidth || viewerMousePos.y < 0 || viewerMousePos.y > this._vm._viewerHeight) {\r\n details.mouseOutsideViewer = true;\r\n return;\r\n }\r\n let scoreGlobalPos = this._scoreViewer.vScore.toGlobal(\r\n new Point(this._pah.app.stage.x, this._pah.app.stage.y)\r\n );\r\n details.scoreMousePos = new Point(x - scoreGlobalPos.x, y - scoreGlobalPos.y);\r\n }\r\n _getPointDetailsInScore() {\r\n this._pointDetails.scorePoint = this._mouseDetails.scoreMousePos;\r\n this._pointDetails.visualMeasure = null;\r\n this._pointDetails.visualNoteGroup = null;\r\n this._pointDetails.visualSystem = null;\r\n this._pointDetails.clickRegion = null;\r\n this._scoreViewer.vScore.gridSearch(this._pointDetails);\r\n }\r\n};\r\nvar _MouseEventDetails = class {\r\n constructor() {\r\n this.mouseOutsideCanvas = false;\r\n this.mouseOutsideViewer = false;\r\n }\r\n};\r\n\r\n// src/score_performance/scoreViewer/ScoreViewerPlaybackManager.ts\r\nimport { DurationType } from \"score_data\";\r\nvar ScoreViewerPlaybackManager = class {\r\n constructor(scoreViewer, viewManager, interactionManager, context) {\r\n this._vngIndex = 0;\r\n //user controlled setting\r\n this._forceScrolling = false;\r\n //num _passedTime = 0;\r\n this._audioStartDelay = 0.5;\r\n this._qNoteTime = 0;\r\n this._isPlaying = false;\r\n this._onEnterFrame = () => {\r\n let currentTime = this._getCurrentTime();\r\n this._qNoteTime = this._getQNoteTime(currentTime);\r\n this._updateCursorAndScrollPos();\r\n this._updateCountoffDisplay();\r\n this._displayRepeatPreview(currentTime);\r\n let lastVng = this._vngList[this._vngList.length - 1];\r\n if (this._vngIndex >= this._vngList.length && this._qNoteTime > lastVng.noteGroup.qNoteTime + lastVng.noteGroup.qNoteDuration && this._nextTimeStamp == null) {\r\n this._stopPlayback();\r\n }\r\n };\r\n this._scoreViewer = scoreViewer;\r\n this._vm = viewManager;\r\n this._im = interactionManager;\r\n this._context = context;\r\n }\r\n setNewScore(vScore, vngList) {\r\n this._vScore = vScore;\r\n this._vngList = vngList;\r\n this._cursor = this._vm.drawCursor();\r\n if (this._isPlaying) {\r\n this._vScore.addChild(this._cursor);\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n }\r\n play(timeStamps, beatList, countoffBeatList, audioStartDelaySeconds = 0.5, startNG = null, endQNoteTime = null) {\r\n if (this._vScore == null) {\r\n throw \"must call setNewScore before using!\";\r\n }\r\n if (timeStamps == null || timeStamps.length < 1) {\r\n throw \"No time stamps!\";\r\n }\r\n this._vm.notifyPlaybackStateChange(true);\r\n this._im.notifyPlaybackStateChange(true);\r\n this._prepareTracking(\r\n timeStamps,\r\n beatList,\r\n countoffBeatList,\r\n audioStartDelaySeconds,\r\n startNG,\r\n endQNoteTime\r\n );\r\n this._prepareScrolling();\r\n this._vScore.pixiAppHelper.app.ticker.add(this._onEnterFrame);\r\n this._isPlaying = true;\r\n }\r\n stop() {\r\n this._stopPlayback();\r\n }\r\n _prepareTracking(timeStamps, beatList, countoffBeatList, audioStartDelaySeconds, startNG, endQNoteTime) {\r\n this._contextStartTime = Number.isNaN(this._context.currentTime) ? 0 : this._context.currentTime;\r\n this._timeStamps = timeStamps;\r\n this._lastTimeStamp = this._timeStamps[0];\r\n this._nextTimeStamp = this._timeStamps[1];\r\n this._currentQNoteToSecondsRatio = this._lastTimeStamp.tempo / 60;\r\n this._audioStartDelay = audioStartDelaySeconds;\r\n this._beatList = this._sortAndRemoveDuplicates(beatList.slice(0));\r\n this._countoffBeatList = countoffBeatList;\r\n this._beatIndex = 0;\r\n this._countoffBeatIndex = 0;\r\n this._firstNoteReached = false;\r\n this._vngIndex = this._initializeCursorAndView(startNG);\r\n this._lastReachedVNG = null;\r\n if (endQNoteTime == null) {\r\n this._lastVNGInRegion = this._vngList[this._vngList.length - 1];\r\n } else {\r\n for (let i = this._vngList.length - 1; i >= 0; i--) {\r\n if (this._vngList[i].noteGroup.qNoteTime < endQNoteTime) {\r\n this._lastVNGInRegion = this._vngList[i];\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n _prepareScrolling() {\r\n this._useScrolling = this._forceScrolling || !this._vm.isNoteInView(this._lastVNGInRegion);\r\n if (!this._useScrolling) {\r\n let ts = this._timeStamps[0];\r\n while (ts.nextSampleTimeStampDO != null) {\r\n if (ts.nextSampleTimeStampDO.qNoteTime < ts.qNoteEndTime) {\r\n this._useScrolling = true;\r\n break;\r\n }\r\n ts = ts.nextSampleTimeStampDO;\r\n }\r\n }\r\n }\r\n _initializeCursorAndView(startNG) {\r\n let i;\r\n let vng;\r\n if (startNG == null) {\r\n vng = this._vngList[0];\r\n i = 0;\r\n } else {\r\n for (i = 0; i < this._vngList.length; i++) {\r\n if (this._vngList[i].noteGroup === startNG) {\r\n vng = this._vngList[i];\r\n break;\r\n }\r\n }\r\n }\r\n if (vng == null) {\r\n vng = this._vngList[0];\r\n i = 0;\r\n }\r\n this._lastSystem = vng.vSystemRef;\r\n this._vScore.addChild(this._cursor);\r\n this._vm.scrollToSystem(this._lastSystem, 0);\r\n this._moveCursorToNotePosition(vng);\r\n return i;\r\n }\r\n _getCurrentTime() {\r\n let currentTime = this._context.currentTime - this._contextStartTime - this._audioStartDelay;\r\n return currentTime;\r\n }\r\n _getQNoteTime(currentTime) {\r\n while (this._nextTimeStamp != null && this._nextTimeStamp.msTime / 1e3 <= currentTime) {\r\n let qNoteTime2 = this._lastTimeStamp.qNoteTime + this._currentQNoteToSecondsRatio * (currentTime - this._lastTimeStamp.msTime / 1e3);\r\n if (this._nextTimeStamp.qNoteTime < qNoteTime2) {\r\n this._vngIndex = 0;\r\n let newStampQNoteTime = this._nextTimeStamp.qNoteTime;\r\n while (this._vngIndex < this._vngList.length && this._vngList[this._vngIndex].noteGroup.qNoteTime < newStampQNoteTime) {\r\n this._vngIndex++;\r\n }\r\n this._beatIndex = 0;\r\n while (this._beatIndex < this._beatList.length && this._beatList[this._beatIndex] < newStampQNoteTime) {\r\n this._beatIndex++;\r\n }\r\n this._vm.removeSystemPreview(true);\r\n }\r\n this._lastTimeStamp = this._nextTimeStamp;\r\n this._nextTimeStamp = this._lastTimeStamp.nextSampleTimeStampDO;\r\n this._currentQNoteToSecondsRatio = this._lastTimeStamp.tempo / 60;\r\n }\r\n let qNoteTime = this._lastTimeStamp.qNoteTime + this._currentQNoteToSecondsRatio * (currentTime - this._lastTimeStamp.msTime / 1e3);\r\n return qNoteTime;\r\n }\r\n _updateCursorAndScrollPos() {\r\n if (!this._firstNoteReached) {\r\n if (this._qNoteTime < this._beatList[0] && this._qNoteTime < this._vngList[this._vngIndex].noteGroup.qNoteTime) {\r\n return;\r\n }\r\n this._firstNoteReached = true;\r\n }\r\n let mostRecentVNG;\r\n while (this._vngIndex < this._vngList.length && this._vngList[this._vngIndex].noteGroup.qNoteTime <= this._qNoteTime) {\r\n let vng = this._vngList[this._vngIndex];\r\n let skipNote = false;\r\n if (!vng.noteGroup.visible && vng.noteGroup.qNoteTime > vng.noteGroup.voice.measure.stack.startTime) {\r\n skipNote = true;\r\n }\r\n if (!skipNote) {\r\n mostRecentVNG = vng;\r\n this._lastReachedVNG = vng;\r\n let vSystem = mostRecentVNG.vSystemRef;\r\n if (vSystem !== this._lastSystem) {\r\n if (this._useScrolling) {\r\n this._vm.scrollToSystem(vSystem, 0.5);\r\n }\r\n this._lastSystem = vSystem;\r\n }\r\n }\r\n let ev = new ScoreViewerEvent(0 /* noteReached */);\r\n ev.visualNoteGroup = vng;\r\n ev.qNoteTime = vng.noteGroup.qNoteTime;\r\n ev.contextTime = this._context.currentTime;\r\n ev.tempo = this._lastTimeStamp.tempo;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n this._vngIndex++;\r\n }\r\n let mostRecentBeat = null;\r\n while (this._beatIndex < this._beatList.length && this._beatList[this._beatIndex] <= this._qNoteTime) {\r\n mostRecentBeat = this._beatList[this._beatIndex];\r\n let ev = new ScoreViewerEvent(1 /* beatReached */);\r\n ev.qNoteTime = mostRecentBeat;\r\n ev.contextTime = this._context.currentTime;\r\n ev.tempo = this._lastTimeStamp.tempo;\r\n this._scoreViewer._dispatchClientEvent(ev);\r\n this._beatIndex++;\r\n }\r\n if (mostRecentVNG != null && (mostRecentBeat == null || mostRecentVNG.noteGroup.qNoteTime >= mostRecentBeat) && !this._isMeasureWholeRest(mostRecentVNG.noteGroup)) {\r\n this._moveCursorToNotePosition(mostRecentVNG);\r\n } else if (mostRecentBeat != null) {\r\n let prevNG = this._lastReachedVNG?.noteGroup;\r\n if (prevNG == null) {\r\n return;\r\n }\r\n let nextNG = prevNG.next;\r\n if (nextNG != null && nextNG.visible === false) {\r\n nextNG = null;\r\n }\r\n let startHPos;\r\n let distance;\r\n let endQNoteTime;\r\n let prevNoteXPos = this._lastReachedVNG.spx;\r\n let sysPageOffset = 0;\r\n if (nextNG != null && nextNG.voice.measure === prevNG.voice.measure) {\r\n startHPos = sysPageOffset + prevNoteXPos;\r\n distance = nextNG.hPos - prevNG.hPos;\r\n endQNoteTime = nextNG.qNoteTime;\r\n } else if (this._isMeasureWholeRest(prevNG)) {\r\n let stack = prevNG.voice.measure.stack;\r\n distance = stack.newSystem ? stack.width - stack.indentAsSystemLeader : stack.width - stack.indent;\r\n startHPos = sysPageOffset + prevNoteXPos - prevNG.hPos;\r\n startHPos += stack.newSystem ? stack.indentAsSystemLeader : stack.indent;\r\n endQNoteTime = stack.endTime;\r\n } else {\r\n let stack = prevNG.voice.measure.stack;\r\n startHPos = sysPageOffset + prevNoteXPos;\r\n distance = stack.width - prevNG.hPos;\r\n endQNoteTime = stack.endTime;\r\n }\r\n let px = this._vScore.scoreProps.pixelsPerSpace;\r\n this._cursor.x = this._lastSystem.x + px * (startHPos + 0.5 + distance * ((this._qNoteTime - prevNG.qNoteTime) / (endQNoteTime - prevNG.qNoteTime)));\r\n this._cursor.y = this._lastSystem.scoreY - this._vScore.scoreProps.pixelsPerSpace;\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n }\r\n _updateCountoffDisplay() {\r\n if (this._countoffBeatIndex < this._countoffBeatList.length && this._qNoteTime >= this._countoffBeatList[this._countoffBeatIndex]) {\r\n this._vm.updateVisualCountoff(this._countoffBeatList.length - this._countoffBeatIndex);\r\n this._countoffBeatIndex++;\r\n }\r\n }\r\n _moveCursorToNotePosition(vng) {\r\n let px = this._vScore.scoreProps.pixelsPerSpace;\r\n this._cursor.x = vng.vSystemRef.x + vng.x + 0.5 * this._vScore.scoreProps.noteheadWidth * px;\r\n this._cursor.y = vng.vSystemRef.scoreY - 1 * this._vScore.scoreProps.pixelsPerSpace;\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n _displayRepeatPreview(currentTime) {\r\n let lastVng = this._lastSystem.visNoteGroups[this._lastSystem.visNoteGroups.length - 1];\r\n if (this._nextTimeStamp != null && this._nextTimeStamp.qNoteTime < this._qNoteTime && this._useScrolling && this._vm._systemPreview == null && currentTime + 3 >= this._nextTimeStamp.msTime / 1e3 && this._lastSystem.visNoteGroups[0].noteGroup.qNoteTime > this._nextTimeStamp.qNoteTime && lastVng.noteGroup.qNoteTime + lastVng.noteGroup.qNoteDuration >= this._lastTimeStamp.qNoteEndTime) {\r\n for (let i = 0; i < this._vngList.length; i++) {\r\n let vng = this._vngList[i];\r\n if (vng.noteGroup.qNoteTime >= this._nextTimeStamp.qNoteTime) {\r\n let vsys = vng.vSystemRef;\r\n this._vm.showSystemPreview(vsys, this._lastSystem, vng);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n _stopPlayback() {\r\n if (this._isPlaying) {\r\n this._vScore.pixiAppHelper.app.ticker.remove(this._onEnterFrame);\r\n this._isPlaying = false;\r\n this._vm.notifyPlaybackStateChange(false);\r\n this._im.notifyPlaybackStateChange(false);\r\n this._cursor.parent.removeChild(this._cursor);\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n }\r\n _isMeasureWholeRest(ng) {\r\n return ng.isRest && ng.durationType === DurationType.WHOLE && ng.voice.noteGroups.length === 1;\r\n }\r\n _sortAndRemoveDuplicates(list) {\r\n list.sort((num1, num2) => {\r\n return num1 <= num2 ? -1 : 1;\r\n });\r\n let newList = [];\r\n let lastNum;\r\n for (let i = 0; i < list.length; i++) {\r\n let newNum = list[i];\r\n if (newNum !== lastNum) {\r\n newList.push(newNum);\r\n }\r\n lastNum = newNum;\r\n }\r\n return newList;\r\n }\r\n get qNoteTime() {\r\n return this._qNoteTime;\r\n }\r\n get tempo() {\r\n return this._lastTimeStamp?.tempo;\r\n }\r\n /**Setting this to true will force system scrolling when the cursor\r\n * reaches a new line. If this is false, scrolling will still occur if\r\n * notes are not visible on the screen.*/\r\n get forceScrolling() {\r\n return this._forceScrolling;\r\n }\r\n set forceScrolling(value) {\r\n this._forceScrolling = value;\r\n }\r\n};\r\nvar TimeTrackMode = /* @__PURE__ */ ((TimeTrackMode2) => {\r\n TimeTrackMode2[TimeTrackMode2[\"AUDIO_CONTEXT\"] = 0] = \"AUDIO_CONTEXT\";\r\n TimeTrackMode2[TimeTrackMode2[\"BEAT_HITS\"] = 1] = \"BEAT_HITS\";\r\n return TimeTrackMode2;\r\n})(TimeTrackMode || {});\r\n\r\n// src/score_performance/scoreViewer/ScoreViewerViewManager.ts\r\nimport { VisualPage } from \"score_render\";\r\nimport { Text, Graphics, Container } from \"pixi.js\";\r\nimport { Easing, Tween } from \"@tweenjs/tween.js\";\r\nimport { createEmitter as createEmitter2 } from \"ts_utils\";\r\nvar _ScoreViewerViewManager = class _ScoreViewerViewManager {\r\n constructor(scoreViewer) {\r\n this._viewerWidth = 500;\r\n this._viewerHeight = 400;\r\n this._systemScrollEmitter = createEmitter2();\r\n this._onUpdateTweens = () => {\r\n let runAgain = false;\r\n if (this._scrollTween != null) {\r\n runAgain = true;\r\n this._scrollTween.update();\r\n }\r\n if (this._countoffFadeTween != null) {\r\n runAgain = true;\r\n this._countoffFadeTween.update();\r\n }\r\n if (this._systemPreviewScrollTween != null) {\r\n runAgain = true;\r\n this._systemPreviewScrollTween.update();\r\n }\r\n if (runAgain) {\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n requestAnimationFrame(this._onUpdateTweens);\r\n }\r\n };\r\n this._scoreViewer = scoreViewer;\r\n this._init();\r\n }\r\n get systemScrollEvent() {\r\n return this._systemScrollEmitter.event;\r\n }\r\n _init() {\r\n this._scoreViewer._assessmentOverlay = new Container();\r\n }\r\n setNewScore(visualScore, viewerWidth = -1, viewerHeight = -1) {\r\n if (this._vScore != null && this._vScore.parent === this._scoreViewer) {\r\n this._scoreViewer.removeChild(this._vScore);\r\n }\r\n this._vScore = visualScore;\r\n this._vSystems = this._vScore.getVisualSystems();\r\n if (viewerWidth === -1)\r\n viewerWidth = this._viewerWidth;\r\n if (viewerHeight === -1)\r\n viewerHeight = this._viewerHeight;\r\n this.setWidthAndHeight(viewerWidth, viewerHeight);\r\n this._scoreViewer.addChild(this._vScore);\r\n this._scoreViewer._assessmentOverlay.parent?.removeChild(\r\n this._scoreViewer._assessmentOverlay\r\n );\r\n this._vScore.addChild(this._scoreViewer._assessmentOverlay);\r\n }\r\n setWidthAndHeight(viewerWidth, viewerHeight) {\r\n this._viewerWidth = viewerWidth;\r\n this._viewerHeight = viewerHeight;\r\n if (this._viewerMask && this._viewerMask.parent === this._scoreViewer) {\r\n this._scoreViewer.removeChild(this._viewerMask);\r\n }\r\n let mask = new Graphics();\r\n let e = _ScoreViewerViewManager.EDGE_BUFFER;\r\n mask.rect(-e, 0, this._viewerWidth + 2 * e, this._viewerHeight);\r\n mask.fill(0);\r\n this._scoreViewer.mask = mask;\r\n this._scoreViewer.addChild(mask);\r\n this._viewerMask = mask;\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n if (this._viewerWidth != null && this._vScore != null) {\r\n this._vScore.x = 0;\r\n this.updateVisibleSystems(0, true);\r\n }\r\n }\r\n notifyPlaybackStateChange(isPlaying) {\r\n if (!isPlaying) {\r\n this.removeSystemPreview(false);\r\n }\r\n }\r\n prepareForRemoval() {\r\n this.stopCurrentScrollTween();\r\n this.removeSystemPreview(false);\r\n if (this._vScore != null && this._vScore.parent === this._scoreViewer) {\r\n this._scoreViewer.removeChild(this._vScore);\r\n this._vScore = null;\r\n }\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n isNoteInView(vng) {\r\n let vSys = vng.vSystemRef;\r\n if (vSys.parent == null) {\r\n return false;\r\n } else {\r\n if (this._vScore.y + vSys.scoreY > 0 && this._vScore.y + (vSys.scoreY + vSys.height) < this._viewerHeight) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n }\r\n /**returns the first [VisualSystem] object that is currently in view. If\r\n * none are found in view, null is returned.*/\r\n getFirstVisibleSystem() {\r\n for (let i = 0; i < this._vSystems.length; i++) {\r\n let vSys = this._vSystems[i];\r\n if (this._vScore.y + (vSys.scoreY + vSys.height) > 0 && this._vScore.y + vSys.scoreY < this._viewerHeight) {\r\n return vSys;\r\n }\r\n }\r\n return null;\r\n }\r\n /**returns the [VisualSystem] objects that are currently in view. Returns an\r\n * empty array if none are in view. */\r\n getVisibleSystems() {\r\n return this._vSystems.filter((vsys) => {\r\n return this._vScore.y + (vsys.scoreY + vsys.height) > 0 && this._vScore.y + vsys.scoreY < this._viewerHeight;\r\n });\r\n }\r\n scrollToSystem(vSystem, seconds) {\r\n if (this._scrollTween != null) {\r\n this._scrollTween.end();\r\n this._scrollTween = null;\r\n }\r\n let targetY = this._vScore.firstPageVerticalOffset + -1 * vSystem.scoreY;\r\n if (seconds > 0 && this._vScore.y > targetY) {\r\n this.updateVisibleSystems(this._vScore.y - targetY);\r\n this._scrollTween = new Tween(this._vScore).to({ y: targetY }, 500).easing(Easing.Quadratic.Out).onComplete(() => {\r\n this._scrollTween = null;\r\n this._systemScrollEmitter.emit();\r\n }).start();\r\n this._onUpdateTweens();\r\n } else {\r\n this._vScore.y = targetY;\r\n this.updateVisibleSystems(0);\r\n }\r\n }\r\n stopCurrentScrollTween() {\r\n if (this._scrollTween != null) {\r\n this._scrollTween.end();\r\n this._scrollTween = null;\r\n }\r\n }\r\n /**updates which systems are currently in view. This caches the visible \r\n * systems and removes the cache for systems which are out of view (as well \r\n * as removing them from the stage). Use cacheAlreadyVisibleSystems the \r\n * first time a score is processed to make sure that previously visible \r\n * systems are cached.*/\r\n updateVisibleSystems(nextScrollDelta = 0, cacheAlreadyVisibleSystems = false) {\r\n for (let i = 0; i < this._vSystems.length; i++) {\r\n let vSys = this._vSystems[i];\r\n if (this._vScore.y + (vSys.scoreY + vSys.height) > 0 && this._vScore.y + vSys.scoreY < this._viewerHeight + nextScrollDelta) {\r\n if (vSys.parent !== vSys.pageRef || cacheAlreadyVisibleSystems) {\r\n vSys.displayTexture();\r\n }\r\n if (vSys.parent !== vSys.pageRef) {\r\n vSys.pageRef.addChild(vSys);\r\n }\r\n } else {\r\n if (vSys.parent === vSys.pageRef) {\r\n vSys.pageRef.removeChild(vSys);\r\n }\r\n }\r\n }\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n updateVisualCountoff(countoffBeat) {\r\n if (this._countoffFadeTween != null && this._countoffFadeTween.isPlaying) {\r\n this._countoffFadeTween.end();\r\n }\r\n if (this._countoffDisplay != null && this._countoffDisplay.parent === this._scoreViewer) {\r\n this._scoreViewer.removeChild(this._countoffDisplay);\r\n }\r\n this._countoffDisplay = new Container();\r\n let text;\r\n if (countoffBeat === 2) {\r\n text = \"Set\";\r\n } else if (countoffBeat === 1) {\r\n text = \"Go\";\r\n } else {\r\n text = countoffBeat.toString();\r\n }\r\n let tf = new Text({ text, style: {\r\n fontFamily: \"Arial\",\r\n fill: 65280,\r\n fontSize: 80 * this._viewerWidth / 600,\r\n align: \"left\"\r\n } });\r\n this._countoffDisplay.addChild(tf);\r\n this._countoffDisplay.x = (this._viewerWidth - tf.width) / 2;\r\n this._countoffDisplay.y = (this._viewerHeight - tf.height) / 2;\r\n this._scoreViewer.addChild(this._countoffDisplay);\r\n this._countoffFadeTween = new Tween(this._countoffDisplay).to({ alpha: 0 }).easing(Easing.Linear.None).onComplete(() => {\r\n if (this._countoffDisplay.parent === this._scoreViewer) {\r\n this._scoreViewer.removeChild(this._countoffDisplay);\r\n }\r\n this._countoffFadeTween = null;\r\n }).start();\r\n this._onUpdateTweens();\r\n }\r\n drawCursor(color = 65280) {\r\n let px = this._vScore.scoreProps.pixelsPerSpace;\r\n let graphics = new Graphics();\r\n graphics.setStrokeStyle({\r\n color,\r\n alpha: 0.3,\r\n width: 20 * px / 10,\r\n join: \"round\",\r\n cap: \"square\"\r\n });\r\n graphics.moveTo(0, 0);\r\n graphics.lineTo(0, px * 6);\r\n graphics.y = -1 * px;\r\n graphics.stroke();\r\n return graphics;\r\n }\r\n showSystemPreview(targetSys, currentSys, targetVng) {\r\n this.removeSystemPreview(false);\r\n let preview = new Container();\r\n let g = new Graphics();\r\n g.rect(targetSys.x, targetSys.y, targetSys.width, targetSys.height);\r\n g.fill(16777215);\r\n preview.addChild(g);\r\n preview.addChild(targetSys.getTextureSprite());\r\n this._systemPreview = preview;\r\n let cursor = this.drawCursor();\r\n this._systemPreview.x = this._vScore.x;\r\n this._systemPreview.y = this._vScore.firstPageVerticalOffset + currentSys.height + VisualPage.DISTANCE_BETWEEN_SYSTEMS;\r\n this._scoreViewer.addChild(this._systemPreview);\r\n let r = currentSys.graphicsBounds;\r\n let graphics = new Graphics();\r\n graphics.rect(r.x, r.y, r.width, r.height);\r\n graphics.fill(0);\r\n graphics.x = currentSys.scoreX + r.x;\r\n graphics.y = currentSys.scoreY;\r\n this._vScore.addChild(graphics);\r\n this._vScore.mask = graphics;\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n removeSystemPreview(fadeIntoPosition) {\r\n if (this._systemPreview != null && this._systemPreview.parent != null) {\r\n if (fadeIntoPosition) {\r\n let tempSys = this._systemPreview;\r\n this._systemPreviewScrollTween = new Tween(tempSys).to({ y: this._vScore.firstPageVerticalOffset }, 500).easing(Easing.Cubic.Out).onComplete(() => {\r\n tempSys.parent.removeChild(tempSys);\r\n this._vScore.mask = null;\r\n this._systemPreviewScrollTween = null;\r\n }).start();\r\n this._onUpdateTweens();\r\n } else {\r\n this._systemPreviewScrollTween = null;\r\n this._systemPreview.parent.removeChild(\r\n this._systemPreview\r\n );\r\n this._vScore.removeChild(this._vScore.mask);\r\n this._vScore.mask = null;\r\n }\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n if (this._systemPreview != null) {\r\n this._systemPreview = null;\r\n this._vScore.removeChild(this._vScore.mask);\r\n this._vScore.mask = null;\r\n this._scoreViewer.pixiAppHelper.requestRender();\r\n }\r\n }\r\n};\r\n/**gap between scoreViewer edge and visualScore*/\r\n_ScoreViewerViewManager.EDGE_BUFFER = 2;\r\nvar ScoreViewerViewManager = _ScoreViewerViewManager;\r\n\r\n// src/score_performance/scoreViewer/ScoreViewer.ts\r\nvar ScoreViewer3 = class extends Container2 {\r\n constructor(pixiAppHelper, visualScore, viewerWidth, viewerHeight, context) {\r\n super();\r\n this._emitter = createEmitter3();\r\n this._pah = pixiAppHelper;\r\n this._init(visualScore, viewerWidth, viewerHeight, context);\r\n }\r\n get event() {\r\n return this._emitter.event;\r\n }\r\n _init(visualScore, viewerWidth, viewerHeight, context) {\r\n this._vm = new ScoreViewerViewManager(this);\r\n this._im = new ScoreViewerInteractionManager(this._vm, this);\r\n this._pm = new ScoreViewerPlaybackManager(\r\n this,\r\n this._vm,\r\n this._im,\r\n context\r\n );\r\n this.setScore(visualScore, viewerWidth, viewerHeight);\r\n this._im.enableInteraction();\r\n }\r\n setScore(visualScore, viewerWidth = -1, viewerHeight = -1) {\r\n this._vScore = visualScore;\r\n this._vngList = this._vScore.getVisualNoteGroups();\r\n this._vngList.sort((vng1, vng2) => vng1.noteGroup.qNoteTime <= vng2.noteGroup.qNoteTime ? -1 : 1);\r\n this._vm.setNewScore(this._vScore, viewerWidth, viewerHeight);\r\n this._pm.setNewScore(this._vScore, this._vngList);\r\n this._im.setNewScore(this._vScore);\r\n }\r\n prepareForRemoval() {\r\n this._pm.stop();\r\n this._vm.prepareForRemoval();\r\n this._im.prepareForRemoval();\r\n this._vScore = null;\r\n }\r\n setWidthAndHeight(viewerWidth, viewerHeight) {\r\n this._vm.setWidthAndHeight(viewerWidth, viewerHeight);\r\n }\r\n play(timeStamps, beatList, countoffBeatList, audioStartDelaySeconds = 0.5, startNG = null, endQNoteTime = null) {\r\n this._pm.play(\r\n timeStamps,\r\n beatList,\r\n countoffBeatList,\r\n audioStartDelaySeconds,\r\n startNG,\r\n endQNoteTime\r\n );\r\n }\r\n stop() {\r\n this._pm.stop();\r\n }\r\n startBeatTrackPlayback(countoffBeats) {\r\n }\r\n /**\r\n * scrolls the score to the indicated system\r\n */\r\n scrollToSystem(system, seconds) {\r\n for (let vSystem of this._vm._vSystems) {\r\n if (vSystem.systemRef === system) {\r\n this._vm.scrollToSystem(vSystem, seconds);\r\n return;\r\n }\r\n }\r\n }\r\n /**scrolls the score to the top system*/\r\n scrollToTop(seconds) {\r\n this.scrollToSystem(this._vm._vSystems[0].systemRef, seconds);\r\n }\r\n /**returns the first [VisualSystem] object that is currently in view. If\r\n * none are found in view, null is returned.*/\r\n getFirstVisibleSystem() {\r\n return this._vm.getFirstVisibleSystem();\r\n }\r\n /**returns the [VisualSystem] objects that are currently in view. Returns an\r\n * empty array if none are in view. */\r\n getVisibleSystems() {\r\n return this._vm.getVisibleSystems();\r\n }\r\n /**Sets the interactions that are available when ScoreViewer playback is not\r\n * active.*/\r\n setInteraction(settings) {\r\n this._im.setInteraction(settings);\r\n }\r\n draw1pxFrame(color = 16711680) {\r\n if (this._frame != null && this._frame.parent === this) {\r\n this.removeChild(this._frame);\r\n }\r\n this._frame = new Graphics2();\r\n this._frame.setStrokeStyle({ color, width: 1 });\r\n this._frame.rect(0, 0, this.width, this.height);\r\n this._frame.stroke();\r\n this.addChildAt(this._frame, 0);\r\n }\r\n /**Sets extra scrollable space above and below the score */\r\n setScrollBuffers(aboveScore = 0, belowScore = 100) {\r\n this._im.setScrollBuffers(aboveScore, belowScore);\r\n }\r\n _dispatchClientEvent(e) {\r\n this._emitter.emit(e);\r\n }\r\n get pixiAppHelper() {\r\n return this._pah;\r\n }\r\n get vScore() {\r\n return this._vScore;\r\n }\r\n /**returns a list of the VisualNoteGroups, sorted by qNoteTime*/\r\n get vngList() {\r\n return this._vngList;\r\n }\r\n get viewManager() {\r\n return this._vm;\r\n }\r\n get playbackManager() {\r\n return this._pm;\r\n }\r\n get assessmentOverlay() {\r\n return this._assessmentOverlay;\r\n }\r\n /**Setting this to true will force system scrolling when the cursor\r\n * reaches a new line. If this is false, scrolling will still occur if\r\n * notes are not visible on the screen.*/\r\n get forceScrolling() {\r\n return this._pm.forceScrolling;\r\n }\r\n set forceScrolling(value) {\r\n this._pm.forceScrolling = value;\r\n }\r\n};\r\nvar ScoreViewerEvent = class {\r\n constructor(type) {\r\n this.type = type;\r\n }\r\n};\r\nvar ScoreViewerEventType = /* @__PURE__ */ ((ScoreViewerEventType2) => {\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"noteReached\"] = 0] = \"noteReached\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"beatReached\"] = 1] = \"beatReached\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"measureClicked\"] = 2] = \"measureClicked\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"measureMouseOver\"] = 3] = \"measureMouseOver\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"noteGroupClicked\"] = 4] = \"noteGroupClicked\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"noteGroupMouseOver\"] = 5] = \"noteGroupMouseOver\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"regionClicked\"] = 6] = \"regionClicked\";\r\n ScoreViewerEventType2[ScoreViewerEventType2[\"regionOver\"] = 7] = \"regionOver\";\r\n return ScoreViewerEventType2;\r\n})(ScoreViewerEventType || {});\r\n\r\n// src/score_performance/assessment/NoteSplitter.ts\r\nvar NoteSplitter = class {\r\n constructor() {\r\n this._prEvents = [];\r\n this._pitchHistory = [];\r\n this._currentEventIndex = 0;\r\n /**/\r\n ///SHARED SPLIT PARAMS//////////*/\r\n /**/\r\n ///OPTIONAL SPLIT PARAMS////////*/\r\n this._osMinStablePitches = 6;\r\n this._osPitchesToConsider = 9;\r\n this._osMinTotalPitchJump = 60;\r\n this._osMinPitchStabilityThreshold = 40;\r\n this._osLastStablePitch = 0;\r\n //keeps track of the number of events that have kept stable and are added\r\n //into our average\r\n this._osStablePitchEventsCount = 0;\r\n this._osMinAmplPercRise = 1;\r\n this._osAmplMaxRiseTime = 0.1;\r\n this._osLastSplitTime = 0;\r\n this._minTimeBetweenSplits = 0.1;\r\n //minimum amplitude a pitch event must be to be considered as a split point\r\n this._minAmplPerc = 0;\r\n this._highestAmpl = 0;\r\n }\r\n //sets note splitter parameters using settings from the passed in instrument\r\n setInstrument(inst) {\r\n if (inst.psMinStablePitches != null) {\r\n this._osMinStablePitches = inst.psMinStablePitches;\r\n }\r\n if (inst.psPitchesToConsider != null) {\r\n this._osPitchesToConsider = inst.psPitchesToConsider;\r\n }\r\n if (inst.psMinTotalPitchJump != null) {\r\n this._osMinTotalPitchJump = inst.psMinTotalPitchJump;\r\n }\r\n if (inst.psMinPitchStabilityThresh != null) {\r\n this._osMinPitchStabilityThreshold = inst.psMinPitchStabilityThresh;\r\n }\r\n if (inst.asMinAmplPercRise != null) {\r\n this._osMinAmplPercRise = inst.asMinAmplPercRise;\r\n }\r\n if (inst.asMaxAmplRiseTime != null) {\r\n this._osAmplMaxRiseTime = inst.asMaxAmplRiseTime;\r\n }\r\n if (inst.spMinTimeBetweenSplits != null) {\r\n this._minTimeBetweenSplits = inst.spMinTimeBetweenSplits;\r\n }\r\n if (inst.minAmplPerc != null) {\r\n this._minAmplPerc = inst.minAmplPerc;\r\n }\r\n }\r\n /**\r\n * resets the splitter for a new performance\r\n */\r\n reset() {\r\n this._prEvents = [];\r\n this._pitchHistory = [];\r\n this._currentEventIndex = 0;\r\n this._osLastStablePitch = 0;\r\n this._osStablePitchEventsCount = 0;\r\n this._osLastSplitTime = 0;\r\n this._highestAmpl = 0;\r\n }\r\n addEvent(prEvent) {\r\n this._prEvents.push(prEvent);\r\n this._pitchHistory.push(prEvent.cents);\r\n let cprEvent = this._prEvents[this._currentEventIndex];\r\n if (cprEvent.rms > this._highestAmpl) {\r\n this._highestAmpl = cprEvent.rms;\r\n } else if (cprEvent.rms < this._minAmplPerc * this._highestAmpl) {\r\n this._currentEventIndex++;\r\n return;\r\n }\r\n let cPitch = prEvent.cents;\r\n if ((cPitch - this._osLastStablePitch >= this._osMinTotalPitchJump || this._osLastStablePitch - cPitch >= this._osMinTotalPitchJump) && this._currentEventIndex - this._osPitchesToConsider + 1 >= 0) {\r\n let firstPitchIndex = this._currentEventIndex - this._osPitchesToConsider + 1;\r\n let firstSamePitchIndex = -1;\r\n let stableCount = 1;\r\n let stableTotal = cPitch;\r\n let pitchStable = false;\r\n for (let i = firstPitchIndex; i < this._currentEventIndex; i++) {\r\n if (this._pitchHistory[i] - cPitch < this._osMinPitchStabilityThreshold && cPitch - this._pitchHistory[i] < this._osMinPitchStabilityThreshold) {\r\n stableCount++;\r\n stableTotal += this._pitchHistory[i];\r\n if (firstSamePitchIndex === -1) {\r\n firstSamePitchIndex = i;\r\n }\r\n if (stableCount >= this._osMinStablePitches) {\r\n pitchStable = true;\r\n }\r\n }\r\n }\r\n if (pitchStable) {\r\n let newAverage = ~~(stableTotal / stableCount);\r\n if (newAverage - this._osLastStablePitch >= this._osMinTotalPitchJump || this._osLastStablePitch - newAverage >= this._osMinTotalPitchJump) {\r\n this._osLastStablePitch = newAverage;\r\n this._osStablePitchEventsCount = stableCount;\r\n this._osLastSplitTime = this._prEvents[firstPitchIndex].time;\r\n this._prEvents[firstSamePitchIndex].pitchSplit = true;\r\n this._prEvents[firstSamePitchIndex].splitCents = this._osLastStablePitch;\r\n }\r\n }\r\n } else if (cPitch - this._osLastStablePitch < this._osMinPitchStabilityThreshold && this._osLastStablePitch - cPitch < this._osMinPitchStabilityThreshold) {\r\n this._osStablePitchEventsCount++;\r\n if (this._osStablePitchEventsCount < 2) {\r\n this._osStablePitchEventsCount = 2;\r\n }\r\n this._osLastStablePitch = ~~(((this._osStablePitchEventsCount - 1) * this._osLastStablePitch + cPitch) / this._osStablePitchEventsCount);\r\n }\r\n if (cprEvent.time - this._minTimeBetweenSplits <= this._osLastSplitTime) {\r\n this._currentEventIndex++;\r\n return;\r\n }\r\n let prevEventIndex = this._currentEventIndex - 1;\r\n while (prevEventIndex >= 0 && this._prEvents[prevEventIndex].time >= cprEvent.time - this._osAmplMaxRiseTime) {\r\n if (this._prEvents[prevEventIndex].rms * (1 + this._osMinAmplPercRise) <= cprEvent.rms) {\r\n cprEvent.amplSplit = true;\r\n this._osLastSplitTime = cprEvent.time;\r\n break;\r\n }\r\n prevEventIndex--;\r\n }\r\n this._currentEventIndex++;\r\n }\r\n};\r\n\r\n// src/score_performance/assessment/PitchAssessor.ts\r\nvar PitchAssessor = class extends Assessor {\r\n constructor(scoreViewer, visualizer) {\r\n super(scoreViewer, visualizer);\r\n //number of milliseconds to wait before checking assessment for a note\r\n this._assess_Delay = 0.8;\r\n this._debugPRecString = \"\";\r\n this._debugNotesString = \"\";\r\n this._debug = false;\r\n this._onScoreViewerEvent = (e) => {\r\n if (e.type === 0 /* noteReached */) {\r\n this._notationNotesQue.push(e);\r\n if (this._debug)\r\n this._debugNREvents.push(e);\r\n }\r\n };\r\n this._onPitchRec = (e) => {\r\n this._prEvents.push(e);\r\n this._pitchHistory.push(e.cents);\r\n if (this._inst.checkNoteStartTimes) {\r\n this._noteSplitter.addEvent(e);\r\n }\r\n if (this._debug) {\r\n this._debugPREvents.push(e);\r\n }\r\n };\r\n this._onEnterFrame = () => {\r\n this._checkForNotesToAssess(false);\r\n };\r\n this._initialize();\r\n }\r\n _initialize() {\r\n this._slm = SoundLibManager2.get();\r\n if (!MediaDeviceManager.isInitialized || !MediaDeviceManager.get().isMicReady) {\r\n throw \"You must initialize the MediaDeviceManager and get mic permission before using microphone pitch assessment\";\r\n }\r\n this._pitchRecognizer = new PitchRecognizer(MicManager.get());\r\n this._noteSplitter = new NoteSplitter();\r\n }\r\n setInstrument(inst) {\r\n this._inst = AssessmentInstrumentUtils.getInstrumentByID(inst.id);\r\n if (this._inst == null)\r\n throw \"InstrumentDO.id doesn't match an assessment inst\";\r\n this._pitchRecognizer.setInstrument(this._inst);\r\n this._noteSplitter.setInstrument(this._inst);\r\n }\r\n /**starts assessment*/\r\n start() {\r\n if (this._debug) {\r\n this._debugNREvents = [];\r\n this._debugPREvents = [];\r\n this._debugMatchedNotes = \"\";\r\n }\r\n this._hitMissHistory = [];\r\n this._prEvents = [];\r\n this._pitchHistory = [];\r\n this._prEventWindowStartIndex = 0;\r\n this._lastNotationPitch = 0;\r\n this._maxAmplitudeEncountered = 0;\r\n this._noteSplitter.reset();\r\n this._notationNotesQue = [];\r\n this._scoreViewer.event.on(this._onScoreViewerEvent);\r\n this._scoreViewer.vScore.pixiAppHelper.app.ticker.add(\r\n this._onEnterFrame\r\n );\r\n this._pitchRecognizer.setInstrument(this._inst);\r\n this._pitchRecognizer.pitchRecEvent.on(this._onPitchRec);\r\n this._pitchRecognizer.startPRec(false);\r\n this._debugNotesString = \"tuning window: ${this._inst.tuningWindow}\\n\";\r\n this._debugPRecString = \"\";\r\n }\r\n /**stops assessment*/\r\n stop() {\r\n if (this._pitchRecognizer.isRunning) {\r\n this._pitchRecognizer.stopPRec(false);\r\n this._scoreViewer.vScore.pixiAppHelper.app.ticker.remove(\r\n this._onEnterFrame\r\n );\r\n this._checkForNotesToAssess(true);\r\n this._pitchRecognizer.pitchRecEvent.off(this._onPitchRec);\r\n this._scoreViewer.event.off(this._onScoreViewerEvent);\r\n if (this._debug) {\r\n console.log(this._debugNotesString);\r\n console.log(this._debugPRecString);\r\n }\r\n }\r\n }\r\n get requiresMicrophone() {\r\n return true;\r\n }\r\n _checkForNotesToAssess(isFinalFrame) {\r\n let cTime = this._slm.context.currentTime;\r\n while (this._notationNotesQue.length > 0 && (cTime - this._assess_Delay >= this._notationNotesQue[0].contextTime || isFinalFrame)) {\r\n let nrEvent = this._notationNotesQue.splice(0, 1)[0];\r\n let ng = nrEvent.visualNoteGroup.noteGroup;\r\n if (!ng.isRest && !ng.notes[0].isTieTarget) {\r\n if (!this._inst.checkNoteStartTimes) {\r\n this.assessNote(nrEvent, cTime);\r\n } else {\r\n this.assessNote4(nrEvent, cTime);\r\n }\r\n } else {\r\n this._lastNotationPitch = 0;\r\n }\r\n }\r\n }\r\n assessNote(noteReachedEvent, cTime) {\r\n let noteStartTime = noteReachedEvent.contextTime;\r\n let assessNote = this.getAssessNoteFromVNG(\r\n noteReachedEvent.visualNoteGroup\r\n );\r\n let noteGroup = assessNote.vng.noteGroup;\r\n let note = noteGroup.notes[0];\r\n let durationInSeconds = noteGroup.qNoteDuration * (60 / noteReachedEvent.tempo);\r\n let requiredMatches = Math.ceil(durationInSeconds * this._inst.requiredPitchesPerSecond);\r\n let matchedPitches = 0;\r\n let notationCents = note.displayCents - this._inst.transposition * 100;\r\n let timeWindow = this._inst.timeBucketRight * Math.pow(durationInSeconds, 0.3);\r\n let allowMultipleGuesses = this._pitchRecognizer.pitchRecMethod === 4;\r\n let maxGuesses = 3;\r\n let length = this._prEvents.length;\r\n for (let i = 0; i < length; i++) {\r\n let pitchRecEvent = this._prEvents[i];\r\n pitchRecEvent.correlationScore = -5;\r\n if (pitchRecEvent.time >= noteStartTime - timeWindow && pitchRecEvent.time <= noteStartTime + timeWindow) {\r\n let pitchMatch = false;\r\n if (!allowMultipleGuesses) {\r\n let pRecCents = pitchRecEvent.cents;\r\n if (!this._inst.ignoreOctave) {\r\n pitchMatch = notationCents - pRecCents < this._inst.tuningWindow && pRecCents - notationCents < this._inst.tuningWindow;\r\n } else {\r\n let difference = notationCents >= pRecCents ? (notationCents - pRecCents) % 1200 : (pRecCents - notationCents) % 1200;\r\n pitchMatch = difference < this._inst.tuningWindow || difference > 1200 - this._inst.tuningWindow;\r\n }\r\n } else {\r\n let guesses = pitchRecEvent.centsGuessList;\r\n let numGuesses = guesses.length;\r\n if (numGuesses > maxGuesses) {\r\n numGuesses = maxGuesses;\r\n }\r\n for (let j = 0; j < numGuesses; j++) {\r\n let pRecCents = guesses[j];\r\n if (this._inst.ignoreOctave) {\r\n if (notationCents - pRecCents < this._inst.tuningWindow && pRecCents - notationCents < this._inst.tuningWindow) {\r\n pitchMatch = true;\r\n break;\r\n }\r\n } else {\r\n let difference = notationCents >= pRecCents ? (notationCents - pRecCents) % 1200 : (pRecCents - notationCents) % 1200;\r\n if (difference < this._inst.tuningWindow || difference > 1200 - this._inst.tuningWindow) {\r\n pitchMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (pitchMatch) {\r\n matchedPitches++;\r\n if (matchedPitches >= requiredMatches) {\r\n this._markNoteCorrect(assessNote);\r\n this._hitMissHistory.push(1);\r\n if (i + 1 >= matchedPitches && this._debug) {\r\n this._debugMatchedNotes += `matched note: precTime: ${this._prEvents[i + 1 - matchedPitches].time} noteTime: $noteStartTime\r\n`;\r\n console.log(`matched note: precTime: ${this._prEvents[i + 1 - matchedPitches].time}noteTime: ${noteStartTime}`);\r\n }\r\n return;\r\n }\r\n }\r\n } else if (pitchRecEvent.time < noteStartTime - timeWindow) {\r\n this._prEvents.splice(i, 1);\r\n i--;\r\n length--;\r\n } else if (pitchRecEvent.time > noteStartTime + timeWindow) {\r\n break;\r\n }\r\n }\r\n this._markNoteIncorrect(assessNote);\r\n this._hitMissHistory.push(0);\r\n }\r\n assessNote4(noteReachedEvent, cTime) {\r\n let noteStartTime = noteReachedEvent.contextTime;\r\n let assessNote = this.getAssessNoteFromVNG(\r\n noteReachedEvent.visualNoteGroup\r\n );\r\n let noteGroup = assessNote.vng.noteGroup;\r\n let note = noteGroup.notes[0];\r\n let durationInSeconds = noteGroup.qNoteDuration * (60 / noteReachedEvent.tempo);\r\n let requiredMatches = durationInSeconds < 1 ? Math.ceil(durationInSeconds * this._inst.requiredPitchesPerSecond) : this._inst.requiredPitchesPerSecond;\r\n let matchedPitches = 0;\r\n let notationCents = note.displayCents - this._inst.transposition * 100;\r\n let twLeft;\r\n let twRight;\r\n if (durationInSeconds >= 1) {\r\n twLeft = this._inst.timeBucketLeft;\r\n twRight = this._inst.timeBucketRight;\r\n } else {\r\n twLeft = this._inst.timeBucketLeft * Math.pow(durationInSeconds, 0.4);\r\n twRight = this._inst.timeBucketRight * Math.pow(durationInSeconds, 0.4);\r\n }\r\n let allowMultipleGuesses = this._pitchRecognizer.pitchRecMethod === 4;\r\n let maxGuesses = 3;\r\n let haveSplitPointInTimeWindow = false;\r\n if (this._debug) {\r\n this._debugNotesString += `${note.pitchName} cents: $notationCents${noteStartTime} r ${requiredMatches} w ${twLeft} / ${twRight} ct ${cTime}\r\n`;\r\n }\r\n let length = this._prEvents.length;\r\n for (let i = this._prEventWindowStartIndex; i < length; i++) {\r\n let pitchRecEvent = this._prEvents[i];\r\n let logThisEvent = true;\r\n let prEventTime = pitchRecEvent.time;\r\n let pRecCents = pitchRecEvent.cents;\r\n if (logThisEvent && this._debug) {\r\n this._debugPRecString += \"\\n${pitchRecEvent.pitchName} ${pitchRecEvent.time} cents: ${pitchRecEvent.cents} ct $cTime\";\r\n }\r\n let prEventInTimeWindow = prEventTime >= noteStartTime - twLeft && prEventTime <= noteStartTime + twRight;\r\n if (pitchRecEvent.pitchSplit || pitchRecEvent.amplSplit) {\r\n haveSplitPointInTimeWindow = prEventInTimeWindow;\r\n }\r\n let rms = pitchRecEvent.rms;\r\n if (rms > this._maxAmplitudeEncountered) {\r\n this._maxAmplitudeEncountered = rms;\r\n }\r\n if (rms < this._maxAmplitudeEncountered * this._inst.minAmplPerc) {\r\n } else if (haveSplitPointInTimeWindow && prEventTime <= noteStartTime + 2 * twRight || prEventTime >= noteStartTime && prEventTime <= noteStartTime + twRight && this._lastNotationPitch === notationCents) {\r\n if (logThisEvent && this._debug) {\r\n this._debugPRecString += \" tm!\";\r\n }\r\n let pitchMatch = false;\r\n if (!allowMultipleGuesses) {\r\n if (!this._inst.ignoreOctave) {\r\n pitchMatch = notationCents - pRecCents < this._inst.tuningWindow && pRecCents - notationCents < this._inst.tuningWindow;\r\n } else {\r\n let difference = notationCents >= pRecCents ? (notationCents - pRecCents) % 1200 : (pRecCents - notationCents) % 1200;\r\n pitchMatch = difference < this._inst.tuningWindow || difference > 1200 - this._inst.tuningWindow;\r\n }\r\n } else {\r\n let guesses = pitchRecEvent.centsGuessList;\r\n let numGuesses = guesses.length;\r\n if (numGuesses > maxGuesses) {\r\n numGuesses = maxGuesses;\r\n }\r\n for (let j = 0; j < numGuesses; j++) {\r\n pRecCents = guesses[j];\r\n if (!this._inst.ignoreOctave) {\r\n if (notationCents - pRecCents < this._inst.tuningWindow && pRecCents - notationCents < this._inst.tuningWindow) {\r\n pitchMatch = true;\r\n break;\r\n }\r\n } else {\r\n let difference = notationCents >= pRecCents ? (notationCents - pRecCents) % 1200 : (pRecCents - notationCents) % 1200;\r\n if (difference < this._inst.tuningWindow || difference > 1200 - this._inst.tuningWindow) {\r\n pitchMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (pitchMatch) {\r\n matchedPitches++;\r\n if (logThisEvent && this._debug) {\r\n this._debugPRecString += \" m+ $matchedPitches\";\r\n }\r\n if (matchedPitches >= requiredMatches) {\r\n this._lastNotationPitch = notationCents;\r\n this._markNoteCorrect(assessNote);\r\n this._hitMissHistory.push(1);\r\n if (i + 1 >= matchedPitches && this._debug) {\r\n this._debugMatchedNotes += `matched note: precTime: ${this._prEvents[i + 1 - matchedPitches].time}noteTime: ${noteStartTime}\r\n`;\r\n console.log(`matched note: precTime:${this._prEvents[i + 1 - matchedPitches].time}noteTime: ${noteStartTime}`);\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n if (prEventTime < noteStartTime - twLeft) {\r\n this._prEventWindowStartIndex++;\r\n } else if (prEventTime > noteStartTime + twRight && !haveSplitPointInTimeWindow) {\r\n break;\r\n }\r\n }\r\n this._lastNotationPitch = notationCents;\r\n this._markNoteIncorrect(assessNote);\r\n this._hitMissHistory.push(0);\r\n }\r\n //DEBUG\r\n get debugPRecString() {\r\n return this._debugPRecString;\r\n }\r\n get debugNotesString() {\r\n return this._debugNotesString;\r\n }\r\n get debugPREvents() {\r\n return this._debugPREvents;\r\n }\r\n /**List of NoteReached events from ScoreViewer.*/\r\n get debugNREvents() {\r\n return this._debugNREvents;\r\n }\r\n get debugMatchedNotes() {\r\n return this._debugMatchedNotes;\r\n }\r\n /**\r\n * if true, data will be sent to debug output\r\n */\r\n get debug() {\r\n return this._debug;\r\n }\r\n set debug(value) {\r\n this._debug = value;\r\n }\r\n};\r\n\r\n// src/score_performance/assessment/RhythmAssessor.ts\r\nimport {\r\n AssessmentInstrumentUtils as AssessmentInstrumentUtils2,\r\n HitType as HitType2,\r\n KeyHitRecognizer as KeyHitRecognizer2,\r\n MediaDeviceManager as MediaDeviceManager2,\r\n MicHitRecognizer,\r\n MicManager as MicManager2\r\n} from \"audio_input\";\r\nimport { TieState as TieState2 } from \"score_data\";\r\nimport { LiveNoteInfoDO, NoteInfoDO as NoteInfoDO2, SoundLibManager as SoundLibManager3 } from \"sound_lib\";\r\nvar _RhythmAssessor = class _RhythmAssessor extends Assessor {\r\n constructor(scoreViewer, visualizer) {\r\n super(scoreViewer, visualizer);\r\n //list of beat hit events\r\n this._keyMap = /* @__PURE__ */ new Map();\r\n this._isActive = false;\r\n this._defaultWindowSize = 0.25;\r\n this._onHit = (e) => {\r\n e.time = this._scoreViewer.playbackManager.qNoteTime;\r\n switch (e.hitType) {\r\n case HitType2.rhythm_hit_start:\r\n this._handleRhythmHitStart(e);\r\n break;\r\n case HitType2.rhythm_hit_end:\r\n this._handleRhythmHitEnd(e);\r\n break;\r\n case HitType2.beat_hit:\r\n if (this.assessBeats) {\r\n this._handleBeatHit(e);\r\n }\r\n break;\r\n case HitType2.rhythm_hit:\r\n this._handleRhythmHitStart(e);\r\n break;\r\n default:\r\n console.log(\"unsupported HitType\");\r\n }\r\n };\r\n this._onScoreViewerEvent = (e) => {\r\n if (e.type === 0 /* noteReached */) {\r\n if (!this._firstNotePlayed)\r\n this._firstNotePlayed = true;\r\n this._notesReachedQue.push(e);\r\n }\r\n };\r\n this._onEnterFrame = () => {\r\n let cTime = this._slm.context.currentTime;\r\n let tempo = this._scoreViewer.playbackManager.tempo;\r\n let windowSize = this._defaultWindowSize * (tempo / _RhythmAssessor.DEFAULT_TEMPO);\r\n while (this._notesReachedIndex < this._notesReachedQue.length) {\r\n let ev = this._notesReachedQue[this._notesReachedIndex];\r\n if (ev.contextTime < cTime - windowSize) {\r\n this._notesReachedIndex++;\r\n let vng = ev.visualNoteGroup;\r\n if (vng.noteGroup.isRest || vng.noteGroup.isGrace) {\r\n continue;\r\n }\r\n let aNote = this.getAssessNoteFromVNG(vng);\r\n if (aNote != null && !aNote.matched) {\r\n this._markNoteIncorrect(aNote);\r\n }\r\n } else {\r\n break;\r\n }\r\n }\r\n if (this.assessBeats) {\r\n let qNoteTime = this._scoreViewer.playbackManager.qNoteTime;\r\n while (this._beatIndex < this._beatList.length) {\r\n let beat = this._beatList[this._beatIndex];\r\n if (beat.matched) {\r\n this._beatIndex++;\r\n } else if (beat.qNoteTime < qNoteTime - this._defaultWindowSize) {\r\n this._markBeatIncorrect(beat);\r\n this._beatIndex++;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n this._initialize();\r\n }\r\n /**starts assessment*/\r\n start() {\r\n this._scoreViewer.event.on(this._onScoreViewerEvent);\r\n this._scoreViewer.vScore.pixiAppHelper.app.ticker.add(\r\n this._onEnterFrame\r\n );\r\n this._rhythmHits = [];\r\n this._beatHits = [];\r\n this._notesReachedIndex = 0;\r\n this._notesReachedQue = [];\r\n this._firstNotePlayed = false;\r\n this._noteIndex = 0;\r\n this._beatIndex = 0;\r\n if (this.usesKeyboard) {\r\n this._keyHitRecognizer.startHitRec();\r\n this._keyHitRecognizer.event.on(this._onHit);\r\n if (this.usesLiveNotes) {\r\n this._slm.enableLiveNotePlayer();\r\n }\r\n }\r\n if (this.usesMicHit) {\r\n this._micHitRecognizer.startHitRec();\r\n this._micHitRecognizer.event.on(this._onHit);\r\n }\r\n this._isActive = true;\r\n }\r\n /**stops assessment*/\r\n stop() {\r\n if (!this._isActive) {\r\n return;\r\n }\r\n if (this.usesKeyboard) {\r\n this._keyHitRecognizer.stopHitRec();\r\n this._keyHitRecognizer.event.off(this._onHit);\r\n this._slm.disableLiveNotePlayer();\r\n }\r\n if (this.usesMicHit) {\r\n this._micHitRecognizer.stopHitRec();\r\n this._micHitRecognizer.event.off(this._onHit);\r\n }\r\n this._scoreViewer.event.off(this._onScoreViewerEvent);\r\n this._scoreViewer.vScore.pixiAppHelper.app.ticker.remove(\r\n this._onEnterFrame\r\n );\r\n }\r\n setHitMode(mode) {\r\n this._hitMode = mode;\r\n this._keyHitRecognizer = KeyHitRecognizer2.get(this._slm.context);\r\n this._keyHitRecognizer.sendStartEndEvents = !this.usesMicHit;\r\n this._keyHitRecognizer.sendBeatEvents = this.assessBeats;\r\n if (this.usesMicHit) {\r\n if (!MediaDeviceManager2.isInitialized || !MediaDeviceManager2.get().isMicReady) {\r\n throw \"You must initialize the MediaDeviceManager and get mic permission before using microphone rhythm assessment\";\r\n }\r\n let inst = this.isClapHitRec ? AssessmentInstrumentUtils2.getInstrumentByID(101) : AssessmentInstrumentUtils2.getInstrumentByID(102);\r\n let micManager = MicManager2.get(this._slm.context);\r\n this._micHitRecognizer = MicHitRecognizer.get(micManager);\r\n this._micHitRecognizer.setInstrument(inst);\r\n }\r\n }\r\n get requiresMicrophone() {\r\n return this.usesMicHit;\r\n }\r\n _initialize() {\r\n this._slm = SoundLibManager3.get();\r\n this.setHitMode(0 /* keyboard */);\r\n }\r\n _handleRhythmHitStart(e) {\r\n this._rhythmHits.push(e);\r\n let note = this._findNoteMatchForHit(e);\r\n if (note != null) {\r\n this._markNoteCorrect(note);\r\n } else {\r\n note = this._findClosestNoteForHit(e);\r\n this._addExtraNote(e.time);\r\n }\r\n if (!this.usesMicHit) {\r\n this._playNote(note.vng.noteGroup.notes[0], e.keycode);\r\n }\r\n }\r\n _handleRhythmHitEnd(e) {\r\n if (this._keyMap.get(e.keycode) != null) {\r\n this._slm.stopLiveNote(this._keyMap.get(e.keycode), 0.2);\r\n this._keyMap.delete(e.keycode);\r\n }\r\n }\r\n _handleBeatHit(e) {\r\n this._beatHits.push(e);\r\n let beat = this._findBeatMatchForHit(e);\r\n if (beat != null) {\r\n this._markBeatCorrect(beat);\r\n } else {\r\n this._addExtraBeat(e.time);\r\n }\r\n this._playBeat();\r\n }\r\n _findNoteMatchForHit(e) {\r\n let tempo = this._scoreViewer.playbackManager.tempo;\r\n let windowSize = this._defaultWindowSize * (tempo / _RhythmAssessor.DEFAULT_TEMPO);\r\n for (let i = this._noteIndex; i < this._noteList.length; i++) {\r\n let cng = this._noteList[i].vng.noteGroup;\r\n if (cng.isRest || cng.notes[0].tieState === TieState2.CONTINUE || cng.notes[0].tieState === TieState2.STOP) {\r\n continue;\r\n }\r\n let noteTime = cng.qNoteTime;\r\n if (e.time > noteTime - windowSize && e.time < noteTime + windowSize) {\r\n this._noteIndex = i + 1;\r\n return this._noteList[i];\r\n } else if (e.time <= cng.qNoteTime - windowSize) {\r\n break;\r\n }\r\n }\r\n return null;\r\n }\r\n _findBeatMatchForHit(e) {\r\n for (let i = this._beatIndex; i < this._beatList.length; i++) {\r\n let beat = this._beatList[i];\r\n if (beat.matched) {\r\n continue;\r\n }\r\n if (e.time > beat.qNoteTime - this._defaultWindowSize && e.time < beat.qNoteTime + this._defaultWindowSize) {\r\n return this._beatList[i];\r\n } else if (e.time <= beat.qNoteTime - this._defaultWindowSize) {\r\n break;\r\n }\r\n }\r\n return null;\r\n }\r\n _findClosestNoteForHit(e) {\r\n let i = this._noteIndex < this._noteList.length ? this._noteIndex : this._noteList.length - 1;\r\n let closestNote = this._noteList[i];\r\n let closestDistance = Math.abs(closestNote.vng.noteGroup.qNoteTime - e.time);\r\n let increment = closestNote.vng.noteGroup.qNoteTime > e.time ? -1 : 1;\r\n for (i; i >= 0 && i < this._noteList.length; i += increment) {\r\n let distance = Math.abs(this._noteList[i].vng.noteGroup.qNoteTime - e.time);\r\n if (distance <= closestDistance) {\r\n closestDistance = distance;\r\n closestNote = this._noteList[i];\r\n } else {\r\n break;\r\n }\r\n }\r\n return closestNote;\r\n }\r\n _playNote(note, keyCode) {\r\n if (!this._slm.hasPreset(0, 0)) {\r\n throw \"preset 0:0 not loaded!\";\r\n }\r\n let part = note.noteGroup.voice.measure.staff.partRef;\r\n let pitch = ~~(note.displayCents / 100) - part.chromaticTransposition;\r\n let ldo = new LiveNoteInfoDO(pitch, 0.5, 0, 0);\r\n this._keyMap.set(keyCode, ldo);\r\n this._slm.startLiveNote(ldo);\r\n }\r\n _playBeat() {\r\n this._slm.playNotes([NoteInfoDO2.create(38, 0, 0.5, 0.5, 0.5, 128, 0)]);\r\n }\r\n get assessBeats() {\r\n return this._hitMode === 1 /* keyboardAndBeat */ || this._hitMode === 3 /* clapAndBeat */ || this._hitMode === 5 /* voiceAndBeat */;\r\n }\r\n get usesMicHit() {\r\n return this._hitMode === 2 /* clap */ || this._hitMode === 3 /* clapAndBeat */ || this._hitMode === 4 /* voice */ || this._hitMode === 5 /* voiceAndBeat */;\r\n }\r\n get isClapHitRec() {\r\n return this._hitMode === 2 /* clap */ || this._hitMode === 3 /* clapAndBeat */;\r\n }\r\n get isVoiceHitRec() {\r\n return this._hitMode === 4 /* voice */ || this._hitMode === 5 /* voiceAndBeat */;\r\n }\r\n get usesKeyboard() {\r\n return this._hitMode === 0 /* keyboard */ || this.assessBeats;\r\n }\r\n get usesLiveNotes() {\r\n return this._hitMode == 0 /* keyboard */;\r\n }\r\n};\r\n_RhythmAssessor.DEFAULT_TEMPO = 90;\r\nvar RhythmAssessor = _RhythmAssessor;\r\nvar RhythmAssessorHitMode = /* @__PURE__ */ ((RhythmAssessorHitMode2) => {\r\n RhythmAssessorHitMode2[RhythmAssessorHitMode2[\"keyboard\"] = 0] = \"keyboard\";\r\n RhythmAssessorHitMode2[RhythmAssessorHitMode2[\"keyboardAndBeat\"] = 1] = \"keyboardAndBeat\";\r\n RhythmAssessorHitMode2[RhythmAssessorHitMode2[\"clap\"] = 2] = \"clap\";\r\n RhythmAssessorHitMode2[RhythmAssessorHitMode2[\"clapAndBeat\"] = 3] = \"clapAndBeat\";\r\n RhythmAssessorHitMode2[RhythmAssessorHitMode2[\"voice\"] = 4] = \"voice\";\r\n RhythmAssessorHitMode2[RhythmAssessorHitMode2[\"voiceAndBeat\"] = 5] = \"voiceAndBeat\";\r\n return RhythmAssessorHitMode2;\r\n})(RhythmAssessorHitMode || {});\r\n\r\n// src/score_performance/audio/SFPerformanceNoteMaker.ts\r\nimport { NoteInfoDO as NoteInfoDO3 } from \"sound_lib\";\r\nimport {\r\n Dynamic,\r\n TempoTimeStampDO as TempoTimeStampDO2,\r\n PlaybackRegionDataType,\r\n TieState as TieState3,\r\n ArticulationType\r\n} from \"score_data\";\r\nvar _SFPerformanceNoteMaker = class _SFPerformanceNoteMaker {\r\n constructor(soundLibManager) {\r\n this._slm = soundLibManager;\r\n }\r\n /**\r\n * creates playback notes for all notes in the passed in list of Parts\r\n * @param parts the Parts that contain the notes you want played\r\n * @param tempoRatio ratio of the tempo to the default tempo of the piece\r\n * @param playSoundFontNotes if true, notes will be played\r\n * @param metronomeVolume from 0 to 1.0\r\n * @param startNG NoteGroup with the qNoteTime where playback should begin\r\n * @param endQNoteTime the time when playback should stop. Notes that start\r\n * at this time will not be played.\r\n * @param startRepeatPass - Each time an element is encountered, the repeat\r\n * pass increments. 1 is the first pass.\r\n * @param endRepeatPass - Each time an element is encountered, the repeat\r\n * pass increments. 1 is the first pass. If left null, the final pass for\r\n * the endQNT will be used (matching end of song if endQNT is also null).\r\n * @param numCountoffBeats number of countoff beats that should be played\r\n * @param playRepeats if false, repeats will be ignored, creating a single\r\n * playback region from startNG to endQNoteTime\r\n */\r\n addNotesInParts(score, parts, {\r\n tempoRatio = 1,\r\n playSoundFontNotes = true,\r\n metronomeVolume = 0,\r\n startNG = null,\r\n endQNoteTime = null,\r\n startRepeatPass = 1,\r\n endRepeatPass = null,\r\n numCountoffBeats = 0,\r\n playRepeats = true\r\n }) {\r\n this._score = score;\r\n this._slm.clearSequence();\r\n this._tempoRatio = tempoRatio;\r\n let measures = parts[0].staves[0].measures;\r\n if (startNG == null) {\r\n startNG = measures[0].voices[0].noteGroups[0];\r\n }\r\n let startQNoteTime = this._getNoteOrStackTime(startNG);\r\n if (endQNoteTime == null) {\r\n endQNoteTime = measures[measures.length - 1].stack.endTime;\r\n }\r\n let regions = this._score.playbackInfo.getPlaybackRegions(\r\n startQNoteTime,\r\n endQNoteTime,\r\n startRepeatPass,\r\n endRepeatPass,\r\n playRepeats\r\n );\r\n let startTempo = regions[0].startTempo;\r\n let realStartQNoteTime = this._calculateQNoteStartTime(\r\n startQNoteTime,\r\n startNG.voice.measure,\r\n startTempo * this._tempoRatio,\r\n numCountoffBeats\r\n );\r\n this._createTempoTimeStamps(regions, realStartQNoteTime);\r\n this._createPlaybackNotes(parts, playSoundFontNotes, regions);\r\n this._createMetronomeBeats(metronomeVolume, regions);\r\n this._createCountoffClicks(\r\n numCountoffBeats,\r\n startTempo,\r\n realStartQNoteTime\r\n );\r\n }\r\n /**returns either the qNoteTime of the NoteGroup or the Stack it lies in,\r\n * whichever is greater (protection against grace notes)*/\r\n _getNoteOrStackTime(ng) {\r\n let stackTime = ng.voice.measure.stack.startTime;\r\n return ng.qNoteTime > stackTime ? ng.qNoteTime : stackTime;\r\n }\r\n _calculateQNoteStartTime(startQNoteTime, startMeasure, actualCountoffTempo, numCountoffBeats) {\r\n let beatType = startMeasure.beatType;\r\n if (beatType % 8 === 0 && actualCountoffTempo >= _SFPerformanceNoteMaker.COMPOUND_METER_TEMPO_CUTOFF) {\r\n this._qNotesPerCountoffBeat = 3 * (4 / beatType);\r\n } else {\r\n this._qNotesPerCountoffBeat = 4 / beatType;\r\n }\r\n if (!startMeasure.stack.isPickup) {\r\n this._countoffDuration = numCountoffBeats * this._qNotesPerCountoffBeat * 60 / actualCountoffTempo;\r\n startQNoteTime -= numCountoffBeats * this._qNotesPerCountoffBeat;\r\n return startQNoteTime;\r\n }\r\n let barEndTime = startMeasure.stack.endTime;\r\n let distToBar = barEndTime - startQNoteTime;\r\n let distToNearestBeat = distToBar;\r\n while (distToNearestBeat >= this._qNotesPerCountoffBeat) {\r\n distToNearestBeat -= this._qNotesPerCountoffBeat;\r\n }\r\n let adjustedCountoffBeats = numCountoffBeats - distToNearestBeat;\r\n this._countoffDuration = adjustedCountoffBeats * this._qNotesPerCountoffBeat * 60 / actualCountoffTempo;\r\n startQNoteTime -= adjustedCountoffBeats * this._qNotesPerCountoffBeat;\r\n return startQNoteTime;\r\n }\r\n _createTempoTimeStamps(regions, realStartQNoteTime) {\r\n let startTime = regions[0].startTime;\r\n this._tempoTimeStamps = this._score.playbackInfo.createTempoTimeStamps(\r\n regions\r\n );\r\n this._tempoTimeStamps.forEach((t) => {\r\n t.time = (t.time - startTime) / this._tempoRatio + this._countoffDuration;\r\n t.msTime = ~~(t.time * 1e3);\r\n t.tempo *= this._tempoRatio;\r\n });\r\n let countoffTimeStamp = new TempoTimeStampDO2(\r\n 0,\r\n 0,\r\n realStartQNoteTime,\r\n regions[0].startTempo * this._tempoRatio\r\n );\r\n countoffTimeStamp.qNoteEndTime = this._tempoTimeStamps[0].qNoteTime;\r\n countoffTimeStamp.nextSampleTimeStampDO = this._tempoTimeStamps[0];\r\n this._tempoTimeStamps.splice(0, 0, countoffTimeStamp);\r\n }\r\n _createPlaybackNotes(parts, playSoundFontNotes, regions) {\r\n let playStartTime = regions[0].startTime;\r\n let playAllParts = parts.length === this._score.parts.length;\r\n let partDynamics = /* @__PURE__ */ new Map();\r\n for (let reg of regions) {\r\n for (let i = 0; i < reg.data.length; i++) {\r\n let data = reg.data[i];\r\n if (data.measureAttachment != null) {\r\n let att = data.measureAttachment;\r\n if (att instanceof Dynamic)\r\n partDynamics.set(att.measure.staff.partRef, att.volume);\r\n }\r\n if (data.type !== PlaybackRegionDataType.NOTE_GROUP)\r\n continue;\r\n let part = data.noteGroup.voice.measure.staff.partRef;\r\n let partIndex = parts.indexOf(part);\r\n if (!playAllParts && partIndex === -1)\r\n continue;\r\n if (part.midiChannel % 16 !== 10) {\r\n this._slm.setPreset(0, part.midiPreset);\r\n } else {\r\n this._slm.setPreset(128, 0);\r\n }\r\n let ng = data.noteGroup;\r\n let notes = ng.notes;\r\n let numNotes = notes.length;\r\n let startTime = (data.time - playStartTime) / this._tempoRatio + this._countoffDuration;\r\n if (startTime < 0) {\r\n startTime = 0;\r\n }\r\n ng.playbackStartTime = startTime;\r\n ng.playbackTempo = data.tempo * this._tempoRatio;\r\n if (part.muted || !playSoundFontNotes) {\r\n continue;\r\n }\r\n let ngQnDur = ng.qNoteTime + ng.qNoteDuration <= reg.qNoteEndTime ? ng.qNoteDuration : reg.qNoteEndTime - ng.qNoteTime;\r\n let duration = !ng.isGrace ? ngQnDur * (60 / (data.tempo * this._tempoRatio)) : 0.25;\r\n let tieDuration = 0;\r\n for (let j = 0; j < numNotes; j++) {\r\n let note = notes[j];\r\n if (note.tieState !== TieState3.NONE) {\r\n if (note.tieState === TieState3.START) {\r\n let tieEndFound = false;\r\n tieDuration = 0;\r\n let nextNG = ng.next;\r\n while (!tieEndFound && nextNG != null && nextNG.qNoteTime < reg.qNoteEndTime) {\r\n let nextNote = nextNG.notes.find((n) => n.displayCents === note.displayCents);\r\n if (nextNote == null) {\r\n break;\r\n }\r\n let nextNgData;\r\n for (let j2 = i + 1; j2 < reg.data.length; j2++) {\r\n if ((nextNgData = reg.data[j2]).noteGroup == nextNG) {\r\n break;\r\n }\r\n }\r\n if (nextNote.tieState === TieState3.STOP) {\r\n tieEndFound = true;\r\n tieDuration += nextNG.qNoteDuration * (60 / (nextNgData.tempo * this._tempoRatio));\r\n break;\r\n } else if (nextNote.tieState === TieState3.CONTINUE) {\r\n tieDuration += nextNG.qNoteDuration * (60 / (nextNgData.tempo * this._tempoRatio));\r\n }\r\n nextNG = nextNG.next;\r\n }\r\n } else {\r\n continue;\r\n }\r\n }\r\n let noteVolume = (partDynamics.get(part) ?? 0.4) * part.volume;\r\n if (ng.articulations != null) {\r\n for (let art of ng.articulations) {\r\n if (art.type === ArticulationType.ACCENT) {\r\n noteVolume += 0.2;\r\n if (noteVolume > 1)\r\n noteVolume = 1;\r\n } else if (art.type === ArticulationType.STACCATO) {\r\n duration *= 0.75;\r\n }\r\n }\r\n }\r\n let pitch;\r\n if (note.playbackCents <= 0) {\r\n pitch = ~~(note.displayCents / 100) - part.chromaticTransposition + 12 * part.playbackOctaveDelta;\r\n } else {\r\n pitch = ~~(note.playbackCents / 100);\r\n }\r\n let ndo = NoteInfoDO3.create(\r\n pitch,\r\n startTime,\r\n duration + tieDuration,\r\n noteVolume,\r\n part.pan\r\n );\r\n ndo.trackId = ng.trackId != null ? ng.trackId : partIndex + 1;\r\n this._slm.addNoteToSequence(ndo);\r\n }\r\n }\r\n }\r\n }\r\n _createMetronomeBeats(metronomeVolume, regions) {\r\n this._beats = [];\r\n this._slm.setPreset(128, 0);\r\n let playStartTime = regions[0].startTime;\r\n let useSubBeat = false;\r\n let cStack;\r\n for (let region of regions) {\r\n for (let data of region.data) {\r\n if (data.stack != null) {\r\n cStack = data.stack;\r\n useSubBeat = cStack.measures[0].beatType % 8 === 0 && data.tempo * this._tempoRatio < _SFPerformanceNoteMaker.COMPOUND_METER_TEMPO_CUTOFF;\r\n }\r\n if (data.type === PlaybackRegionDataType.BEAT || useSubBeat && data.type === PlaybackRegionDataType.SUB_BEAT) {\r\n this._beats.push(data.qNoteTime);\r\n let beatTime = (data.time - playStartTime) / this._tempoRatio + this._countoffDuration;\r\n let duration = 60 / data.tempo * data.qNoteDuration / this._tempoRatio;\r\n let metronomeNote;\r\n let actualMetVolume;\r\n if (data.qNoteTime !== cStack.startTime) {\r\n metronomeNote = 37;\r\n actualMetVolume = metronomeVolume * 0.8;\r\n } else {\r\n metronomeNote = 37;\r\n actualMetVolume = metronomeVolume;\r\n }\r\n let ndo = NoteInfoDO3.create(\r\n metronomeNote,\r\n beatTime,\r\n duration,\r\n actualMetVolume,\r\n 0.5\r\n );\r\n ndo.trackId = 0;\r\n this._slm.addNoteToSequence(ndo);\r\n }\r\n }\r\n }\r\n }\r\n _createCountoffClicks(numCountoffBeats, startNGMarkerTempo, startQNoteTime) {\r\n this._slm.setPreset(128, 0);\r\n let remainingClicks = numCountoffBeats;\r\n let clickPos = 0;\r\n let cSecondsPerQNote = 1 / (startNGMarkerTempo * this._tempoRatio / 60);\r\n let clickDuration = this._qNotesPerCountoffBeat * cSecondsPerQNote;\r\n this._countoffBeats = [];\r\n let qNoteTime = startQNoteTime;\r\n while (remainingClicks > 0) {\r\n let ndo = NoteInfoDO3.create(37, clickPos, clickDuration, 0.8, 0.5);\r\n ndo.trackId = 0;\r\n this._slm.addNoteToSequence(ndo);\r\n clickPos += clickDuration;\r\n remainingClicks -= 1;\r\n this._countoffBeats.push(qNoteTime);\r\n qNoteTime += this._qNotesPerCountoffBeat;\r\n }\r\n }\r\n get sampleTimeStamps() {\r\n return this._tempoTimeStamps.slice();\r\n }\r\n /**\r\n * gets the qNote positions of the beats in the playback region (from \r\n * startNG to endNG)\r\n */\r\n get beatQNotePositions() {\r\n return this._beats;\r\n }\r\n /**\r\n * gets the qNote positions of the beats in the countoff\r\n */\r\n get countoffBeatQNotePositions() {\r\n return this._countoffBeats;\r\n }\r\n /**the duration of the countoff in seconds*/\r\n get countoffDuration() {\r\n return this._countoffDuration;\r\n }\r\n};\r\n//at this tempo, beats and clicks will be sent once every 3 in compound\r\n//meters instead of each beat\r\n_SFPerformanceNoteMaker.COMPOUND_METER_TEMPO_CUTOFF = 80;\r\nvar SFPerformanceNoteMaker = _SFPerformanceNoteMaker;\r\n\r\n// src/score_performance/drivers/sf_loop_driver/SFLoopDriver.ts\r\nimport {\r\n AudioRecorder2,\r\n MediaDeviceManager as MediaDeviceManager3,\r\n MicManager as MicManager3\r\n} from \"audio_input\";\r\nimport { DestinationAudioComponent } from \"audio_output\";\r\nimport { AudioLooper } from \"audio_sequencer\";\r\nimport {\r\n MusicXmlParser2,\r\n ScoreFormatter\r\n} from \"score_data\";\r\nimport { BitmapMusicRenderer, MusicTextures as MusicTextures2 } from \"score_render\";\r\nimport { SoundLibEventType, SoundLibManager as SoundLibManager5 } from \"sound_lib\";\r\n\r\n// src/score_performance/drivers/SFPlaybackDO.ts\r\nvar SFPlaybackDO = class _SFPlaybackDO {\r\n constructor() {\r\n /**The tempo ratio, with 1.0 being default.*/\r\n this.tempoRatio = 1;\r\n /**If true, SoundFonts will be used to play score notes*/\r\n this.playSoundFontNotes = true;\r\n /**Volume for the metronome - should be between 0 and 1.0*/\r\n this.metronomeVolume = 1;\r\n /**The desired length of the countoff in seconds. If countoffBeats is\r\n * also defined, it will override this. The actual duration of the countoff\r\n * will be calculated and reported via countoffDuration.*/\r\n this.countoffSeconds = 2;\r\n /**if true, repeats in the score are honored*/\r\n this.playRepeats = true;\r\n /**The [AssessmentType] used for this playback session*/\r\n this.assessmentType = 0 /* none */;\r\n /**if true, mic input will be recorded*/\r\n this.record = false;\r\n /**if true, an [AudioSequencer] will be used to play any audio files added\r\n * via addSequencerSounds()*/\r\n this.playAudio = false;\r\n }\r\n /**creates a new [SFPlaybackDO] by copying relevant settings from an\r\n * existing source [SFPlaybackDO] object.*/\r\n static fromPDO(source) {\r\n let pdo = new _SFPlaybackDO();\r\n pdo.tempoRatio = source.tempoRatio;\r\n pdo.playSoundFontNotes = source.playSoundFontNotes;\r\n pdo.metronomeVolume = source.metronomeVolume;\r\n pdo.startNG = source.startNG;\r\n pdo.endQNoteTime = source.endQNoteTime;\r\n pdo.countoffBeats = source.countoffBeats;\r\n pdo.countoffSeconds = source.countoffSeconds;\r\n pdo.playRepeats = source.playRepeats;\r\n pdo.assessmentType = source.assessmentType;\r\n pdo.instDO = source.instDO;\r\n pdo.record = source.record;\r\n pdo.playAudio = source.playAudio;\r\n pdo._countoffDuration = source._countoffDuration;\r\n pdo._startNoteTimeOffset = source._startNoteTimeOffset;\r\n pdo._beatQNotePositions = source._beatQNotePositions.slice(0);\r\n pdo._countoffBeatQNotePositions = source._countoffBeatQNotePositions;\r\n return pdo;\r\n }\r\n /**Calculated duration of the countoff, in seconds.*/\r\n get countoffDuration() {\r\n return this._countoffDuration;\r\n }\r\n /**Determines whether playback requires the microphone for recording or\r\n * assessment*/\r\n get requiresMic() {\r\n return this.record || this.assessmentType === 3 /* pitch */ || this.assessmentType === 2 /* rhythmClap */;\r\n }\r\n};\r\n\r\n// src/score_performance/drivers/sf_loop_driver/SFLoopDriver.ts\r\nvar SFLoopDriver = class _SFLoopDriver {\r\n constructor() {\r\n }\r\n /**creates a new [SFLoopDriver]\r\n * @param context - an [AudioContext] instance\r\n * @param config - [SFLoopDriverConfig] object with path settings for music\r\n * symbols and SoundFonts. See class for requirements info.\r\n * @param instrument the default instrument - if null, the first instrument\r\n * in [InstrumentUtils] will be used.\r\n * @returns a Promise that completes with the new [SFLoopDriver] instance.*/\r\n static async create(pixiApp, context, config) {\r\n let sfd = new _SFLoopDriver();\r\n sfd._pah = pixiApp;\r\n sfd._context = context;\r\n if (sfd._context == null)\r\n throw \"AudioContext not set\";\r\n await MusicTextures2.createTextures(config.initialPixelsPerSpace);\r\n if (!MediaDeviceManager3.isInitialized) {\r\n let deviceManager = MediaDeviceManager3.get();\r\n await deviceManager.init();\r\n }\r\n sfd._micManager = MicManager3.get(sfd._context);\r\n sfd.setInstrument(config.initialInstrument);\r\n sfd._outputComponent = config.outputComponent ?? new DestinationAudioComponent(context);\r\n sfd._slm = SoundLibManager5.get(\r\n context,\r\n config.soundLibType,\r\n sfd._outputComponent\r\n );\r\n if (config.indexedDbName != null) {\r\n sfd._slm.dbName = config.indexedDbName;\r\n }\r\n await sfd._slm.loadSoundMap(config.soundMapPath);\r\n await sfd._slm.loadPresets(null);\r\n sfd._performanceNoteMaker = new SFPerformanceNoteMaker(sfd._slm);\r\n sfd._renderer = new BitmapMusicRenderer(pixiApp);\r\n if (config.useAudioLooper) {\r\n sfd._audioLooper = new AudioLooper(context);\r\n sfd._audioLooper.connect(sfd._outputComponent);\r\n }\r\n sfd._audioRecorder2 = new AudioRecorder2(sfd._micManager);\r\n return sfd;\r\n }\r\n setInstrument(instDO) {\r\n if (instDO != null) {\r\n this._instrument = instDO;\r\n }\r\n }\r\n /**attempts to enable microphone, if one is available. User is prompted\r\n * to give permission the first session.*/\r\n async enableMicrophone(micOptions = null, videoOptions = null) {\r\n let deviceManager = MediaDeviceManager3.get();\r\n let useCamera = videoOptions != null;\r\n await deviceManager.getPermissions(true, useCamera);\r\n await deviceManager.getDevices();\r\n if (deviceManager.currentMic == null) {\r\n deviceManager.setMic();\r\n }\r\n if (useCamera && deviceManager.currentCamera == null) {\r\n deviceManager.setCamera();\r\n }\r\n await this._micManager.initMicMediaStream(micOptions, videoOptions);\r\n }\r\n async parseScore(musicXmlString, overrideScoreProps = null) {\r\n let parser = new MusicXmlParser2();\r\n if (overrideScoreProps != null) {\r\n this._score = await parser.parseXML(\r\n musicXmlString,\r\n true,\r\n true,\r\n overrideScoreProps\r\n );\r\n } else {\r\n this._score = await parser.parseXML(musicXmlString, true, false);\r\n }\r\n return this._score;\r\n }\r\n renderNotation(score, width, height, parts = null) {\r\n this._score = score;\r\n this._score.getSystems().forEach((s) => s.indent = 0);\r\n return this._renderMusic(width, height, parts);\r\n }\r\n resetNotation(width = 0, height = 0, parts = null) {\r\n if (width === 0)\r\n width = this._scoreViewerWidth;\r\n if (height === 0)\r\n height = this._scoreViewerHeight;\r\n if (this._viewer != null) {\r\n this._viewer.vScore.prepareForRemoval();\r\n }\r\n if (parts == null)\r\n parts = this._displayedParts;\r\n this._renderMusic(width, height, parts);\r\n }\r\n /**Loads and renders a score all in one action*/\r\n async loadScore(musicXmlString, pageWidth, pageHeight, {\r\n properties = null,\r\n allowMultipleSystems = true\r\n }) {\r\n if (this._slm.isPlaying && this._soundLibEventCallback != null) {\r\n this._stopNotationPlayback(false);\r\n }\r\n let parser = new MusicXmlParser2();\r\n this._score = await parser.parseXML(\r\n musicXmlString,\r\n true,\r\n true,\r\n properties\r\n );\r\n this._score.setPageSize(\r\n pageWidth,\r\n this._score.scoreProperties.pageHeight\r\n );\r\n let formatter = new ScoreFormatter(this._score);\r\n formatter.setPartList([this._score.parts[0]]);\r\n formatter.formatScore2(allowMultipleSystems);\r\n this._vScore = this._renderer.renderScore(\r\n this._score,\r\n [this._score.parts[0]]\r\n );\r\n if (this._viewer != null) {\r\n this._viewer.setScore(this._vScore);\r\n this._viewer.setWidthAndHeight(pageWidth, pageHeight);\r\n } else {\r\n this._viewer = new ScoreViewer3(\r\n this._pah,\r\n this._vScore,\r\n pageWidth,\r\n pageHeight,\r\n this._context\r\n );\r\n }\r\n return this._viewer;\r\n }\r\n unloadScore() {\r\n if (this._assessor != null) {\r\n this._assessor.prepareForRemoval();\r\n this._assessor = null;\r\n }\r\n if (this._viewer != null) {\r\n this._viewer.prepareForRemoval();\r\n this._viewer.parent?.removeChild(this._viewer);\r\n this._viewer = null;\r\n }\r\n this._vScore = null;\r\n this._score = null;\r\n }\r\n /**adds a [LoopTrack] to the [AudioLooper]. If the looper is already\r\n * playing, the track is added to the playback.*/\r\n addLoopTrack(track) {\r\n if (this._audioLooper == null) {\r\n throw \"AudioLooper must be enabled in SfLoopDriverConfig\";\r\n }\r\n this._audioLooper.addTrack(track);\r\n }\r\n /**removes a [LoopTrack] from the [AudioLooper]*/\r\n removeLoopTrack(track) {\r\n this._audioLooper.removeTrack(track);\r\n }\r\n /**removes all [LoopTrack]s from the [AudioLooper]*/\r\n removeAllLoopTracks() {\r\n this._audioLooper.removeAllTracks();\r\n }\r\n /**adds [NoteInfoDO] notes to the [SoundLibManager] for playback and returns\r\n * the id of the note set that is created for them.*/\r\n addLoopNotes(notes) {\r\n this._slm.clearSequence();\r\n for (let note of notes) {\r\n this._slm.addNoteToSequence(note);\r\n }\r\n return this._slm.prepareSequencedPlayback(true);\r\n }\r\n /**removes a note set from the player*/\r\n removeLoopNotes(notesetId) {\r\n this._slm.removeNoteSet(notesetId);\r\n }\r\n /**removes all note sets from the player*/\r\n removeAllLoopNotes() {\r\n this._slm.clearNotes();\r\n }\r\n /**starts loop playback for the passed in [notes]. If the [AudioLooper]\r\n * was enabled in the [SFLoopDriverConfig], it will start playing as well.\r\n * Set the [loopDuration] to the full duration of the loop, in seconds.*/\r\n startLoopPlayback(loopDuration, { startTime = null }) {\r\n if (!this._slm.isPlaying) {\r\n this._slm.play(startTime ?? 0);\r\n } else if (startTime != null) {\r\n let delta = startTime - this._slm.currentPlayTime;\r\n this._slm.shiftPlayerTime(delta);\r\n }\r\n if (this._audioLooper != null) {\r\n this._audioLooper.play(0, loopDuration, {\r\n overridePlayStartTime: this._slm.playStartTime\r\n });\r\n }\r\n }\r\n adjustLoopTime(timeDelta) {\r\n this._audioLooper.stop();\r\n this._slm.shiftPlayerTime(timeDelta);\r\n this._audioLooper.play(0, this._audioLooper.masterLoopDuration, {\r\n overridePlayStartTime: this._slm.playStartTime\r\n });\r\n }\r\n stop() {\r\n if (this._slm.isPlaying) {\r\n this._slm.stop();\r\n this._audioLooper?.stop();\r\n this._stopNotationPlayback(false);\r\n }\r\n }\r\n startFreetimeAssessment(tempo) {\r\n if (this._sfPlayerNoteSetId != null) {\r\n return;\r\n }\r\n let ft = new FreeTimeRhythmAssessor(this._viewer);\r\n ft.tempo = tempo;\r\n this._assessor = ft;\r\n this._assessor.start();\r\n }\r\n /**Generates [NoteInfoDO]s for the notation, adding them to the\r\n * [SoundManager]s note builder sequence. To play these notes,\r\n * [SoundLibManager.prepareSequencedPlayback] must be called. If you call\r\n * [playNotation], this is handled for you.*/\r\n prepareNotationPlayback({\r\n tempoRatio = 1,\r\n playSoundFontNotes = true,\r\n metronomeVolume = 1,\r\n startNG = null,\r\n endQNoteTime = null,\r\n countoffBeats = null,\r\n countoffSeconds = null,\r\n assessmentType = 0 /* none */,\r\n instDO = null,\r\n record = false\r\n }) {\r\n if (countoffBeats == null) {\r\n if (countoffSeconds != null) {\r\n countoffBeats = this._getCountoffBeatsForSeconds(\r\n countoffSeconds,\r\n startNG,\r\n tempoRatio\r\n );\r\n } else {\r\n countoffBeats = 0;\r\n }\r\n }\r\n this._performanceNoteMaker.addNotesInParts(\r\n this._score,\r\n this._score.parts,\r\n {\r\n tempoRatio,\r\n playSoundFontNotes,\r\n metronomeVolume,\r\n startNG,\r\n endQNoteTime,\r\n startRepeatPass: 1,\r\n endRepeatPass: null,\r\n numCountoffBeats: countoffBeats,\r\n playRepeats: false\r\n }\r\n );\r\n let pdo = new SFPlaybackDO();\r\n pdo._countoffDuration = this._performanceNoteMaker.countoffDuration;\r\n pdo._beatQNotePositions = this._performanceNoteMaker.beatQNotePositions;\r\n pdo._countoffBeatQNotePositions = this._performanceNoteMaker.countoffBeatQNotePositions;\r\n pdo.tempoRatio = tempoRatio;\r\n pdo.playSoundFontNotes = playSoundFontNotes;\r\n pdo.metronomeVolume = metronomeVolume;\r\n pdo.startNG = startNG;\r\n pdo.endQNoteTime = endQNoteTime;\r\n pdo.countoffBeats = countoffBeats;\r\n pdo.assessmentType = assessmentType;\r\n pdo.record = record;\r\n if (instDO != null) {\r\n this.setInstrument(instDO);\r\n }\r\n this._prepareAssessment(assessmentType);\r\n return pdo;\r\n }\r\n /**adds notation [PerformanceNoteDO]s as a set to the [SFPlayer]. The\r\n * [startTime] parameter is used for delaying the start of playback,\r\n * typically to line up with a loop. The time is in terms of seconds from\r\n * the start of [SoundLibManager] playback. Use \r\n * [SoundLibManager.playStartTime] to calculate this. [startLoopPlayback] \r\n * must be called before using this. The optional [completeCallback] will be\r\n * called upon playback completion. If a value for [extraRecordTime] is \r\n * passed in, this calls to stop notation playback and recording and sending\r\n * the [completeCallback] will be delayed by this amount (in seconds).*/\r\n playNotation(pdo, {\r\n startTime = null,\r\n completeCallback = null,\r\n extraRecordTime = null\r\n }) {\r\n if (!this._slm.isPlaying)\r\n throw \"must call startLoopPlayback() first\";\r\n if (this._soundLibEventCallback != null) {\r\n this._stopNotationPlayback(false);\r\n }\r\n if (startTime == null) {\r\n startTime = this._slm.currentPlayTime;\r\n }\r\n this._sfPlayerNoteSetId = this._slm.prepareSequencedPlayback(\r\n false,\r\n startTime\r\n );\r\n this._notationPlaybackStartTime = this._context.currentTime;\r\n let startDelay = startTime - this._slm.currentPlayTime;\r\n if (startDelay < 0)\r\n startDelay = 0;\r\n this._viewer.play(\r\n this._performanceNoteMaker.sampleTimeStamps,\r\n pdo._beatQNotePositions,\r\n pdo._countoffBeatQNotePositions,\r\n startDelay,\r\n pdo.startNG,\r\n pdo.endQNoteTime\r\n );\r\n if (pdo.record) {\r\n this._audioRecorder2.record();\r\n }\r\n if (this._assessor != null) {\r\n this._assessor.start();\r\n if (this._assessor.requiresMicrophone) {\r\n this._micManager.startCapture();\r\n }\r\n }\r\n this._slm.soundLibEvent.on(\r\n this._soundLibEventCallback = (e) => {\r\n if (e.type === SoundLibEventType.noteSetComplete && this._slm.isPlaying && e.noteSetId === this._sfPlayerNoteSetId) {\r\n if (extraRecordTime != null) {\r\n setTimeout(() => {\r\n this._stopNotationPlayback(true);\r\n if (completeCallback != null) {\r\n completeCallback();\r\n }\r\n }, extraRecordTime * 1e3);\r\n } else {\r\n this._stopNotationPlayback(true);\r\n if (completeCallback != null) {\r\n completeCallback();\r\n }\r\n }\r\n }\r\n }\r\n );\r\n }\r\n /**stops notation playback*/\r\n stopNotation() {\r\n this._stopNotationPlayback(false);\r\n }\r\n clearAssessmentVisuals() {\r\n if (this._assessor != null) {\r\n this._assessor.clearAssessmentVisuals();\r\n }\r\n }\r\n /**gets recording as an html.Blob object that can be saved to a file.*/\r\n getRecordingBlobAR2() {\r\n return this._audioRecorder2.getAudioBlob();\r\n }\r\n /**returns the AudioContext time, in seconds, when recording starts.*/\r\n get recordStartTime() {\r\n return this._audioRecorder2.recordStartTime;\r\n }\r\n /**returns the AudioContext time, in seconds, when recording stops.*/\r\n get recordStopTime() {\r\n return this._audioRecorder2.recordStopTime;\r\n }\r\n /**returns the AudioContext time, in seconds, when the notation notes\r\n * are sent to the [SoundLibManager] for playback via [playNotation]. This \r\n * does not account for any delayed start that may be passed to \r\n * [playNotation] via the startTime parameter.*/\r\n get notationPlaybackStartTime() {\r\n return this._notationPlaybackStartTime;\r\n }\r\n /**Gets an AudioElement with the recorded audio. This uses AudioRecorder2.*/\r\n getAudioElementAR2() {\r\n return this._audioRecorder2.getAudioElement();\r\n }\r\n _stopNotationPlayback(completePerformance) {\r\n if (this._viewer != null) {\r\n this._viewer.stop();\r\n }\r\n if (this._assessor != null) {\r\n this._assessor.stop();\r\n if (this._assessor.requiresMicrophone) {\r\n this._micManager.stopCapture();\r\n }\r\n if (completePerformance) {\r\n }\r\n }\r\n if (this._audioRecorder2.isRecording) {\r\n this._audioRecorder2.stop();\r\n }\r\n if (this._soundLibEventCallback != null) {\r\n this._slm.soundLibEvent.off(this._soundLibEventCallback);\r\n this._slm.removeNoteSet(this._sfPlayerNoteSetId);\r\n this._soundLibEventCallback = null;\r\n this._sfPlayerNoteSetId = null;\r\n }\r\n }\r\n _prepareAssessment(assessmentType) {\r\n if (assessmentType === 3 /* pitch */) {\r\n this._assessor = new PitchAssessor(this._viewer);\r\n this._assessor.setInstrument(this._instrument);\r\n } else if (assessmentType === 1 /* rhythmKeyboard */) {\r\n this._assessor = new RhythmAssessor(this._viewer);\r\n } else {\r\n this._assessor = null;\r\n }\r\n }\r\n _renderMusic(width, height, parts) {\r\n this._markMeasuresForRendering();\r\n this._score.setPageSize(width, this._score.scoreProperties.pageHeight);\r\n this._formatMusic(parts);\r\n let vScore = this._renderer.renderScore(this._score, parts);\r\n this._displayedParts = parts;\r\n this._scoreViewerWidth = width;\r\n this._scoreViewerHeight = height;\r\n if (this._viewer != null) {\r\n this._viewer.setScore(vScore);\r\n this._viewer.setWidthAndHeight(width, height);\r\n } else {\r\n this._viewer = new ScoreViewer3(\r\n this._pah,\r\n vScore,\r\n width,\r\n height,\r\n this._context\r\n );\r\n }\r\n return this._viewer;\r\n }\r\n _markMeasuresForRendering() {\r\n let stacks = this._score.getMeasureStacks();\r\n for (let stack of stacks) {\r\n for (let measure of stack.measures) {\r\n measure.notesNeedRendering = true;\r\n }\r\n }\r\n }\r\n _formatMusic(parts) {\r\n let formatter = new ScoreFormatter(this._score);\r\n formatter.setPartList(parts);\r\n formatter.formatScore2(true, 0);\r\n }\r\n _getCountoffBeatsForSeconds(seconds, startNG, tempoRatio) {\r\n if (startNG == null) {\r\n startNG = this._score.parts[0].staves[0].measures[0].voices[0].noteGroups[0];\r\n }\r\n let stack = startNG.voice.measure.stack;\r\n let tm;\r\n let tmList = stack.tempoMarkers;\r\n if (tmList != null) {\r\n for (let i = tmList.length - 1; i >= 0; i--) {\r\n if (tmList[i].qNoteTime <= startNG.qNoteTime) {\r\n tm = tmList[i];\r\n }\r\n }\r\n } else {\r\n tm = stack.getInheritedTempoMarker();\r\n }\r\n let tempo = tm != null ? tm.tempo : 90;\r\n let actualTempo = tempo * tempoRatio;\r\n let startMeasure = startNG.voice.measure;\r\n let beatType = startMeasure.beatType;\r\n let qNotesPerMeasure = startMeasure.numBeats * 4 / beatType;\r\n let secondsPerMeasure = qNotesPerMeasure * 60 / actualTempo;\r\n let numCountoffMeasures = Math.ceil(seconds / secondsPerMeasure);\r\n seconds = numCountoffMeasures * secondsPerMeasure;\r\n let qNotesPerCountoffBeat;\r\n if (beatType % 8 === 0 && actualTempo >= SFPerformanceNoteMaker.COMPOUND_METER_TEMPO_CUTOFF) {\r\n qNotesPerCountoffBeat = 3 * (4 / beatType);\r\n } else {\r\n qNotesPerCountoffBeat = 4 / beatType;\r\n }\r\n let numBeats = seconds / (qNotesPerCountoffBeat * (60 / actualTempo));\r\n return Math.round(numBeats);\r\n }\r\n get pixiAppHelper() {\r\n return this._pah;\r\n }\r\n get soundLibManager() {\r\n return this._slm;\r\n }\r\n get audioLooper() {\r\n return this._audioLooper;\r\n }\r\n get isPlaying() {\r\n return this._slm.isPlaying;\r\n }\r\n get assessor() {\r\n return this._assessor;\r\n }\r\n /**The audio output from the [SFScoreDriver] will be routed through the\r\n * [outputComponent]. This defaults to an instance of [MasterAudioComponent]\r\n * and can be changed via the [SFLoopDriverConfig] during initialization.*/\r\n get outputComponent() {\r\n return this._outputComponent;\r\n }\r\n get score() {\r\n return this._score;\r\n }\r\n get scoreViewer() {\r\n return this._viewer;\r\n }\r\n get audioContext() {\r\n return this._context;\r\n }\r\n /**The MicrophoneManager instance*/\r\n get micManager() {\r\n return this._micManager;\r\n }\r\n};\r\n\r\n// src/score_performance/drivers/sf_loop_driver/SFLoopDriverConfig.ts\r\nimport { ScoreProperties as ScoreProperties3, InstrumentUtils } from \"score_data\";\r\nvar SFLoopDriverConfig = class {\r\n constructor(soundLibType, soundMapPath) {\r\n /**The initial scaling for the score. Used for initial texture generation.\r\n * If you pass in a [ScoreProperties] object when parsing your score, its\r\n * [ScoreProperties.pixelsPerInch] property should match this.*/\r\n this.initialPixelsPerSpace = ScoreProperties3.DEFAULT_PIXELS_PER_SPACE;\r\n /**the initial instrument to use.*/\r\n this.initialInstrument = InstrumentUtils.instruments[0];\r\n /**if true, an [AudioLooper] will be initialized*/\r\n this.useAudioLooper = false;\r\n this.soundLibType = soundLibType;\r\n this.soundMapPath = soundMapPath;\r\n }\r\n};\r\n\r\n// src/score_performance/drivers/sf_score_driver/SFScoreDriver.ts\r\nimport {\r\n AudioRecorder,\r\n AudioRecorder2 as AudioRecorder22,\r\n MediaDeviceManager as MediaDeviceManager4,\r\n MicManager as MicManager4\r\n} from \"audio_input\";\r\nimport { DestinationAudioComponent as DestinationAudioComponent2 } from \"audio_output\";\r\nimport { AudioSequencer } from \"audio_sequencer\";\r\nimport { SoundLibEventType as SoundLibEventType2, SoundLibManager as SoundLibManager6 } from \"sound_lib\";\r\n\r\n// src/score_performance/drivers/sf_score_driver/SFDriverDrawManager.ts\r\nimport { ScoreFormatter as ScoreFormatter2, ScoreProperties as ScoreProperties4 } from \"score_data\";\r\nvar SFDriverDrawManager = class {\r\n constructor(driver) {\r\n this._scoreViewerWidth = 0;\r\n this._scoreViewerHeight = 0;\r\n /**Affects the number of measures that fit on a line, effectively adjusting\r\n * the scaling. The actual width of the rendered music is controlled\r\n * separately. Default is ScoreProperties.DEFAULT_PAGE_WIDTH.*/\r\n this.defaultPageWidth = ScoreProperties4.DEFAULT_PAGE_WIDTH;\r\n this._driver = driver;\r\n }\r\n /**\r\n * renders a new score for the first time\r\n */\r\n renderNotation(width, height, parts = null, measuresPerSystem = 0, clearSystemIndents = false) {\r\n if (clearSystemIndents) {\r\n this._clearSystemIndents();\r\n }\r\n this._scoreFormatter = null;\r\n this._renderMusic(width, height, measuresPerSystem, parts);\r\n return this._driver._scoreViewer;\r\n }\r\n /**\r\n * re-renders the score and adds the new VisualScore to the existing \r\n * ScoreViewer\r\n */\r\n resetNotation(width = 0, height = 0, measuresPerSystem = 0, parts = null) {\r\n if (width === 0)\r\n width = this._scoreViewerWidth;\r\n if (height === 0)\r\n height = this._scoreViewerHeight;\r\n if (this._driver._scoreViewer != null) {\r\n this._driver._scoreViewer.vScore.prepareForRemoval();\r\n }\r\n if (parts == null)\r\n parts = this._displayedParts;\r\n this._renderMusic(width, height, measuresPerSystem, parts);\r\n }\r\n /**\r\n * resizes the scoreViewer visible area - if values are left null,\r\n * existing width and/or height is used\r\n */\r\n resizeScoreViewer(width, height) {\r\n if (width != null) {\r\n this._scoreViewerWidth = width;\r\n }\r\n if (height != null) {\r\n this._scoreViewerHeight = height;\r\n }\r\n if (this._driver._scoreViewer != null) {\r\n this._driver._scoreViewer.setWidthAndHeight(\r\n this._scoreViewerWidth,\r\n this._scoreViewerHeight\r\n );\r\n }\r\n }\r\n _renderMusic(width, height, measuresPerSystem, parts) {\r\n this._markMeasuresForRendering();\r\n let score = this._driver._score;\r\n let pageWidth = width;\r\n score.setPageSize(pageWidth, score.scoreProperties.pageHeight);\r\n this._formatMusic(parts, measuresPerSystem);\r\n let vScore = this._driver._renderer.renderScore(\r\n this._driver._score,\r\n parts\r\n );\r\n this._displayedParts = parts;\r\n this._scoreViewerWidth = width;\r\n this._scoreViewerHeight = height;\r\n if (this._driver._scoreViewer != null) {\r\n this._driver._scoreViewer.setScore(vScore);\r\n this._driver._scoreViewer.setWidthAndHeight(width, height);\r\n } else {\r\n this._driver._scoreViewer = new ScoreViewer3(\r\n this._driver._pah,\r\n vScore,\r\n this._scoreViewerWidth,\r\n this._scoreViewerHeight,\r\n this._driver._context\r\n );\r\n }\r\n }\r\n _markMeasuresForRendering() {\r\n let stacks = this._driver._score.getMeasureStacks();\r\n for (let i = 0; i < stacks.length; i++) {\r\n let stack = stacks[i];\r\n let measures = stack.measures;\r\n for (let j = 0; j < measures.length; j++) {\r\n measures[j].notesNeedRendering = true;\r\n }\r\n }\r\n }\r\n _clearSystemIndents() {\r\n let systems = this._driver._score.getSystems();\r\n for (let system of systems) {\r\n system.indent = 0;\r\n }\r\n }\r\n /**\r\n * formats the music for the requested parts\r\n * @param\tparts the parts to format - if null, all parts are included in \r\n * the formatting\r\n */\r\n _formatMusic(parts, measuresPerSystem = 0) {\r\n if (this._scoreFormatter == null) {\r\n this._scoreFormatter = new ScoreFormatter2(this._driver._score);\r\n }\r\n this._scoreFormatter.setPartList(parts);\r\n this._scoreFormatter.formatScore2(true, measuresPerSystem);\r\n }\r\n};\r\n\r\n// src/score_performance/drivers/sf_score_driver/SFScoreDriver.ts\r\nimport {\r\n MusicXmlParser2 as MusicXmlParser22\r\n} from \"score_data\";\r\nimport { BitmapMusicRenderer as BitmapMusicRenderer2, MusicTextures as MusicTextures3 } from \"score_render\";\r\n\r\n// src/score_performance/drivers/sf_score_driver/assessor_factory.ts\r\nvar IAssessorFactory = class {\r\n};\r\nvar BasicAssessorFactory = class extends IAssessorFactory {\r\n getAssessor(assessType, scoreViewer) {\r\n switch (assessType) {\r\n case 3 /* pitch */:\r\n return new PitchAssessor(\r\n scoreViewer,\r\n new NewAssessmentVisualizer()\r\n );\r\n case 1 /* rhythmKeyboard */:\r\n return new RhythmAssessor(\r\n scoreViewer,\r\n new NewAssessmentVisualizer()\r\n );\r\n case 0 /* none */:\r\n return null;\r\n default:\r\n throw \"unhandled AssessmentType: ${assessType.toString()}\";\r\n }\r\n }\r\n};\r\n\r\n// src/score_performance/drivers/sf_score_driver/sf_driver_events.ts\r\nvar SFDriverStatusEvent = class {\r\n constructor(type) {\r\n this.type = type;\r\n }\r\n};\r\nvar SFDriverStatusType = /* @__PURE__ */ ((SFDriverStatusType2) => {\r\n SFDriverStatusType2[SFDriverStatusType2[\"textureLoading\"] = 0] = \"textureLoading\";\r\n SFDriverStatusType2[SFDriverStatusType2[\"sfDownloadProgress\"] = 1] = \"sfDownloadProgress\";\r\n SFDriverStatusType2[SFDriverStatusType2[\"sfParsing\"] = 2] = \"sfParsing\";\r\n SFDriverStatusType2[SFDriverStatusType2[\"scoreParsing\"] = 3] = \"scoreParsing\";\r\n SFDriverStatusType2[SFDriverStatusType2[\"scoreRendering\"] = 4] = \"scoreRendering\";\r\n return SFDriverStatusType2;\r\n})(SFDriverStatusType || {});\r\n\r\n// src/score_performance/drivers/sf_score_driver/SFScoreDriver.ts\r\nimport { createEmitter as createEmitter4 } from \"ts_utils\";\r\nvar SFScoreDriver = class _SFScoreDriver {\r\n constructor() {\r\n this._useAudioRecorder2 = false;\r\n this._isPlaying = false;\r\n this._assessorFactory = new BasicAssessorFactory();\r\n this._leaveMicCaptureEnabled = false;\r\n this._statusEmitter = createEmitter4();\r\n this._onSoundLibEvent = (e) => {\r\n switch (e.type) {\r\n case SoundLibEventType2.loadProgress:\r\n let status = new SFDriverStatusEvent(\r\n 1 /* sfDownloadProgress */\r\n );\r\n status.progress = e.progress;\r\n this._statusEmitter.emit(status);\r\n break;\r\n case SoundLibEventType2.parsing:\r\n this._statusEmitter.emit(new SFDriverStatusEvent(\r\n 2 /* sfParsing */\r\n ));\r\n break;\r\n case SoundLibEventType2.libraryReady:\r\n break;\r\n case SoundLibEventType2.noteSetComplete:\r\n break;\r\n case SoundLibEventType2.playbackFinished:\r\n this._onPlaybackComplete();\r\n break;\r\n default:\r\n }\r\n };\r\n this._onPlaybackComplete = () => {\r\n this.stop();\r\n if (this._playbackCompleteCallback != null) {\r\n this._playbackCompleteCallback();\r\n }\r\n };\r\n }\r\n /**listen for progress in downloading SF, parsing SF, parsing XML, and\r\n * rendering scores.*/\r\n get statusEvent() {\r\n return this._statusEmitter.event;\r\n }\r\n /**creates a new SFScoreDriver\r\n * @param context - an AudioContext instance\r\n * @param config - SFDriverConfig object with path settings for music\r\n * symbols and SoundFonts. See class for requirements info.\r\n * @param instrument the default instrument - if null, the first instrument \r\n * in InstrumentUtils will be used.\r\n * @param loadSFBankImmediately - if true, the sfGmBank specified in the\r\n * SFDriverConfig is loaded as the [SFScoreDriver] is created.\r\n * @returns a Promise that completes with a new SFScoreDriver instance.*/\r\n static async create(pixiAppHelper, context, config) {\r\n let sfd = new _SFScoreDriver();\r\n sfd._pah = pixiAppHelper;\r\n sfd._context = context;\r\n let hasAudio = sfd._context != null;\r\n if (!hasAudio && config.throwErrorOnNoAudioContext)\r\n throw \"AudioContext not set\";\r\n sfd._drawManager = new SFDriverDrawManager(sfd);\r\n if (hasAudio) {\r\n sfd._outputComponent = config.outputComponent ?? new DestinationAudioComponent2(context);\r\n sfd._slm = SoundLibManager6.get(\r\n context,\r\n config.soundLibType,\r\n sfd._outputComponent\r\n );\r\n sfd._slm.soundLibEvent.on(sfd._onSoundLibEvent);\r\n }\r\n sfd._statusEmitter.emit(new SFDriverStatusEvent(\r\n 0 /* textureLoading */\r\n ));\r\n await MusicTextures3.createTextures(config.initialPixelsPerSpace);\r\n sfd._renderer = new BitmapMusicRenderer2(pixiAppHelper);\r\n if (hasAudio) {\r\n if (!MediaDeviceManager4.isInitialized) {\r\n let deviceManager = MediaDeviceManager4.get();\r\n await deviceManager.init();\r\n }\r\n sfd._micManager = MicManager4.get(sfd._context);\r\n sfd._audioRecorder = new AudioRecorder(sfd._micManager);\r\n sfd._audioRecorder2 = new AudioRecorder22(sfd._micManager);\r\n sfd._useAudioRecorder2 = config.useAudioRecorder2;\r\n }\r\n sfd.setInstrument(config.initialInstrument);\r\n if (config.soundMapPath != null && config.loadMapOnInit && hasAudio) {\r\n await sfd.loadSoundMap(config.soundMapPath);\r\n if (config.loadPresetsOnInit) {\r\n await sfd.loadPresets(null);\r\n }\r\n }\r\n return sfd;\r\n }\r\n /**attempts to enable microphone, if one is available. User is prompted\r\n * to give permission the first session.*/\r\n async enableMicrophone(micOptions = null, videoOptions = null) {\r\n let deviceManager = MediaDeviceManager4.get();\r\n let useCamera = videoOptions != null;\r\n await deviceManager.getPermissions(true, useCamera);\r\n await deviceManager.getDevices();\r\n if (deviceManager.currentMic == null) {\r\n deviceManager.setMic();\r\n }\r\n if (useCamera && deviceManager.currentCamera == null) {\r\n deviceManager.setCamera();\r\n }\r\n await this._micManager.initMicMediaStream(micOptions, videoOptions);\r\n }\r\n unloadScore() {\r\n if (this._score == null) {\r\n return;\r\n }\r\n if (this._assessor != null) {\r\n this._assessor.prepareForRemoval();\r\n this._assessor = null;\r\n }\r\n if (this._scoreViewer != null) {\r\n this._scoreViewer.prepareForRemoval();\r\n this._scoreViewer.parent?.removeChild(this._scoreViewer);\r\n this._scoreViewer = null;\r\n }\r\n this._scoreViewer = null;\r\n this._score = null;\r\n this.destroyParser();\r\n }\r\n parseScore(musicXmlString, computeMaxKeySizeForRendering = true, overrideScoreProps = false, scoreProps = null, keepParserObject = false) {\r\n return new Promise((resolve, reject) => {\r\n let parser = new MusicXmlParser22();\r\n this._statusEmitter.emit(new SFDriverStatusEvent(\r\n 3 /* scoreParsing */\r\n ));\r\n parser.parseXML(\r\n musicXmlString,\r\n computeMaxKeySizeForRendering,\r\n overrideScoreProps,\r\n scoreProps\r\n ).then((score) => {\r\n if (keepParserObject) {\r\n this._parser = parser;\r\n }\r\n resolve(score);\r\n }).catch((e) => {\r\n reject(e);\r\n });\r\n });\r\n }\r\n destroyParser() {\r\n this._parser = null;\r\n }\r\n renderNotation(score, width, height, parts = null, measuresPerSystem = 0, clearSystemIndents = false) {\r\n this._score = score;\r\n this._statusEmitter.emit(new SFDriverStatusEvent(\r\n 4 /* scoreRendering */\r\n ));\r\n return this._drawManager.renderNotation(\r\n width,\r\n height,\r\n parts,\r\n measuresPerSystem,\r\n clearSystemIndents\r\n );\r\n }\r\n /**\r\n * re-renders the score and adds the new VisualScore to the existing \r\n * ScoreViewer\r\n */\r\n resetNotation(width = 0, height = 0, measuresPerSystem = 0, parts = null) {\r\n this._drawManager.resetNotation(\r\n width,\r\n height,\r\n measuresPerSystem,\r\n parts\r\n );\r\n }\r\n /**\r\n * resizes the scoreViewer visible area - if values are left null, \r\n * existing width and/or height is used\r\n */\r\n resizeScoreViewer(width, height) {\r\n this._drawManager.resizeScoreViewer(width, height);\r\n }\r\n /**Loads a sound map json file. See the [SoundMap.fromJson] constructor for\r\n * details on the file and folder structures.*/\r\n async loadSoundMap(mapUrl) {\r\n await this._slm.loadSoundMap(mapUrl);\r\n }\r\n /**Loads the presets from the map. The [bankPresetPairs] is a list in the\r\n * form of [bank, preset, bank, preset, ...]. If left null, all presets\r\n * in the map are loaded.*/\r\n async loadPresets(bankPresetPairs) {\r\n await this._slm.loadPresets(bankPresetPairs);\r\n }\r\n /**Adds SequencerSound objects to the AudioSequencer*/\r\n addSequencerSounds(sounds) {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n if (this._audioSequencer == null) {\r\n this._audioSequencer = new AudioSequencer(this._context);\r\n }\r\n for (let sound of sounds) {\r\n this._audioSequencer.addSound(sound);\r\n }\r\n }\r\n preparePlayback(pdo) {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n this._prepareSFAudio(pdo);\r\n if (pdo.instDO == null) {\r\n pdo.instDO = this._instrument;\r\n } else {\r\n this.setInstrument(pdo.instDO);\r\n }\r\n this._prepareAssessment(pdo.assessmentType);\r\n if (pdo.playAudio && this._audioSequencer != null) {\r\n pdo._startNoteTimeOffset = pdo.startNG != null ? this._score.playbackInfo.convertQNoteTimeToSeconds(\r\n pdo.startNG.qNoteTime\r\n ) : 0;\r\n }\r\n }\r\n play(playbackCompleteCallback, pdo) {\r\n if (this._slm != null && this._slm.isPlaying) {\r\n return;\r\n }\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n this.preparePlayback(pdo);\r\n this.playPrepared(pdo, playbackCompleteCallback);\r\n }\r\n playPrepared(pdo, playbackCompleteCallback) {\r\n if (this._slm != null && this._slm.isPlaying) {\r\n return;\r\n }\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n this._slm.clearNotes();\r\n this._slm.prepareSequencedPlayback();\r\n this._playbackCompleteCallback = playbackCompleteCallback;\r\n this._isPlaying = true;\r\n this._slm.play();\r\n if (pdo.playAudio && this._audioSequencer != null) {\r\n this._audioSequencer.play(\r\n pdo._countoffDuration,\r\n pdo._startNoteTimeOffset\r\n );\r\n }\r\n this._scoreViewer.play(\r\n this._performanceNoteMaker.sampleTimeStamps,\r\n pdo._beatQNotePositions,\r\n pdo._countoffBeatQNotePositions,\r\n 0,\r\n pdo.startNG,\r\n pdo.endQNoteTime\r\n );\r\n if (!this._micManager.isCapturing && (pdo.record && !this._useAudioRecorder2 || this._assessor != null && this._assessor.requiresMicrophone)) {\r\n this._micManager.startCapture();\r\n }\r\n if (pdo.record) {\r\n if (this._useAudioRecorder2) {\r\n this._audioRecorder2.record();\r\n } else {\r\n this._audioRecorder.record(false);\r\n }\r\n }\r\n if (this._assessor != null)\r\n this._assessor.start();\r\n }\r\n stop() {\r\n if (this._slm != null) {\r\n this._slm.stop();\r\n if (this._audioSequencer != null) {\r\n this._audioSequencer.stop();\r\n }\r\n this._scoreViewer.stop();\r\n if (!this._leaveMicCaptureEnabled) {\r\n this._micManager.stopCapture();\r\n }\r\n if (this._assessor != null) {\r\n this._assessor.stop();\r\n }\r\n if (this._audioRecorder.isRecording) {\r\n this._audioRecorder.stop(false);\r\n }\r\n if (this._audioRecorder2.isRecording) {\r\n this._audioRecorder2.stop();\r\n }\r\n }\r\n this._isPlaying = false;\r\n }\r\n setInstrument(instDO) {\r\n if (instDO != null) {\r\n this._instrument = instDO;\r\n }\r\n }\r\n getAssessmentScore() {\r\n return this._assessor?.getScore();\r\n }\r\n getAssessmentResults() {\r\n return this._assessor?.getResults();\r\n }\r\n clearAssessmentVisuals() {\r\n if (this._assessor != null) {\r\n this._assessor.clearAssessmentVisuals();\r\n }\r\n }\r\n /**Gets the recorded audio as an AudioBuffer. Does not use AudioRecorder2.\r\n * @stereo - if true, mono recording is copied to both channels\r\n * @resampleRate - default null means no resampling. If specified, must\r\n * be a value lower than AudioContext's sample rate.\r\n * @deleteRecordedAudio - clears audio data from this class so it can be\r\n * garbage collected.*/\r\n getRecording(stereo, resampleRate = null, deleteRecordedAudio = true) {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n return this._audioRecorder.getAudioBuffer(\r\n stereo,\r\n resampleRate,\r\n deleteRecordedAudio\r\n );\r\n }\r\n /**gets an html.Blob object that can be saved to a file. This does not use\r\n * AudioRecorder2*/\r\n getRecordingAsOggAudioBlob() {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n return this._audioRecorder.getOggAudioBlob();\r\n }\r\n /**gets recording as an html.Blob object that can be saved to a file. This\r\n * uses AudioRecorder2.*/\r\n getRecordingBlobAR2() {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n return this._audioRecorder2.getAudioBlob();\r\n }\r\n /**returns the AudioContext time, in seconds, when recording starts.*/\r\n get recordStartTime() {\r\n if (this._audioRecorder2 != null) {\r\n return this._audioRecorder2.recordStartTime;\r\n } else if (this._audioRecorder != null) {\r\n return this._audioRecorder.recordStartTime;\r\n } else {\r\n return null;\r\n }\r\n }\r\n /**returns the AudioContext time, in seconds, when recording stops.*/\r\n get recordStopTime() {\r\n if (this._audioRecorder2 != null) {\r\n return this._audioRecorder2.recordStopTime;\r\n } else if (this._audioRecorder != null) {\r\n return this._audioRecorder.recordStopTime;\r\n } else {\r\n return null;\r\n }\r\n }\r\n /**Gets an AudioElement with the recorded audio. This uses AudioRecorder2.*/\r\n getAudioElementAR2() {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n return this._audioRecorder2.getAudioElement();\r\n }\r\n startBeatTrackPlayback(playbackCompleteCallback, playSoundFontNotes = true, countoffBeats = null, assessmentType = 0 /* none */) {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n if (this._scoreViewer == null) {\r\n throw \"must call init() and render a score before playback.\";\r\n }\r\n this._prepareAssessment(assessmentType);\r\n this._playbackCompleteCallback = playbackCompleteCallback;\r\n if (this._assessor != null)\r\n this._assessor.start();\r\n }\r\n _prepareSFAudio(pdo) {\r\n if (this._score == null) {\r\n throw \"must call init() and render a score before playback.\";\r\n }\r\n if (this._performanceNoteMaker == null) {\r\n this._performanceNoteMaker = new SFPerformanceNoteMaker(this._slm);\r\n }\r\n if (pdo.countoffBeats == null) {\r\n if (pdo.countoffSeconds != null) {\r\n pdo.countoffBeats = this._getCountoffBeatsForSeconds(\r\n pdo.countoffSeconds,\r\n pdo.startNG,\r\n pdo.tempoRatio\r\n );\r\n } else {\r\n pdo.countoffBeats = 0;\r\n }\r\n }\r\n this._performanceNoteMaker.addNotesInParts(\r\n this._score,\r\n this._score.parts,\r\n {\r\n tempoRatio: pdo.tempoRatio,\r\n playSoundFontNotes: pdo.playSoundFontNotes,\r\n metronomeVolume: pdo.metronomeVolume,\r\n startNG: pdo.startNG,\r\n endQNoteTime: pdo.endQNoteTime,\r\n startRepeatPass: 1,\r\n endRepeatPass: null,\r\n numCountoffBeats: pdo.countoffBeats,\r\n playRepeats: pdo.playRepeats\r\n }\r\n );\r\n pdo._countoffDuration = this._performanceNoteMaker.countoffDuration;\r\n pdo._beatQNotePositions = this._performanceNoteMaker.beatQNotePositions;\r\n pdo._countoffBeatQNotePositions = this._performanceNoteMaker.countoffBeatQNotePositions;\r\n return pdo;\r\n }\r\n _getCountoffBeatsForSeconds(seconds, startNG, tempoRatio) {\r\n if (startNG == null) {\r\n startNG = this._score.parts[0].staves[0].measures[0].voices[0].noteGroups[0];\r\n }\r\n let stack = startNG.voice.measure.stack;\r\n let tm;\r\n let tmList = stack.tempoMarkers;\r\n if (tmList != null) {\r\n for (let i = tmList.length - 1; i >= 0; i--) {\r\n if (tmList[i].qNoteTime <= startNG.qNoteTime) {\r\n tm = tmList[i];\r\n }\r\n }\r\n } else {\r\n tm = stack.getInheritedTempoMarker();\r\n }\r\n let tempo = tm != null ? tm.tempo : 90;\r\n let actualTempo = tempo * tempoRatio;\r\n let startMeasure = startNG.voice.measure;\r\n let beatType = startMeasure.beatType;\r\n let qNotesPerMeasure = startMeasure.numBeats * 4 / beatType;\r\n let secondsPerMeasure = qNotesPerMeasure * 60 / actualTempo;\r\n let numCountoffMeasures = Math.ceil(seconds / secondsPerMeasure);\r\n seconds = numCountoffMeasures * secondsPerMeasure;\r\n let qNotesPerCountoffBeat;\r\n if (beatType % 8 === 0 && actualTempo >= SFPerformanceNoteMaker.COMPOUND_METER_TEMPO_CUTOFF) {\r\n qNotesPerCountoffBeat = 3 * (4 / beatType);\r\n } else {\r\n qNotesPerCountoffBeat = 4 / beatType;\r\n }\r\n let numBeats = seconds / (qNotesPerCountoffBeat * (60 / actualTempo));\r\n return Math.round(numBeats);\r\n }\r\n _prepareAssessment(assessType) {\r\n this._assessor = this._assessorFactory.getAssessor(\r\n assessType,\r\n this.scoreViewer\r\n );\r\n if (this._assessor == null) {\r\n return;\r\n }\r\n if (this._assessor.requiresMicrophone && !MediaDeviceManager4.get().isMicReady) {\r\n throw \"Microphone device not set up.\";\r\n }\r\n this._assessor.setInstrument(this._instrument);\r\n }\r\n get pixiAppHelper() {\r\n return this._pah;\r\n }\r\n get score() {\r\n return this._score;\r\n }\r\n get parser() {\r\n return this._parser;\r\n }\r\n get scoreViewer() {\r\n return this._scoreViewer;\r\n }\r\n get isPlaying() {\r\n return this._isPlaying;\r\n }\r\n get instrument() {\r\n return this._instrument;\r\n }\r\n /**default is false. If true, ogg encoding happens in real time as date is\r\n * received. Could create performance issues (but seems pretty fast)*/\r\n get encodeLive() {\r\n return this._audioRecorder != null && this._audioRecorder.encodeLive;\r\n }\r\n set encodeLive(value) {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n this._audioRecorder.encodeLive = value;\r\n }\r\n /**If true, when playback is stopped, no call will be sent to the \r\n * [MicManager] to stop mic capture.*/\r\n get leaveMicCaptureEnabled() {\r\n return this._leaveMicCaptureEnabled;\r\n }\r\n set leaveMicCaptureEnabled(value) {\r\n this._leaveMicCaptureEnabled = value;\r\n }\r\n /**AudioRecorder2 uses MediaRecorder and creates a blob object.*/\r\n get useAudioRecorder2() {\r\n return this._useAudioRecorder2;\r\n }\r\n set useAudioRecorder2(value) {\r\n this._useAudioRecorder2 = value;\r\n }\r\n /**Returns the countoff duration in seconds, or null if no playback\r\n * has occurred.*/\r\n get countoffDuration() {\r\n return this._performanceNoteMaker?.countoffDuration;\r\n }\r\n /**Gets a reference to the audioSequencer. If it doesn't exist, it is\r\n * initialized.*/\r\n get audioSequencer() {\r\n if (!this.audioSupported)\r\n throw \"Audio support not available\";\r\n if (this._audioSequencer == null) {\r\n this._audioSequencer = new AudioSequencer(this._context);\r\n }\r\n return this._audioSequencer;\r\n }\r\n /**Affects the number of measures that fit on a line, effectively adjusting\r\n * the scaling. The actual width of the rendered music is controlled\r\n * separately. Default is ScoreProperties.DEFAULT_PAGE_WIDTH.*/\r\n get defaultPageWidth() {\r\n return this._drawManager.defaultPageWidth;\r\n }\r\n set defaultPageWidth(value) {\r\n this._drawManager.defaultPageWidth = value;\r\n }\r\n /**indicates whether the driver has audio support for playback, assessment,\r\n * recording.*/\r\n get audioSupported() {\r\n return this._context != null;\r\n }\r\n /**Gets/Sets the factory used to create [Assessor]s*/\r\n get assessorFactory() {\r\n return this._assessorFactory;\r\n }\r\n set assessorFactory(value) {\r\n this._assessorFactory = value;\r\n }\r\n /**The audio output from the [SFScoreDriver] will be routed through the\r\n * [outputComponent]. This defaults to an instance of [MasterAudioComponent]\r\n * and can be changed via the [SFDriverConfig] during initialization.*/\r\n get outputComponent() {\r\n return this._outputComponent;\r\n }\r\n};\r\n\r\n// src/score_performance/drivers/sf_score_driver/SFDriverConfig.ts\r\nimport { ScoreProperties as ScoreProperties6, InstrumentUtils as InstrumentUtils2 } from \"score_data\";\r\nvar SFDriverConfig = class {\r\n /**/\r\n /////////////////////////////////////////*/\r\n /**The [soundLibType] should match the setting in your map.json file.\r\n * If [loadMapOnInit] is true and a [soundMapPath] is specified, the map\r\n * will be loaded during initialization (and completion of initialization\r\n * will be delayed until this completes). If [loadPresetsOnInit] is also\r\n * true, all presets in the sound map will be loaded during initialization.\r\n * */\r\n constructor(soundLibType, {\r\n soundMapPath = null,\r\n loadMapOnInit = true,\r\n loadPresetsOnInit = false\r\n }) {\r\n /**The initial scaling for the score. Used for initial texture generation.\r\n * If you pass in a [ScoreProperties] object when parsing your score, its\r\n * [ScoreProperties.pixelsPerInch] property should match this.*/\r\n this.initialPixelsPerSpace = ScoreProperties6.DEFAULT_PIXELS_PER_SPACE;\r\n /**if true, AudioRecorder2 will be used for recording audio. This uses\r\n * MediaRecorder.*/\r\n this.useAudioRecorder2 = false;\r\n /**if no AudioContext is supplied, either an error will be thrown, or the\r\n * driver will be initialized with no playback/assessment/recording support.\r\n * */\r\n this.throwErrorOnNoAudioContext = true;\r\n /**the initial instrument to use.*/\r\n this.initialInstrument = InstrumentUtils2.instruments[0];\r\n this.soundLibType = soundLibType;\r\n this.soundMapPath = soundMapPath;\r\n this.loadMapOnInit = loadMapOnInit;\r\n this.loadPresetsOnInit = loadPresetsOnInit;\r\n }\r\n};\r\nexport {\r\n AssessmentBeat,\r\n AssessmentNote,\r\n AssessmentResults,\r\n AssessmentType,\r\n AssessmentVisualizer,\r\n AssessmentVisualizerBase,\r\n Assessor,\r\n BasicAssessorFactory,\r\n FreeTimeRhythmAssessor,\r\n IAssessorFactory,\r\n InteractionSettings,\r\n NewAssessmentVisualizer,\r\n PitchAssessor,\r\n RhythmAssessor,\r\n RhythmAssessorHitMode,\r\n SFDriverConfig,\r\n SFDriverStatusEvent,\r\n SFDriverStatusType,\r\n SFLoopDriver,\r\n SFLoopDriverConfig,\r\n SFPerformanceNoteMaker,\r\n SFPlaybackDO,\r\n SFScoreDriver,\r\n ScoreViewer3 as ScoreViewer,\r\n ScoreViewerEvent,\r\n ScoreViewerEventType,\r\n ScoreViewerPlaybackManager,\r\n ScoreViewerViewManager,\r\n TimeTrackMode\r\n};\r\n","export class AppSettings {\r\n\tprivate static _jsParams:any;\r\n\tprivate static _isBot:boolean;\r\n\t\r\n\tpublic static init():void {\r\n\t\tthis._jsParams = window['params'];\r\n\t\t\r\n\t\tlet rx = /bot|googlebot|crawler|spider|robot|crawling/i;\r\n\t\tAppSettings._isBot = (rx.test(window.navigator.userAgent) ||\r\n\t\t\tAppSettings.getJSParam(\"fakeBot\") === true);\r\n\t}\r\n\t\r\n\tpublic static getJSParam(paramName:string):any {\r\n\t\tif (AppSettings._jsParams.hasOwnProperty(paramName)){\r\n\t\t\treturn AppSettings._jsParams[paramName];\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static get isBot():boolean {\r\n\t\treturn AppSettings._isBot;\r\n\t}\r\n\t\r\n\tpublic static get resourcesPath():string {\r\n\t\treturn AppSettings.getJSParam(\"resourcesUrl\");\r\n\t}\r\n\t\r\n\tpublic static get pageUrl():string {\r\n\t\treturn AppSettings.getJSParam(\"pageUrl\");\r\n\t}\r\n}","import { AppSettings } from \"../settings/AppSettings\";\r\n\r\nexport class Templates {\r\n\t\r\n\tpublic static createElement(htmlString:string):HTMLElement {\r\n\t\tlet template = document.createElement(\"template\");\r\n\t\thtmlString = htmlString.replace(/{{r}}/g, AppSettings.resourcesPath);\r\n\t\ttemplate.innerHTML = htmlString;\r\n\t\tlet el = template.content.firstElementChild;\r\n\t\tel.remove();\r\n\t\treturn el as HTMLElement;\r\n\t}\r\n\t\r\n\tpublic static createDiv(htmlString:string):HTMLDivElement {\r\n\t\treturn Templates.createElement(htmlString) as HTMLDivElement;\r\n\t}\r\n}","import { Templates } from \"./Templates\";\r\nimport { appContainer } from \"./templates/appContainerTemplates\";\r\nimport { playerContainer } from \"./templates/playerTemplates\";\r\nimport { songMenuContainer } from \"./templates/songMenuTemplates\";\r\n\r\nexport class AppContainer {\r\n\tprivate _appContainer:HTMLDivElement;\r\n\t\r\n\tpublic get songMenuUi():HTMLDivElement {\r\n\t\treturn this._songMenuUi;\r\n\t}\r\n\tprivate _songMenuUi:HTMLDivElement;\r\n\t\r\n\tpublic get playerUi():HTMLDivElement {\r\n\t\treturn this._playerUi;\r\n\t}\r\n\tprivate _playerUi:HTMLDivElement;\r\n\t\r\n\tprivate _activeScreen:AppScreen;\r\n\t\r\n\tprivate static _ref:AppContainer;\r\n\t\r\n\tprivate constructor(){\r\n\t\tAppContainer._ref = this;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tpublic static get():AppContainer {\r\n\t\tif (AppContainer._ref == null){\r\n\t\t\tnew AppContainer();\r\n\t\t}\r\n\t\treturn AppContainer._ref;\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._appContainer = Templates.createDiv(appContainer);\r\n\t\tdocument.body.append(this._appContainer);\r\n\t\t\r\n\t\tvar qs = this._appContainer.querySelector.bind(this._appContainer);\r\n\t\t\r\n\t\tthis._playerUi = Templates.createDiv(playerContainer);\r\n\t\tqs(\"#raac-player\").append(this._playerUi);\r\n\t\t\r\n\t\tthis._songMenuUi = Templates.createDiv(songMenuContainer);\r\n\t\tqs(\"#raac-menu\").append(this._songMenuUi);\r\n\t}\r\n\t\r\n\tpublic setActiveScreen(screen:AppScreen):void {\r\n\t\tthis._activeScreen = screen;\r\n\t\tthis._updateDisplay();\r\n\t}\r\n\t\r\n\tprivate _updateDisplay():void {\r\n\t\tthis._appContainer.classList.remove(\"menu\");\r\n\t\tthis._appContainer.classList.remove(\"player\");\r\n\t\t\r\n\t\tlet className:string;\r\n\t\tswitch (this._activeScreen){\r\n\t\t\tcase AppScreen.menu:\r\n\t\t\t\tclassName = \"menu\";\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase AppScreen.player:\r\n\t\t\t\tclassName = \"player\";\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase AppScreen.none:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tif (className != null){\r\n\t\t\tthis._appContainer.classList.add(className);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport enum AppScreen {\r\n\tnone,\r\n\tmenu,\r\n\tplayer\r\n}","export const appContainer:string = `\r\n
\r\n\t
\r\n\t\t\r\n\t
\r\n\t
\r\n\t\t\r\n\t
\r\n
\r\n`;","export const playerContainer = `\r\n
\r\n\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t

\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t
Tempo: 100%
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t
100%
\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n
\r\n`;","export const songMenuOverlay = `\r\n
\r\n\t
\r\n\t\t

Welcome to RecorderAce

\r\n\t\t
Loading songs and team data...
\r\n\t
\r\n
\r\n`;\r\n\r\nexport const songMenuContainer = `\r\n
\r\n\t\r\n\t\r\n\t\r\n\t
\r\n\t\t
\r\n\t\t\t

Master music challenges with RecorderAce!

\r\n\t\t\t
Practice Recorder Karate and other fun recorder songs. Connect\r\n\t\t\t\tyour microphone to go for a perfect score! And new in RecorderAce 2.0,\r\n\t\t\t\tteam up with other students in your class and find out which class\r\n\t\t\t\tcan earn the most points on the worldwide leaderboard each week!\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n\t\r\n\t
\r\n\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\tSwitch User\r\n\t\t
\r\n\t
\r\n\t\r\n\t
\t\t\t\t\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\"Songs\"/\r\n\t\t\t\t
\r\n\t\t\t\t
Music Challenges
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
Categories
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n\t\r\n\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\"Leaders\"/\r\n\t\t\t
\r\n\t\t\t
Team Leaderboard:
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\tWeekly Leaders - New contests begin every Monday -\r\n\t\t\t\tSee last week's results.\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\tLast Week's Results -\r\n\t\t\t\tSee current week.\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t
\r\n
\r\n`;\r\n\r\nexport const sidebarItem = `\r\n
\r\n`;\r\n\r\nexport const songItem = `\r\n
\r\n\t
\r\n\t\t
\r\n\t
\r\n\t
\r\n\t\t
\r\n\t
\r\n
\r\n`;\r\n\r\nexport const leaderboardItem = `\r\n
\r\n`;","import { PixiAppHelper } from \"score_render\";\r\n\r\nexport let pixiAppHelper:PixiAppHelper;\r\n\r\nexport function setMainPixiApp(setPixiAppHelper:PixiAppHelper):void {\r\n\tif (pixiAppHelper == null){\r\n\t\tpixiAppHelper = setPixiAppHelper;\r\n\t}\r\n}","import { AudioContextManager, SoundLoader } from \"audio_utils\";\r\nimport { AppSettings } from \"../settings/AppSettings\";\r\n\r\nexport class SfxPlayer {\r\n\tpublic static _sfx:Map;\r\n\t\r\n\tpublic static async loadSounds():Promise {\r\n\t\tlet context = AudioContextManager.context;\r\n\t\tlet r = AppSettings.resourcesPath;\r\n\t\tSfxPlayer._sfx = new Map();\r\n\t\tlet clap1 = await SoundLoader.getAudioBufferFromUrl(\r\n\t\t\t`${r}sounds/sfx/reactionClap.mp3`, context);\r\n\t\tSfxPlayer._sfx.set(\"clap1\", clap1);\r\n\t\tlet clap2 = await SoundLoader.getAudioBufferFromUrl(\r\n\t\t\t`${r}sounds/sfx/clapMore.mp3`, context);\r\n\t\tSfxPlayer._sfx.set(\"clap2\", clap2);\r\n\t\tlet clap3 = await SoundLoader.getAudioBufferFromUrl(\r\n\t\t\t`${r}sounds/sfx/reaction_Yahoo.mp3`, context);\r\n\t\tSfxPlayer._sfx.set(\"clap3\", clap3);\r\n\t}\r\n\t\r\n\tpublic static playSound(soundId:string):void {\r\n\t\tlet buffer = SfxPlayer._sfx.get(soundId);\r\n\t\t\r\n\t\tlet ctx = AudioContextManager.context;\r\n\t\tlet bsn = ctx.createBufferSource();\r\n\t\tbsn.buffer = buffer;\r\n\t\tlet gain = ctx.createGain();\r\n\t\tbsn.connect(gain);\r\n\t\tgain.connect(ctx.destination);\r\n\t\tbsn.start();\r\n\t}\r\n}","import { Easing, Tween } from \"@tweenjs/tween.js\";\r\nimport { AnimatedSprite, TextStyle, Texture, Text } from \"pixi.js\";\r\nimport { AssessmentNote, NewAssessmentVisualizer } from \"score_performance\";\r\nimport { VisualNoteGroup } from \"score_render\";\r\nimport { SfxPlayer } from \"../audio/SfxPlayer\";\r\nimport { pixiAppHelper } from \"../ui/pixi_apps\";\r\n\r\nexport class RaAssessmentVisualizer extends NewAssessmentVisualizer {\t\r\n\tprivate _explosion:Texture[];\r\n\tprivate _rewardTextStyle = new TextStyle({ fontFamily: \"arial\",\r\n\t\tfontSize: 100, fill: 0x00FF00, stroke: 1.0, fontWeight: \"bold\",\r\n\t\talign: \"left\" });\r\n\t\r\n\tprivate _streak:number = 0;\r\n\t\r\n\tprivate _tweenWrappers:_TweenWrapper[] = [];\r\n\t\r\n\tprivate _animationWrappers:_AnimationWrapper[] = []; //for cleanup\r\n\t\r\n\t\r\n\tpublic static readonly GREEN:number = 0x00FF00;\r\n\tpublic static readonly RED:number = 0xFF0000;\r\n\t\r\n\tconstructor(explosion:Texture[]){\r\n\t\tsuper();\r\n\t\tthis._explosion = explosion;\r\n\t\twindow.requestAnimationFrame(this._handleAnimationFrame);\r\n\t}\r\n\t\r\n\tpublic override markNoteCorrect(note:AssessmentNote):void {\r\n\t\tthis._streak++;\r\n\t\tthis.setNoteColor(note.vng, RaAssessmentVisualizer.GREEN);\r\n\t\tthis.addExplosion(note.vng);\r\n\t\tif (this._streak === 10){\r\n\t\t\tSfxPlayer.playSound('clap1');\r\n\t\t}\r\n\t\telse if (this._streak % 10 === 0){\r\n\t\t\tSfxPlayer.playSound('clap2');\r\n\t\t}\r\n\t\tthis.displayText();\r\n\t\tif (this.autoMarkTiedNotes){\r\n\t\t\tthis.markTiedNotes(note, RaAssessmentVisualizer.GREEN);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic override markNoteIncorrect(note:AssessmentNote):void {\r\n\t\tthis.setNoteColor(note.vng, RaAssessmentVisualizer.RED);\r\n\t\tif (this.autoMarkTiedNotes){\r\n\t\t\tthis.markTiedNotes(note, RaAssessmentVisualizer.RED);\r\n\t\t}\r\n\t\tthis._streak = 0;\r\n\t}\r\n\t\r\n\tpublic override addExtraNote(qNoteTime:number):void {\r\n\t\tsuper.addExtraNote(qNoteTime);\r\n\t\tthis._streak = 0;\r\n\t}\r\n\t\r\n\t/**removes extra red notes and sets red/green notes back to black*/\r\n\tpublic override clearAssessmentVisuals():void {\r\n\t\tfor (let wrapper of this._animationWrappers){\r\n\t\t\tif (wrapper.sprite.parent != null){\r\n\t\t\t\twrapper.sprite.stop();\r\n\t\t\t\twrapper.sprite.parent.removeChild(wrapper.sprite);\r\n\t\t\t\twrapper.completionHandler = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis.assessor.scoreViewer.assessmentOverlay.removeChildren(0);\r\n\t\t\r\n\t\tthis._streak = 0;\r\n\t\tthis._animationWrappers = [];\r\n\t}\r\n\t\r\n\tpublic addExplosion(vng:VisualNoteGroup):void {\r\n\t\tlet sprite = new AnimatedSprite(this._explosion);\r\n\t\tsprite.animationSpeed = 0.50;\r\n\t\tlet notehead = vng.noteheadList[0];\r\n\t\tsprite.pivot.x = 25;\r\n\t\tsprite.pivot.y = 75;\r\n\t\tsprite.x = vng.scoreX + notehead.x;\r\n\t\tsprite.y = vng.scoreY + notehead.y;\r\n\t\tthis.assessor.scoreViewer.assessmentOverlay.addChild(sprite);\r\n\t\tsprite.loop = false;\r\n\t\tsprite.play();\r\n\t\tlet wrapper = new _AnimationWrapper();\r\n\t\twrapper.sprite = sprite;\r\n\t\twrapper.completionHandler = () => {\r\n\t\t\tthis.assessor.scoreViewer.assessmentOverlay.removeChild(sprite);\r\n\t\t\twrapper.completionHandler = null;\r\n\t\t\twrapper.sprite.onFrameChange = null;\r\n\t\t\twrapper.sprite.onComplete = null;\r\n\t\t}\r\n\t\tsprite.onComplete = wrapper.completionHandler;\r\n\t\tsprite.onFrameChange = this._onSpriteFrameChange;\r\n\t\tthis._animationWrappers.push(wrapper);\r\n\t}\r\n\t\r\n\tpublic displayText():void {\r\n\t\tlet overlay = this.assessor.scoreViewer.assessmentOverlay;\r\n\t\tlet vScore = this.assessor.scoreViewer.vScore;\r\n\t\tthis._rewardTextStyle.fontSize = pixiAppHelper.app.canvas.width / 25;\r\n\t\tlet tf = new Text({\r\n\t\t\ttext: `${this._streak} note streak!`,\r\n\t\t\tstyle: this._rewardTextStyle });\r\n\t\ttf.pivot.x = tf.width / 2;\r\n\t\ttf.pivot.y = tf.height / 2;\r\n\t\ttf.y = pixiAppHelper.app.canvas.height / 2 - vScore.y;\r\n\t\ttf.x = pixiAppHelper.app.canvas.width / 2;\r\n\t\t\r\n\t\tlet wrapper = new _TweenWrapper(tf);\r\n\t\twrapper.tween = new Tween(tf)\r\n\t\t\t.to( { y: tf.y - 50, scaleY: 3.0, scaleX: 3.0, alpha: 0.0 }, 500)\r\n\t\t\t.onComplete(() => { wrapper.finished = true; })\r\n\t\t\t.start();\r\n\t\toverlay.addChild(tf);\r\n\t\tthis._tweenWrappers.push(wrapper);\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate _handleAnimationFrame = ():void => {\r\n\t\tfor (let i = this._tweenWrappers.length - 1; i >= 0; i--){\r\n\t\t\tlet wrapper = this._tweenWrappers[i];\r\n\t\t\twrapper.tween.update();\r\n\t\t\tif (wrapper.finished){\r\n\t\t\t\twrapper.object.parent.removeChild(wrapper.object);\r\n\t\t\t\tthis._tweenWrappers.splice(i, 1);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\twindow.requestAnimationFrame(this._handleAnimationFrame);\r\n\t}\r\n\t\r\n\tprivate _onSpriteFrameChange = (currentFrame:number):void => {\r\n\t\tpixiAppHelper.requestRender();\r\n\t}\r\n\t\r\n\t// public override set assessor(value:Assessor) {\r\n\t// \tvalue.scoreViewer.forceScrolling = true;\r\n\t// \tsuper.assessor = value;\r\n\t// }\r\n}\r\n\r\nclass _AnimationWrapper {\r\n\tpublic sprite:AnimatedSprite;\r\n\tpublic completionHandler:() => void;\r\n}\r\n\r\nclass _TweenWrapper {\r\n\tpublic object:T;\r\n\tpublic tween:Tween;\r\n\tpublic finished:boolean = false;\r\n\t\r\n\tconstructor(object:T){\r\n\t\tthis.object = object;\r\n\t}\r\n}","import { Assets, Loader, Spritesheet } from \"pixi.js\";\r\nimport { AssessmentType, Assessor, IAssessorFactory, PitchAssessor,\r\n\tRhythmAssessor, RhythmAssessorHitMode, ScoreViewer } from \"score_performance\";\r\nimport { RaAssessmentVisualizer } from \"./RaAssessmentVisualizer\";\r\n\r\nexport class RaAssessorFactory implements IAssessorFactory {\r\n\tprivate _spriteSheet:Spritesheet;\r\n\t\r\n\tpublic assessBeats:boolean = false;\r\n\t\r\n\tpublic async loadAnimations():Promise {\r\n\t\ttry {\r\n\t\t\tlet path = 'images/atlases/explosion.json';\r\n\t\t\tthis._spriteSheet = await Assets.load(path) as Spritesheet;\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t}\r\n\t//https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-and-animations-with-pixijs5\r\n\tpublic getAssessor(assessType:AssessmentType, scoreViewer:ScoreViewer)\r\n\t\t\t:Assessor {\r\n\t\tlet explosion = this._spriteSheet.animations[\"explosion\"];\r\n\t\tswitch (assessType){\r\n\t\t\tcase AssessmentType.pitch:\r\n\t\t\t\treturn new PitchAssessor(scoreViewer, \r\n\t\t\t\t\tnew RaAssessmentVisualizer(explosion));\r\n\t\t\tcase AssessmentType.rhythmKeyboard:\r\n\t\t\t\tlet assessor = new RhythmAssessor(scoreViewer,\r\n\t\t\t\t\tnew RaAssessmentVisualizer(explosion));\r\n\t\t\t\tlet mode = (this.assessBeats)\r\n\t\t\t\t\t? RhythmAssessorHitMode.keyboardAndBeat\r\n\t\t\t\t\t: RhythmAssessorHitMode.keyboard;\r\n\t\t\t\tassessor.setHitMode(mode);\r\n\t\t\t\treturn assessor;\r\n\t\t\tcase AssessmentType.none:\r\n\t\t\t\treturn null;\r\n\t\t\tdefault: \r\n\t\t\t\tthrow 'unhandled AssessmentType: ${assessType.toString()}';\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n}","import { IDTO } from 'ts_utils';\r\n\r\nexport class UserDTO extends IDTO {\r\n\tpublic userId:number;\r\n\tpublic fbUserId:string;\r\n\tpublic displayName:string;\r\n\tpublic role:number;\r\n\t\r\n\tpublic override parse(json:any):void {\r\n\t\tif (\"userId\" in json) this.userId = json[\"userId\"];\r\n\t\tif (\"fbUserId\" in json) this.fbUserId = json[\"fbUserId\"];\r\n\t\tif (\"displayName\" in json) this.displayName = json[\"displayName\"];\r\n\t\tif (\"role\" in json) this.role = json[\"role\"];\r\n\t}\r\n}\r\n\r\nexport class CreateUserDTO {\r\n\tpublic fbUserId:string;\r\n\tpublic displayName:string;\r\n\tpublic email:string;\r\n\tpublic role:number;\r\n\t\r\n\tpublic toForm():FormData {\r\n\t\tlet fd = new FormData();\r\n\t\tif (this.fbUserId != null) fd.append(\"fbUserId\", this.fbUserId);\r\n\t\tif (this.displayName != null) fd.append(\"displayName\",\r\n\t\t\tthis.displayName);\r\n\t\tif (this.email != null) fd.append(\"email\", this.email);\r\n\t\tif (this.role != null) fd.append(\"role\", this.role.toString());\r\n\t\t\r\n\t\treturn fd;\r\n\t}\r\n}\r\n\r\nexport class TeamDTO extends IDTO {\r\n\tpublic id:number;\r\n\tpublic name:string;\r\n\tpublic code:string;\r\n\tpublic size:number;\r\n\tpublic userId:number;\r\n\t\r\n\tpublic override parse(json:any):void {\r\n\t\tthis.id = json[\"id\"];\r\n\t\tthis.name = json[\"name\"];\r\n\t\tthis.code = json[\"code\"];\r\n\t\tthis.size = json[\"size\"];\r\n\t\tthis.userId = json[\"userId\"];\r\n\t}\r\n}\r\n\r\nexport class TeamUploadDTO {\r\n\tpublic name:string;\r\n\tpublic code:string;\r\n\tpublic size:number;\r\n\tpublic userId:number;\r\n\t\r\n\tpublic toForm():FormData {\r\n\t\tlet fd = new FormData();\r\n\t\tfd.append(\"name\", this.name);\r\n\t\tfd.append(\"code\", this.code);\r\n\t\tfd.append(\"size\", this.size.toString());\r\n\t\tfd.append(\"userId\", this.userId.toString());\r\n\t\t\r\n\t\treturn fd;\r\n\t}\r\n}\r\n\r\nexport class TeamUpdateDTO {\r\n\tpublic id:number;\r\n\tpublic size:number;\r\n\t\r\n\tpublic toForm():FormData {\r\n\t\tlet fd = new FormData();\r\n\t\tfd.append(\"id\", this.id.toString());\r\n\t\tfd.append(\"size\", this.size.toString());\r\n\t\t\r\n\t\treturn fd;\r\n\t}\r\n}\r\n\r\nexport class ContestEntryDTO extends IDTO {\r\n\tpublic id:number;\r\n\tpublic dateString:string;\r\n\tpublic points:number;\r\n\tpublic teamId:number;\r\n\tpublic teamDto:TeamDTO;\r\n\t\r\n\tpublic override parse(json:any):void {\r\n\t\tthis.id = json[\"id\"];\r\n\t\tthis.dateString = json[\"dateString\"];\r\n\t\tthis.points = json[\"points\"];\r\n\t\tthis.teamId = json[\"teamId\"];\r\n\t\tthis.teamDto = new TeamDTO();\r\n\t\tthis.teamDto.parse(json[\"team\"]);\r\n\t}\r\n}\r\n\r\nexport class ContestEntryUpdateDTO {\r\n\tpublic dateString:string;\r\n\tpublic points:number;\r\n\tpublic teamId:number;\r\n\t\r\n\tpublic toForm():FormData {\r\n\t\tlet fd = new FormData();\r\n\t\tfd.append(\"dateString\", this.dateString);\r\n\t\tfd.append(\"points\", this.points.toString());\r\n\t\tfd.append(\"teamId\", this.teamId.toString());\r\n\t\t\r\n\t\treturn fd;\r\n\t}\r\n}","/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time.\r\n */\r\nconst CONSTANTS = {\r\n /**\r\n * @define {boolean} Whether this is the client Node.js SDK.\r\n */\r\n NODE_CLIENT: false,\r\n /**\r\n * @define {boolean} Whether this is the Admin Node.js SDK.\r\n */\r\n NODE_ADMIN: false,\r\n /**\r\n * Firebase SDK Version\r\n */\r\n SDK_VERSION: '${JSCORE_VERSION}'\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Throws an error if the provided assertion is falsy\r\n */\r\nconst assert = function (assertion, message) {\r\n if (!assertion) {\r\n throw assertionError(message);\r\n }\r\n};\r\n/**\r\n * Returns an Error object suitable for throwing.\r\n */\r\nconst assertionError = function (message) {\r\n return new Error('Firebase Database (' +\r\n CONSTANTS.SDK_VERSION +\r\n ') INTERNAL ASSERT FAILED: ' +\r\n message);\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst stringToByteArray$1 = function (str) {\r\n // TODO(user): Use native implementations if/when available\r\n const out = [];\r\n let p = 0;\r\n for (let i = 0; i < str.length; i++) {\r\n let c = str.charCodeAt(i);\r\n if (c < 128) {\r\n out[p++] = c;\r\n }\r\n else if (c < 2048) {\r\n out[p++] = (c >> 6) | 192;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else if ((c & 0xfc00) === 0xd800 &&\r\n i + 1 < str.length &&\r\n (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\r\n // Surrogate Pair\r\n c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);\r\n out[p++] = (c >> 18) | 240;\r\n out[p++] = ((c >> 12) & 63) | 128;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else {\r\n out[p++] = (c >> 12) | 224;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n }\r\n return out;\r\n};\r\n/**\r\n * Turns an array of numbers into the string given by the concatenation of the\r\n * characters to which the numbers correspond.\r\n * @param bytes Array of numbers representing characters.\r\n * @return Stringification of the array.\r\n */\r\nconst byteArrayToString = function (bytes) {\r\n // TODO(user): Use native implementations if/when available\r\n const out = [];\r\n let pos = 0, c = 0;\r\n while (pos < bytes.length) {\r\n const c1 = bytes[pos++];\r\n if (c1 < 128) {\r\n out[c++] = String.fromCharCode(c1);\r\n }\r\n else if (c1 > 191 && c1 < 224) {\r\n const c2 = bytes[pos++];\r\n out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));\r\n }\r\n else if (c1 > 239 && c1 < 365) {\r\n // Surrogate Pair\r\n const c2 = bytes[pos++];\r\n const c3 = bytes[pos++];\r\n const c4 = bytes[pos++];\r\n const u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) -\r\n 0x10000;\r\n out[c++] = String.fromCharCode(0xd800 + (u >> 10));\r\n out[c++] = String.fromCharCode(0xdc00 + (u & 1023));\r\n }\r\n else {\r\n const c2 = bytes[pos++];\r\n const c3 = bytes[pos++];\r\n out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\r\n }\r\n }\r\n return out.join('');\r\n};\r\n// We define it as an object literal instead of a class because a class compiled down to es5 can't\r\n// be treeshaked. https://github.com/rollup/rollup/issues/1691\r\n// Static lookup maps, lazily populated by init_()\r\nconst base64 = {\r\n /**\r\n * Maps bytes to characters.\r\n */\r\n byteToCharMap_: null,\r\n /**\r\n * Maps characters to bytes.\r\n */\r\n charToByteMap_: null,\r\n /**\r\n * Maps bytes to websafe characters.\r\n * @private\r\n */\r\n byteToCharMapWebSafe_: null,\r\n /**\r\n * Maps websafe characters to bytes.\r\n * @private\r\n */\r\n charToByteMapWebSafe_: null,\r\n /**\r\n * Our default alphabet, shared between\r\n * ENCODED_VALS and ENCODED_VALS_WEBSAFE\r\n */\r\n ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789',\r\n /**\r\n * Our default alphabet. Value 64 (=) is special; it means \"nothing.\"\r\n */\r\n get ENCODED_VALS() {\r\n return this.ENCODED_VALS_BASE + '+/=';\r\n },\r\n /**\r\n * Our websafe alphabet.\r\n */\r\n get ENCODED_VALS_WEBSAFE() {\r\n return this.ENCODED_VALS_BASE + '-_.';\r\n },\r\n /**\r\n * Whether this browser supports the atob and btoa functions. This extension\r\n * started at Mozilla but is now implemented by many browsers. We use the\r\n * ASSUME_* variables to avoid pulling in the full useragent detection library\r\n * but still allowing the standard per-browser compilations.\r\n *\r\n */\r\n HAS_NATIVE_SUPPORT: typeof atob === 'function',\r\n /**\r\n * Base64-encode an array of bytes.\r\n *\r\n * @param input An array of bytes (numbers with\r\n * value in [0, 255]) to encode.\r\n * @param webSafe Boolean indicating we should use the\r\n * alternative alphabet.\r\n * @return The base64 encoded string.\r\n */\r\n encodeByteArray(input, webSafe) {\r\n if (!Array.isArray(input)) {\r\n throw Error('encodeByteArray takes an array as a parameter');\r\n }\r\n this.init_();\r\n const byteToCharMap = webSafe\r\n ? this.byteToCharMapWebSafe_\r\n : this.byteToCharMap_;\r\n const output = [];\r\n for (let i = 0; i < input.length; i += 3) {\r\n const byte1 = input[i];\r\n const haveByte2 = i + 1 < input.length;\r\n const byte2 = haveByte2 ? input[i + 1] : 0;\r\n const haveByte3 = i + 2 < input.length;\r\n const byte3 = haveByte3 ? input[i + 2] : 0;\r\n const outByte1 = byte1 >> 2;\r\n const outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);\r\n let outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6);\r\n let outByte4 = byte3 & 0x3f;\r\n if (!haveByte3) {\r\n outByte4 = 64;\r\n if (!haveByte2) {\r\n outByte3 = 64;\r\n }\r\n }\r\n output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);\r\n }\r\n return output.join('');\r\n },\r\n /**\r\n * Base64-encode a string.\r\n *\r\n * @param input A string to encode.\r\n * @param webSafe If true, we should use the\r\n * alternative alphabet.\r\n * @return The base64 encoded string.\r\n */\r\n encodeString(input, webSafe) {\r\n // Shortcut for Mozilla browsers that implement\r\n // a native base64 encoder in the form of \"btoa/atob\"\r\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\r\n return btoa(input);\r\n }\r\n return this.encodeByteArray(stringToByteArray$1(input), webSafe);\r\n },\r\n /**\r\n * Base64-decode a string.\r\n *\r\n * @param input to decode.\r\n * @param webSafe True if we should use the\r\n * alternative alphabet.\r\n * @return string representing the decoded value.\r\n */\r\n decodeString(input, webSafe) {\r\n // Shortcut for Mozilla browsers that implement\r\n // a native base64 encoder in the form of \"btoa/atob\"\r\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\r\n return atob(input);\r\n }\r\n return byteArrayToString(this.decodeStringToByteArray(input, webSafe));\r\n },\r\n /**\r\n * Base64-decode a string.\r\n *\r\n * In base-64 decoding, groups of four characters are converted into three\r\n * bytes. If the encoder did not apply padding, the input length may not\r\n * be a multiple of 4.\r\n *\r\n * In this case, the last group will have fewer than 4 characters, and\r\n * padding will be inferred. If the group has one or two characters, it decodes\r\n * to one byte. If the group has three characters, it decodes to two bytes.\r\n *\r\n * @param input Input to decode.\r\n * @param webSafe True if we should use the web-safe alphabet.\r\n * @return bytes representing the decoded value.\r\n */\r\n decodeStringToByteArray(input, webSafe) {\r\n this.init_();\r\n const charToByteMap = webSafe\r\n ? this.charToByteMapWebSafe_\r\n : this.charToByteMap_;\r\n const output = [];\r\n for (let i = 0; i < input.length;) {\r\n const byte1 = charToByteMap[input.charAt(i++)];\r\n const haveByte2 = i < input.length;\r\n const byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;\r\n ++i;\r\n const haveByte3 = i < input.length;\r\n const byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;\r\n ++i;\r\n const haveByte4 = i < input.length;\r\n const byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;\r\n ++i;\r\n if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {\r\n throw Error();\r\n }\r\n const outByte1 = (byte1 << 2) | (byte2 >> 4);\r\n output.push(outByte1);\r\n if (byte3 !== 64) {\r\n const outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2);\r\n output.push(outByte2);\r\n if (byte4 !== 64) {\r\n const outByte3 = ((byte3 << 6) & 0xc0) | byte4;\r\n output.push(outByte3);\r\n }\r\n }\r\n }\r\n return output;\r\n },\r\n /**\r\n * Lazy static initialization function. Called before\r\n * accessing any of the static map variables.\r\n * @private\r\n */\r\n init_() {\r\n if (!this.byteToCharMap_) {\r\n this.byteToCharMap_ = {};\r\n this.charToByteMap_ = {};\r\n this.byteToCharMapWebSafe_ = {};\r\n this.charToByteMapWebSafe_ = {};\r\n // We want quick mappings back and forth, so we precompute two maps.\r\n for (let i = 0; i < this.ENCODED_VALS.length; i++) {\r\n this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i);\r\n this.charToByteMap_[this.byteToCharMap_[i]] = i;\r\n this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i);\r\n this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i;\r\n // Be forgiving when decoding and correctly decode both encodings.\r\n if (i >= this.ENCODED_VALS_BASE.length) {\r\n this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i;\r\n this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i;\r\n }\r\n }\r\n }\r\n }\r\n};\r\n/**\r\n * URL-safe base64 encoding\r\n */\r\nconst base64Encode = function (str) {\r\n const utf8Bytes = stringToByteArray$1(str);\r\n return base64.encodeByteArray(utf8Bytes, true);\r\n};\r\n/**\r\n * URL-safe base64 encoding (without \".\" padding in the end).\r\n * e.g. Used in JSON Web Token (JWT) parts.\r\n */\r\nconst base64urlEncodeWithoutPadding = function (str) {\r\n // Use base64url encoding and remove padding in the end (dot characters).\r\n return base64Encode(str).replace(/\\./g, '');\r\n};\r\n/**\r\n * URL-safe base64 decoding\r\n *\r\n * NOTE: DO NOT use the global atob() function - it does NOT support the\r\n * base64Url variant encoding.\r\n *\r\n * @param str To be decoded\r\n * @return Decoded result, if possible\r\n */\r\nconst base64Decode = function (str) {\r\n try {\r\n return base64.decodeString(str, true);\r\n }\r\n catch (e) {\r\n console.error('base64Decode failed: ', e);\r\n }\r\n return null;\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Do a deep-copy of basic JavaScript Objects or Arrays.\r\n */\r\nfunction deepCopy(value) {\r\n return deepExtend(undefined, value);\r\n}\r\n/**\r\n * Copy properties from source to target (recursively allows extension\r\n * of Objects and Arrays). Scalar values in the target are over-written.\r\n * If target is undefined, an object of the appropriate type will be created\r\n * (and returned).\r\n *\r\n * We recursively copy all child properties of plain Objects in the source- so\r\n * that namespace- like dictionaries are merged.\r\n *\r\n * Note that the target can be a function, in which case the properties in\r\n * the source Object are copied onto it as static properties of the Function.\r\n *\r\n * Note: we don't merge __proto__ to prevent prototype pollution\r\n */\r\nfunction deepExtend(target, source) {\r\n if (!(source instanceof Object)) {\r\n return source;\r\n }\r\n switch (source.constructor) {\r\n case Date:\r\n // Treat Dates like scalars; if the target date object had any child\r\n // properties - they will be lost!\r\n const dateValue = source;\r\n return new Date(dateValue.getTime());\r\n case Object:\r\n if (target === undefined) {\r\n target = {};\r\n }\r\n break;\r\n case Array:\r\n // Always copy the array source and overwrite the target.\r\n target = [];\r\n break;\r\n default:\r\n // Not a plain Object - treat it as a scalar.\r\n return source;\r\n }\r\n for (const prop in source) {\r\n // use isValidKey to guard against prototype pollution. See https://snyk.io/vuln/SNYK-JS-LODASH-450202\r\n if (!source.hasOwnProperty(prop) || !isValidKey(prop)) {\r\n continue;\r\n }\r\n target[prop] = deepExtend(target[prop], source[prop]);\r\n }\r\n return target;\r\n}\r\nfunction isValidKey(key) {\r\n return key !== '__proto__';\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass Deferred {\r\n constructor() {\r\n this.reject = () => { };\r\n this.resolve = () => { };\r\n this.promise = new Promise((resolve, reject) => {\r\n this.resolve = resolve;\r\n this.reject = reject;\r\n });\r\n }\r\n /**\r\n * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around\r\n * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback\r\n * and returns a node-style callback which will resolve or reject the Deferred's promise.\r\n */\r\n wrapCallback(callback) {\r\n return (error, value) => {\r\n if (error) {\r\n this.reject(error);\r\n }\r\n else {\r\n this.resolve(value);\r\n }\r\n if (typeof callback === 'function') {\r\n // Attaching noop handler just in case developer wasn't expecting\r\n // promises\r\n this.promise.catch(() => { });\r\n // Some of our callbacks don't expect a value and our own tests\r\n // assert that the parameter length is 1\r\n if (callback.length === 1) {\r\n callback(error);\r\n }\r\n else {\r\n callback(error, value);\r\n }\r\n }\r\n };\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction createMockUserToken(token, projectId) {\r\n if (token.uid) {\r\n throw new Error('The \"uid\" field is no longer supported by mockUserToken. Please use \"sub\" instead for Firebase Auth User ID.');\r\n }\r\n // Unsecured JWTs use \"none\" as the algorithm.\r\n const header = {\r\n alg: 'none',\r\n type: 'JWT'\r\n };\r\n const project = projectId || 'demo-project';\r\n const iat = token.iat || 0;\r\n const sub = token.sub || token.user_id;\r\n if (!sub) {\r\n throw new Error(\"mockUserToken must contain 'sub' or 'user_id' field!\");\r\n }\r\n const payload = Object.assign({ \r\n // Set all required fields to decent defaults\r\n iss: `https://securetoken.google.com/${project}`, aud: project, iat, exp: iat + 3600, auth_time: iat, sub, user_id: sub, firebase: {\r\n sign_in_provider: 'custom',\r\n identities: {}\r\n } }, token);\r\n // Unsecured JWTs use the empty string as a signature.\r\n const signature = '';\r\n return [\r\n base64urlEncodeWithoutPadding(JSON.stringify(header)),\r\n base64urlEncodeWithoutPadding(JSON.stringify(payload)),\r\n signature\r\n ].join('.');\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns navigator.userAgent string or '' if it's not defined.\r\n * @return user agent string\r\n */\r\nfunction getUA() {\r\n if (typeof navigator !== 'undefined' &&\r\n typeof navigator['userAgent'] === 'string') {\r\n return navigator['userAgent'];\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\n/**\r\n * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.\r\n *\r\n * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap\r\n * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally\r\n * wait for a callback.\r\n */\r\nfunction isMobileCordova() {\r\n return (typeof window !== 'undefined' &&\r\n // @ts-ignore Setting up an broadly applicable index signature for Window\r\n // just to deal with this case would probably be a bad idea.\r\n !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) &&\r\n /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA()));\r\n}\r\n/**\r\n * Detect Node.js.\r\n *\r\n * @return true if Node.js environment is detected.\r\n */\r\n// Node detection logic from: https://github.com/iliakan/detect-node/\r\nfunction isNode() {\r\n try {\r\n return (Object.prototype.toString.call(global.process) === '[object process]');\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n}\r\n/**\r\n * Detect Browser Environment\r\n */\r\nfunction isBrowser() {\r\n return typeof self === 'object' && self.self === self;\r\n}\r\nfunction isBrowserExtension() {\r\n const runtime = typeof chrome === 'object'\r\n ? chrome.runtime\r\n : typeof browser === 'object'\r\n ? browser.runtime\r\n : undefined;\r\n return typeof runtime === 'object' && runtime.id !== undefined;\r\n}\r\n/**\r\n * Detect React Native.\r\n *\r\n * @return true if ReactNative environment is detected.\r\n */\r\nfunction isReactNative() {\r\n return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');\r\n}\r\n/** Detects Electron apps. */\r\nfunction isElectron() {\r\n return getUA().indexOf('Electron/') >= 0;\r\n}\r\n/** Detects Internet Explorer. */\r\nfunction isIE() {\r\n const ua = getUA();\r\n return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;\r\n}\r\n/** Detects Universal Windows Platform apps. */\r\nfunction isUWP() {\r\n return getUA().indexOf('MSAppHost/') >= 0;\r\n}\r\n/**\r\n * Detect whether the current SDK build is the Node version.\r\n *\r\n * @return true if it's the Node SDK build.\r\n */\r\nfunction isNodeSdk() {\r\n return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true;\r\n}\r\n/** Returns true if we are running in Safari. */\r\nfunction isSafari() {\r\n return (!isNode() &&\r\n navigator.userAgent.includes('Safari') &&\r\n !navigator.userAgent.includes('Chrome'));\r\n}\r\n/**\r\n * This method checks if indexedDB is supported by current browser/service worker context\r\n * @return true if indexedDB is supported by current browser/service worker context\r\n */\r\nfunction isIndexedDBAvailable() {\r\n return typeof indexedDB === 'object';\r\n}\r\n/**\r\n * This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject\r\n * if errors occur during the database open operation.\r\n *\r\n * @throws exception if current browser/sw context can't run idb.open (ex: Safari iframe, Firefox\r\n * private browsing)\r\n */\r\nfunction validateIndexedDBOpenable() {\r\n return new Promise((resolve, reject) => {\r\n try {\r\n let preExist = true;\r\n const DB_CHECK_NAME = 'validate-browser-context-for-indexeddb-analytics-module';\r\n const request = self.indexedDB.open(DB_CHECK_NAME);\r\n request.onsuccess = () => {\r\n request.result.close();\r\n // delete database only when it doesn't pre-exist\r\n if (!preExist) {\r\n self.indexedDB.deleteDatabase(DB_CHECK_NAME);\r\n }\r\n resolve(true);\r\n };\r\n request.onupgradeneeded = () => {\r\n preExist = false;\r\n };\r\n request.onerror = () => {\r\n var _a;\r\n reject(((_a = request.error) === null || _a === void 0 ? void 0 : _a.message) || '');\r\n };\r\n }\r\n catch (error) {\r\n reject(error);\r\n }\r\n });\r\n}\r\n/**\r\n *\r\n * This method checks whether cookie is enabled within current browser\r\n * @return true if cookie is enabled within current browser\r\n */\r\nfunction areCookiesEnabled() {\r\n if (typeof navigator === 'undefined' || !navigator.cookieEnabled) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Polyfill for `globalThis` object.\r\n * @returns the `globalThis` object for the given environment.\r\n */\r\nfunction getGlobal() {\r\n if (typeof self !== 'undefined') {\r\n return self;\r\n }\r\n if (typeof window !== 'undefined') {\r\n return window;\r\n }\r\n if (typeof global !== 'undefined') {\r\n return global;\r\n }\r\n throw new Error('Unable to locate global object.');\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * @fileoverview Standardized Firebase Error.\r\n *\r\n * Usage:\r\n *\r\n * // Typescript string literals for type-safe codes\r\n * type Err =\r\n * 'unknown' |\r\n * 'object-not-found'\r\n * ;\r\n *\r\n * // Closure enum for type-safe error codes\r\n * // at-enum {string}\r\n * var Err = {\r\n * UNKNOWN: 'unknown',\r\n * OBJECT_NOT_FOUND: 'object-not-found',\r\n * }\r\n *\r\n * let errors: Map = {\r\n * 'generic-error': \"Unknown error\",\r\n * 'file-not-found': \"Could not find file: {$file}\",\r\n * };\r\n *\r\n * // Type-safe function - must pass a valid error code as param.\r\n * let error = new ErrorFactory('service', 'Service', errors);\r\n *\r\n * ...\r\n * throw error.create(Err.GENERIC);\r\n * ...\r\n * throw error.create(Err.FILE_NOT_FOUND, {'file': fileName});\r\n * ...\r\n * // Service: Could not file file: foo.txt (service/file-not-found).\r\n *\r\n * catch (e) {\r\n * assert(e.message === \"Could not find file: foo.txt.\");\r\n * if (e.code === 'service/file-not-found') {\r\n * console.log(\"Could not read file: \" + e['file']);\r\n * }\r\n * }\r\n */\r\nconst ERROR_NAME = 'FirebaseError';\r\n// Based on code from:\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types\r\nclass FirebaseError extends Error {\r\n constructor(\r\n /** The error code for this error. */\r\n code, message, \r\n /** Custom data for this error. */\r\n customData) {\r\n super(message);\r\n this.code = code;\r\n this.customData = customData;\r\n /** The custom name for all FirebaseErrors. */\r\n this.name = ERROR_NAME;\r\n // Fix For ES5\r\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n Object.setPrototypeOf(this, FirebaseError.prototype);\r\n // Maintains proper stack trace for where our error was thrown.\r\n // Only available on V8.\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, ErrorFactory.prototype.create);\r\n }\r\n }\r\n}\r\nclass ErrorFactory {\r\n constructor(service, serviceName, errors) {\r\n this.service = service;\r\n this.serviceName = serviceName;\r\n this.errors = errors;\r\n }\r\n create(code, ...data) {\r\n const customData = data[0] || {};\r\n const fullCode = `${this.service}/${code}`;\r\n const template = this.errors[code];\r\n const message = template ? replaceTemplate(template, customData) : 'Error';\r\n // Service Name: Error message (service/code).\r\n const fullMessage = `${this.serviceName}: ${message} (${fullCode}).`;\r\n const error = new FirebaseError(fullCode, fullMessage, customData);\r\n return error;\r\n }\r\n}\r\nfunction replaceTemplate(template, data) {\r\n return template.replace(PATTERN, (_, key) => {\r\n const value = data[key];\r\n return value != null ? String(value) : `<${key}?>`;\r\n });\r\n}\r\nconst PATTERN = /\\{\\$([^}]+)}/g;\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Evaluates a JSON string into a javascript object.\r\n *\r\n * @param {string} str A string containing JSON.\r\n * @return {*} The javascript object representing the specified JSON.\r\n */\r\nfunction jsonEval(str) {\r\n return JSON.parse(str);\r\n}\r\n/**\r\n * Returns JSON representing a javascript object.\r\n * @param {*} data Javascript object to be stringified.\r\n * @return {string} The JSON contents of the object.\r\n */\r\nfunction stringify(data) {\r\n return JSON.stringify(data);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Decodes a Firebase auth. token into constituent parts.\r\n *\r\n * Notes:\r\n * - May return with invalid / incomplete claims if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nconst decode = function (token) {\r\n let header = {}, claims = {}, data = {}, signature = '';\r\n try {\r\n const parts = token.split('.');\r\n header = jsonEval(base64Decode(parts[0]) || '');\r\n claims = jsonEval(base64Decode(parts[1]) || '');\r\n signature = parts[2];\r\n data = claims['d'] || {};\r\n delete claims['d'];\r\n }\r\n catch (e) { }\r\n return {\r\n header,\r\n claims,\r\n data,\r\n signature\r\n };\r\n};\r\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the\r\n * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nconst isValidTimestamp = function (token) {\r\n const claims = decode(token).claims;\r\n const now = Math.floor(new Date().getTime() / 1000);\r\n let validSince = 0, validUntil = 0;\r\n if (typeof claims === 'object') {\r\n if (claims.hasOwnProperty('nbf')) {\r\n validSince = claims['nbf'];\r\n }\r\n else if (claims.hasOwnProperty('iat')) {\r\n validSince = claims['iat'];\r\n }\r\n if (claims.hasOwnProperty('exp')) {\r\n validUntil = claims['exp'];\r\n }\r\n else {\r\n // token will expire after 24h by default\r\n validUntil = validSince + 86400;\r\n }\r\n }\r\n return (!!now &&\r\n !!validSince &&\r\n !!validUntil &&\r\n now >= validSince &&\r\n now <= validUntil);\r\n};\r\n/**\r\n * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise.\r\n *\r\n * Notes:\r\n * - May return null if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nconst issuedAtTime = function (token) {\r\n const claims = decode(token).claims;\r\n if (typeof claims === 'object' && claims.hasOwnProperty('iat')) {\r\n return claims['iat'];\r\n }\r\n return null;\r\n};\r\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nconst isValidFormat = function (token) {\r\n const decoded = decode(token), claims = decoded.claims;\r\n return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat');\r\n};\r\n/**\r\n * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nconst isAdmin = function (token) {\r\n const claims = decode(token).claims;\r\n return typeof claims === 'object' && claims['admin'] === true;\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction contains(obj, key) {\r\n return Object.prototype.hasOwnProperty.call(obj, key);\r\n}\r\nfunction safeGet(obj, key) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n return obj[key];\r\n }\r\n else {\r\n return undefined;\r\n }\r\n}\r\nfunction isEmpty(obj) {\r\n for (const key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nfunction map(obj, fn, contextObj) {\r\n const res = {};\r\n for (const key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n res[key] = fn.call(contextObj, obj[key], key, obj);\r\n }\r\n }\r\n return res;\r\n}\r\n/**\r\n * Deep equal two objects. Support Arrays and Objects.\r\n */\r\nfunction deepEqual(a, b) {\r\n if (a === b) {\r\n return true;\r\n }\r\n const aKeys = Object.keys(a);\r\n const bKeys = Object.keys(b);\r\n for (const k of aKeys) {\r\n if (!bKeys.includes(k)) {\r\n return false;\r\n }\r\n const aProp = a[k];\r\n const bProp = b[k];\r\n if (isObject(aProp) && isObject(bProp)) {\r\n if (!deepEqual(aProp, bProp)) {\r\n return false;\r\n }\r\n }\r\n else if (aProp !== bProp) {\r\n return false;\r\n }\r\n }\r\n for (const k of bKeys) {\r\n if (!aKeys.includes(k)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nfunction isObject(thing) {\r\n return thing !== null && typeof thing === 'object';\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a\r\n * params object (e.g. {arg: 'val', arg2: 'val2'})\r\n * Note: You must prepend it with ? when adding it to a URL.\r\n */\r\nfunction querystring(querystringParams) {\r\n const params = [];\r\n for (const [key, value] of Object.entries(querystringParams)) {\r\n if (Array.isArray(value)) {\r\n value.forEach(arrayVal => {\r\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal));\r\n });\r\n }\r\n else {\r\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\r\n }\r\n }\r\n return params.length ? '&' + params.join('&') : '';\r\n}\r\n/**\r\n * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object\r\n * (e.g. {arg: 'val', arg2: 'val2'})\r\n */\r\nfunction querystringDecode(querystring) {\r\n const obj = {};\r\n const tokens = querystring.replace(/^\\?/, '').split('&');\r\n tokens.forEach(token => {\r\n if (token) {\r\n const [key, value] = token.split('=');\r\n obj[decodeURIComponent(key)] = decodeURIComponent(value);\r\n }\r\n });\r\n return obj;\r\n}\r\n/**\r\n * Extract the query string part of a URL, including the leading question mark (if present).\r\n */\r\nfunction extractQuerystring(url) {\r\n const queryStart = url.indexOf('?');\r\n if (!queryStart) {\r\n return '';\r\n }\r\n const fragmentStart = url.indexOf('#', queryStart);\r\n return url.substring(queryStart, fragmentStart > 0 ? fragmentStart : undefined);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * @fileoverview SHA-1 cryptographic hash.\r\n * Variable names follow the notation in FIPS PUB 180-3:\r\n * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf.\r\n *\r\n * Usage:\r\n * var sha1 = new sha1();\r\n * sha1.update(bytes);\r\n * var hash = sha1.digest();\r\n *\r\n * Performance:\r\n * Chrome 23: ~400 Mbit/s\r\n * Firefox 16: ~250 Mbit/s\r\n *\r\n */\r\n/**\r\n * SHA-1 cryptographic hash constructor.\r\n *\r\n * The properties declared here are discussed in the above algorithm document.\r\n * @constructor\r\n * @final\r\n * @struct\r\n */\r\nclass Sha1 {\r\n constructor() {\r\n /**\r\n * Holds the previous values of accumulated variables a-e in the compress_\r\n * function.\r\n * @private\r\n */\r\n this.chain_ = [];\r\n /**\r\n * A buffer holding the partially computed hash result.\r\n * @private\r\n */\r\n this.buf_ = [];\r\n /**\r\n * An array of 80 bytes, each a part of the message to be hashed. Referred to\r\n * as the message schedule in the docs.\r\n * @private\r\n */\r\n this.W_ = [];\r\n /**\r\n * Contains data needed to pad messages less than 64 bytes.\r\n * @private\r\n */\r\n this.pad_ = [];\r\n /**\r\n * @private {number}\r\n */\r\n this.inbuf_ = 0;\r\n /**\r\n * @private {number}\r\n */\r\n this.total_ = 0;\r\n this.blockSize = 512 / 8;\r\n this.pad_[0] = 128;\r\n for (let i = 1; i < this.blockSize; ++i) {\r\n this.pad_[i] = 0;\r\n }\r\n this.reset();\r\n }\r\n reset() {\r\n this.chain_[0] = 0x67452301;\r\n this.chain_[1] = 0xefcdab89;\r\n this.chain_[2] = 0x98badcfe;\r\n this.chain_[3] = 0x10325476;\r\n this.chain_[4] = 0xc3d2e1f0;\r\n this.inbuf_ = 0;\r\n this.total_ = 0;\r\n }\r\n /**\r\n * Internal compress helper function.\r\n * @param buf Block to compress.\r\n * @param offset Offset of the block in the buffer.\r\n * @private\r\n */\r\n compress_(buf, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n const W = this.W_;\r\n // get 16 big endian words\r\n if (typeof buf === 'string') {\r\n for (let i = 0; i < 16; i++) {\r\n // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS\r\n // have a bug that turns the post-increment ++ operator into pre-increment\r\n // during JIT compilation. We have code that depends heavily on SHA-1 for\r\n // correctness and which is affected by this bug, so I've removed all uses\r\n // of post-increment ++ in which the result value is used. We can revert\r\n // this change once the Safari bug\r\n // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and\r\n // most clients have been updated.\r\n W[i] =\r\n (buf.charCodeAt(offset) << 24) |\r\n (buf.charCodeAt(offset + 1) << 16) |\r\n (buf.charCodeAt(offset + 2) << 8) |\r\n buf.charCodeAt(offset + 3);\r\n offset += 4;\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < 16; i++) {\r\n W[i] =\r\n (buf[offset] << 24) |\r\n (buf[offset + 1] << 16) |\r\n (buf[offset + 2] << 8) |\r\n buf[offset + 3];\r\n offset += 4;\r\n }\r\n }\r\n // expand to 80 words\r\n for (let i = 16; i < 80; i++) {\r\n const t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\r\n W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff;\r\n }\r\n let a = this.chain_[0];\r\n let b = this.chain_[1];\r\n let c = this.chain_[2];\r\n let d = this.chain_[3];\r\n let e = this.chain_[4];\r\n let f, k;\r\n // TODO(user): Try to unroll this loop to speed up the computation.\r\n for (let i = 0; i < 80; i++) {\r\n if (i < 40) {\r\n if (i < 20) {\r\n f = d ^ (b & (c ^ d));\r\n k = 0x5a827999;\r\n }\r\n else {\r\n f = b ^ c ^ d;\r\n k = 0x6ed9eba1;\r\n }\r\n }\r\n else {\r\n if (i < 60) {\r\n f = (b & c) | (d & (b | c));\r\n k = 0x8f1bbcdc;\r\n }\r\n else {\r\n f = b ^ c ^ d;\r\n k = 0xca62c1d6;\r\n }\r\n }\r\n const t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff;\r\n e = d;\r\n d = c;\r\n c = ((b << 30) | (b >>> 2)) & 0xffffffff;\r\n b = a;\r\n a = t;\r\n }\r\n this.chain_[0] = (this.chain_[0] + a) & 0xffffffff;\r\n this.chain_[1] = (this.chain_[1] + b) & 0xffffffff;\r\n this.chain_[2] = (this.chain_[2] + c) & 0xffffffff;\r\n this.chain_[3] = (this.chain_[3] + d) & 0xffffffff;\r\n this.chain_[4] = (this.chain_[4] + e) & 0xffffffff;\r\n }\r\n update(bytes, length) {\r\n // TODO(johnlenz): tighten the function signature and remove this check\r\n if (bytes == null) {\r\n return;\r\n }\r\n if (length === undefined) {\r\n length = bytes.length;\r\n }\r\n const lengthMinusBlock = length - this.blockSize;\r\n let n = 0;\r\n // Using local instead of member variables gives ~5% speedup on Firefox 16.\r\n const buf = this.buf_;\r\n let inbuf = this.inbuf_;\r\n // The outer while loop should execute at most twice.\r\n while (n < length) {\r\n // When we have no data in the block to top up, we can directly process the\r\n // input buffer (assuming it contains sufficient data). This gives ~25%\r\n // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that\r\n // the data is provided in large chunks (or in multiples of 64 bytes).\r\n if (inbuf === 0) {\r\n while (n <= lengthMinusBlock) {\r\n this.compress_(bytes, n);\r\n n += this.blockSize;\r\n }\r\n }\r\n if (typeof bytes === 'string') {\r\n while (n < length) {\r\n buf[inbuf] = bytes.charCodeAt(n);\r\n ++inbuf;\r\n ++n;\r\n if (inbuf === this.blockSize) {\r\n this.compress_(buf);\r\n inbuf = 0;\r\n // Jump to the outer loop so we use the full-block optimization.\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n while (n < length) {\r\n buf[inbuf] = bytes[n];\r\n ++inbuf;\r\n ++n;\r\n if (inbuf === this.blockSize) {\r\n this.compress_(buf);\r\n inbuf = 0;\r\n // Jump to the outer loop so we use the full-block optimization.\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n this.inbuf_ = inbuf;\r\n this.total_ += length;\r\n }\r\n /** @override */\r\n digest() {\r\n const digest = [];\r\n let totalBits = this.total_ * 8;\r\n // Add pad 0x80 0x00*.\r\n if (this.inbuf_ < 56) {\r\n this.update(this.pad_, 56 - this.inbuf_);\r\n }\r\n else {\r\n this.update(this.pad_, this.blockSize - (this.inbuf_ - 56));\r\n }\r\n // Add # bits.\r\n for (let i = this.blockSize - 1; i >= 56; i--) {\r\n this.buf_[i] = totalBits & 255;\r\n totalBits /= 256; // Don't use bit-shifting here!\r\n }\r\n this.compress_(this.buf_);\r\n let n = 0;\r\n for (let i = 0; i < 5; i++) {\r\n for (let j = 24; j >= 0; j -= 8) {\r\n digest[n] = (this.chain_[i] >> j) & 255;\r\n ++n;\r\n }\r\n }\r\n return digest;\r\n }\r\n}\n\n/**\r\n * Helper to make a Subscribe function (just like Promise helps make a\r\n * Thenable).\r\n *\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\r\nfunction createSubscribe(executor, onNoObservers) {\r\n const proxy = new ObserverProxy(executor, onNoObservers);\r\n return proxy.subscribe.bind(proxy);\r\n}\r\n/**\r\n * Implement fan-out for any number of Observers attached via a subscribe\r\n * function.\r\n */\r\nclass ObserverProxy {\r\n /**\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\r\n constructor(executor, onNoObservers) {\r\n this.observers = [];\r\n this.unsubscribes = [];\r\n this.observerCount = 0;\r\n // Micro-task scheduling by calling task.then().\r\n this.task = Promise.resolve();\r\n this.finalized = false;\r\n this.onNoObservers = onNoObservers;\r\n // Call the executor asynchronously so subscribers that are called\r\n // synchronously after the creation of the subscribe function\r\n // can still receive the very first value generated in the executor.\r\n this.task\r\n .then(() => {\r\n executor(this);\r\n })\r\n .catch(e => {\r\n this.error(e);\r\n });\r\n }\r\n next(value) {\r\n this.forEachObserver((observer) => {\r\n observer.next(value);\r\n });\r\n }\r\n error(error) {\r\n this.forEachObserver((observer) => {\r\n observer.error(error);\r\n });\r\n this.close(error);\r\n }\r\n complete() {\r\n this.forEachObserver((observer) => {\r\n observer.complete();\r\n });\r\n this.close();\r\n }\r\n /**\r\n * Subscribe function that can be used to add an Observer to the fan-out list.\r\n *\r\n * - We require that no event is sent to a subscriber sychronously to their\r\n * call to subscribe().\r\n */\r\n subscribe(nextOrObserver, error, complete) {\r\n let observer;\r\n if (nextOrObserver === undefined &&\r\n error === undefined &&\r\n complete === undefined) {\r\n throw new Error('Missing Observer.');\r\n }\r\n // Assemble an Observer object when passed as callback functions.\r\n if (implementsAnyMethods(nextOrObserver, [\r\n 'next',\r\n 'error',\r\n 'complete'\r\n ])) {\r\n observer = nextOrObserver;\r\n }\r\n else {\r\n observer = {\r\n next: nextOrObserver,\r\n error,\r\n complete\r\n };\r\n }\r\n if (observer.next === undefined) {\r\n observer.next = noop;\r\n }\r\n if (observer.error === undefined) {\r\n observer.error = noop;\r\n }\r\n if (observer.complete === undefined) {\r\n observer.complete = noop;\r\n }\r\n const unsub = this.unsubscribeOne.bind(this, this.observers.length);\r\n // Attempt to subscribe to a terminated Observable - we\r\n // just respond to the Observer with the final error or complete\r\n // event.\r\n if (this.finalized) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.task.then(() => {\r\n try {\r\n if (this.finalError) {\r\n observer.error(this.finalError);\r\n }\r\n else {\r\n observer.complete();\r\n }\r\n }\r\n catch (e) {\r\n // nothing\r\n }\r\n return;\r\n });\r\n }\r\n this.observers.push(observer);\r\n return unsub;\r\n }\r\n // Unsubscribe is synchronous - we guarantee that no events are sent to\r\n // any unsubscribed Observer.\r\n unsubscribeOne(i) {\r\n if (this.observers === undefined || this.observers[i] === undefined) {\r\n return;\r\n }\r\n delete this.observers[i];\r\n this.observerCount -= 1;\r\n if (this.observerCount === 0 && this.onNoObservers !== undefined) {\r\n this.onNoObservers(this);\r\n }\r\n }\r\n forEachObserver(fn) {\r\n if (this.finalized) {\r\n // Already closed by previous event....just eat the additional values.\r\n return;\r\n }\r\n // Since sendOne calls asynchronously - there is no chance that\r\n // this.observers will become undefined.\r\n for (let i = 0; i < this.observers.length; i++) {\r\n this.sendOne(i, fn);\r\n }\r\n }\r\n // Call the Observer via one of it's callback function. We are careful to\r\n // confirm that the observe has not been unsubscribed since this asynchronous\r\n // function had been queued.\r\n sendOne(i, fn) {\r\n // Execute the callback asynchronously\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.task.then(() => {\r\n if (this.observers !== undefined && this.observers[i] !== undefined) {\r\n try {\r\n fn(this.observers[i]);\r\n }\r\n catch (e) {\r\n // Ignore exceptions raised in Observers or missing methods of an\r\n // Observer.\r\n // Log error to console. b/31404806\r\n if (typeof console !== 'undefined' && console.error) {\r\n console.error(e);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n close(err) {\r\n if (this.finalized) {\r\n return;\r\n }\r\n this.finalized = true;\r\n if (err !== undefined) {\r\n this.finalError = err;\r\n }\r\n // Proxy is no longer needed - garbage collect references\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.task.then(() => {\r\n this.observers = undefined;\r\n this.onNoObservers = undefined;\r\n });\r\n }\r\n}\r\n/** Turn synchronous function into one called asynchronously. */\r\n// eslint-disable-next-line @typescript-eslint/ban-types\r\nfunction async(fn, onError) {\r\n return (...args) => {\r\n Promise.resolve(true)\r\n .then(() => {\r\n fn(...args);\r\n })\r\n .catch((error) => {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}\r\n/**\r\n * Return true if the object passed in implements any of the named methods.\r\n */\r\nfunction implementsAnyMethods(obj, methods) {\r\n if (typeof obj !== 'object' || obj === null) {\r\n return false;\r\n }\r\n for (const method of methods) {\r\n if (method in obj && typeof obj[method] === 'function') {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nfunction noop() {\r\n // do nothing\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Check to make sure the appropriate number of arguments are provided for a public function.\r\n * Throws an error if it fails.\r\n *\r\n * @param fnName The function name\r\n * @param minCount The minimum number of arguments to allow for the function call\r\n * @param maxCount The maximum number of argument to allow for the function call\r\n * @param argCount The actual number of arguments provided.\r\n */\r\nconst validateArgCount = function (fnName, minCount, maxCount, argCount) {\r\n let argError;\r\n if (argCount < minCount) {\r\n argError = 'at least ' + minCount;\r\n }\r\n else if (argCount > maxCount) {\r\n argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount;\r\n }\r\n if (argError) {\r\n const error = fnName +\r\n ' failed: Was called with ' +\r\n argCount +\r\n (argCount === 1 ? ' argument.' : ' arguments.') +\r\n ' Expects ' +\r\n argError +\r\n '.';\r\n throw new Error(error);\r\n }\r\n};\r\n/**\r\n * Generates a string to prefix an error message about failed argument validation\r\n *\r\n * @param fnName The function name\r\n * @param argName The name of the argument\r\n * @return The prefix to add to the error thrown for validation.\r\n */\r\nfunction errorPrefix(fnName, argName) {\r\n return `${fnName} failed: ${argName} argument `;\r\n}\r\n/**\r\n * @param fnName\r\n * @param argumentNumber\r\n * @param namespace\r\n * @param optional\r\n */\r\nfunction validateNamespace(fnName, namespace, optional) {\r\n if (optional && !namespace) {\r\n return;\r\n }\r\n if (typeof namespace !== 'string') {\r\n //TODO: I should do more validation here. We only allow certain chars in namespaces.\r\n throw new Error(errorPrefix(fnName, 'namespace') + 'must be a valid firebase namespace.');\r\n }\r\n}\r\nfunction validateCallback(fnName, argumentName, \r\n// eslint-disable-next-line @typescript-eslint/ban-types\r\ncallback, optional) {\r\n if (optional && !callback) {\r\n return;\r\n }\r\n if (typeof callback !== 'function') {\r\n throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid function.');\r\n }\r\n}\r\nfunction validateContextObject(fnName, argumentName, context, optional) {\r\n if (optional && !context) {\r\n return;\r\n }\r\n if (typeof context !== 'object' || context === null) {\r\n throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid context object.');\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they\r\n// automatically replaced '\\r\\n' with '\\n', and they didn't handle surrogate pairs,\r\n// so it's been modified.\r\n// Note that not all Unicode characters appear as single characters in JavaScript strings.\r\n// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters\r\n// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first\r\n// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate\r\n// pair).\r\n// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3\r\n/**\r\n * @param {string} str\r\n * @return {Array}\r\n */\r\nconst stringToByteArray = function (str) {\r\n const out = [];\r\n let p = 0;\r\n for (let i = 0; i < str.length; i++) {\r\n let c = str.charCodeAt(i);\r\n // Is this the lead surrogate in a surrogate pair?\r\n if (c >= 0xd800 && c <= 0xdbff) {\r\n const high = c - 0xd800; // the high 10 bits.\r\n i++;\r\n assert(i < str.length, 'Surrogate pair missing trail surrogate.');\r\n const low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.\r\n c = 0x10000 + (high << 10) + low;\r\n }\r\n if (c < 128) {\r\n out[p++] = c;\r\n }\r\n else if (c < 2048) {\r\n out[p++] = (c >> 6) | 192;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else if (c < 65536) {\r\n out[p++] = (c >> 12) | 224;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else {\r\n out[p++] = (c >> 18) | 240;\r\n out[p++] = ((c >> 12) & 63) | 128;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n }\r\n return out;\r\n};\r\n/**\r\n * Calculate length without actually converting; useful for doing cheaper validation.\r\n * @param {string} str\r\n * @return {number}\r\n */\r\nconst stringLength = function (str) {\r\n let p = 0;\r\n for (let i = 0; i < str.length; i++) {\r\n const c = str.charCodeAt(i);\r\n if (c < 128) {\r\n p++;\r\n }\r\n else if (c < 2048) {\r\n p += 2;\r\n }\r\n else if (c >= 0xd800 && c <= 0xdbff) {\r\n // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent.\r\n p += 4;\r\n i++; // skip trail surrogate.\r\n }\r\n else {\r\n p += 3;\r\n }\r\n }\r\n return p;\r\n};\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * The amount of milliseconds to exponentially increase.\r\n */\r\nconst DEFAULT_INTERVAL_MILLIS = 1000;\r\n/**\r\n * The factor to backoff by.\r\n * Should be a number greater than 1.\r\n */\r\nconst DEFAULT_BACKOFF_FACTOR = 2;\r\n/**\r\n * The maximum milliseconds to increase to.\r\n *\r\n *

Visible for testing\r\n */\r\nconst MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android.\r\n/**\r\n * The percentage of backoff time to randomize by.\r\n * See\r\n * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic\r\n * for context.\r\n *\r\n *

Visible for testing\r\n */\r\nconst RANDOM_FACTOR = 0.5;\r\n/**\r\n * Based on the backoff method from\r\n * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js.\r\n * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around.\r\n */\r\nfunction calculateBackoffMillis(backoffCount, intervalMillis = DEFAULT_INTERVAL_MILLIS, backoffFactor = DEFAULT_BACKOFF_FACTOR) {\r\n // Calculates an exponentially increasing value.\r\n // Deviation: calculates value from count and a constant interval, so we only need to save value\r\n // and count to restore state.\r\n const currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount);\r\n // A random \"fuzz\" to avoid waves of retries.\r\n // Deviation: randomFactor is required.\r\n const randomWait = Math.round(\r\n // A fraction of the backoff value to add/subtract.\r\n // Deviation: changes multiplication order to improve readability.\r\n RANDOM_FACTOR *\r\n currBaseValue *\r\n // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines\r\n // if we add or subtract.\r\n (Math.random() - 0.5) *\r\n 2);\r\n // Limits backoff to max to avoid effectively permanent backoff.\r\n return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provide English ordinal letters after a number\r\n */\r\nfunction ordinal(i) {\r\n if (!Number.isFinite(i)) {\r\n return `${i}`;\r\n }\r\n return i + indicator(i);\r\n}\r\nfunction indicator(i) {\r\n i = Math.abs(i);\r\n const cent = i % 100;\r\n if (cent >= 10 && cent <= 20) {\r\n return 'th';\r\n }\r\n const dec = i % 10;\r\n if (dec === 1) {\r\n return 'st';\r\n }\r\n if (dec === 2) {\r\n return 'nd';\r\n }\r\n if (dec === 3) {\r\n return 'rd';\r\n }\r\n return 'th';\r\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction getModularInstance(service) {\r\n if (service && service._delegate) {\r\n return service._delegate;\r\n }\r\n else {\r\n return service;\r\n }\r\n}\n\nexport { CONSTANTS, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, ordinal, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };\n//# sourceMappingURL=index.esm2017.js.map\n","import { Deferred } from '@firebase/util';\n\n/**\r\n * Component for service name T, e.g. `auth`, `auth-internal`\r\n */\r\nclass Component {\r\n /**\r\n *\r\n * @param name The public service name, e.g. app, auth, firestore, database\r\n * @param instanceFactory Service factory responsible for creating the public interface\r\n * @param type whether the service provided by the component is public or private\r\n */\r\n constructor(name, instanceFactory, type) {\r\n this.name = name;\r\n this.instanceFactory = instanceFactory;\r\n this.type = type;\r\n this.multipleInstances = false;\r\n /**\r\n * Properties to be added to the service namespace\r\n */\r\n this.serviceProps = {};\r\n this.instantiationMode = \"LAZY\" /* LAZY */;\r\n this.onInstanceCreated = null;\r\n }\r\n setInstantiationMode(mode) {\r\n this.instantiationMode = mode;\r\n return this;\r\n }\r\n setMultipleInstances(multipleInstances) {\r\n this.multipleInstances = multipleInstances;\r\n return this;\r\n }\r\n setServiceProps(props) {\r\n this.serviceProps = props;\r\n return this;\r\n }\r\n setInstanceCreatedCallback(callback) {\r\n this.onInstanceCreated = callback;\r\n return this;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for instance for service name T, e.g. 'auth', 'auth-internal'\r\n * NameServiceMapping[T] is an alias for the type of the instance\r\n */\r\nclass Provider {\r\n constructor(name, container) {\r\n this.name = name;\r\n this.container = container;\r\n this.component = null;\r\n this.instances = new Map();\r\n this.instancesDeferred = new Map();\r\n this.instancesOptions = new Map();\r\n this.onInitCallbacks = new Map();\r\n }\r\n /**\r\n * @param identifier A provider can provide mulitple instances of a service\r\n * if this.component.multipleInstances is true.\r\n */\r\n get(identifier) {\r\n // if multipleInstances is not supported, use the default name\r\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\r\n if (!this.instancesDeferred.has(normalizedIdentifier)) {\r\n const deferred = new Deferred();\r\n this.instancesDeferred.set(normalizedIdentifier, deferred);\r\n if (this.isInitialized(normalizedIdentifier) ||\r\n this.shouldAutoInitialize()) {\r\n // initialize the service if it can be auto-initialized\r\n try {\r\n const instance = this.getOrInitializeService({\r\n instanceIdentifier: normalizedIdentifier\r\n });\r\n if (instance) {\r\n deferred.resolve(instance);\r\n }\r\n }\r\n catch (e) {\r\n // when the instance factory throws an exception during get(), it should not cause\r\n // a fatal error. We just return the unresolved promise in this case.\r\n }\r\n }\r\n }\r\n return this.instancesDeferred.get(normalizedIdentifier).promise;\r\n }\r\n getImmediate(options) {\r\n var _a;\r\n // if multipleInstances is not supported, use the default name\r\n const normalizedIdentifier = this.normalizeInstanceIdentifier(options === null || options === void 0 ? void 0 : options.identifier);\r\n const optional = (_a = options === null || options === void 0 ? void 0 : options.optional) !== null && _a !== void 0 ? _a : false;\r\n if (this.isInitialized(normalizedIdentifier) ||\r\n this.shouldAutoInitialize()) {\r\n try {\r\n return this.getOrInitializeService({\r\n instanceIdentifier: normalizedIdentifier\r\n });\r\n }\r\n catch (e) {\r\n if (optional) {\r\n return null;\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n else {\r\n // In case a component is not initialized and should/can not be auto-initialized at the moment, return null if the optional flag is set, or throw\r\n if (optional) {\r\n return null;\r\n }\r\n else {\r\n throw Error(`Service ${this.name} is not available`);\r\n }\r\n }\r\n }\r\n getComponent() {\r\n return this.component;\r\n }\r\n setComponent(component) {\r\n if (component.name !== this.name) {\r\n throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`);\r\n }\r\n if (this.component) {\r\n throw Error(`Component for ${this.name} has already been provided`);\r\n }\r\n this.component = component;\r\n // return early without attempting to initialize the component if the component requires explicit initialization (calling `Provider.initialize()`)\r\n if (!this.shouldAutoInitialize()) {\r\n return;\r\n }\r\n // if the service is eager, initialize the default instance\r\n if (isComponentEager(component)) {\r\n try {\r\n this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME });\r\n }\r\n catch (e) {\r\n // when the instance factory for an eager Component throws an exception during the eager\r\n // initialization, it should not cause a fatal error.\r\n // TODO: Investigate if we need to make it configurable, because some component may want to cause\r\n // a fatal error in this case?\r\n }\r\n }\r\n // Create service instances for the pending promises and resolve them\r\n // NOTE: if this.multipleInstances is false, only the default instance will be created\r\n // and all promises with resolve with it regardless of the identifier.\r\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\r\n const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\r\n try {\r\n // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.\r\n const instance = this.getOrInitializeService({\r\n instanceIdentifier: normalizedIdentifier\r\n });\r\n instanceDeferred.resolve(instance);\r\n }\r\n catch (e) {\r\n // when the instance factory throws an exception, it should not cause\r\n // a fatal error. We just leave the promise unresolved.\r\n }\r\n }\r\n }\r\n clearInstance(identifier = DEFAULT_ENTRY_NAME) {\r\n this.instancesDeferred.delete(identifier);\r\n this.instancesOptions.delete(identifier);\r\n this.instances.delete(identifier);\r\n }\r\n // app.delete() will call this method on every provider to delete the services\r\n // TODO: should we mark the provider as deleted?\r\n async delete() {\r\n const services = Array.from(this.instances.values());\r\n await Promise.all([\r\n ...services\r\n .filter(service => 'INTERNAL' in service) // legacy services\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map(service => service.INTERNAL.delete()),\r\n ...services\r\n .filter(service => '_delete' in service) // modularized services\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map(service => service._delete())\r\n ]);\r\n }\r\n isComponentSet() {\r\n return this.component != null;\r\n }\r\n isInitialized(identifier = DEFAULT_ENTRY_NAME) {\r\n return this.instances.has(identifier);\r\n }\r\n getOptions(identifier = DEFAULT_ENTRY_NAME) {\r\n return this.instancesOptions.get(identifier) || {};\r\n }\r\n initialize(opts = {}) {\r\n const { options = {} } = opts;\r\n const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);\r\n if (this.isInitialized(normalizedIdentifier)) {\r\n throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`);\r\n }\r\n if (!this.isComponentSet()) {\r\n throw Error(`Component ${this.name} has not been registered yet`);\r\n }\r\n const instance = this.getOrInitializeService({\r\n instanceIdentifier: normalizedIdentifier,\r\n options\r\n });\r\n // resolve any pending promise waiting for the service instance\r\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\r\n const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\r\n if (normalizedIdentifier === normalizedDeferredIdentifier) {\r\n instanceDeferred.resolve(instance);\r\n }\r\n }\r\n return instance;\r\n }\r\n /**\r\n *\r\n * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().\r\n * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.\r\n *\r\n * @param identifier An optional instance identifier\r\n * @returns a function to unregister the callback\r\n */\r\n onInit(callback, identifier) {\r\n var _a;\r\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\r\n const existingCallbacks = (_a = this.onInitCallbacks.get(normalizedIdentifier)) !== null && _a !== void 0 ? _a : new Set();\r\n existingCallbacks.add(callback);\r\n this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);\r\n const existingInstance = this.instances.get(normalizedIdentifier);\r\n if (existingInstance) {\r\n callback(existingInstance, normalizedIdentifier);\r\n }\r\n return () => {\r\n existingCallbacks.delete(callback);\r\n };\r\n }\r\n /**\r\n * Invoke onInit callbacks synchronously\r\n * @param instance the service instance`\r\n */\r\n invokeOnInitCallbacks(instance, identifier) {\r\n const callbacks = this.onInitCallbacks.get(identifier);\r\n if (!callbacks) {\r\n return;\r\n }\r\n for (const callback of callbacks) {\r\n try {\r\n callback(instance, identifier);\r\n }\r\n catch (_a) {\r\n // ignore errors in the onInit callback\r\n }\r\n }\r\n }\r\n getOrInitializeService({ instanceIdentifier, options = {} }) {\r\n let instance = this.instances.get(instanceIdentifier);\r\n if (!instance && this.component) {\r\n instance = this.component.instanceFactory(this.container, {\r\n instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),\r\n options\r\n });\r\n this.instances.set(instanceIdentifier, instance);\r\n this.instancesOptions.set(instanceIdentifier, options);\r\n /**\r\n * Invoke onInit listeners.\r\n * Note this.component.onInstanceCreated is different, which is used by the component creator,\r\n * while onInit listeners are registered by consumers of the provider.\r\n */\r\n this.invokeOnInitCallbacks(instance, instanceIdentifier);\r\n /**\r\n * Order is important\r\n * onInstanceCreated() should be called after this.instances.set(instanceIdentifier, instance); which\r\n * makes `isInitialized()` return true.\r\n */\r\n if (this.component.onInstanceCreated) {\r\n try {\r\n this.component.onInstanceCreated(this.container, instanceIdentifier, instance);\r\n }\r\n catch (_a) {\r\n // ignore errors in the onInstanceCreatedCallback\r\n }\r\n }\r\n }\r\n return instance || null;\r\n }\r\n normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME) {\r\n if (this.component) {\r\n return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME;\r\n }\r\n else {\r\n return identifier; // assume multiple instances are supported before the component is provided.\r\n }\r\n }\r\n shouldAutoInitialize() {\r\n return (!!this.component &&\r\n this.component.instantiationMode !== \"EXPLICIT\" /* EXPLICIT */);\r\n }\r\n}\r\n// undefined should be passed to the service factory for the default instance\r\nfunction normalizeIdentifierForFactory(identifier) {\r\n return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier;\r\n}\r\nfunction isComponentEager(component) {\r\n return component.instantiationMode === \"EAGER\" /* EAGER */;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`\r\n */\r\nclass ComponentContainer {\r\n constructor(name) {\r\n this.name = name;\r\n this.providers = new Map();\r\n }\r\n /**\r\n *\r\n * @param component Component being added\r\n * @param overwrite When a component with the same name has already been registered,\r\n * if overwrite is true: overwrite the existing component with the new component and create a new\r\n * provider with the new component. It can be useful in tests where you want to use different mocks\r\n * for different tests.\r\n * if overwrite is false: throw an exception\r\n */\r\n addComponent(component) {\r\n const provider = this.getProvider(component.name);\r\n if (provider.isComponentSet()) {\r\n throw new Error(`Component ${component.name} has already been registered with ${this.name}`);\r\n }\r\n provider.setComponent(component);\r\n }\r\n addOrOverwriteComponent(component) {\r\n const provider = this.getProvider(component.name);\r\n if (provider.isComponentSet()) {\r\n // delete the existing provider from the container, so we can register the new component\r\n this.providers.delete(component.name);\r\n }\r\n this.addComponent(component);\r\n }\r\n /**\r\n * getProvider provides a type safe interface where it can only be called with a field name\r\n * present in NameServiceMapping interface.\r\n *\r\n * Firebase SDKs providing services should extend NameServiceMapping interface to register\r\n * themselves.\r\n */\r\n getProvider(name) {\r\n if (this.providers.has(name)) {\r\n return this.providers.get(name);\r\n }\r\n // create a Provider for a service that hasn't registered with Firebase\r\n const provider = new Provider(name, this);\r\n this.providers.set(name, provider);\r\n return provider;\r\n }\r\n getProviders() {\r\n return Array.from(this.providers.values());\r\n }\r\n}\n\nexport { Component, ComponentContainer, Provider };\n//# sourceMappingURL=index.esm2017.js.map\n","/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * A container for all of the Logger instances\r\n */\r\nconst instances = [];\r\n/**\r\n * The JS SDK supports 5 log levels and also allows a user the ability to\r\n * silence the logs altogether.\r\n *\r\n * The order is a follows:\r\n * DEBUG < VERBOSE < INFO < WARN < ERROR\r\n *\r\n * All of the log types above the current log level will be captured (i.e. if\r\n * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and\r\n * `VERBOSE` logs will not)\r\n */\r\nvar LogLevel;\r\n(function (LogLevel) {\r\n LogLevel[LogLevel[\"DEBUG\"] = 0] = \"DEBUG\";\r\n LogLevel[LogLevel[\"VERBOSE\"] = 1] = \"VERBOSE\";\r\n LogLevel[LogLevel[\"INFO\"] = 2] = \"INFO\";\r\n LogLevel[LogLevel[\"WARN\"] = 3] = \"WARN\";\r\n LogLevel[LogLevel[\"ERROR\"] = 4] = \"ERROR\";\r\n LogLevel[LogLevel[\"SILENT\"] = 5] = \"SILENT\";\r\n})(LogLevel || (LogLevel = {}));\r\nconst levelStringToEnum = {\r\n 'debug': LogLevel.DEBUG,\r\n 'verbose': LogLevel.VERBOSE,\r\n 'info': LogLevel.INFO,\r\n 'warn': LogLevel.WARN,\r\n 'error': LogLevel.ERROR,\r\n 'silent': LogLevel.SILENT\r\n};\r\n/**\r\n * The default log level\r\n */\r\nconst defaultLogLevel = LogLevel.INFO;\r\n/**\r\n * By default, `console.debug` is not displayed in the developer console (in\r\n * chrome). To avoid forcing users to have to opt-in to these logs twice\r\n * (i.e. once for firebase, and once in the console), we are sending `DEBUG`\r\n * logs to the `console.log` function.\r\n */\r\nconst ConsoleMethod = {\r\n [LogLevel.DEBUG]: 'log',\r\n [LogLevel.VERBOSE]: 'log',\r\n [LogLevel.INFO]: 'info',\r\n [LogLevel.WARN]: 'warn',\r\n [LogLevel.ERROR]: 'error'\r\n};\r\n/**\r\n * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR\r\n * messages on to their corresponding console counterparts (if the log method\r\n * is supported by the current log level)\r\n */\r\nconst defaultLogHandler = (instance, logType, ...args) => {\r\n if (logType < instance.logLevel) {\r\n return;\r\n }\r\n const now = new Date().toISOString();\r\n const method = ConsoleMethod[logType];\r\n if (method) {\r\n console[method](`[${now}] ${instance.name}:`, ...args);\r\n }\r\n else {\r\n throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);\r\n }\r\n};\r\nclass Logger {\r\n /**\r\n * Gives you an instance of a Logger to capture messages according to\r\n * Firebase's logging scheme.\r\n *\r\n * @param name The name that the logs will be associated with\r\n */\r\n constructor(name) {\r\n this.name = name;\r\n /**\r\n * The log level of the given Logger instance.\r\n */\r\n this._logLevel = defaultLogLevel;\r\n /**\r\n * The main (internal) log handler for the Logger instance.\r\n * Can be set to a new function in internal package code but not by user.\r\n */\r\n this._logHandler = defaultLogHandler;\r\n /**\r\n * The optional, additional, user-defined log handler for the Logger instance.\r\n */\r\n this._userLogHandler = null;\r\n /**\r\n * Capture the current instance for later use\r\n */\r\n instances.push(this);\r\n }\r\n get logLevel() {\r\n return this._logLevel;\r\n }\r\n set logLevel(val) {\r\n if (!(val in LogLevel)) {\r\n throw new TypeError(`Invalid value \"${val}\" assigned to \\`logLevel\\``);\r\n }\r\n this._logLevel = val;\r\n }\r\n // Workaround for setter/getter having to be the same type.\r\n setLogLevel(val) {\r\n this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;\r\n }\r\n get logHandler() {\r\n return this._logHandler;\r\n }\r\n set logHandler(val) {\r\n if (typeof val !== 'function') {\r\n throw new TypeError('Value assigned to `logHandler` must be a function');\r\n }\r\n this._logHandler = val;\r\n }\r\n get userLogHandler() {\r\n return this._userLogHandler;\r\n }\r\n set userLogHandler(val) {\r\n this._userLogHandler = val;\r\n }\r\n /**\r\n * The functions below are all based on the `console` interface\r\n */\r\n debug(...args) {\r\n this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);\r\n this._logHandler(this, LogLevel.DEBUG, ...args);\r\n }\r\n log(...args) {\r\n this._userLogHandler &&\r\n this._userLogHandler(this, LogLevel.VERBOSE, ...args);\r\n this._logHandler(this, LogLevel.VERBOSE, ...args);\r\n }\r\n info(...args) {\r\n this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);\r\n this._logHandler(this, LogLevel.INFO, ...args);\r\n }\r\n warn(...args) {\r\n this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);\r\n this._logHandler(this, LogLevel.WARN, ...args);\r\n }\r\n error(...args) {\r\n this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);\r\n this._logHandler(this, LogLevel.ERROR, ...args);\r\n }\r\n}\r\nfunction setLogLevel(level) {\r\n instances.forEach(inst => {\r\n inst.setLogLevel(level);\r\n });\r\n}\r\nfunction setUserLogHandler(logCallback, options) {\r\n for (const instance of instances) {\r\n let customLogLevel = null;\r\n if (options && options.level) {\r\n customLogLevel = levelStringToEnum[options.level];\r\n }\r\n if (logCallback === null) {\r\n instance.userLogHandler = null;\r\n }\r\n else {\r\n instance.userLogHandler = (instance, level, ...args) => {\r\n const message = args\r\n .map(arg => {\r\n if (arg == null) {\r\n return null;\r\n }\r\n else if (typeof arg === 'string') {\r\n return arg;\r\n }\r\n else if (typeof arg === 'number' || typeof arg === 'boolean') {\r\n return arg.toString();\r\n }\r\n else if (arg instanceof Error) {\r\n return arg.message;\r\n }\r\n else {\r\n try {\r\n return JSON.stringify(arg);\r\n }\r\n catch (ignored) {\r\n return null;\r\n }\r\n }\r\n })\r\n .filter(arg => arg)\r\n .join(' ');\r\n if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {\r\n logCallback({\r\n level: LogLevel[level].toLowerCase(),\r\n message,\r\n args,\r\n type: instance.name\r\n });\r\n }\r\n };\r\n }\r\n }\r\n}\n\nexport { LogLevel, Logger, setLogLevel, setUserLogHandler };\n//# sourceMappingURL=index.esm2017.js.map\n","import { Component, ComponentContainer } from '@firebase/component';\nimport { Logger, setUserLogHandler, setLogLevel as setLogLevel$1 } from '@firebase/logger';\nimport { ErrorFactory, deepEqual } from '@firebase/util';\nexport { FirebaseError } from '@firebase/util';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass PlatformLoggerServiceImpl {\r\n constructor(container) {\r\n this.container = container;\r\n }\r\n // In initial implementation, this will be called by installations on\r\n // auth token refresh, and installations will send this string.\r\n getPlatformInfoString() {\r\n const providers = this.container.getProviders();\r\n // Loop through providers and get library/version pairs from any that are\r\n // version components.\r\n return providers\r\n .map(provider => {\r\n if (isVersionServiceProvider(provider)) {\r\n const service = provider.getImmediate();\r\n return `${service.library}/${service.version}`;\r\n }\r\n else {\r\n return null;\r\n }\r\n })\r\n .filter(logString => logString)\r\n .join(' ');\r\n }\r\n}\r\n/**\r\n *\r\n * @param provider check if this provider provides a VersionService\r\n *\r\n * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider\r\n * provides VersionService. The provider is not necessarily a 'app-version'\r\n * provider.\r\n */\r\nfunction isVersionServiceProvider(provider) {\r\n const component = provider.getComponent();\r\n return (component === null || component === void 0 ? void 0 : component.type) === \"VERSION\" /* VERSION */;\r\n}\n\nconst name$o = \"@firebase/app\";\nconst version$1 = \"0.7.16\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst logger = new Logger('@firebase/app');\n\nconst name$n = \"@firebase/app-compat\";\n\nconst name$m = \"@firebase/analytics-compat\";\n\nconst name$l = \"@firebase/analytics\";\n\nconst name$k = \"@firebase/app-check-compat\";\n\nconst name$j = \"@firebase/app-check\";\n\nconst name$i = \"@firebase/auth\";\n\nconst name$h = \"@firebase/auth-compat\";\n\nconst name$g = \"@firebase/database\";\n\nconst name$f = \"@firebase/database-compat\";\n\nconst name$e = \"@firebase/functions\";\n\nconst name$d = \"@firebase/functions-compat\";\n\nconst name$c = \"@firebase/installations\";\n\nconst name$b = \"@firebase/installations-compat\";\n\nconst name$a = \"@firebase/messaging\";\n\nconst name$9 = \"@firebase/messaging-compat\";\n\nconst name$8 = \"@firebase/performance\";\n\nconst name$7 = \"@firebase/performance-compat\";\n\nconst name$6 = \"@firebase/remote-config\";\n\nconst name$5 = \"@firebase/remote-config-compat\";\n\nconst name$4 = \"@firebase/storage\";\n\nconst name$3 = \"@firebase/storage-compat\";\n\nconst name$2 = \"@firebase/firestore\";\n\nconst name$1 = \"@firebase/firestore-compat\";\n\nconst name = \"firebase\";\nconst version = \"9.6.6\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * The default app name\r\n *\r\n * @internal\r\n */\r\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\r\nconst PLATFORM_LOG_STRING = {\r\n [name$o]: 'fire-core',\r\n [name$n]: 'fire-core-compat',\r\n [name$l]: 'fire-analytics',\r\n [name$m]: 'fire-analytics-compat',\r\n [name$j]: 'fire-app-check',\r\n [name$k]: 'fire-app-check-compat',\r\n [name$i]: 'fire-auth',\r\n [name$h]: 'fire-auth-compat',\r\n [name$g]: 'fire-rtdb',\r\n [name$f]: 'fire-rtdb-compat',\r\n [name$e]: 'fire-fn',\r\n [name$d]: 'fire-fn-compat',\r\n [name$c]: 'fire-iid',\r\n [name$b]: 'fire-iid-compat',\r\n [name$a]: 'fire-fcm',\r\n [name$9]: 'fire-fcm-compat',\r\n [name$8]: 'fire-perf',\r\n [name$7]: 'fire-perf-compat',\r\n [name$6]: 'fire-rc',\r\n [name$5]: 'fire-rc-compat',\r\n [name$4]: 'fire-gcs',\r\n [name$3]: 'fire-gcs-compat',\r\n [name$2]: 'fire-fst',\r\n [name$1]: 'fire-fst-compat',\r\n 'fire-js': 'fire-js',\r\n [name]: 'fire-js-all'\r\n};\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * @internal\r\n */\r\nconst _apps = new Map();\r\n/**\r\n * Registered components.\r\n *\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nconst _components = new Map();\r\n/**\r\n * @param component - the component being added to this app's container\r\n *\r\n * @internal\r\n */\r\nfunction _addComponent(app, component) {\r\n try {\r\n app.container.addComponent(component);\r\n }\r\n catch (e) {\r\n logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);\r\n }\r\n}\r\n/**\r\n *\r\n * @internal\r\n */\r\nfunction _addOrOverwriteComponent(app, component) {\r\n app.container.addOrOverwriteComponent(component);\r\n}\r\n/**\r\n *\r\n * @param component - the component to register\r\n * @returns whether or not the component is registered successfully\r\n *\r\n * @internal\r\n */\r\nfunction _registerComponent(component) {\r\n const componentName = component.name;\r\n if (_components.has(componentName)) {\r\n logger.debug(`There were multiple attempts to register component ${componentName}.`);\r\n return false;\r\n }\r\n _components.set(componentName, component);\r\n // add the component to existing app instances\r\n for (const app of _apps.values()) {\r\n _addComponent(app, component);\r\n }\r\n return true;\r\n}\r\n/**\r\n *\r\n * @param app - FirebaseApp instance\r\n * @param name - service name\r\n *\r\n * @returns the provider for the service with the matching name\r\n *\r\n * @internal\r\n */\r\nfunction _getProvider(app, name) {\r\n return app.container.getProvider(name);\r\n}\r\n/**\r\n *\r\n * @param app - FirebaseApp instance\r\n * @param name - service name\r\n * @param instanceIdentifier - service instance identifier in case the service supports multiple instances\r\n *\r\n * @internal\r\n */\r\nfunction _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NAME) {\r\n _getProvider(app, name).clearInstance(instanceIdentifier);\r\n}\r\n/**\r\n * Test only\r\n *\r\n * @internal\r\n */\r\nfunction _clearComponents() {\r\n _components.clear();\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst ERRORS = {\r\n [\"no-app\" /* NO_APP */]: \"No Firebase App '{$appName}' has been created - \" +\r\n 'call Firebase App.initializeApp()',\r\n [\"bad-app-name\" /* BAD_APP_NAME */]: \"Illegal App name: '{$appName}\",\r\n [\"duplicate-app\" /* DUPLICATE_APP */]: \"Firebase App named '{$appName}' already exists with different options or config\",\r\n [\"app-deleted\" /* APP_DELETED */]: \"Firebase App named '{$appName}' already deleted\",\r\n [\"invalid-app-argument\" /* INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +\r\n 'Firebase App instance.',\r\n [\"invalid-log-argument\" /* INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.'\r\n};\r\nconst ERROR_FACTORY = new ErrorFactory('app', 'Firebase', ERRORS);\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass FirebaseAppImpl {\r\n constructor(options, config, container) {\r\n this._isDeleted = false;\r\n this._options = Object.assign({}, options);\r\n this._config = Object.assign({}, config);\r\n this._name = config.name;\r\n this._automaticDataCollectionEnabled =\r\n config.automaticDataCollectionEnabled;\r\n this._container = container;\r\n this.container.addComponent(new Component('app', () => this, \"PUBLIC\" /* PUBLIC */));\r\n }\r\n get automaticDataCollectionEnabled() {\r\n this.checkDestroyed();\r\n return this._automaticDataCollectionEnabled;\r\n }\r\n set automaticDataCollectionEnabled(val) {\r\n this.checkDestroyed();\r\n this._automaticDataCollectionEnabled = val;\r\n }\r\n get name() {\r\n this.checkDestroyed();\r\n return this._name;\r\n }\r\n get options() {\r\n this.checkDestroyed();\r\n return this._options;\r\n }\r\n get config() {\r\n this.checkDestroyed();\r\n return this._config;\r\n }\r\n get container() {\r\n return this._container;\r\n }\r\n get isDeleted() {\r\n return this._isDeleted;\r\n }\r\n set isDeleted(val) {\r\n this._isDeleted = val;\r\n }\r\n /**\r\n * This function will throw an Error if the App has already been deleted -\r\n * use before performing API actions on the App.\r\n */\r\n checkDestroyed() {\r\n if (this.isDeleted) {\r\n throw ERROR_FACTORY.create(\"app-deleted\" /* APP_DELETED */, { appName: this._name });\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * The current SDK version.\r\n *\r\n * @public\r\n */\r\nconst SDK_VERSION = version;\r\nfunction initializeApp(options, rawConfig = {}) {\r\n if (typeof rawConfig !== 'object') {\r\n const name = rawConfig;\r\n rawConfig = { name };\r\n }\r\n const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);\r\n const name = config.name;\r\n if (typeof name !== 'string' || !name) {\r\n throw ERROR_FACTORY.create(\"bad-app-name\" /* BAD_APP_NAME */, {\r\n appName: String(name)\r\n });\r\n }\r\n const existingApp = _apps.get(name);\r\n if (existingApp) {\r\n // return the existing app if options and config deep equal the ones in the existing app.\r\n if (deepEqual(options, existingApp.options) &&\r\n deepEqual(config, existingApp.config)) {\r\n return existingApp;\r\n }\r\n else {\r\n throw ERROR_FACTORY.create(\"duplicate-app\" /* DUPLICATE_APP */, { appName: name });\r\n }\r\n }\r\n const container = new ComponentContainer(name);\r\n for (const component of _components.values()) {\r\n container.addComponent(component);\r\n }\r\n const newApp = new FirebaseAppImpl(options, config, container);\r\n _apps.set(name, newApp);\r\n return newApp;\r\n}\r\n/**\r\n * Retrieves a {@link @firebase/app#FirebaseApp} instance.\r\n *\r\n * When called with no arguments, the default app is returned. When an app name\r\n * is provided, the app corresponding to that name is returned.\r\n *\r\n * An exception is thrown if the app being retrieved has not yet been\r\n * initialized.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Return the default app\r\n * const app = getApp();\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Return a named app\r\n * const otherApp = getApp(\"otherApp\");\r\n * ```\r\n *\r\n * @param name - Optional name of the app to return. If no name is\r\n * provided, the default is `\"[DEFAULT]\"`.\r\n *\r\n * @returns The app corresponding to the provided app name.\r\n * If no app name is provided, the default app is returned.\r\n *\r\n * @public\r\n */\r\nfunction getApp(name = DEFAULT_ENTRY_NAME) {\r\n const app = _apps.get(name);\r\n if (!app) {\r\n throw ERROR_FACTORY.create(\"no-app\" /* NO_APP */, { appName: name });\r\n }\r\n return app;\r\n}\r\n/**\r\n * A (read-only) array of all initialized apps.\r\n * @public\r\n */\r\nfunction getApps() {\r\n return Array.from(_apps.values());\r\n}\r\n/**\r\n * Renders this app unusable and frees the resources of all associated\r\n * services.\r\n *\r\n * @example\r\n * ```javascript\r\n * deleteApp(app)\r\n * .then(function() {\r\n * console.log(\"App deleted successfully\");\r\n * })\r\n * .catch(function(error) {\r\n * console.log(\"Error deleting app:\", error);\r\n * });\r\n * ```\r\n *\r\n * @public\r\n */\r\nasync function deleteApp(app) {\r\n const name = app.name;\r\n if (_apps.has(name)) {\r\n _apps.delete(name);\r\n await Promise.all(app.container\r\n .getProviders()\r\n .map(provider => provider.delete()));\r\n app.isDeleted = true;\r\n }\r\n}\r\n/**\r\n * Registers a library's name and version for platform logging purposes.\r\n * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)\r\n * @param version - Current version of that library.\r\n * @param variant - Bundle variant, e.g., node, rn, etc.\r\n *\r\n * @public\r\n */\r\nfunction registerVersion(libraryKeyOrName, version, variant) {\r\n var _a;\r\n // TODO: We can use this check to whitelist strings when/if we set up\r\n // a good whitelist system.\r\n let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;\r\n if (variant) {\r\n library += `-${variant}`;\r\n }\r\n const libraryMismatch = library.match(/\\s|\\//);\r\n const versionMismatch = version.match(/\\s|\\//);\r\n if (libraryMismatch || versionMismatch) {\r\n const warning = [\r\n `Unable to register library \"${library}\" with version \"${version}\":`\r\n ];\r\n if (libraryMismatch) {\r\n warning.push(`library name \"${library}\" contains illegal characters (whitespace or \"/\")`);\r\n }\r\n if (libraryMismatch && versionMismatch) {\r\n warning.push('and');\r\n }\r\n if (versionMismatch) {\r\n warning.push(`version name \"${version}\" contains illegal characters (whitespace or \"/\")`);\r\n }\r\n logger.warn(warning.join(' '));\r\n return;\r\n }\r\n _registerComponent(new Component(`${library}-version`, () => ({ library, version }), \"VERSION\" /* VERSION */));\r\n}\r\n/**\r\n * Sets log handler for all Firebase SDKs.\r\n * @param logCallback - An optional custom log handler that executes user code whenever\r\n * the Firebase SDK makes a logging call.\r\n *\r\n * @public\r\n */\r\nfunction onLog(logCallback, options) {\r\n if (logCallback !== null && typeof logCallback !== 'function') {\r\n throw ERROR_FACTORY.create(\"invalid-log-argument\" /* INVALID_LOG_ARGUMENT */);\r\n }\r\n setUserLogHandler(logCallback, options);\r\n}\r\n/**\r\n * Sets log level for all Firebase SDKs.\r\n *\r\n * All of the log types above the current log level are captured (i.e. if\r\n * you set the log level to `info`, errors are logged, but `debug` and\r\n * `verbose` logs are not).\r\n *\r\n * @public\r\n */\r\nfunction setLogLevel(logLevel) {\r\n setLogLevel$1(logLevel);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction registerCoreComponents(variant) {\r\n _registerComponent(new Component('platform-logger', container => new PlatformLoggerServiceImpl(container), \"PRIVATE\" /* PRIVATE */));\r\n // Register `app` package.\r\n registerVersion(name$o, version$1, variant);\r\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\r\n registerVersion(name$o, version$1, 'esm2017');\r\n // Register platform SDK identifier (no version).\r\n registerVersion('fire-js', '');\r\n}\n\n/**\r\n * Firebase App\r\n *\r\n * @remarks This package coordinates the communication between the different Firebase components\r\n * @packageDocumentation\r\n */\r\nregisterCoreComponents('');\n\nexport { SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _registerComponent, _removeServiceInstance, deleteApp, getApp, getApps, initializeApp, onLog, registerVersion, setLogLevel };\n//# sourceMappingURL=index.esm2017.js.map\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","import { ErrorFactory, deepEqual, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, getUA, isIE, createSubscribe, querystringDecode, extractQuerystring, isEmpty } from '@firebase/util';\nimport { SDK_VERSION, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';\nimport { __rest } from 'tslib';\nimport { Logger, LogLevel } from '@firebase/logger';\nimport { Component } from '@firebase/component';\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * An enum of factors that may be used for multifactor authentication.\r\n *\r\n * @public\r\n */\r\nconst FactorId = {\r\n /** Phone as second factor */\r\n PHONE: 'phone'\r\n};\r\n/**\r\n * Enumeration of supported providers.\r\n *\r\n * @public\r\n */\r\nconst ProviderId = {\r\n /** Facebook provider ID */\r\n FACEBOOK: 'facebook.com',\r\n /** GitHub provider ID */\r\n GITHUB: 'github.com',\r\n /** Google provider ID */\r\n GOOGLE: 'google.com',\r\n /** Password provider */\r\n PASSWORD: 'password',\r\n /** Phone provider */\r\n PHONE: 'phone',\r\n /** Twitter provider ID */\r\n TWITTER: 'twitter.com'\r\n};\r\n/**\r\n * Enumeration of supported sign-in methods.\r\n *\r\n * @public\r\n */\r\nconst SignInMethod = {\r\n /** Email link sign in method */\r\n EMAIL_LINK: 'emailLink',\r\n /** Email/password sign in method */\r\n EMAIL_PASSWORD: 'password',\r\n /** Facebook sign in method */\r\n FACEBOOK: 'facebook.com',\r\n /** GitHub sign in method */\r\n GITHUB: 'github.com',\r\n /** Google sign in method */\r\n GOOGLE: 'google.com',\r\n /** Phone sign in method */\r\n PHONE: 'phone',\r\n /** Twitter sign in method */\r\n TWITTER: 'twitter.com'\r\n};\r\n/**\r\n * Enumeration of supported operation types.\r\n *\r\n * @public\r\n */\r\nconst OperationType = {\r\n /** Operation involving linking an additional provider to an already signed-in user. */\r\n LINK: 'link',\r\n /** Operation involving using a provider to reauthenticate an already signed-in user. */\r\n REAUTHENTICATE: 'reauthenticate',\r\n /** Operation involving signing in a user. */\r\n SIGN_IN: 'signIn'\r\n};\r\n/**\r\n * An enumeration of the possible email action types.\r\n *\r\n * @public\r\n */\r\nconst ActionCodeOperation = {\r\n /** The email link sign-in action. */\r\n EMAIL_SIGNIN: 'EMAIL_SIGNIN',\r\n /** The password reset action. */\r\n PASSWORD_RESET: 'PASSWORD_RESET',\r\n /** The email revocation action. */\r\n RECOVER_EMAIL: 'RECOVER_EMAIL',\r\n /** The revert second factor addition email action. */\r\n REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION',\r\n /** The revert second factor addition email action. */\r\n VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL',\r\n /** The email verification action. */\r\n VERIFY_EMAIL: 'VERIFY_EMAIL'\r\n};\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _debugErrorMap() {\r\n return {\r\n [\"admin-restricted-operation\" /* ADMIN_ONLY_OPERATION */]: 'This operation is restricted to administrators only.',\r\n [\"argument-error\" /* ARGUMENT_ERROR */]: '',\r\n [\"app-not-authorized\" /* APP_NOT_AUTHORIZED */]: \"This app, identified by the domain where it's hosted, is not \" +\r\n 'authorized to use Firebase Authentication with the provided API key. ' +\r\n 'Review your key configuration in the Google API console.',\r\n [\"app-not-installed\" /* APP_NOT_INSTALLED */]: 'The requested mobile application corresponding to the identifier (' +\r\n 'Android package name or iOS bundle ID) provided is not installed on ' +\r\n 'this device.',\r\n [\"captcha-check-failed\" /* CAPTCHA_CHECK_FAILED */]: 'The reCAPTCHA response token provided is either invalid, expired, ' +\r\n 'already used or the domain associated with it does not match the list ' +\r\n 'of whitelisted domains.',\r\n [\"code-expired\" /* CODE_EXPIRED */]: 'The SMS code has expired. Please re-send the verification code to try ' +\r\n 'again.',\r\n [\"cordova-not-ready\" /* CORDOVA_NOT_READY */]: 'Cordova framework is not ready.',\r\n [\"cors-unsupported\" /* CORS_UNSUPPORTED */]: 'This browser is not supported.',\r\n [\"credential-already-in-use\" /* CREDENTIAL_ALREADY_IN_USE */]: 'This credential is already associated with a different user account.',\r\n [\"custom-token-mismatch\" /* CREDENTIAL_MISMATCH */]: 'The custom token corresponds to a different audience.',\r\n [\"requires-recent-login\" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: 'This operation is sensitive and requires recent authentication. Log in ' +\r\n 'again before retrying this request.',\r\n [\"dependent-sdk-initialized-before-auth\" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +\r\n 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +\r\n 'starting any other Firebase SDK.',\r\n [\"dynamic-link-not-activated\" /* DYNAMIC_LINK_NOT_ACTIVATED */]: 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +\r\n 'conditions.',\r\n [\"email-change-needs-verification\" /* EMAIL_CHANGE_NEEDS_VERIFICATION */]: 'Multi-factor users must always have a verified email.',\r\n [\"email-already-in-use\" /* EMAIL_EXISTS */]: 'The email address is already in use by another account.',\r\n [\"emulator-config-failed\" /* EMULATOR_CONFIG_FAILED */]: 'Auth instance has already been used to make a network call. Auth can ' +\r\n 'no longer be configured to use the emulator. Try calling ' +\r\n '\"connectAuthEmulator()\" sooner.',\r\n [\"expired-action-code\" /* EXPIRED_OOB_CODE */]: 'The action code has expired.',\r\n [\"cancelled-popup-request\" /* EXPIRED_POPUP_REQUEST */]: 'This operation has been cancelled due to another conflicting popup being opened.',\r\n [\"internal-error\" /* INTERNAL_ERROR */]: 'An internal AuthError has occurred.',\r\n [\"invalid-app-credential\" /* INVALID_APP_CREDENTIAL */]: 'The phone verification request contains an invalid application verifier.' +\r\n ' The reCAPTCHA token response is either invalid or expired.',\r\n [\"invalid-app-id\" /* INVALID_APP_ID */]: 'The mobile app identifier is not registed for the current project.',\r\n [\"invalid-user-token\" /* INVALID_AUTH */]: \"This user's credential isn't valid for this project. This can happen \" +\r\n \"if the user's token has been tampered with, or if the user isn't for \" +\r\n 'the project associated with this API key.',\r\n [\"invalid-auth-event\" /* INVALID_AUTH_EVENT */]: 'An internal AuthError has occurred.',\r\n [\"invalid-verification-code\" /* INVALID_CODE */]: 'The SMS verification code used to create the phone auth credential is ' +\r\n 'invalid. Please resend the verification code sms and be sure to use the ' +\r\n 'verification code provided by the user.',\r\n [\"invalid-continue-uri\" /* INVALID_CONTINUE_URI */]: 'The continue URL provided in the request is invalid.',\r\n [\"invalid-cordova-configuration\" /* INVALID_CORDOVA_CONFIGURATION */]: 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +\r\n 'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +\r\n 'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +\r\n 'cordova-plugin-customurlscheme.',\r\n [\"invalid-custom-token\" /* INVALID_CUSTOM_TOKEN */]: 'The custom token format is incorrect. Please check the documentation.',\r\n [\"invalid-dynamic-link-domain\" /* INVALID_DYNAMIC_LINK_DOMAIN */]: 'The provided dynamic link domain is not configured or authorized for the current project.',\r\n [\"invalid-email\" /* INVALID_EMAIL */]: 'The email address is badly formatted.',\r\n [\"invalid-emulator-scheme\" /* INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).',\r\n [\"invalid-api-key\" /* INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.',\r\n [\"invalid-cert-hash\" /* INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.',\r\n [\"invalid-credential\" /* INVALID_IDP_RESPONSE */]: 'The supplied auth credential is malformed or has expired.',\r\n [\"invalid-message-payload\" /* INVALID_MESSAGE_PAYLOAD */]: 'The email template corresponding to this action contains invalid characters in its message. ' +\r\n 'Please fix by going to the Auth email templates section in the Firebase Console.',\r\n [\"invalid-multi-factor-session\" /* INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.',\r\n [\"invalid-oauth-provider\" /* INVALID_OAUTH_PROVIDER */]: 'EmailAuthProvider is not supported for this operation. This operation ' +\r\n 'only supports OAuth providers.',\r\n [\"invalid-oauth-client-id\" /* INVALID_OAUTH_CLIENT_ID */]: 'The OAuth client ID provided is either invalid or does not match the ' +\r\n 'specified API key.',\r\n [\"unauthorized-domain\" /* INVALID_ORIGIN */]: 'This domain is not authorized for OAuth operations for your Firebase ' +\r\n 'project. Edit the list of authorized domains from the Firebase console.',\r\n [\"invalid-action-code\" /* INVALID_OOB_CODE */]: 'The action code is invalid. This can happen if the code is malformed, ' +\r\n 'expired, or has already been used.',\r\n [\"wrong-password\" /* INVALID_PASSWORD */]: 'The password is invalid or the user does not have a password.',\r\n [\"invalid-persistence-type\" /* INVALID_PERSISTENCE */]: 'The specified persistence type is invalid. It can only be local, session or none.',\r\n [\"invalid-phone-number\" /* INVALID_PHONE_NUMBER */]: 'The format of the phone number provided is incorrect. Please enter the ' +\r\n 'phone number in a format that can be parsed into E.164 format. E.164 ' +\r\n 'phone numbers are written in the format [+][country code][subscriber ' +\r\n 'number including area code].',\r\n [\"invalid-provider-id\" /* INVALID_PROVIDER_ID */]: 'The specified provider ID is invalid.',\r\n [\"invalid-recipient-email\" /* INVALID_RECIPIENT_EMAIL */]: 'The email corresponding to this action failed to send as the provided ' +\r\n 'recipient email address is invalid.',\r\n [\"invalid-sender\" /* INVALID_SENDER */]: 'The email template corresponding to this action contains an invalid sender email or name. ' +\r\n 'Please fix by going to the Auth email templates section in the Firebase Console.',\r\n [\"invalid-verification-id\" /* INVALID_SESSION_INFO */]: 'The verification ID used to create the phone auth credential is invalid.',\r\n [\"invalid-tenant-id\" /* INVALID_TENANT_ID */]: \"The Auth instance's tenant ID is invalid.\",\r\n [\"missing-android-pkg-name\" /* MISSING_ANDROID_PACKAGE_NAME */]: 'An Android Package Name must be provided if the Android App is required to be installed.',\r\n [\"auth-domain-config-required\" /* MISSING_AUTH_DOMAIN */]: 'Be sure to include authDomain when calling firebase.initializeApp(), ' +\r\n 'by following the instructions in the Firebase console.',\r\n [\"missing-app-credential\" /* MISSING_APP_CREDENTIAL */]: 'The phone verification request is missing an application verifier ' +\r\n 'assertion. A reCAPTCHA response token needs to be provided.',\r\n [\"missing-verification-code\" /* MISSING_CODE */]: 'The phone auth credential was created with an empty SMS verification code.',\r\n [\"missing-continue-uri\" /* MISSING_CONTINUE_URI */]: 'A continue URL must be provided in the request.',\r\n [\"missing-iframe-start\" /* MISSING_IFRAME_START */]: 'An internal AuthError has occurred.',\r\n [\"missing-ios-bundle-id\" /* MISSING_IOS_BUNDLE_ID */]: 'An iOS Bundle ID must be provided if an App Store ID is provided.',\r\n [\"missing-or-invalid-nonce\" /* MISSING_OR_INVALID_NONCE */]: 'The request does not contain a valid nonce. This can occur if the ' +\r\n 'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +\r\n 'in the ID token payload.',\r\n [\"missing-multi-factor-info\" /* MISSING_MFA_INFO */]: 'No second factor identifier is provided.',\r\n [\"missing-multi-factor-session\" /* MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.',\r\n [\"missing-phone-number\" /* MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.',\r\n [\"missing-verification-id\" /* MISSING_SESSION_INFO */]: 'The phone auth credential was created with an empty verification ID.',\r\n [\"app-deleted\" /* MODULE_DESTROYED */]: 'This instance of FirebaseApp has been deleted.',\r\n [\"multi-factor-info-not-found\" /* MFA_INFO_NOT_FOUND */]: 'The user does not have a second factor matching the identifier provided.',\r\n [\"multi-factor-auth-required\" /* MFA_REQUIRED */]: 'Proof of ownership of a second factor is required to complete sign-in.',\r\n [\"account-exists-with-different-credential\" /* NEED_CONFIRMATION */]: 'An account already exists with the same email address but different ' +\r\n 'sign-in credentials. Sign in using a provider associated with this ' +\r\n 'email address.',\r\n [\"network-request-failed\" /* NETWORK_REQUEST_FAILED */]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',\r\n [\"no-auth-event\" /* NO_AUTH_EVENT */]: 'An internal AuthError has occurred.',\r\n [\"no-such-provider\" /* NO_SUCH_PROVIDER */]: 'User was not linked to an account with the given provider.',\r\n [\"null-user\" /* NULL_USER */]: 'A null user object was provided as the argument for an operation which ' +\r\n 'requires a non-null user object.',\r\n [\"operation-not-allowed\" /* OPERATION_NOT_ALLOWED */]: 'The given sign-in provider is disabled for this Firebase project. ' +\r\n 'Enable it in the Firebase console, under the sign-in method tab of the ' +\r\n 'Auth section.',\r\n [\"operation-not-supported-in-this-environment\" /* OPERATION_NOT_SUPPORTED */]: 'This operation is not supported in the environment this application is ' +\r\n 'running on. \"location.protocol\" must be http, https or chrome-extension' +\r\n ' and web storage must be enabled.',\r\n [\"popup-blocked\" /* POPUP_BLOCKED */]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.',\r\n [\"popup-closed-by-user\" /* POPUP_CLOSED_BY_USER */]: 'The popup has been closed by the user before finalizing the operation.',\r\n [\"provider-already-linked\" /* PROVIDER_ALREADY_LINKED */]: 'User can only be linked to one identity for the given provider.',\r\n [\"quota-exceeded\" /* QUOTA_EXCEEDED */]: \"The project's quota for this operation has been exceeded.\",\r\n [\"redirect-cancelled-by-user\" /* REDIRECT_CANCELLED_BY_USER */]: 'The redirect operation has been cancelled by the user before finalizing.',\r\n [\"redirect-operation-pending\" /* REDIRECT_OPERATION_PENDING */]: 'A redirect sign-in operation is already pending.',\r\n [\"rejected-credential\" /* REJECTED_CREDENTIAL */]: 'The request contains malformed or mismatching credentials.',\r\n [\"second-factor-already-in-use\" /* SECOND_FACTOR_ALREADY_ENROLLED */]: 'The second factor is already enrolled on this account.',\r\n [\"maximum-second-factor-count-exceeded\" /* SECOND_FACTOR_LIMIT_EXCEEDED */]: 'The maximum allowed number of second factors on a user has been exceeded.',\r\n [\"tenant-id-mismatch\" /* TENANT_ID_MISMATCH */]: \"The provided tenant ID does not match the Auth instance's tenant ID\",\r\n [\"timeout\" /* TIMEOUT */]: 'The operation has timed out.',\r\n [\"user-token-expired\" /* TOKEN_EXPIRED */]: \"The user's credential is no longer valid. The user must sign in again.\",\r\n [\"too-many-requests\" /* TOO_MANY_ATTEMPTS_TRY_LATER */]: 'We have blocked all requests from this device due to unusual activity. ' +\r\n 'Try again later.',\r\n [\"unauthorized-continue-uri\" /* UNAUTHORIZED_DOMAIN */]: 'The domain of the continue URL is not whitelisted. Please whitelist ' +\r\n 'the domain in the Firebase console.',\r\n [\"unsupported-first-factor\" /* UNSUPPORTED_FIRST_FACTOR */]: 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',\r\n [\"unsupported-persistence-type\" /* UNSUPPORTED_PERSISTENCE */]: 'The current environment does not support the specified persistence type.',\r\n [\"unsupported-tenant-operation\" /* UNSUPPORTED_TENANT_OPERATION */]: 'This operation is not supported in a multi-tenant context.',\r\n [\"unverified-email\" /* UNVERIFIED_EMAIL */]: 'The operation requires a verified email.',\r\n [\"user-cancelled\" /* USER_CANCELLED */]: 'The user did not grant your application the permissions it requested.',\r\n [\"user-not-found\" /* USER_DELETED */]: 'There is no user record corresponding to this identifier. The user may ' +\r\n 'have been deleted.',\r\n [\"user-disabled\" /* USER_DISABLED */]: 'The user account has been disabled by an administrator.',\r\n [\"user-mismatch\" /* USER_MISMATCH */]: 'The supplied credentials do not correspond to the previously signed in user.',\r\n [\"user-signed-out\" /* USER_SIGNED_OUT */]: '',\r\n [\"weak-password\" /* WEAK_PASSWORD */]: 'The password must be 6 characters long or more.',\r\n [\"web-storage-unsupported\" /* WEB_STORAGE_UNSUPPORTED */]: 'This browser is not supported or 3rd party cookies and data may be disabled.',\r\n [\"already-initialized\" /* ALREADY_INITIALIZED */]: 'initializeAuth() has already been called with ' +\r\n 'different options. To avoid this error, call initializeAuth() with the ' +\r\n 'same options as when it was originally called, or call getAuth() to return the' +\r\n ' already initialized instance.'\r\n };\r\n}\r\nfunction _prodErrorMap() {\r\n // We will include this one message in the prod error map since by the very\r\n // nature of this error, developers will never be able to see the message\r\n // using the debugErrorMap (which is installed during auth initialization).\r\n return {\r\n [\"dependent-sdk-initialized-before-auth\" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +\r\n 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +\r\n 'starting any other Firebase SDK.'\r\n };\r\n}\r\n/**\r\n * A verbose error map with detailed descriptions for most error codes.\r\n *\r\n * See discussion at {@link AuthErrorMap}\r\n *\r\n * @public\r\n */\r\nconst debugErrorMap = _debugErrorMap;\r\n/**\r\n * A minimal error map with all verbose error messages stripped.\r\n *\r\n * See discussion at {@link AuthErrorMap}\r\n *\r\n * @public\r\n */\r\nconst prodErrorMap = _prodErrorMap;\r\nconst _DEFAULT_AUTH_ERROR_FACTORY = new ErrorFactory('auth', 'Firebase', _prodErrorMap());\r\n/**\r\n * A map of potential `Auth` error codes, for easier comparison with errors\r\n * thrown by the SDK.\r\n *\r\n * @remarks\r\n * Note that you can't tree-shake individual keys\r\n * in the map, so by using the map you might substantially increase your\r\n * bundle size.\r\n *\r\n * @public\r\n */\r\nconst AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {\r\n ADMIN_ONLY_OPERATION: 'auth/admin-restricted-operation',\r\n ARGUMENT_ERROR: 'auth/argument-error',\r\n APP_NOT_AUTHORIZED: 'auth/app-not-authorized',\r\n APP_NOT_INSTALLED: 'auth/app-not-installed',\r\n CAPTCHA_CHECK_FAILED: 'auth/captcha-check-failed',\r\n CODE_EXPIRED: 'auth/code-expired',\r\n CORDOVA_NOT_READY: 'auth/cordova-not-ready',\r\n CORS_UNSUPPORTED: 'auth/cors-unsupported',\r\n CREDENTIAL_ALREADY_IN_USE: 'auth/credential-already-in-use',\r\n CREDENTIAL_MISMATCH: 'auth/custom-token-mismatch',\r\n CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login',\r\n DEPENDENT_SDK_INIT_BEFORE_AUTH: 'auth/dependent-sdk-initialized-before-auth',\r\n DYNAMIC_LINK_NOT_ACTIVATED: 'auth/dynamic-link-not-activated',\r\n EMAIL_CHANGE_NEEDS_VERIFICATION: 'auth/email-change-needs-verification',\r\n EMAIL_EXISTS: 'auth/email-already-in-use',\r\n EMULATOR_CONFIG_FAILED: 'auth/emulator-config-failed',\r\n EXPIRED_OOB_CODE: 'auth/expired-action-code',\r\n EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request',\r\n INTERNAL_ERROR: 'auth/internal-error',\r\n INVALID_API_KEY: 'auth/invalid-api-key',\r\n INVALID_APP_CREDENTIAL: 'auth/invalid-app-credential',\r\n INVALID_APP_ID: 'auth/invalid-app-id',\r\n INVALID_AUTH: 'auth/invalid-user-token',\r\n INVALID_AUTH_EVENT: 'auth/invalid-auth-event',\r\n INVALID_CERT_HASH: 'auth/invalid-cert-hash',\r\n INVALID_CODE: 'auth/invalid-verification-code',\r\n INVALID_CONTINUE_URI: 'auth/invalid-continue-uri',\r\n INVALID_CORDOVA_CONFIGURATION: 'auth/invalid-cordova-configuration',\r\n INVALID_CUSTOM_TOKEN: 'auth/invalid-custom-token',\r\n INVALID_DYNAMIC_LINK_DOMAIN: 'auth/invalid-dynamic-link-domain',\r\n INVALID_EMAIL: 'auth/invalid-email',\r\n INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme',\r\n INVALID_IDP_RESPONSE: 'auth/invalid-credential',\r\n INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload',\r\n INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session',\r\n INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id',\r\n INVALID_OAUTH_PROVIDER: 'auth/invalid-oauth-provider',\r\n INVALID_OOB_CODE: 'auth/invalid-action-code',\r\n INVALID_ORIGIN: 'auth/unauthorized-domain',\r\n INVALID_PASSWORD: 'auth/wrong-password',\r\n INVALID_PERSISTENCE: 'auth/invalid-persistence-type',\r\n INVALID_PHONE_NUMBER: 'auth/invalid-phone-number',\r\n INVALID_PROVIDER_ID: 'auth/invalid-provider-id',\r\n INVALID_RECIPIENT_EMAIL: 'auth/invalid-recipient-email',\r\n INVALID_SENDER: 'auth/invalid-sender',\r\n INVALID_SESSION_INFO: 'auth/invalid-verification-id',\r\n INVALID_TENANT_ID: 'auth/invalid-tenant-id',\r\n MFA_INFO_NOT_FOUND: 'auth/multi-factor-info-not-found',\r\n MFA_REQUIRED: 'auth/multi-factor-auth-required',\r\n MISSING_ANDROID_PACKAGE_NAME: 'auth/missing-android-pkg-name',\r\n MISSING_APP_CREDENTIAL: 'auth/missing-app-credential',\r\n MISSING_AUTH_DOMAIN: 'auth/auth-domain-config-required',\r\n MISSING_CODE: 'auth/missing-verification-code',\r\n MISSING_CONTINUE_URI: 'auth/missing-continue-uri',\r\n MISSING_IFRAME_START: 'auth/missing-iframe-start',\r\n MISSING_IOS_BUNDLE_ID: 'auth/missing-ios-bundle-id',\r\n MISSING_OR_INVALID_NONCE: 'auth/missing-or-invalid-nonce',\r\n MISSING_MFA_INFO: 'auth/missing-multi-factor-info',\r\n MISSING_MFA_SESSION: 'auth/missing-multi-factor-session',\r\n MISSING_PHONE_NUMBER: 'auth/missing-phone-number',\r\n MISSING_SESSION_INFO: 'auth/missing-verification-id',\r\n MODULE_DESTROYED: 'auth/app-deleted',\r\n NEED_CONFIRMATION: 'auth/account-exists-with-different-credential',\r\n NETWORK_REQUEST_FAILED: 'auth/network-request-failed',\r\n NULL_USER: 'auth/null-user',\r\n NO_AUTH_EVENT: 'auth/no-auth-event',\r\n NO_SUCH_PROVIDER: 'auth/no-such-provider',\r\n OPERATION_NOT_ALLOWED: 'auth/operation-not-allowed',\r\n OPERATION_NOT_SUPPORTED: 'auth/operation-not-supported-in-this-environment',\r\n POPUP_BLOCKED: 'auth/popup-blocked',\r\n POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user',\r\n PROVIDER_ALREADY_LINKED: 'auth/provider-already-linked',\r\n QUOTA_EXCEEDED: 'auth/quota-exceeded',\r\n REDIRECT_CANCELLED_BY_USER: 'auth/redirect-cancelled-by-user',\r\n REDIRECT_OPERATION_PENDING: 'auth/redirect-operation-pending',\r\n REJECTED_CREDENTIAL: 'auth/rejected-credential',\r\n SECOND_FACTOR_ALREADY_ENROLLED: 'auth/second-factor-already-in-use',\r\n SECOND_FACTOR_LIMIT_EXCEEDED: 'auth/maximum-second-factor-count-exceeded',\r\n TENANT_ID_MISMATCH: 'auth/tenant-id-mismatch',\r\n TIMEOUT: 'auth/timeout',\r\n TOKEN_EXPIRED: 'auth/user-token-expired',\r\n TOO_MANY_ATTEMPTS_TRY_LATER: 'auth/too-many-requests',\r\n UNAUTHORIZED_DOMAIN: 'auth/unauthorized-continue-uri',\r\n UNSUPPORTED_FIRST_FACTOR: 'auth/unsupported-first-factor',\r\n UNSUPPORTED_PERSISTENCE: 'auth/unsupported-persistence-type',\r\n UNSUPPORTED_TENANT_OPERATION: 'auth/unsupported-tenant-operation',\r\n UNVERIFIED_EMAIL: 'auth/unverified-email',\r\n USER_CANCELLED: 'auth/user-cancelled',\r\n USER_DELETED: 'auth/user-not-found',\r\n USER_DISABLED: 'auth/user-disabled',\r\n USER_MISMATCH: 'auth/user-mismatch',\r\n USER_SIGNED_OUT: 'auth/user-signed-out',\r\n WEAK_PASSWORD: 'auth/weak-password',\r\n WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported',\r\n ALREADY_INITIALIZED: 'auth/already-initialized'\r\n};\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst logClient = new Logger('@firebase/auth');\r\nfunction _logError(msg, ...args) {\r\n if (logClient.logLevel <= LogLevel.ERROR) {\r\n logClient.error(`Auth (${SDK_VERSION}): ${msg}`, ...args);\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _fail(authOrCode, ...rest) {\r\n throw createErrorInternal(authOrCode, ...rest);\r\n}\r\nfunction _createError(authOrCode, ...rest) {\r\n return createErrorInternal(authOrCode, ...rest);\r\n}\r\nfunction _errorWithCustomMessage(auth, code, message) {\r\n const errorMap = Object.assign(Object.assign({}, prodErrorMap()), { [code]: message });\r\n const factory = new ErrorFactory('auth', 'Firebase', errorMap);\r\n return factory.create(code, {\r\n appName: auth.name,\r\n });\r\n}\r\nfunction _assertInstanceOf(auth, object, instance) {\r\n const constructorInstance = instance;\r\n if (!(object instanceof constructorInstance)) {\r\n if (constructorInstance.name !== object.constructor.name) {\r\n _fail(auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n }\r\n throw _errorWithCustomMessage(auth, \"argument-error\" /* ARGUMENT_ERROR */, `Type of ${object.constructor.name} does not match expected instance.` +\r\n `Did you pass a reference from a different Auth SDK?`);\r\n }\r\n}\r\nfunction createErrorInternal(authOrCode, ...rest) {\r\n if (typeof authOrCode !== 'string') {\r\n const code = rest[0];\r\n const fullParams = [...rest.slice(1)];\r\n if (fullParams[0]) {\r\n fullParams[0].appName = authOrCode.name;\r\n }\r\n return authOrCode._errorFactory.create(code, ...fullParams);\r\n }\r\n return _DEFAULT_AUTH_ERROR_FACTORY.create(authOrCode, ...rest);\r\n}\r\nfunction _assert(assertion, authOrCode, ...rest) {\r\n if (!assertion) {\r\n throw createErrorInternal(authOrCode, ...rest);\r\n }\r\n}\r\n/**\r\n * Unconditionally fails, throwing an internal error with the given message.\r\n *\r\n * @param failure type of failure encountered\r\n * @throws Error\r\n */\r\nfunction debugFail(failure) {\r\n // Log the failure in addition to throw an exception, just in case the\r\n // exception is swallowed.\r\n const message = `INTERNAL ASSERTION FAILED: ` + failure;\r\n _logError(message);\r\n // NOTE: We don't use FirebaseError here because these are internal failures\r\n // that cannot be handled by the user. (Also it would create a circular\r\n // dependency between the error and assert modules which doesn't work.)\r\n throw new Error(message);\r\n}\r\n/**\r\n * Fails if the given assertion condition is false, throwing an Error with the\r\n * given message if it did.\r\n *\r\n * @param assertion\r\n * @param message\r\n */\r\nfunction debugAssert(assertion, message) {\r\n if (!assertion) {\r\n debugFail(message);\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst instanceCache = new Map();\r\nfunction _getInstance(cls) {\r\n debugAssert(cls instanceof Function, 'Expected a class definition');\r\n let instance = instanceCache.get(cls);\r\n if (instance) {\r\n debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class');\r\n return instance;\r\n }\r\n instance = new cls();\r\n instanceCache.set(cls, instance);\r\n return instance;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Initializes an {@link Auth} instance with fine-grained control over\r\n * {@link Dependencies}.\r\n *\r\n * @remarks\r\n *\r\n * This function allows more control over the {@link Auth} instance than\r\n * {@link getAuth}. `getAuth` uses platform-specific defaults to supply\r\n * the {@link Dependencies}. In general, `getAuth` is the easiest way to\r\n * initialize Auth and works for most use cases. Use `initializeAuth` if you\r\n * need control over which persistence layer is used, or to minimize bundle\r\n * size if you're not using either `signInWithPopup` or `signInWithRedirect`.\r\n *\r\n * For example, if your app only uses anonymous accounts and you only want\r\n * accounts saved for the current session, initialize `Auth` with:\r\n *\r\n * ```js\r\n * const auth = initializeAuth(app, {\r\n * persistence: browserSessionPersistence,\r\n * popupRedirectResolver: undefined,\r\n * });\r\n * ```\r\n *\r\n * @public\r\n */\r\nfunction initializeAuth(app, deps) {\r\n const provider = _getProvider(app, 'auth');\r\n if (provider.isInitialized()) {\r\n const auth = provider.getImmediate();\r\n const initialOptions = provider.getOptions();\r\n if (deepEqual(initialOptions, deps !== null && deps !== void 0 ? deps : {})) {\r\n return auth;\r\n }\r\n else {\r\n _fail(auth, \"already-initialized\" /* ALREADY_INITIALIZED */);\r\n }\r\n }\r\n const auth = provider.initialize({ options: deps });\r\n return auth;\r\n}\r\nfunction _initializeAuthInstance(auth, deps) {\r\n const persistence = (deps === null || deps === void 0 ? void 0 : deps.persistence) || [];\r\n const hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance);\r\n if (deps === null || deps === void 0 ? void 0 : deps.errorMap) {\r\n auth._updateErrorMap(deps.errorMap);\r\n }\r\n // This promise is intended to float; auth initialization happens in the\r\n // background, meanwhile the auth object may be used by the app.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n auth._initializeWithPersistence(hierarchy, deps === null || deps === void 0 ? void 0 : deps.popupRedirectResolver);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _getCurrentUrl() {\r\n var _a;\r\n return (typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.href)) || '';\r\n}\r\nfunction _isHttpOrHttps() {\r\n return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:';\r\n}\r\nfunction _getCurrentScheme() {\r\n var _a;\r\n return (typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.protocol)) || null;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Determine whether the browser is working online\r\n */\r\nfunction _isOnline() {\r\n if (typeof navigator !== 'undefined' &&\r\n navigator &&\r\n 'onLine' in navigator &&\r\n typeof navigator.onLine === 'boolean' &&\r\n // Apply only for traditional web apps and Chrome extensions.\r\n // This is especially true for Cordova apps which have unreliable\r\n // navigator.onLine behavior unless cordova-plugin-network-information is\r\n // installed which overwrites the native navigator.onLine value and\r\n // defines navigator.connection.\r\n (_isHttpOrHttps() || isBrowserExtension() || 'connection' in navigator)) {\r\n return navigator.onLine;\r\n }\r\n // If we can't determine the state, assume it is online.\r\n return true;\r\n}\r\nfunction _getUserLanguage() {\r\n if (typeof navigator === 'undefined') {\r\n return null;\r\n }\r\n const navigatorLanguage = navigator;\r\n return (\r\n // Most reliable, but only supported in Chrome/Firefox.\r\n (navigatorLanguage.languages && navigatorLanguage.languages[0]) ||\r\n // Supported in most browsers, but returns the language of the browser\r\n // UI, not the language set in browser settings.\r\n navigatorLanguage.language ||\r\n // Couldn't determine language.\r\n null);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * A structure to help pick between a range of long and short delay durations\r\n * depending on the current environment. In general, the long delay is used for\r\n * mobile environments whereas short delays are used for desktop environments.\r\n */\r\nclass Delay {\r\n constructor(shortDelay, longDelay) {\r\n this.shortDelay = shortDelay;\r\n this.longDelay = longDelay;\r\n // Internal error when improperly initialized.\r\n debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');\r\n this.isMobile = isMobileCordova() || isReactNative();\r\n }\r\n get() {\r\n if (!_isOnline()) {\r\n // Pick the shorter timeout.\r\n return Math.min(5000 /* OFFLINE */, this.shortDelay);\r\n }\r\n // If running in a mobile environment, return the long delay, otherwise\r\n // return the short delay.\r\n // This could be improved in the future to dynamically change based on other\r\n // variables instead of just reading the current environment.\r\n return this.isMobile ? this.longDelay : this.shortDelay;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _emulatorUrl(config, path) {\r\n debugAssert(config.emulator, 'Emulator should always be set here');\r\n const { url } = config.emulator;\r\n if (!path) {\r\n return url;\r\n }\r\n return `${url}${path.startsWith('/') ? path.slice(1) : path}`;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass FetchProvider {\r\n static initialize(fetchImpl, headersImpl, responseImpl) {\r\n this.fetchImpl = fetchImpl;\r\n if (headersImpl) {\r\n this.headersImpl = headersImpl;\r\n }\r\n if (responseImpl) {\r\n this.responseImpl = responseImpl;\r\n }\r\n }\r\n static fetch() {\r\n if (this.fetchImpl) {\r\n return this.fetchImpl;\r\n }\r\n if (typeof self !== 'undefined' && 'fetch' in self) {\r\n return self.fetch;\r\n }\r\n debugFail('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\r\n }\r\n static headers() {\r\n if (this.headersImpl) {\r\n return this.headersImpl;\r\n }\r\n if (typeof self !== 'undefined' && 'Headers' in self) {\r\n return self.Headers;\r\n }\r\n debugFail('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\r\n }\r\n static response() {\r\n if (this.responseImpl) {\r\n return this.responseImpl;\r\n }\r\n if (typeof self !== 'undefined' && 'Response' in self) {\r\n return self.Response;\r\n }\r\n debugFail('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Map from errors returned by the server to errors to developer visible errors\r\n */\r\nconst SERVER_ERROR_MAP = {\r\n // Custom token errors.\r\n [\"CREDENTIAL_MISMATCH\" /* CREDENTIAL_MISMATCH */]: \"custom-token-mismatch\" /* CREDENTIAL_MISMATCH */,\r\n // This can only happen if the SDK sends a bad request.\r\n [\"MISSING_CUSTOM_TOKEN\" /* MISSING_CUSTOM_TOKEN */]: \"internal-error\" /* INTERNAL_ERROR */,\r\n // Create Auth URI errors.\r\n [\"INVALID_IDENTIFIER\" /* INVALID_IDENTIFIER */]: \"invalid-email\" /* INVALID_EMAIL */,\r\n // This can only happen if the SDK sends a bad request.\r\n [\"MISSING_CONTINUE_URI\" /* MISSING_CONTINUE_URI */]: \"internal-error\" /* INTERNAL_ERROR */,\r\n // Sign in with email and password errors (some apply to sign up too).\r\n [\"INVALID_PASSWORD\" /* INVALID_PASSWORD */]: \"wrong-password\" /* INVALID_PASSWORD */,\r\n // This can only happen if the SDK sends a bad request.\r\n [\"MISSING_PASSWORD\" /* MISSING_PASSWORD */]: \"internal-error\" /* INTERNAL_ERROR */,\r\n // Sign up with email and password errors.\r\n [\"EMAIL_EXISTS\" /* EMAIL_EXISTS */]: \"email-already-in-use\" /* EMAIL_EXISTS */,\r\n [\"PASSWORD_LOGIN_DISABLED\" /* PASSWORD_LOGIN_DISABLED */]: \"operation-not-allowed\" /* OPERATION_NOT_ALLOWED */,\r\n // Verify assertion for sign in with credential errors:\r\n [\"INVALID_IDP_RESPONSE\" /* INVALID_IDP_RESPONSE */]: \"invalid-credential\" /* INVALID_IDP_RESPONSE */,\r\n [\"INVALID_PENDING_TOKEN\" /* INVALID_PENDING_TOKEN */]: \"invalid-credential\" /* INVALID_IDP_RESPONSE */,\r\n [\"FEDERATED_USER_ID_ALREADY_LINKED\" /* FEDERATED_USER_ID_ALREADY_LINKED */]: \"credential-already-in-use\" /* CREDENTIAL_ALREADY_IN_USE */,\r\n // This can only happen if the SDK sends a bad request.\r\n [\"MISSING_REQ_TYPE\" /* MISSING_REQ_TYPE */]: \"internal-error\" /* INTERNAL_ERROR */,\r\n // Send Password reset email errors:\r\n [\"EMAIL_NOT_FOUND\" /* EMAIL_NOT_FOUND */]: \"user-not-found\" /* USER_DELETED */,\r\n [\"RESET_PASSWORD_EXCEED_LIMIT\" /* RESET_PASSWORD_EXCEED_LIMIT */]: \"too-many-requests\" /* TOO_MANY_ATTEMPTS_TRY_LATER */,\r\n [\"EXPIRED_OOB_CODE\" /* EXPIRED_OOB_CODE */]: \"expired-action-code\" /* EXPIRED_OOB_CODE */,\r\n [\"INVALID_OOB_CODE\" /* INVALID_OOB_CODE */]: \"invalid-action-code\" /* INVALID_OOB_CODE */,\r\n // This can only happen if the SDK sends a bad request.\r\n [\"MISSING_OOB_CODE\" /* MISSING_OOB_CODE */]: \"internal-error\" /* INTERNAL_ERROR */,\r\n // Operations that require ID token in request:\r\n [\"CREDENTIAL_TOO_OLD_LOGIN_AGAIN\" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: \"requires-recent-login\" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,\r\n [\"INVALID_ID_TOKEN\" /* INVALID_ID_TOKEN */]: \"invalid-user-token\" /* INVALID_AUTH */,\r\n [\"TOKEN_EXPIRED\" /* TOKEN_EXPIRED */]: \"user-token-expired\" /* TOKEN_EXPIRED */,\r\n [\"USER_NOT_FOUND\" /* USER_NOT_FOUND */]: \"user-token-expired\" /* TOKEN_EXPIRED */,\r\n // Other errors.\r\n [\"TOO_MANY_ATTEMPTS_TRY_LATER\" /* TOO_MANY_ATTEMPTS_TRY_LATER */]: \"too-many-requests\" /* TOO_MANY_ATTEMPTS_TRY_LATER */,\r\n // Phone Auth related errors.\r\n [\"INVALID_CODE\" /* INVALID_CODE */]: \"invalid-verification-code\" /* INVALID_CODE */,\r\n [\"INVALID_SESSION_INFO\" /* INVALID_SESSION_INFO */]: \"invalid-verification-id\" /* INVALID_SESSION_INFO */,\r\n [\"INVALID_TEMPORARY_PROOF\" /* INVALID_TEMPORARY_PROOF */]: \"invalid-credential\" /* INVALID_IDP_RESPONSE */,\r\n [\"MISSING_SESSION_INFO\" /* MISSING_SESSION_INFO */]: \"missing-verification-id\" /* MISSING_SESSION_INFO */,\r\n [\"SESSION_EXPIRED\" /* SESSION_EXPIRED */]: \"code-expired\" /* CODE_EXPIRED */,\r\n // Other action code errors when additional settings passed.\r\n // MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.\r\n // This is OK as this error will be caught by client side validation.\r\n [\"MISSING_ANDROID_PACKAGE_NAME\" /* MISSING_ANDROID_PACKAGE_NAME */]: \"missing-android-pkg-name\" /* MISSING_ANDROID_PACKAGE_NAME */,\r\n [\"UNAUTHORIZED_DOMAIN\" /* UNAUTHORIZED_DOMAIN */]: \"unauthorized-continue-uri\" /* UNAUTHORIZED_DOMAIN */,\r\n // getProjectConfig errors when clientId is passed.\r\n [\"INVALID_OAUTH_CLIENT_ID\" /* INVALID_OAUTH_CLIENT_ID */]: \"invalid-oauth-client-id\" /* INVALID_OAUTH_CLIENT_ID */,\r\n // User actions (sign-up or deletion) disabled errors.\r\n [\"ADMIN_ONLY_OPERATION\" /* ADMIN_ONLY_OPERATION */]: \"admin-restricted-operation\" /* ADMIN_ONLY_OPERATION */,\r\n // Multi factor related errors.\r\n [\"INVALID_MFA_PENDING_CREDENTIAL\" /* INVALID_MFA_PENDING_CREDENTIAL */]: \"invalid-multi-factor-session\" /* INVALID_MFA_SESSION */,\r\n [\"MFA_ENROLLMENT_NOT_FOUND\" /* MFA_ENROLLMENT_NOT_FOUND */]: \"multi-factor-info-not-found\" /* MFA_INFO_NOT_FOUND */,\r\n [\"MISSING_MFA_ENROLLMENT_ID\" /* MISSING_MFA_ENROLLMENT_ID */]: \"missing-multi-factor-info\" /* MISSING_MFA_INFO */,\r\n [\"MISSING_MFA_PENDING_CREDENTIAL\" /* MISSING_MFA_PENDING_CREDENTIAL */]: \"missing-multi-factor-session\" /* MISSING_MFA_SESSION */,\r\n [\"SECOND_FACTOR_EXISTS\" /* SECOND_FACTOR_EXISTS */]: \"second-factor-already-in-use\" /* SECOND_FACTOR_ALREADY_ENROLLED */,\r\n [\"SECOND_FACTOR_LIMIT_EXCEEDED\" /* SECOND_FACTOR_LIMIT_EXCEEDED */]: \"maximum-second-factor-count-exceeded\" /* SECOND_FACTOR_LIMIT_EXCEEDED */,\r\n // Blocking functions related errors.\r\n [\"BLOCKING_FUNCTION_ERROR_RESPONSE\" /* BLOCKING_FUNCTION_ERROR_RESPONSE */]: \"internal-error\" /* INTERNAL_ERROR */,\r\n};\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000);\r\nfunction _addTidIfNecessary(auth, request) {\r\n if (auth.tenantId && !request.tenantId) {\r\n return Object.assign(Object.assign({}, request), { tenantId: auth.tenantId });\r\n }\r\n return request;\r\n}\r\nasync function _performApiRequest(auth, method, path, request, customErrorMap = {}) {\r\n return _performFetchWithErrorHandling(auth, customErrorMap, async () => {\r\n let body = {};\r\n let params = {};\r\n if (request) {\r\n if (method === \"GET\" /* GET */) {\r\n params = request;\r\n }\r\n else {\r\n body = {\r\n body: JSON.stringify(request)\r\n };\r\n }\r\n }\r\n const query = querystring(Object.assign({ key: auth.config.apiKey }, params)).slice(1);\r\n const headers = await auth._getAdditionalHeaders();\r\n headers[\"Content-Type\" /* CONTENT_TYPE */] = 'application/json';\r\n if (auth.languageCode) {\r\n headers[\"X-Firebase-Locale\" /* X_FIREBASE_LOCALE */] = auth.languageCode;\r\n }\r\n return FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), Object.assign({ method,\r\n headers, referrerPolicy: 'no-referrer' }, body));\r\n });\r\n}\r\nasync function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {\r\n auth._canInitEmulator = false;\r\n const errorMap = Object.assign(Object.assign({}, SERVER_ERROR_MAP), customErrorMap);\r\n try {\r\n const networkTimeout = new NetworkTimeout(auth);\r\n const response = await Promise.race([\r\n fetchFn(),\r\n networkTimeout.promise\r\n ]);\r\n // If we've reached this point, the fetch succeeded and the networkTimeout\r\n // didn't throw; clear the network timeout delay so that Node won't hang\r\n networkTimeout.clearNetworkTimeout();\r\n const json = await response.json();\r\n if ('needConfirmation' in json) {\r\n throw _makeTaggedError(auth, \"account-exists-with-different-credential\" /* NEED_CONFIRMATION */, json);\r\n }\r\n if (response.ok && !('errorMessage' in json)) {\r\n return json;\r\n }\r\n else {\r\n const errorMessage = response.ok ? json.errorMessage : json.error.message;\r\n const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : ');\r\n if (serverErrorCode === \"FEDERATED_USER_ID_ALREADY_LINKED\" /* FEDERATED_USER_ID_ALREADY_LINKED */) {\r\n throw _makeTaggedError(auth, \"credential-already-in-use\" /* CREDENTIAL_ALREADY_IN_USE */, json);\r\n }\r\n else if (serverErrorCode === \"EMAIL_EXISTS\" /* EMAIL_EXISTS */) {\r\n throw _makeTaggedError(auth, \"email-already-in-use\" /* EMAIL_EXISTS */, json);\r\n }\r\n const authError = errorMap[serverErrorCode] ||\r\n serverErrorCode\r\n .toLowerCase()\r\n .replace(/[_\\s]+/g, '-');\r\n if (serverErrorMessage) {\r\n throw _errorWithCustomMessage(auth, authError, serverErrorMessage);\r\n }\r\n else {\r\n _fail(auth, authError);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n if (e instanceof FirebaseError) {\r\n throw e;\r\n }\r\n _fail(auth, \"network-request-failed\" /* NETWORK_REQUEST_FAILED */);\r\n }\r\n}\r\nasync function _performSignInRequest(auth, method, path, request, customErrorMap = {}) {\r\n const serverResponse = (await _performApiRequest(auth, method, path, request, customErrorMap));\r\n if ('mfaPendingCredential' in serverResponse) {\r\n _fail(auth, \"multi-factor-auth-required\" /* MFA_REQUIRED */, {\r\n _serverResponse: serverResponse\r\n });\r\n }\r\n return serverResponse;\r\n}\r\nfunction _getFinalTarget(auth, host, path, query) {\r\n const base = `${host}${path}?${query}`;\r\n if (!auth.config.emulator) {\r\n return `${auth.config.apiScheme}://${base}`;\r\n }\r\n return _emulatorUrl(auth.config, base);\r\n}\r\nclass NetworkTimeout {\r\n constructor(auth) {\r\n this.auth = auth;\r\n // Node timers and browser timers are fundamentally incompatible, but we\r\n // don't care about the value here\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n this.timer = null;\r\n this.promise = new Promise((_, reject) => {\r\n this.timer = setTimeout(() => {\r\n return reject(_createError(this.auth, \"network-request-failed\" /* NETWORK_REQUEST_FAILED */));\r\n }, DEFAULT_API_TIMEOUT_MS.get());\r\n });\r\n }\r\n clearNetworkTimeout() {\r\n clearTimeout(this.timer);\r\n }\r\n}\r\nfunction _makeTaggedError(auth, code, response) {\r\n const errorParams = {\r\n appName: auth.name\r\n };\r\n if (response.email) {\r\n errorParams.email = response.email;\r\n }\r\n if (response.phoneNumber) {\r\n errorParams.phoneNumber = response.phoneNumber;\r\n }\r\n const error = _createError(auth, code, errorParams);\r\n // We know customData is defined on error because errorParams is defined\r\n error.customData._tokenResponse = response;\r\n return error;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function deleteAccount(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:delete\" /* DELETE_ACCOUNT */, request);\r\n}\r\nasync function deleteLinkedAccounts(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:update\" /* SET_ACCOUNT_INFO */, request);\r\n}\r\nasync function getAccountInfo(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:lookup\" /* GET_ACCOUNT_INFO */, request);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction utcTimestampToDateString(utcTimestamp) {\r\n if (!utcTimestamp) {\r\n return undefined;\r\n }\r\n try {\r\n // Convert to date object.\r\n const date = new Date(Number(utcTimestamp));\r\n // Test date is valid.\r\n if (!isNaN(date.getTime())) {\r\n // Convert to UTC date string.\r\n return date.toUTCString();\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing. undefined will be returned.\r\n }\r\n return undefined;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.\r\n *\r\n * @remarks\r\n * Returns the current token if it has not expired or if it will not expire in the next five\r\n * minutes. Otherwise, this will refresh the token and return a new one.\r\n *\r\n * @param user - The user.\r\n * @param forceRefresh - Force refresh regardless of token expiration.\r\n *\r\n * @public\r\n */\r\nfunction getIdToken(user, forceRefresh = false) {\r\n return getModularInstance(user).getIdToken(forceRefresh);\r\n}\r\n/**\r\n * Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service.\r\n *\r\n * @remarks\r\n * Returns the current token if it has not expired or if it will not expire in the next five\r\n * minutes. Otherwise, this will refresh the token and return a new one.\r\n *\r\n * @param user - The user.\r\n * @param forceRefresh - Force refresh regardless of token expiration.\r\n *\r\n * @public\r\n */\r\nasync function getIdTokenResult(user, forceRefresh = false) {\r\n const userInternal = getModularInstance(user);\r\n const token = await userInternal.getIdToken(forceRefresh);\r\n const claims = _parseToken(token);\r\n _assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;\r\n const signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];\r\n return {\r\n claims,\r\n token,\r\n authTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.auth_time)),\r\n issuedAtTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.iat)),\r\n expirationTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.exp)),\r\n signInProvider: signInProvider || null,\r\n signInSecondFactor: (firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_second_factor']) || null\r\n };\r\n}\r\nfunction secondsStringToMilliseconds(seconds) {\r\n return Number(seconds) * 1000;\r\n}\r\nfunction _parseToken(token) {\r\n const [algorithm, payload, signature] = token.split('.');\r\n if (algorithm === undefined ||\r\n payload === undefined ||\r\n signature === undefined) {\r\n _logError('JWT malformed, contained fewer than 3 sections');\r\n return null;\r\n }\r\n try {\r\n const decoded = base64Decode(payload);\r\n if (!decoded) {\r\n _logError('Failed to decode base64 JWT payload');\r\n return null;\r\n }\r\n return JSON.parse(decoded);\r\n }\r\n catch (e) {\r\n _logError('Caught error parsing JWT payload as JSON', e);\r\n return null;\r\n }\r\n}\r\n/**\r\n * Extract expiresIn TTL from a token by subtracting the expiration from the issuance.\r\n */\r\nfunction _tokenExpiresIn(token) {\r\n const parsedToken = _parseToken(token);\r\n _assert(parsedToken, \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof parsedToken.exp !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof parsedToken.iat !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n return Number(parsedToken.exp) - Number(parsedToken.iat);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function _logoutIfInvalidated(user, promise, bypassAuthState = false) {\r\n if (bypassAuthState) {\r\n return promise;\r\n }\r\n try {\r\n return await promise;\r\n }\r\n catch (e) {\r\n if (e instanceof FirebaseError && isUserInvalidated(e)) {\r\n if (user.auth.currentUser === user) {\r\n await user.auth.signOut();\r\n }\r\n }\r\n throw e;\r\n }\r\n}\r\nfunction isUserInvalidated({ code }) {\r\n return (code === `auth/${\"user-disabled\" /* USER_DISABLED */}` ||\r\n code === `auth/${\"user-token-expired\" /* TOKEN_EXPIRED */}`);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass ProactiveRefresh {\r\n constructor(user) {\r\n this.user = user;\r\n this.isRunning = false;\r\n // Node timers and browser timers return fundamentally different types.\r\n // We don't actually care what the value is but TS won't accept unknown and\r\n // we can't cast properly in both environments.\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n this.timerId = null;\r\n this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;\r\n }\r\n _start() {\r\n if (this.isRunning) {\r\n return;\r\n }\r\n this.isRunning = true;\r\n this.schedule();\r\n }\r\n _stop() {\r\n if (!this.isRunning) {\r\n return;\r\n }\r\n this.isRunning = false;\r\n if (this.timerId !== null) {\r\n clearTimeout(this.timerId);\r\n }\r\n }\r\n getInterval(wasError) {\r\n var _a;\r\n if (wasError) {\r\n const interval = this.errorBackoff;\r\n this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);\r\n return interval;\r\n }\r\n else {\r\n // Reset the error backoff\r\n this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;\r\n const expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;\r\n const interval = expTime - Date.now() - 300000 /* OFFSET */;\r\n return Math.max(0, interval);\r\n }\r\n }\r\n schedule(wasError = false) {\r\n if (!this.isRunning) {\r\n // Just in case...\r\n return;\r\n }\r\n const interval = this.getInterval(wasError);\r\n this.timerId = setTimeout(async () => {\r\n await this.iteration();\r\n }, interval);\r\n }\r\n async iteration() {\r\n try {\r\n await this.user.getIdToken(true);\r\n }\r\n catch (e) {\r\n // Only retry on network errors\r\n if (e.code === `auth/${\"network-request-failed\" /* NETWORK_REQUEST_FAILED */}`) {\r\n this.schedule(/* wasError */ true);\r\n }\r\n return;\r\n }\r\n this.schedule();\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass UserMetadata {\r\n constructor(createdAt, lastLoginAt) {\r\n this.createdAt = createdAt;\r\n this.lastLoginAt = lastLoginAt;\r\n this._initializeTime();\r\n }\r\n _initializeTime() {\r\n this.lastSignInTime = utcTimestampToDateString(this.lastLoginAt);\r\n this.creationTime = utcTimestampToDateString(this.createdAt);\r\n }\r\n _copy(metadata) {\r\n this.createdAt = metadata.createdAt;\r\n this.lastLoginAt = metadata.lastLoginAt;\r\n this._initializeTime();\r\n }\r\n toJSON() {\r\n return {\r\n createdAt: this.createdAt,\r\n lastLoginAt: this.lastLoginAt\r\n };\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function _reloadWithoutSaving(user) {\r\n var _a;\r\n const auth = user.auth;\r\n const idToken = await user.getIdToken();\r\n const response = await _logoutIfInvalidated(user, getAccountInfo(auth, { idToken }));\r\n _assert(response === null || response === void 0 ? void 0 : response.users.length, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const coreAccount = response.users[0];\r\n user._notifyReloadListener(coreAccount);\r\n const newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)\r\n ? extractProviderData(coreAccount.providerUserInfo)\r\n : [];\r\n const providerData = mergeProviderData(user.providerData, newProviderData);\r\n // Preserves the non-nonymous status of the stored user, even if no more\r\n // credentials (federated or email/password) are linked to the user. If\r\n // the user was previously anonymous, then use provider data to update.\r\n // On the other hand, if it was not anonymous before, it should never be\r\n // considered anonymous now.\r\n const oldIsAnonymous = user.isAnonymous;\r\n const newIsAnonymous = !(user.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);\r\n const isAnonymous = !oldIsAnonymous ? false : newIsAnonymous;\r\n const updates = {\r\n uid: coreAccount.localId,\r\n displayName: coreAccount.displayName || null,\r\n photoURL: coreAccount.photoUrl || null,\r\n email: coreAccount.email || null,\r\n emailVerified: coreAccount.emailVerified || false,\r\n phoneNumber: coreAccount.phoneNumber || null,\r\n tenantId: coreAccount.tenantId || null,\r\n providerData,\r\n metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),\r\n isAnonymous\r\n };\r\n Object.assign(user, updates);\r\n}\r\n/**\r\n * Reloads user account data, if signed in.\r\n *\r\n * @param user - The user.\r\n *\r\n * @public\r\n */\r\nasync function reload(user) {\r\n const userInternal = getModularInstance(user);\r\n await _reloadWithoutSaving(userInternal);\r\n // Even though the current user hasn't changed, update\r\n // current user will trigger a persistence update w/ the\r\n // new info.\r\n await userInternal.auth._persistUserIfCurrent(userInternal);\r\n userInternal.auth._notifyListenersIfCurrent(userInternal);\r\n}\r\nfunction mergeProviderData(original, newData) {\r\n const deduped = original.filter(o => !newData.some(n => n.providerId === o.providerId));\r\n return [...deduped, ...newData];\r\n}\r\nfunction extractProviderData(providers) {\r\n return providers.map((_a) => {\r\n var { providerId } = _a, provider = __rest(_a, [\"providerId\"]);\r\n return {\r\n providerId,\r\n uid: provider.rawId || '',\r\n displayName: provider.displayName || null,\r\n email: provider.email || null,\r\n phoneNumber: provider.phoneNumber || null,\r\n photoURL: provider.photoUrl || null\r\n };\r\n });\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function requestStsToken(auth, refreshToken) {\r\n const response = await _performFetchWithErrorHandling(auth, {}, async () => {\r\n const body = querystring({\r\n 'grant_type': 'refresh_token',\r\n 'refresh_token': refreshToken\r\n }).slice(1);\r\n const { tokenApiHost, apiKey } = auth.config;\r\n const url = _getFinalTarget(auth, tokenApiHost, \"/v1/token\" /* TOKEN */, `key=${apiKey}`);\r\n const headers = await auth._getAdditionalHeaders();\r\n headers[\"Content-Type\" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';\r\n return FetchProvider.fetch()(url, {\r\n method: \"POST\" /* POST */,\r\n headers,\r\n body\r\n });\r\n });\r\n // The response comes back in snake_case. Convert to camel:\r\n return {\r\n accessToken: response.access_token,\r\n expiresIn: response.expires_in,\r\n refreshToken: response.refresh_token\r\n };\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * We need to mark this class as internal explicitly to exclude it in the public typings, because\r\n * it references AuthInternal which has a circular dependency with UserInternal.\r\n *\r\n * @internal\r\n */\r\nclass StsTokenManager {\r\n constructor() {\r\n this.refreshToken = null;\r\n this.accessToken = null;\r\n this.expirationTime = null;\r\n }\r\n get isExpired() {\r\n return (!this.expirationTime ||\r\n Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);\r\n }\r\n updateFromServerResponse(response) {\r\n _assert(response.idToken, \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof response.idToken !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof response.refreshToken !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n const expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'\r\n ? Number(response.expiresIn)\r\n : _tokenExpiresIn(response.idToken);\r\n this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);\r\n }\r\n async getToken(auth, forceRefresh = false) {\r\n _assert(!this.accessToken || this.refreshToken, auth, \"user-token-expired\" /* TOKEN_EXPIRED */);\r\n if (!forceRefresh && this.accessToken && !this.isExpired) {\r\n return this.accessToken;\r\n }\r\n if (this.refreshToken) {\r\n await this.refresh(auth, this.refreshToken);\r\n return this.accessToken;\r\n }\r\n return null;\r\n }\r\n clearRefreshToken() {\r\n this.refreshToken = null;\r\n }\r\n async refresh(auth, oldToken) {\r\n const { accessToken, refreshToken, expiresIn } = await requestStsToken(auth, oldToken);\r\n this.updateTokensAndExpiration(accessToken, refreshToken, Number(expiresIn));\r\n }\r\n updateTokensAndExpiration(accessToken, refreshToken, expiresInSec) {\r\n this.refreshToken = refreshToken || null;\r\n this.accessToken = accessToken || null;\r\n this.expirationTime = Date.now() + expiresInSec * 1000;\r\n }\r\n static fromJSON(appName, object) {\r\n const { refreshToken, accessToken, expirationTime } = object;\r\n const manager = new StsTokenManager();\r\n if (refreshToken) {\r\n _assert(typeof refreshToken === 'string', \"internal-error\" /* INTERNAL_ERROR */, {\r\n appName\r\n });\r\n manager.refreshToken = refreshToken;\r\n }\r\n if (accessToken) {\r\n _assert(typeof accessToken === 'string', \"internal-error\" /* INTERNAL_ERROR */, {\r\n appName\r\n });\r\n manager.accessToken = accessToken;\r\n }\r\n if (expirationTime) {\r\n _assert(typeof expirationTime === 'number', \"internal-error\" /* INTERNAL_ERROR */, {\r\n appName\r\n });\r\n manager.expirationTime = expirationTime;\r\n }\r\n return manager;\r\n }\r\n toJSON() {\r\n return {\r\n refreshToken: this.refreshToken,\r\n accessToken: this.accessToken,\r\n expirationTime: this.expirationTime\r\n };\r\n }\r\n _assign(stsTokenManager) {\r\n this.accessToken = stsTokenManager.accessToken;\r\n this.refreshToken = stsTokenManager.refreshToken;\r\n this.expirationTime = stsTokenManager.expirationTime;\r\n }\r\n _clone() {\r\n return Object.assign(new StsTokenManager(), this.toJSON());\r\n }\r\n _performRefresh() {\r\n return debugFail('not implemented');\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction assertStringOrUndefined(assertion, appName) {\r\n _assert(typeof assertion === 'string' || typeof assertion === 'undefined', \"internal-error\" /* INTERNAL_ERROR */, { appName });\r\n}\r\nclass UserImpl {\r\n constructor(_a) {\r\n var { uid, auth, stsTokenManager } = _a, opt = __rest(_a, [\"uid\", \"auth\", \"stsTokenManager\"]);\r\n // For the user object, provider is always Firebase.\r\n this.providerId = \"firebase\" /* FIREBASE */;\r\n this.proactiveRefresh = new ProactiveRefresh(this);\r\n this.reloadUserInfo = null;\r\n this.reloadListener = null;\r\n this.uid = uid;\r\n this.auth = auth;\r\n this.stsTokenManager = stsTokenManager;\r\n this.accessToken = stsTokenManager.accessToken;\r\n this.displayName = opt.displayName || null;\r\n this.email = opt.email || null;\r\n this.emailVerified = opt.emailVerified || false;\r\n this.phoneNumber = opt.phoneNumber || null;\r\n this.photoURL = opt.photoURL || null;\r\n this.isAnonymous = opt.isAnonymous || false;\r\n this.tenantId = opt.tenantId || null;\r\n this.providerData = opt.providerData ? [...opt.providerData] : [];\r\n this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);\r\n }\r\n async getIdToken(forceRefresh) {\r\n const accessToken = await _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh));\r\n _assert(accessToken, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n if (this.accessToken !== accessToken) {\r\n this.accessToken = accessToken;\r\n await this.auth._persistUserIfCurrent(this);\r\n this.auth._notifyListenersIfCurrent(this);\r\n }\r\n return accessToken;\r\n }\r\n getIdTokenResult(forceRefresh) {\r\n return getIdTokenResult(this, forceRefresh);\r\n }\r\n reload() {\r\n return reload(this);\r\n }\r\n _assign(user) {\r\n if (this === user) {\r\n return;\r\n }\r\n _assert(this.uid === user.uid, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n this.displayName = user.displayName;\r\n this.photoURL = user.photoURL;\r\n this.email = user.email;\r\n this.emailVerified = user.emailVerified;\r\n this.phoneNumber = user.phoneNumber;\r\n this.isAnonymous = user.isAnonymous;\r\n this.tenantId = user.tenantId;\r\n this.providerData = user.providerData.map(userInfo => (Object.assign({}, userInfo)));\r\n this.metadata._copy(user.metadata);\r\n this.stsTokenManager._assign(user.stsTokenManager);\r\n }\r\n _clone(auth) {\r\n return new UserImpl(Object.assign(Object.assign({}, this), { auth, stsTokenManager: this.stsTokenManager._clone() }));\r\n }\r\n _onReload(callback) {\r\n // There should only ever be one listener, and that is a single instance of MultiFactorUser\r\n _assert(!this.reloadListener, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n this.reloadListener = callback;\r\n if (this.reloadUserInfo) {\r\n this._notifyReloadListener(this.reloadUserInfo);\r\n this.reloadUserInfo = null;\r\n }\r\n }\r\n _notifyReloadListener(userInfo) {\r\n if (this.reloadListener) {\r\n this.reloadListener(userInfo);\r\n }\r\n else {\r\n // If no listener is subscribed yet, save the result so it's available when they do subscribe\r\n this.reloadUserInfo = userInfo;\r\n }\r\n }\r\n _startProactiveRefresh() {\r\n this.proactiveRefresh._start();\r\n }\r\n _stopProactiveRefresh() {\r\n this.proactiveRefresh._stop();\r\n }\r\n async _updateTokensIfNecessary(response, reload = false) {\r\n let tokensRefreshed = false;\r\n if (response.idToken &&\r\n response.idToken !== this.stsTokenManager.accessToken) {\r\n this.stsTokenManager.updateFromServerResponse(response);\r\n tokensRefreshed = true;\r\n }\r\n if (reload) {\r\n await _reloadWithoutSaving(this);\r\n }\r\n await this.auth._persistUserIfCurrent(this);\r\n if (tokensRefreshed) {\r\n this.auth._notifyListenersIfCurrent(this);\r\n }\r\n }\r\n async delete() {\r\n const idToken = await this.getIdToken();\r\n await _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken }));\r\n this.stsTokenManager.clearRefreshToken();\r\n // TODO: Determine if cancellable-promises are necessary to use in this class so that delete()\r\n // cancels pending actions...\r\n return this.auth.signOut();\r\n }\r\n toJSON() {\r\n return Object.assign(Object.assign({ uid: this.uid, email: this.email || undefined, emailVerified: this.emailVerified, displayName: this.displayName || undefined, isAnonymous: this.isAnonymous, photoURL: this.photoURL || undefined, phoneNumber: this.phoneNumber || undefined, tenantId: this.tenantId || undefined, providerData: this.providerData.map(userInfo => (Object.assign({}, userInfo))), stsTokenManager: this.stsTokenManager.toJSON(), \r\n // Redirect event ID must be maintained in case there is a pending\r\n // redirect event.\r\n _redirectEventId: this._redirectEventId }, this.metadata.toJSON()), { \r\n // Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing):\r\n apiKey: this.auth.config.apiKey, appName: this.auth.name });\r\n }\r\n get refreshToken() {\r\n return this.stsTokenManager.refreshToken || '';\r\n }\r\n static _fromJSON(auth, object) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n const displayName = (_a = object.displayName) !== null && _a !== void 0 ? _a : undefined;\r\n const email = (_b = object.email) !== null && _b !== void 0 ? _b : undefined;\r\n const phoneNumber = (_c = object.phoneNumber) !== null && _c !== void 0 ? _c : undefined;\r\n const photoURL = (_d = object.photoURL) !== null && _d !== void 0 ? _d : undefined;\r\n const tenantId = (_e = object.tenantId) !== null && _e !== void 0 ? _e : undefined;\r\n const _redirectEventId = (_f = object._redirectEventId) !== null && _f !== void 0 ? _f : undefined;\r\n const createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;\r\n const lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;\r\n const { uid, emailVerified, isAnonymous, providerData, stsTokenManager: plainObjectTokenManager } = object;\r\n _assert(uid && plainObjectTokenManager, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);\r\n _assert(typeof uid === 'string', auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n assertStringOrUndefined(displayName, auth.name);\r\n assertStringOrUndefined(email, auth.name);\r\n _assert(typeof emailVerified === 'boolean', auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof isAnonymous === 'boolean', auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n assertStringOrUndefined(phoneNumber, auth.name);\r\n assertStringOrUndefined(photoURL, auth.name);\r\n assertStringOrUndefined(tenantId, auth.name);\r\n assertStringOrUndefined(_redirectEventId, auth.name);\r\n assertStringOrUndefined(createdAt, auth.name);\r\n assertStringOrUndefined(lastLoginAt, auth.name);\r\n const user = new UserImpl({\r\n uid,\r\n auth,\r\n email,\r\n emailVerified,\r\n displayName,\r\n isAnonymous,\r\n photoURL,\r\n phoneNumber,\r\n tenantId,\r\n stsTokenManager,\r\n createdAt,\r\n lastLoginAt\r\n });\r\n if (providerData && Array.isArray(providerData)) {\r\n user.providerData = providerData.map(userInfo => (Object.assign({}, userInfo)));\r\n }\r\n if (_redirectEventId) {\r\n user._redirectEventId = _redirectEventId;\r\n }\r\n return user;\r\n }\r\n /**\r\n * Initialize a User from an idToken server response\r\n * @param auth\r\n * @param idTokenResponse\r\n */\r\n static async _fromIdTokenResponse(auth, idTokenResponse, isAnonymous = false) {\r\n const stsTokenManager = new StsTokenManager();\r\n stsTokenManager.updateFromServerResponse(idTokenResponse);\r\n // Initialize the Firebase Auth user.\r\n const user = new UserImpl({\r\n uid: idTokenResponse.localId,\r\n auth,\r\n stsTokenManager,\r\n isAnonymous\r\n });\r\n // Updates the user info and data and resolves with a user instance.\r\n await _reloadWithoutSaving(user);\r\n return user;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass InMemoryPersistence {\r\n constructor() {\r\n this.type = \"NONE\" /* NONE */;\r\n this.storage = {};\r\n }\r\n async _isAvailable() {\r\n return true;\r\n }\r\n async _set(key, value) {\r\n this.storage[key] = value;\r\n }\r\n async _get(key) {\r\n const value = this.storage[key];\r\n return value === undefined ? null : value;\r\n }\r\n async _remove(key) {\r\n delete this.storage[key];\r\n }\r\n _addListener(_key, _listener) {\r\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\r\n return;\r\n }\r\n _removeListener(_key, _listener) {\r\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\r\n return;\r\n }\r\n}\r\nInMemoryPersistence.type = 'NONE';\r\n/**\r\n * An implementation of {@link Persistence} of type 'NONE'.\r\n *\r\n * @public\r\n */\r\nconst inMemoryPersistence = InMemoryPersistence;\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _persistenceKeyName(key, apiKey, appName) {\r\n return `${\"firebase\" /* PERSISTENCE */}:${key}:${apiKey}:${appName}`;\r\n}\r\nclass PersistenceUserManager {\r\n constructor(persistence, auth, userKey) {\r\n this.persistence = persistence;\r\n this.auth = auth;\r\n this.userKey = userKey;\r\n const { config, name } = this.auth;\r\n this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);\r\n this.fullPersistenceKey = _persistenceKeyName(\"persistence\" /* PERSISTENCE_USER */, config.apiKey, name);\r\n this.boundEventHandler = auth._onStorageEvent.bind(auth);\r\n this.persistence._addListener(this.fullUserKey, this.boundEventHandler);\r\n }\r\n setCurrentUser(user) {\r\n return this.persistence._set(this.fullUserKey, user.toJSON());\r\n }\r\n async getCurrentUser() {\r\n const blob = await this.persistence._get(this.fullUserKey);\r\n return blob ? UserImpl._fromJSON(this.auth, blob) : null;\r\n }\r\n removeCurrentUser() {\r\n return this.persistence._remove(this.fullUserKey);\r\n }\r\n savePersistenceForRedirect() {\r\n return this.persistence._set(this.fullPersistenceKey, this.persistence.type);\r\n }\r\n async setPersistence(newPersistence) {\r\n if (this.persistence === newPersistence) {\r\n return;\r\n }\r\n const currentUser = await this.getCurrentUser();\r\n await this.removeCurrentUser();\r\n this.persistence = newPersistence;\r\n if (currentUser) {\r\n return this.setCurrentUser(currentUser);\r\n }\r\n }\r\n delete() {\r\n this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);\r\n }\r\n static async create(auth, persistenceHierarchy, userKey = \"authUser\" /* AUTH_USER */) {\r\n if (!persistenceHierarchy.length) {\r\n return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey);\r\n }\r\n // Eliminate any persistences that are not available\r\n const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {\r\n if (await persistence._isAvailable()) {\r\n return persistence;\r\n }\r\n return undefined;\r\n }))).filter(persistence => persistence);\r\n // Fall back to the first persistence listed, or in memory if none available\r\n let selectedPersistence = availablePersistences[0] ||\r\n _getInstance(inMemoryPersistence);\r\n const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);\r\n // Pull out the existing user, setting the chosen persistence to that\r\n // persistence if the user exists.\r\n let userToMigrate = null;\r\n // Note, here we check for a user in _all_ persistences, not just the\r\n // ones deemed available. If we can migrate a user out of a broken\r\n // persistence, we will (but only if that persistence supports migration).\r\n for (const persistence of persistenceHierarchy) {\r\n try {\r\n const blob = await persistence._get(key);\r\n if (blob) {\r\n const user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)\r\n if (persistence !== selectedPersistence) {\r\n userToMigrate = user;\r\n }\r\n selectedPersistence = persistence;\r\n break;\r\n }\r\n }\r\n catch (_a) { }\r\n }\r\n // If we find the user in a persistence that does support migration, use\r\n // that migration path (of only persistences that support migration)\r\n const migrationHierarchy = availablePersistences.filter(p => p._shouldAllowMigration);\r\n // If the persistence does _not_ allow migration, just finish off here\r\n if (!selectedPersistence._shouldAllowMigration ||\r\n !migrationHierarchy.length) {\r\n return new PersistenceUserManager(selectedPersistence, auth, userKey);\r\n }\r\n selectedPersistence = migrationHierarchy[0];\r\n if (userToMigrate) {\r\n // This normally shouldn't throw since chosenPersistence.isAvailable() is true, but if it does\r\n // we'll just let it bubble to surface the error.\r\n await selectedPersistence._set(key, userToMigrate.toJSON());\r\n }\r\n // Attempt to clear the key in other persistences but ignore errors. This helps prevent issues\r\n // such as users getting stuck with a previous account after signing out and refreshing the tab.\r\n await Promise.all(persistenceHierarchy.map(async (persistence) => {\r\n if (persistence !== selectedPersistence) {\r\n try {\r\n await persistence._remove(key);\r\n }\r\n catch (_a) { }\r\n }\r\n }));\r\n return new PersistenceUserManager(selectedPersistence, auth, userKey);\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Determine the browser for the purposes of reporting usage to the API\r\n */\r\nfunction _getBrowserName(userAgent) {\r\n const ua = userAgent.toLowerCase();\r\n if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {\r\n return \"Opera\" /* OPERA */;\r\n }\r\n else if (_isIEMobile(ua)) {\r\n // Windows phone IEMobile browser.\r\n return \"IEMobile\" /* IEMOBILE */;\r\n }\r\n else if (ua.includes('msie') || ua.includes('trident/')) {\r\n return \"IE\" /* IE */;\r\n }\r\n else if (ua.includes('edge/')) {\r\n return \"Edge\" /* EDGE */;\r\n }\r\n else if (_isFirefox(ua)) {\r\n return \"Firefox\" /* FIREFOX */;\r\n }\r\n else if (ua.includes('silk/')) {\r\n return \"Silk\" /* SILK */;\r\n }\r\n else if (_isBlackBerry(ua)) {\r\n // Blackberry browser.\r\n return \"Blackberry\" /* BLACKBERRY */;\r\n }\r\n else if (_isWebOS(ua)) {\r\n // WebOS default browser.\r\n return \"Webos\" /* WEBOS */;\r\n }\r\n else if (_isSafari(ua)) {\r\n return \"Safari\" /* SAFARI */;\r\n }\r\n else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&\r\n !ua.includes('edge/')) {\r\n return \"Chrome\" /* CHROME */;\r\n }\r\n else if (_isAndroid(ua)) {\r\n // Android stock browser.\r\n return \"Android\" /* ANDROID */;\r\n }\r\n else {\r\n // Most modern browsers have name/version at end of user agent string.\r\n const re = /([a-zA-Z\\d\\.]+)\\/[a-zA-Z\\d\\.]*$/;\r\n const matches = userAgent.match(re);\r\n if ((matches === null || matches === void 0 ? void 0 : matches.length) === 2) {\r\n return matches[1];\r\n }\r\n }\r\n return \"Other\" /* OTHER */;\r\n}\r\nfunction _isFirefox(ua = getUA()) {\r\n return /firefox\\//i.test(ua);\r\n}\r\nfunction _isSafari(userAgent = getUA()) {\r\n const ua = userAgent.toLowerCase();\r\n return (ua.includes('safari/') &&\r\n !ua.includes('chrome/') &&\r\n !ua.includes('crios/') &&\r\n !ua.includes('android'));\r\n}\r\nfunction _isChromeIOS(ua = getUA()) {\r\n return /crios\\//i.test(ua);\r\n}\r\nfunction _isIEMobile(ua = getUA()) {\r\n return /iemobile/i.test(ua);\r\n}\r\nfunction _isAndroid(ua = getUA()) {\r\n return /android/i.test(ua);\r\n}\r\nfunction _isBlackBerry(ua = getUA()) {\r\n return /blackberry/i.test(ua);\r\n}\r\nfunction _isWebOS(ua = getUA()) {\r\n return /webos/i.test(ua);\r\n}\r\nfunction _isIOS(ua = getUA()) {\r\n return /iphone|ipad|ipod/i.test(ua);\r\n}\r\nfunction _isIOS7Or8(ua = getUA()) {\r\n return (/(iPad|iPhone|iPod).*OS 7_\\d/i.test(ua) ||\r\n /(iPad|iPhone|iPod).*OS 8_\\d/i.test(ua));\r\n}\r\nfunction _isIOSStandalone(ua = getUA()) {\r\n var _a;\r\n return _isIOS(ua) && !!((_a = window.navigator) === null || _a === void 0 ? void 0 : _a.standalone);\r\n}\r\nfunction _isIE10() {\r\n return isIE() && document.documentMode === 10;\r\n}\r\nfunction _isMobileBrowser(ua = getUA()) {\r\n // TODO: implement getBrowserName equivalent for OS.\r\n return (_isIOS(ua) ||\r\n _isAndroid(ua) ||\r\n _isWebOS(ua) ||\r\n _isBlackBerry(ua) ||\r\n /windows phone/i.test(ua) ||\r\n _isIEMobile(ua));\r\n}\r\nfunction _isIframe() {\r\n try {\r\n // Check that the current window is not the top window.\r\n // If so, return true.\r\n return !!(window && window !== window.top);\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/*\r\n * Determine the SDK version string\r\n */\r\nfunction _getClientVersion(clientPlatform, frameworks = []) {\r\n let reportedPlatform;\r\n switch (clientPlatform) {\r\n case \"Browser\" /* BROWSER */:\r\n // In a browser environment, report the browser name.\r\n reportedPlatform = _getBrowserName(getUA());\r\n break;\r\n case \"Worker\" /* WORKER */:\r\n // Technically a worker runs from a browser but we need to differentiate a\r\n // worker from a browser.\r\n // For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.\r\n reportedPlatform = `${_getBrowserName(getUA())}-${clientPlatform}`;\r\n break;\r\n default:\r\n reportedPlatform = clientPlatform;\r\n }\r\n const reportedFrameworks = frameworks.length\r\n ? frameworks.join(',')\r\n : 'FirebaseCore-web'; /* default value if no other framework is used */\r\n return `${reportedPlatform}/${\"JsCore\" /* CORE */}/${SDK_VERSION}/${reportedFrameworks}`;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass AuthImpl {\r\n constructor(app, config) {\r\n this.app = app;\r\n this.config = config;\r\n this.currentUser = null;\r\n this.emulatorConfig = null;\r\n this.operations = Promise.resolve();\r\n this.authStateSubscription = new Subscription(this);\r\n this.idTokenSubscription = new Subscription(this);\r\n this.redirectUser = null;\r\n this.isProactiveRefreshEnabled = false;\r\n // Any network calls will set this to true and prevent subsequent emulator\r\n // initialization\r\n this._canInitEmulator = true;\r\n this._isInitialized = false;\r\n this._deleted = false;\r\n this._initializationPromise = null;\r\n this._popupRedirectResolver = null;\r\n this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY;\r\n // Tracks the last notified UID for state change listeners to prevent\r\n // repeated calls to the callbacks. Undefined means it's never been\r\n // called, whereas null means it's been called with a signed out user\r\n this.lastNotifiedUid = undefined;\r\n this.languageCode = null;\r\n this.tenantId = null;\r\n this.settings = { appVerificationDisabledForTesting: false };\r\n this.frameworks = [];\r\n this.name = app.name;\r\n this.clientVersion = config.sdkClientVersion;\r\n }\r\n _initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {\r\n if (popupRedirectResolver) {\r\n this._popupRedirectResolver = _getInstance(popupRedirectResolver);\r\n }\r\n // Have to check for app deletion throughout initialization (after each\r\n // promise resolution)\r\n this._initializationPromise = this.queue(async () => {\r\n var _a, _b;\r\n if (this._deleted) {\r\n return;\r\n }\r\n this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);\r\n if (this._deleted) {\r\n return;\r\n }\r\n // Initialize the resolver early if necessary (only applicable to web:\r\n // this will cause the iframe to load immediately in certain cases)\r\n if ((_a = this._popupRedirectResolver) === null || _a === void 0 ? void 0 : _a._shouldInitProactively) {\r\n // If this fails, don't halt auth loading\r\n try {\r\n await this._popupRedirectResolver._initialize(this);\r\n }\r\n catch (e) { /* Ignore the error */ }\r\n }\r\n await this.initializeCurrentUser(popupRedirectResolver);\r\n this.lastNotifiedUid = ((_b = this.currentUser) === null || _b === void 0 ? void 0 : _b.uid) || null;\r\n if (this._deleted) {\r\n return;\r\n }\r\n this._isInitialized = true;\r\n });\r\n return this._initializationPromise;\r\n }\r\n /**\r\n * If the persistence is changed in another window, the user manager will let us know\r\n */\r\n async _onStorageEvent() {\r\n if (this._deleted) {\r\n return;\r\n }\r\n const user = await this.assertedPersistence.getCurrentUser();\r\n if (!this.currentUser && !user) {\r\n // No change, do nothing (was signed out and remained signed out).\r\n return;\r\n }\r\n // If the same user is to be synchronized.\r\n if (this.currentUser && user && this.currentUser.uid === user.uid) {\r\n // Data update, simply copy data changes.\r\n this._currentUser._assign(user);\r\n // If tokens changed from previous user tokens, this will trigger\r\n // notifyAuthListeners_.\r\n await this.currentUser.getIdToken();\r\n return;\r\n }\r\n // Update current Auth state. Either a new login or logout.\r\n await this._updateCurrentUser(user);\r\n }\r\n async initializeCurrentUser(popupRedirectResolver) {\r\n var _a;\r\n // First check to see if we have a pending redirect event.\r\n let storedUser = (await this.assertedPersistence.getCurrentUser());\r\n if (popupRedirectResolver && this.config.authDomain) {\r\n await this.getOrInitRedirectPersistenceManager();\r\n const redirectUserEventId = (_a = this.redirectUser) === null || _a === void 0 ? void 0 : _a._redirectEventId;\r\n const storedUserEventId = storedUser === null || storedUser === void 0 ? void 0 : storedUser._redirectEventId;\r\n const result = await this.tryRedirectSignIn(popupRedirectResolver);\r\n // If the stored user (i.e. the old \"currentUser\") has a redirectId that\r\n // matches the redirect user, then we want to initially sign in with the\r\n // new user object from result.\r\n // TODO(samgho): More thoroughly test all of this\r\n if ((!redirectUserEventId || redirectUserEventId === storedUserEventId) &&\r\n (result === null || result === void 0 ? void 0 : result.user)) {\r\n storedUser = result.user;\r\n }\r\n }\r\n // If no user in persistence, there is no current user. Set to null.\r\n if (!storedUser) {\r\n return this.directlySetCurrentUser(null);\r\n }\r\n if (!storedUser._redirectEventId) {\r\n // This isn't a redirect user, we can reload and bail\r\n // This will also catch the redirected user, if available, as that method\r\n // strips the _redirectEventId\r\n return this.reloadAndSetCurrentUserOrClear(storedUser);\r\n }\r\n _assert(this._popupRedirectResolver, this, \"argument-error\" /* ARGUMENT_ERROR */);\r\n await this.getOrInitRedirectPersistenceManager();\r\n // If the redirect user's event ID matches the current user's event ID,\r\n // DO NOT reload the current user, otherwise they'll be cleared from storage.\r\n // This is important for the reauthenticateWithRedirect() flow.\r\n if (this.redirectUser &&\r\n this.redirectUser._redirectEventId === storedUser._redirectEventId) {\r\n return this.directlySetCurrentUser(storedUser);\r\n }\r\n return this.reloadAndSetCurrentUserOrClear(storedUser);\r\n }\r\n async tryRedirectSignIn(redirectResolver) {\r\n // The redirect user needs to be checked (and signed in if available)\r\n // during auth initialization. All of the normal sign in and link/reauth\r\n // flows call back into auth and push things onto the promise queue. We\r\n // need to await the result of the redirect sign in *inside the promise\r\n // queue*. This presents a problem: we run into deadlock. See:\r\n // ┌> [Initialization] ─────┐\r\n // ┌> [] │\r\n // └─ [getRedirectResult] <─┘\r\n // where [] are tasks on the queue and arrows denote awaits\r\n // Initialization will never complete because it's waiting on something\r\n // that's waiting for initialization to complete!\r\n //\r\n // Instead, this method calls getRedirectResult() (stored in\r\n // _completeRedirectFn) with an optional parameter that instructs all of\r\n // the underlying auth operations to skip anything that mutates auth state.\r\n let result = null;\r\n try {\r\n // We know this._popupRedirectResolver is set since redirectResolver\r\n // is passed in. The _completeRedirectFn expects the unwrapped extern.\r\n result = await this._popupRedirectResolver._completeRedirectFn(this, redirectResolver, true);\r\n }\r\n catch (e) {\r\n // Swallow any errors here; the code can retrieve them in\r\n // getRedirectResult().\r\n await this._setRedirectUser(null);\r\n }\r\n return result;\r\n }\r\n async reloadAndSetCurrentUserOrClear(user) {\r\n try {\r\n await _reloadWithoutSaving(user);\r\n }\r\n catch (e) {\r\n if (e.code !== `auth/${\"network-request-failed\" /* NETWORK_REQUEST_FAILED */}`) {\r\n // Something's wrong with the user's token. Log them out and remove\r\n // them from storage\r\n return this.directlySetCurrentUser(null);\r\n }\r\n }\r\n return this.directlySetCurrentUser(user);\r\n }\r\n useDeviceLanguage() {\r\n this.languageCode = _getUserLanguage();\r\n }\r\n async _delete() {\r\n this._deleted = true;\r\n }\r\n async updateCurrentUser(userExtern) {\r\n // The public updateCurrentUser method needs to make a copy of the user,\r\n // and also check that the project matches\r\n const user = userExtern\r\n ? getModularInstance(userExtern)\r\n : null;\r\n if (user) {\r\n _assert(user.auth.config.apiKey === this.config.apiKey, this, \"invalid-user-token\" /* INVALID_AUTH */);\r\n }\r\n return this._updateCurrentUser(user && user._clone(this));\r\n }\r\n async _updateCurrentUser(user) {\r\n if (this._deleted) {\r\n return;\r\n }\r\n if (user) {\r\n _assert(this.tenantId === user.tenantId, this, \"tenant-id-mismatch\" /* TENANT_ID_MISMATCH */);\r\n }\r\n return this.queue(async () => {\r\n await this.directlySetCurrentUser(user);\r\n this.notifyAuthListeners();\r\n });\r\n }\r\n async signOut() {\r\n // Clear the redirect user when signOut is called\r\n if (this.redirectPersistenceManager || this._popupRedirectResolver) {\r\n await this._setRedirectUser(null);\r\n }\r\n return this._updateCurrentUser(null);\r\n }\r\n setPersistence(persistence) {\r\n return this.queue(async () => {\r\n await this.assertedPersistence.setPersistence(_getInstance(persistence));\r\n });\r\n }\r\n _getPersistence() {\r\n return this.assertedPersistence.persistence.type;\r\n }\r\n _updateErrorMap(errorMap) {\r\n this._errorFactory = new ErrorFactory('auth', 'Firebase', errorMap());\r\n }\r\n onAuthStateChanged(nextOrObserver, error, completed) {\r\n return this.registerStateListener(this.authStateSubscription, nextOrObserver, error, completed);\r\n }\r\n onIdTokenChanged(nextOrObserver, error, completed) {\r\n return this.registerStateListener(this.idTokenSubscription, nextOrObserver, error, completed);\r\n }\r\n toJSON() {\r\n var _a;\r\n return {\r\n apiKey: this.config.apiKey,\r\n authDomain: this.config.authDomain,\r\n appName: this.name,\r\n currentUser: (_a = this._currentUser) === null || _a === void 0 ? void 0 : _a.toJSON()\r\n };\r\n }\r\n async _setRedirectUser(user, popupRedirectResolver) {\r\n const redirectManager = await this.getOrInitRedirectPersistenceManager(popupRedirectResolver);\r\n return user === null\r\n ? redirectManager.removeCurrentUser()\r\n : redirectManager.setCurrentUser(user);\r\n }\r\n async getOrInitRedirectPersistenceManager(popupRedirectResolver) {\r\n if (!this.redirectPersistenceManager) {\r\n const resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||\r\n this._popupRedirectResolver;\r\n _assert(resolver, this, \"argument-error\" /* ARGUMENT_ERROR */);\r\n this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], \"redirectUser\" /* REDIRECT_USER */);\r\n this.redirectUser =\r\n await this.redirectPersistenceManager.getCurrentUser();\r\n }\r\n return this.redirectPersistenceManager;\r\n }\r\n async _redirectUserForId(id) {\r\n var _a, _b;\r\n // Make sure we've cleared any pending persistence actions if we're not in\r\n // the initializer\r\n if (this._isInitialized) {\r\n await this.queue(async () => { });\r\n }\r\n if (((_a = this._currentUser) === null || _a === void 0 ? void 0 : _a._redirectEventId) === id) {\r\n return this._currentUser;\r\n }\r\n if (((_b = this.redirectUser) === null || _b === void 0 ? void 0 : _b._redirectEventId) === id) {\r\n return this.redirectUser;\r\n }\r\n return null;\r\n }\r\n async _persistUserIfCurrent(user) {\r\n if (user === this.currentUser) {\r\n return this.queue(async () => this.directlySetCurrentUser(user));\r\n }\r\n }\r\n /** Notifies listeners only if the user is current */\r\n _notifyListenersIfCurrent(user) {\r\n if (user === this.currentUser) {\r\n this.notifyAuthListeners();\r\n }\r\n }\r\n _key() {\r\n return `${this.config.authDomain}:${this.config.apiKey}:${this.name}`;\r\n }\r\n _startProactiveRefresh() {\r\n this.isProactiveRefreshEnabled = true;\r\n if (this.currentUser) {\r\n this._currentUser._startProactiveRefresh();\r\n }\r\n }\r\n _stopProactiveRefresh() {\r\n this.isProactiveRefreshEnabled = false;\r\n if (this.currentUser) {\r\n this._currentUser._stopProactiveRefresh();\r\n }\r\n }\r\n /** Returns the current user cast as the internal type */\r\n get _currentUser() {\r\n return this.currentUser;\r\n }\r\n notifyAuthListeners() {\r\n var _a, _b;\r\n if (!this._isInitialized) {\r\n return;\r\n }\r\n this.idTokenSubscription.next(this.currentUser);\r\n const currentUid = (_b = (_a = this.currentUser) === null || _a === void 0 ? void 0 : _a.uid) !== null && _b !== void 0 ? _b : null;\r\n if (this.lastNotifiedUid !== currentUid) {\r\n this.lastNotifiedUid = currentUid;\r\n this.authStateSubscription.next(this.currentUser);\r\n }\r\n }\r\n registerStateListener(subscription, nextOrObserver, error, completed) {\r\n if (this._deleted) {\r\n return () => { };\r\n }\r\n const cb = typeof nextOrObserver === 'function'\r\n ? nextOrObserver\r\n : nextOrObserver.next.bind(nextOrObserver);\r\n const promise = this._isInitialized\r\n ? Promise.resolve()\r\n : this._initializationPromise;\r\n _assert(promise, this, \"internal-error\" /* INTERNAL_ERROR */);\r\n // The callback needs to be called asynchronously per the spec.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n promise.then(() => cb(this.currentUser));\r\n if (typeof nextOrObserver === 'function') {\r\n return subscription.addObserver(nextOrObserver, error, completed);\r\n }\r\n else {\r\n return subscription.addObserver(nextOrObserver);\r\n }\r\n }\r\n /**\r\n * Unprotected (from race conditions) method to set the current user. This\r\n * should only be called from within a queued callback. This is necessary\r\n * because the queue shouldn't rely on another queued callback.\r\n */\r\n async directlySetCurrentUser(user) {\r\n if (this.currentUser && this.currentUser !== user) {\r\n this._currentUser._stopProactiveRefresh();\r\n if (user && this.isProactiveRefreshEnabled) {\r\n user._startProactiveRefresh();\r\n }\r\n }\r\n this.currentUser = user;\r\n if (user) {\r\n await this.assertedPersistence.setCurrentUser(user);\r\n }\r\n else {\r\n await this.assertedPersistence.removeCurrentUser();\r\n }\r\n }\r\n queue(action) {\r\n // In case something errors, the callback still should be called in order\r\n // to keep the promise chain alive\r\n this.operations = this.operations.then(action, action);\r\n return this.operations;\r\n }\r\n get assertedPersistence() {\r\n _assert(this.persistenceManager, this, \"internal-error\" /* INTERNAL_ERROR */);\r\n return this.persistenceManager;\r\n }\r\n _logFramework(framework) {\r\n if (!framework || this.frameworks.includes(framework)) {\r\n return;\r\n }\r\n this.frameworks.push(framework);\r\n // Sort alphabetically so that \"FirebaseCore-web,FirebaseUI-web\" and\r\n // \"FirebaseUI-web,FirebaseCore-web\" aren't viewed as different.\r\n this.frameworks.sort();\r\n this.clientVersion = _getClientVersion(this.config.clientPlatform, this._getFrameworks());\r\n }\r\n _getFrameworks() {\r\n return this.frameworks;\r\n }\r\n async _getAdditionalHeaders() {\r\n // Additional headers on every request\r\n const headers = {\r\n [\"X-Client-Version\" /* X_CLIENT_VERSION */]: this.clientVersion,\r\n };\r\n if (this.app.options.appId) {\r\n headers[\"X-Firebase-gmpid\" /* X_FIREBASE_GMPID */] = this.app.options.appId;\r\n }\r\n return headers;\r\n }\r\n}\r\n/**\r\n * Method to be used to cast down to our private implmentation of Auth.\r\n * It will also handle unwrapping from the compat type if necessary\r\n *\r\n * @param auth Auth object passed in from developer\r\n */\r\nfunction _castAuth(auth) {\r\n return getModularInstance(auth);\r\n}\r\n/** Helper class to wrap subscriber logic */\r\nclass Subscription {\r\n constructor(auth) {\r\n this.auth = auth;\r\n this.observer = null;\r\n this.addObserver = createSubscribe(observer => (this.observer = observer));\r\n }\r\n get next() {\r\n _assert(this.observer, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return this.observer.next.bind(this.observer);\r\n }\r\n}\n\n/**\r\n * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production\r\n * Firebase Auth services.\r\n *\r\n * @remarks\r\n * This must be called synchronously immediately following the first call to\r\n * {@link initializeAuth}. Do not use with production credentials as emulator\r\n * traffic is not encrypted.\r\n *\r\n *\r\n * @example\r\n * ```javascript\r\n * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').\r\n * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to\r\n * `true` to disable the warning banner attached to the DOM.\r\n *\r\n * @public\r\n */\r\nfunction connectAuthEmulator(auth, url, options) {\r\n const authInternal = _castAuth(auth);\r\n _assert(authInternal._canInitEmulator, authInternal, \"emulator-config-failed\" /* EMULATOR_CONFIG_FAILED */);\r\n _assert(/^https?:\\/\\//.test(url), authInternal, \"invalid-emulator-scheme\" /* INVALID_EMULATOR_SCHEME */);\r\n const disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);\r\n const protocol = extractProtocol(url);\r\n const { host, port } = extractHostAndPort(url);\r\n const portStr = port === null ? '' : `:${port}`;\r\n // Always replace path with \"/\" (even if input url had no path at all, or had a different one).\r\n authInternal.config.emulator = { url: `${protocol}//${host}${portStr}/` };\r\n authInternal.settings.appVerificationDisabledForTesting = true;\r\n authInternal.emulatorConfig = Object.freeze({\r\n host,\r\n port,\r\n protocol: protocol.replace(':', ''),\r\n options: Object.freeze({ disableWarnings })\r\n });\r\n if (!disableWarnings) {\r\n emitEmulatorWarning();\r\n }\r\n}\r\nfunction extractProtocol(url) {\r\n const protocolEnd = url.indexOf(':');\r\n return protocolEnd < 0 ? '' : url.substr(0, protocolEnd + 1);\r\n}\r\nfunction extractHostAndPort(url) {\r\n const protocol = extractProtocol(url);\r\n const authority = /(\\/\\/)?([^?#/]+)/.exec(url.substr(protocol.length)); // Between // and /, ? or #.\r\n if (!authority) {\r\n return { host: '', port: null };\r\n }\r\n const hostAndPort = authority[2].split('@').pop() || ''; // Strip out \"username:password@\".\r\n const bracketedIPv6 = /^(\\[[^\\]]+\\])(:|$)/.exec(hostAndPort);\r\n if (bracketedIPv6) {\r\n const host = bracketedIPv6[1];\r\n return { host, port: parsePort(hostAndPort.substr(host.length + 1)) };\r\n }\r\n else {\r\n const [host, port] = hostAndPort.split(':');\r\n return { host, port: parsePort(port) };\r\n }\r\n}\r\nfunction parsePort(portStr) {\r\n if (!portStr) {\r\n return null;\r\n }\r\n const port = Number(portStr);\r\n if (isNaN(port)) {\r\n return null;\r\n }\r\n return port;\r\n}\r\nfunction emitEmulatorWarning() {\r\n function attachBanner() {\r\n const el = document.createElement('p');\r\n const sty = el.style;\r\n el.innerText =\r\n 'Running in emulator mode. Do not use with production credentials.';\r\n sty.position = 'fixed';\r\n sty.width = '100%';\r\n sty.backgroundColor = '#ffffff';\r\n sty.border = '.1em solid #000000';\r\n sty.color = '#b50000';\r\n sty.bottom = '0px';\r\n sty.left = '0px';\r\n sty.margin = '0px';\r\n sty.zIndex = '10000';\r\n sty.textAlign = 'center';\r\n el.classList.add('firebase-emulator-warning');\r\n document.body.appendChild(el);\r\n }\r\n if (typeof console !== 'undefined' && typeof console.info === 'function') {\r\n console.info('WARNING: You are using the Auth Emulator,' +\r\n ' which is intended for local testing only. Do not use with' +\r\n ' production credentials.');\r\n }\r\n if (typeof window !== 'undefined' &&\r\n typeof document !== 'undefined') {\r\n if (document.readyState === 'loading') {\r\n window.addEventListener('DOMContentLoaded', attachBanner);\r\n }\r\n else {\r\n attachBanner();\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Interface that represents the credentials returned by an {@link AuthProvider}.\r\n *\r\n * @remarks\r\n * Implementations specify the details about each auth provider's credential requirements.\r\n *\r\n * @public\r\n */\r\nclass AuthCredential {\r\n /** @internal */\r\n constructor(\r\n /**\r\n * The authentication provider ID for the credential.\r\n *\r\n * @remarks\r\n * For example, 'facebook.com', or 'google.com'.\r\n */\r\n providerId, \r\n /**\r\n * The authentication sign in method for the credential.\r\n *\r\n * @remarks\r\n * For example, {@link SignInMethod}.EMAIL_PASSWORD, or\r\n * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method\r\n * identifier as returned in {@link fetchSignInMethodsForEmail}.\r\n */\r\n signInMethod) {\r\n this.providerId = providerId;\r\n this.signInMethod = signInMethod;\r\n }\r\n /**\r\n * Returns a JSON-serializable representation of this object.\r\n *\r\n * @returns a JSON-serializable representation of this object.\r\n */\r\n toJSON() {\r\n return debugFail('not implemented');\r\n }\r\n /** @internal */\r\n _getIdTokenResponse(_auth) {\r\n return debugFail('not implemented');\r\n }\r\n /** @internal */\r\n _linkToIdToken(_auth, _idToken) {\r\n return debugFail('not implemented');\r\n }\r\n /** @internal */\r\n _getReauthenticationResolver(_auth) {\r\n return debugFail('not implemented');\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function resetPassword(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:resetPassword\" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request));\r\n}\r\nasync function updateEmailPassword(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:update\" /* SET_ACCOUNT_INFO */, request);\r\n}\r\nasync function applyActionCode$1(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:update\" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function signInWithPassword(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithPassword\" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request));\r\n}\r\nasync function sendOobCode(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:sendOobCode\" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request));\r\n}\r\nasync function sendEmailVerification$1(auth, request) {\r\n return sendOobCode(auth, request);\r\n}\r\nasync function sendPasswordResetEmail$1(auth, request) {\r\n return sendOobCode(auth, request);\r\n}\r\nasync function sendSignInLinkToEmail$1(auth, request) {\r\n return sendOobCode(auth, request);\r\n}\r\nasync function verifyAndChangeEmail(auth, request) {\r\n return sendOobCode(auth, request);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function signInWithEmailLink$1(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithEmailLink\" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));\r\n}\r\nasync function signInWithEmailLinkForLinking(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithEmailLink\" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Interface that represents the credentials returned by {@link EmailAuthProvider} for\r\n * {@link ProviderId}.PASSWORD\r\n *\r\n * @remarks\r\n * Covers both {@link SignInMethod}.EMAIL_PASSWORD and\r\n * {@link SignInMethod}.EMAIL_LINK.\r\n *\r\n * @public\r\n */\r\nclass EmailAuthCredential extends AuthCredential {\r\n /** @internal */\r\n constructor(\r\n /** @internal */\r\n _email, \r\n /** @internal */\r\n _password, signInMethod, \r\n /** @internal */\r\n _tenantId = null) {\r\n super(\"password\" /* PASSWORD */, signInMethod);\r\n this._email = _email;\r\n this._password = _password;\r\n this._tenantId = _tenantId;\r\n }\r\n /** @internal */\r\n static _fromEmailAndPassword(email, password) {\r\n return new EmailAuthCredential(email, password, \"password\" /* EMAIL_PASSWORD */);\r\n }\r\n /** @internal */\r\n static _fromEmailAndCode(email, oobCode, tenantId = null) {\r\n return new EmailAuthCredential(email, oobCode, \"emailLink\" /* EMAIL_LINK */, tenantId);\r\n }\r\n /** {@inheritdoc AuthCredential.toJSON} */\r\n toJSON() {\r\n return {\r\n email: this._email,\r\n password: this._password,\r\n signInMethod: this.signInMethod,\r\n tenantId: this._tenantId\r\n };\r\n }\r\n /**\r\n * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.\r\n *\r\n * @param json - Either `object` or the stringified representation of the object. When string is\r\n * provided, `JSON.parse` would be called first.\r\n *\r\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\r\n */\r\n static fromJSON(json) {\r\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\r\n if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {\r\n if (obj.signInMethod === \"password\" /* EMAIL_PASSWORD */) {\r\n return this._fromEmailAndPassword(obj.email, obj.password);\r\n }\r\n else if (obj.signInMethod === \"emailLink\" /* EMAIL_LINK */) {\r\n return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);\r\n }\r\n }\r\n return null;\r\n }\r\n /** @internal */\r\n async _getIdTokenResponse(auth) {\r\n switch (this.signInMethod) {\r\n case \"password\" /* EMAIL_PASSWORD */:\r\n return signInWithPassword(auth, {\r\n returnSecureToken: true,\r\n email: this._email,\r\n password: this._password\r\n });\r\n case \"emailLink\" /* EMAIL_LINK */:\r\n return signInWithEmailLink$1(auth, {\r\n email: this._email,\r\n oobCode: this._password\r\n });\r\n default:\r\n _fail(auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n }\r\n /** @internal */\r\n async _linkToIdToken(auth, idToken) {\r\n switch (this.signInMethod) {\r\n case \"password\" /* EMAIL_PASSWORD */:\r\n return updateEmailPassword(auth, {\r\n idToken,\r\n returnSecureToken: true,\r\n email: this._email,\r\n password: this._password\r\n });\r\n case \"emailLink\" /* EMAIL_LINK */:\r\n return signInWithEmailLinkForLinking(auth, {\r\n idToken,\r\n email: this._email,\r\n oobCode: this._password\r\n });\r\n default:\r\n _fail(auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n }\r\n /** @internal */\r\n _getReauthenticationResolver(auth) {\r\n return this._getIdTokenResponse(auth);\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function signInWithIdp(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithIdp\" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst IDP_REQUEST_URI$1 = 'http://localhost';\r\n/**\r\n * Represents the OAuth credentials returned by an {@link OAuthProvider}.\r\n *\r\n * @remarks\r\n * Implementations specify the details about each auth provider's credential requirements.\r\n *\r\n * @public\r\n */\r\nclass OAuthCredential extends AuthCredential {\r\n constructor() {\r\n super(...arguments);\r\n this.pendingToken = null;\r\n }\r\n /** @internal */\r\n static _fromParams(params) {\r\n const cred = new OAuthCredential(params.providerId, params.signInMethod);\r\n if (params.idToken || params.accessToken) {\r\n // OAuth 2 and either ID token or access token.\r\n if (params.idToken) {\r\n cred.idToken = params.idToken;\r\n }\r\n if (params.accessToken) {\r\n cred.accessToken = params.accessToken;\r\n }\r\n // Add nonce if available and no pendingToken is present.\r\n if (params.nonce && !params.pendingToken) {\r\n cred.nonce = params.nonce;\r\n }\r\n if (params.pendingToken) {\r\n cred.pendingToken = params.pendingToken;\r\n }\r\n }\r\n else if (params.oauthToken && params.oauthTokenSecret) {\r\n // OAuth 1 and OAuth token with token secret\r\n cred.accessToken = params.oauthToken;\r\n cred.secret = params.oauthTokenSecret;\r\n }\r\n else {\r\n _fail(\"argument-error\" /* ARGUMENT_ERROR */);\r\n }\r\n return cred;\r\n }\r\n /** {@inheritdoc AuthCredential.toJSON} */\r\n toJSON() {\r\n return {\r\n idToken: this.idToken,\r\n accessToken: this.accessToken,\r\n secret: this.secret,\r\n nonce: this.nonce,\r\n pendingToken: this.pendingToken,\r\n providerId: this.providerId,\r\n signInMethod: this.signInMethod\r\n };\r\n }\r\n /**\r\n * Static method to deserialize a JSON representation of an object into an\r\n * {@link AuthCredential}.\r\n *\r\n * @param json - Input can be either Object or the stringified representation of the object.\r\n * When string is provided, JSON.parse would be called first.\r\n *\r\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\r\n */\r\n static fromJSON(json) {\r\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\r\n const { providerId, signInMethod } = obj, rest = __rest(obj, [\"providerId\", \"signInMethod\"]);\r\n if (!providerId || !signInMethod) {\r\n return null;\r\n }\r\n const cred = new OAuthCredential(providerId, signInMethod);\r\n cred.idToken = rest.idToken || undefined;\r\n cred.accessToken = rest.accessToken || undefined;\r\n cred.secret = rest.secret;\r\n cred.nonce = rest.nonce;\r\n cred.pendingToken = rest.pendingToken || null;\r\n return cred;\r\n }\r\n /** @internal */\r\n _getIdTokenResponse(auth) {\r\n const request = this.buildRequest();\r\n return signInWithIdp(auth, request);\r\n }\r\n /** @internal */\r\n _linkToIdToken(auth, idToken) {\r\n const request = this.buildRequest();\r\n request.idToken = idToken;\r\n return signInWithIdp(auth, request);\r\n }\r\n /** @internal */\r\n _getReauthenticationResolver(auth) {\r\n const request = this.buildRequest();\r\n request.autoCreate = false;\r\n return signInWithIdp(auth, request);\r\n }\r\n buildRequest() {\r\n const request = {\r\n requestUri: IDP_REQUEST_URI$1,\r\n returnSecureToken: true\r\n };\r\n if (this.pendingToken) {\r\n request.pendingToken = this.pendingToken;\r\n }\r\n else {\r\n const postBody = {};\r\n if (this.idToken) {\r\n postBody['id_token'] = this.idToken;\r\n }\r\n if (this.accessToken) {\r\n postBody['access_token'] = this.accessToken;\r\n }\r\n if (this.secret) {\r\n postBody['oauth_token_secret'] = this.secret;\r\n }\r\n postBody['providerId'] = this.providerId;\r\n if (this.nonce && !this.pendingToken) {\r\n postBody['nonce'] = this.nonce;\r\n }\r\n request.postBody = querystring(postBody);\r\n }\r\n return request;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function sendPhoneVerificationCode(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:sendVerificationCode\" /* SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request));\r\n}\r\nasync function signInWithPhoneNumber$1(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithPhoneNumber\" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));\r\n}\r\nasync function linkWithPhoneNumber$1(auth, request) {\r\n const response = await _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithPhoneNumber\" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));\r\n if (response.temporaryProof) {\r\n throw _makeTaggedError(auth, \"account-exists-with-different-credential\" /* NEED_CONFIRMATION */, response);\r\n }\r\n return response;\r\n}\r\nconst VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = {\r\n [\"USER_NOT_FOUND\" /* USER_NOT_FOUND */]: \"user-not-found\" /* USER_DELETED */\r\n};\r\nasync function verifyPhoneNumberForExisting(auth, request) {\r\n const apiRequest = Object.assign(Object.assign({}, request), { operation: 'REAUTH' });\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithPhoneNumber\" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Represents the credentials returned by {@link PhoneAuthProvider}.\r\n *\r\n * @public\r\n */\r\nclass PhoneAuthCredential extends AuthCredential {\r\n constructor(params) {\r\n super(\"phone\" /* PHONE */, \"phone\" /* PHONE */);\r\n this.params = params;\r\n }\r\n /** @internal */\r\n static _fromVerification(verificationId, verificationCode) {\r\n return new PhoneAuthCredential({ verificationId, verificationCode });\r\n }\r\n /** @internal */\r\n static _fromTokenResponse(phoneNumber, temporaryProof) {\r\n return new PhoneAuthCredential({ phoneNumber, temporaryProof });\r\n }\r\n /** @internal */\r\n _getIdTokenResponse(auth) {\r\n return signInWithPhoneNumber$1(auth, this._makeVerificationRequest());\r\n }\r\n /** @internal */\r\n _linkToIdToken(auth, idToken) {\r\n return linkWithPhoneNumber$1(auth, Object.assign({ idToken }, this._makeVerificationRequest()));\r\n }\r\n /** @internal */\r\n _getReauthenticationResolver(auth) {\r\n return verifyPhoneNumberForExisting(auth, this._makeVerificationRequest());\r\n }\r\n /** @internal */\r\n _makeVerificationRequest() {\r\n const { temporaryProof, phoneNumber, verificationId, verificationCode } = this.params;\r\n if (temporaryProof && phoneNumber) {\r\n return { temporaryProof, phoneNumber };\r\n }\r\n return {\r\n sessionInfo: verificationId,\r\n code: verificationCode\r\n };\r\n }\r\n /** {@inheritdoc AuthCredential.toJSON} */\r\n toJSON() {\r\n const obj = {\r\n providerId: this.providerId\r\n };\r\n if (this.params.phoneNumber) {\r\n obj.phoneNumber = this.params.phoneNumber;\r\n }\r\n if (this.params.temporaryProof) {\r\n obj.temporaryProof = this.params.temporaryProof;\r\n }\r\n if (this.params.verificationCode) {\r\n obj.verificationCode = this.params.verificationCode;\r\n }\r\n if (this.params.verificationId) {\r\n obj.verificationId = this.params.verificationId;\r\n }\r\n return obj;\r\n }\r\n /** Generates a phone credential based on a plain object or a JSON string. */\r\n static fromJSON(json) {\r\n if (typeof json === 'string') {\r\n json = JSON.parse(json);\r\n }\r\n const { verificationId, verificationCode, phoneNumber, temporaryProof } = json;\r\n if (!verificationCode &&\r\n !verificationId &&\r\n !phoneNumber &&\r\n !temporaryProof) {\r\n return null;\r\n }\r\n return new PhoneAuthCredential({\r\n verificationId,\r\n verificationCode,\r\n phoneNumber,\r\n temporaryProof\r\n });\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Maps the mode string in action code URL to Action Code Info operation.\r\n *\r\n * @param mode\r\n */\r\nfunction parseMode(mode) {\r\n switch (mode) {\r\n case 'recoverEmail':\r\n return \"RECOVER_EMAIL\" /* RECOVER_EMAIL */;\r\n case 'resetPassword':\r\n return \"PASSWORD_RESET\" /* PASSWORD_RESET */;\r\n case 'signIn':\r\n return \"EMAIL_SIGNIN\" /* EMAIL_SIGNIN */;\r\n case 'verifyEmail':\r\n return \"VERIFY_EMAIL\" /* VERIFY_EMAIL */;\r\n case 'verifyAndChangeEmail':\r\n return \"VERIFY_AND_CHANGE_EMAIL\" /* VERIFY_AND_CHANGE_EMAIL */;\r\n case 'revertSecondFactorAddition':\r\n return \"REVERT_SECOND_FACTOR_ADDITION\" /* REVERT_SECOND_FACTOR_ADDITION */;\r\n default:\r\n return null;\r\n }\r\n}\r\n/**\r\n * Helper to parse FDL links\r\n *\r\n * @param url\r\n */\r\nfunction parseDeepLink(url) {\r\n const link = querystringDecode(extractQuerystring(url))['link'];\r\n // Double link case (automatic redirect).\r\n const doubleDeepLink = link\r\n ? querystringDecode(extractQuerystring(link))['deep_link_id']\r\n : null;\r\n // iOS custom scheme links.\r\n const iOSDeepLink = querystringDecode(extractQuerystring(url))['deep_link_id'];\r\n const iOSDoubleDeepLink = iOSDeepLink\r\n ? querystringDecode(extractQuerystring(iOSDeepLink))['link']\r\n : null;\r\n return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;\r\n}\r\n/**\r\n * A utility class to parse email action URLs such as password reset, email verification,\r\n * email link sign in, etc.\r\n *\r\n * @public\r\n */\r\nclass ActionCodeURL {\r\n /**\r\n * @param actionLink - The link from which to extract the URL.\r\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\r\n *\r\n * @internal\r\n */\r\n constructor(actionLink) {\r\n var _a, _b, _c, _d, _e, _f;\r\n const searchParams = querystringDecode(extractQuerystring(actionLink));\r\n const apiKey = (_a = searchParams[\"apiKey\" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;\r\n const code = (_b = searchParams[\"oobCode\" /* CODE */]) !== null && _b !== void 0 ? _b : null;\r\n const operation = parseMode((_c = searchParams[\"mode\" /* MODE */]) !== null && _c !== void 0 ? _c : null);\r\n // Validate API key, code and mode.\r\n _assert(apiKey && code && operation, \"argument-error\" /* ARGUMENT_ERROR */);\r\n this.apiKey = apiKey;\r\n this.operation = operation;\r\n this.code = code;\r\n this.continueUrl = (_d = searchParams[\"continueUrl\" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;\r\n this.languageCode = (_e = searchParams[\"languageCode\" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;\r\n this.tenantId = (_f = searchParams[\"tenantId\" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;\r\n }\r\n /**\r\n * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,\r\n * otherwise returns null.\r\n *\r\n * @param link - The email action link string.\r\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\r\n *\r\n * @public\r\n */\r\n static parseLink(link) {\r\n const actionLink = parseDeepLink(link);\r\n try {\r\n return new ActionCodeURL(actionLink);\r\n }\r\n catch (_a) {\r\n return null;\r\n }\r\n }\r\n}\r\n/**\r\n * Parses the email action link string and returns an {@link ActionCodeURL} if\r\n * the link is valid, otherwise returns null.\r\n *\r\n * @public\r\n */\r\nfunction parseActionCodeURL(link) {\r\n return ActionCodeURL.parseLink(link);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for generating {@link EmailAuthCredential}.\r\n *\r\n * @public\r\n */\r\nclass EmailAuthProvider {\r\n constructor() {\r\n /**\r\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\r\n */\r\n this.providerId = EmailAuthProvider.PROVIDER_ID;\r\n }\r\n /**\r\n * Initialize an {@link AuthCredential} using an email and password.\r\n *\r\n * @example\r\n * ```javascript\r\n * const authCredential = EmailAuthProvider.credential(email, password);\r\n * const userCredential = await signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * const userCredential = await signInWithEmailAndPassword(auth, email, password);\r\n * ```\r\n *\r\n * @param email - Email address.\r\n * @param password - User account password.\r\n * @returns The auth provider credential.\r\n */\r\n static credential(email, password) {\r\n return EmailAuthCredential._fromEmailAndPassword(email, password);\r\n }\r\n /**\r\n * Initialize an {@link AuthCredential} using an email and an email link after a sign in with\r\n * email link operation.\r\n *\r\n * @example\r\n * ```javascript\r\n * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);\r\n * const userCredential = await signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * await sendSignInLinkToEmail(auth, email);\r\n * // Obtain emailLink from user.\r\n * const userCredential = await signInWithEmailLink(auth, email, emailLink);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance used to verify the link.\r\n * @param email - Email address.\r\n * @param emailLink - Sign-in email link.\r\n * @returns - The auth provider credential.\r\n */\r\n static credentialWithLink(email, emailLink) {\r\n const actionCodeUrl = ActionCodeURL.parseLink(emailLink);\r\n _assert(actionCodeUrl, \"argument-error\" /* ARGUMENT_ERROR */);\r\n return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);\r\n }\r\n}\r\n/**\r\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\r\n */\r\nEmailAuthProvider.PROVIDER_ID = \"password\" /* PASSWORD */;\r\n/**\r\n * Always set to {@link SignInMethod}.EMAIL_PASSWORD.\r\n */\r\nEmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = \"password\" /* EMAIL_PASSWORD */;\r\n/**\r\n * Always set to {@link SignInMethod}.EMAIL_LINK.\r\n */\r\nEmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = \"emailLink\" /* EMAIL_LINK */;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * The base class for all Federated providers (OAuth (including OIDC), SAML).\r\n *\r\n * This class is not meant to be instantiated directly.\r\n *\r\n * @public\r\n */\r\nclass FederatedAuthProvider {\r\n /**\r\n * Constructor for generic OAuth providers.\r\n *\r\n * @param providerId - Provider for which credentials should be generated.\r\n */\r\n constructor(providerId) {\r\n this.providerId = providerId;\r\n /** @internal */\r\n this.defaultLanguageCode = null;\r\n /** @internal */\r\n this.customParameters = {};\r\n }\r\n /**\r\n * Set the language gode.\r\n *\r\n * @param languageCode - language code\r\n */\r\n setDefaultLanguage(languageCode) {\r\n this.defaultLanguageCode = languageCode;\r\n }\r\n /**\r\n * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in\r\n * operations.\r\n *\r\n * @remarks\r\n * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,\r\n * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.\r\n *\r\n * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.\r\n */\r\n setCustomParameters(customOAuthParameters) {\r\n this.customParameters = customOAuthParameters;\r\n return this;\r\n }\r\n /**\r\n * Retrieve the current list of {@link CustomParameters}.\r\n */\r\n getCustomParameters() {\r\n return this.customParameters;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Common code to all OAuth providers. This is separate from the\r\n * {@link OAuthProvider} so that child providers (like\r\n * {@link GoogleAuthProvider}) don't inherit the `credential` instance method.\r\n * Instead, they rely on a static `credential` method.\r\n */\r\nclass BaseOAuthProvider extends FederatedAuthProvider {\r\n constructor() {\r\n super(...arguments);\r\n /** @internal */\r\n this.scopes = [];\r\n }\r\n /**\r\n * Add an OAuth scope to the credential.\r\n *\r\n * @param scope - Provider OAuth scope to add.\r\n */\r\n addScope(scope) {\r\n // If not already added, add scope to list.\r\n if (!this.scopes.includes(scope)) {\r\n this.scopes.push(scope);\r\n }\r\n return this;\r\n }\r\n /**\r\n * Retrieve the current list of OAuth scopes.\r\n */\r\n getScopes() {\r\n return [...this.scopes];\r\n }\r\n}\r\n/**\r\n * Provider for generating generic {@link OAuthCredential}.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new OAuthProvider('google.com');\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a OAuth Access Token for the provider.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new OAuthProvider('google.com');\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a OAuth Access Token for the provider.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * ```\r\n * @public\r\n */\r\nclass OAuthProvider extends BaseOAuthProvider {\r\n /**\r\n * Creates an {@link OAuthCredential} from a JSON string or a plain object.\r\n * @param json - A plain object or a JSON string\r\n */\r\n static credentialFromJSON(json) {\r\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\r\n _assert('providerId' in obj && 'signInMethod' in obj, \"argument-error\" /* ARGUMENT_ERROR */);\r\n return OAuthCredential._fromParams(obj);\r\n }\r\n /**\r\n * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token.\r\n *\r\n * @remarks\r\n * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of\r\n * the raw nonce must match the nonce field in the ID token.\r\n *\r\n * @example\r\n * ```javascript\r\n * // `googleUser` from the onsuccess Google Sign In callback.\r\n * // Initialize a generate OAuth provider with a `google.com` providerId.\r\n * const provider = new OAuthProvider('google.com');\r\n * const credential = provider.credential({\r\n * idToken: googleUser.getAuthResponse().id_token,\r\n * });\r\n * const result = await signInWithCredential(credential);\r\n * ```\r\n *\r\n * @param params - Either the options object containing the ID token, access token and raw nonce\r\n * or the ID token string.\r\n */\r\n credential(params) {\r\n return this._credential(Object.assign(Object.assign({}, params), { nonce: params.rawNonce }));\r\n }\r\n /** An internal credential method that accepts more permissive options */\r\n _credential(params) {\r\n _assert(params.idToken || params.accessToken, \"argument-error\" /* ARGUMENT_ERROR */);\r\n // For OAuthCredential, sign in method is same as providerId.\r\n return OAuthCredential._fromParams(Object.assign(Object.assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n return OAuthProvider.oauthCredentialFromTaggedObject(userCredential);\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromError(error) {\r\n return OAuthProvider.oauthCredentialFromTaggedObject((error.customData || {}));\r\n }\r\n static oauthCredentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse) {\r\n return null;\r\n }\r\n const { oauthIdToken, oauthAccessToken, oauthTokenSecret, pendingToken, nonce, providerId } = tokenResponse;\r\n if (!oauthAccessToken &&\r\n !oauthTokenSecret &&\r\n !oauthIdToken &&\r\n !pendingToken) {\r\n return null;\r\n }\r\n if (!providerId) {\r\n return null;\r\n }\r\n try {\r\n return new OAuthProvider(providerId)._credential({\r\n idToken: oauthIdToken,\r\n accessToken: oauthAccessToken,\r\n nonce,\r\n pendingToken\r\n });\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('user_birthday');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = FacebookAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * provider.addScope('user_birthday');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = FacebookAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * ```\r\n *\r\n * @public\r\n */\r\nclass FacebookAuthProvider extends BaseOAuthProvider {\r\n constructor() {\r\n super(\"facebook.com\" /* FACEBOOK */);\r\n }\r\n /**\r\n * Creates a credential for Facebook.\r\n *\r\n * @example\r\n * ```javascript\r\n * // `event` from the Facebook auth.authResponseChange callback.\r\n * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);\r\n * const result = await signInWithCredential(credential);\r\n * ```\r\n *\r\n * @param accessToken - Facebook access token.\r\n */\r\n static credential(accessToken) {\r\n return OAuthCredential._fromParams({\r\n providerId: FacebookAuthProvider.PROVIDER_ID,\r\n signInMethod: FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD,\r\n accessToken\r\n });\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n return FacebookAuthProvider.credentialFromTaggedObject(userCredential);\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromError(error) {\r\n return FacebookAuthProvider.credentialFromTaggedObject((error.customData || {}));\r\n }\r\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\r\n return null;\r\n }\r\n if (!tokenResponse.oauthAccessToken) {\r\n return null;\r\n }\r\n try {\r\n return FacebookAuthProvider.credential(tokenResponse.oauthAccessToken);\r\n }\r\n catch (_a) {\r\n return null;\r\n }\r\n }\r\n}\r\n/** Always set to {@link SignInMethod}.FACEBOOK. */\r\nFacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = \"facebook.com\" /* FACEBOOK */;\r\n/** Always set to {@link ProviderId}.FACEBOOK. */\r\nFacebookAuthProvider.PROVIDER_ID = \"facebook.com\" /* FACEBOOK */;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for generating an an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new GoogleAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Google Access Token.\r\n * const credential = GoogleAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new GoogleAuthProvider();\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Google Access Token.\r\n * const credential = GoogleAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * ```\r\n *\r\n * @public\r\n */\r\nclass GoogleAuthProvider extends BaseOAuthProvider {\r\n constructor() {\r\n super(\"google.com\" /* GOOGLE */);\r\n this.addScope('profile');\r\n }\r\n /**\r\n * Creates a credential for Google. At least one of ID token and access token is required.\r\n *\r\n * @example\r\n * ```javascript\r\n * // \\`googleUser\\` from the onsuccess Google Sign In callback.\r\n * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);\r\n * const result = await signInWithCredential(credential);\r\n * ```\r\n *\r\n * @param idToken - Google ID token.\r\n * @param accessToken - Google access token.\r\n */\r\n static credential(idToken, accessToken) {\r\n return OAuthCredential._fromParams({\r\n providerId: GoogleAuthProvider.PROVIDER_ID,\r\n signInMethod: GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD,\r\n idToken,\r\n accessToken\r\n });\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n return GoogleAuthProvider.credentialFromTaggedObject(userCredential);\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromError(error) {\r\n return GoogleAuthProvider.credentialFromTaggedObject((error.customData || {}));\r\n }\r\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse) {\r\n return null;\r\n }\r\n const { oauthIdToken, oauthAccessToken } = tokenResponse;\r\n if (!oauthIdToken && !oauthAccessToken) {\r\n // This could be an oauth 1 credential or a phone credential\r\n return null;\r\n }\r\n try {\r\n return GoogleAuthProvider.credential(oauthIdToken, oauthAccessToken);\r\n }\r\n catch (_a) {\r\n return null;\r\n }\r\n }\r\n}\r\n/** Always set to {@link SignInMethod}.GOOGLE. */\r\nGoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = \"google.com\" /* GOOGLE */;\r\n/** Always set to {@link ProviderId}.GOOGLE. */\r\nGoogleAuthProvider.PROVIDER_ID = \"google.com\" /* GOOGLE */;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.\r\n *\r\n * @remarks\r\n * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use\r\n * the {@link signInWithPopup} handler:\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new GithubAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('repo');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Github Access Token.\r\n * const credential = GithubAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new GithubAuthProvider();\r\n * provider.addScope('repo');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Github Access Token.\r\n * const credential = GithubAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * ```\r\n * @public\r\n */\r\nclass GithubAuthProvider extends BaseOAuthProvider {\r\n constructor() {\r\n super(\"github.com\" /* GITHUB */);\r\n }\r\n /**\r\n * Creates a credential for Github.\r\n *\r\n * @param accessToken - Github access token.\r\n */\r\n static credential(accessToken) {\r\n return OAuthCredential._fromParams({\r\n providerId: GithubAuthProvider.PROVIDER_ID,\r\n signInMethod: GithubAuthProvider.GITHUB_SIGN_IN_METHOD,\r\n accessToken\r\n });\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n return GithubAuthProvider.credentialFromTaggedObject(userCredential);\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromError(error) {\r\n return GithubAuthProvider.credentialFromTaggedObject((error.customData || {}));\r\n }\r\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\r\n return null;\r\n }\r\n if (!tokenResponse.oauthAccessToken) {\r\n return null;\r\n }\r\n try {\r\n return GithubAuthProvider.credential(tokenResponse.oauthAccessToken);\r\n }\r\n catch (_a) {\r\n return null;\r\n }\r\n }\r\n}\r\n/** Always set to {@link SignInMethod}.GITHUB. */\r\nGithubAuthProvider.GITHUB_SIGN_IN_METHOD = \"github.com\" /* GITHUB */;\r\n/** Always set to {@link ProviderId}.GITHUB. */\r\nGithubAuthProvider.PROVIDER_ID = \"github.com\" /* GITHUB */;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst IDP_REQUEST_URI = 'http://localhost';\r\n/**\r\n * @public\r\n */\r\nclass SAMLAuthCredential extends AuthCredential {\r\n /** @internal */\r\n constructor(providerId, pendingToken) {\r\n super(providerId, providerId);\r\n this.pendingToken = pendingToken;\r\n }\r\n /** @internal */\r\n _getIdTokenResponse(auth) {\r\n const request = this.buildRequest();\r\n return signInWithIdp(auth, request);\r\n }\r\n /** @internal */\r\n _linkToIdToken(auth, idToken) {\r\n const request = this.buildRequest();\r\n request.idToken = idToken;\r\n return signInWithIdp(auth, request);\r\n }\r\n /** @internal */\r\n _getReauthenticationResolver(auth) {\r\n const request = this.buildRequest();\r\n request.autoCreate = false;\r\n return signInWithIdp(auth, request);\r\n }\r\n /** {@inheritdoc AuthCredential.toJSON} */\r\n toJSON() {\r\n return {\r\n signInMethod: this.signInMethod,\r\n providerId: this.providerId,\r\n pendingToken: this.pendingToken\r\n };\r\n }\r\n /**\r\n * Static method to deserialize a JSON representation of an object into an\r\n * {@link AuthCredential}.\r\n *\r\n * @param json - Input can be either Object or the stringified representation of the object.\r\n * When string is provided, JSON.parse would be called first.\r\n *\r\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\r\n */\r\n static fromJSON(json) {\r\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\r\n const { providerId, signInMethod, pendingToken } = obj;\r\n if (!providerId ||\r\n !signInMethod ||\r\n !pendingToken ||\r\n providerId !== signInMethod) {\r\n return null;\r\n }\r\n return new SAMLAuthCredential(providerId, pendingToken);\r\n }\r\n /**\r\n * Helper static method to avoid exposing the constructor to end users.\r\n *\r\n * @internal\r\n */\r\n static _create(providerId, pendingToken) {\r\n return new SAMLAuthCredential(providerId, pendingToken);\r\n }\r\n buildRequest() {\r\n return {\r\n requestUri: IDP_REQUEST_URI,\r\n returnSecureToken: true,\r\n pendingToken: this.pendingToken\r\n };\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst SAML_PROVIDER_PREFIX = 'saml.';\r\n/**\r\n * An {@link AuthProvider} for SAML.\r\n *\r\n * @public\r\n */\r\nclass SAMLAuthProvider extends FederatedAuthProvider {\r\n /**\r\n * Constructor. The providerId must start with \"saml.\"\r\n * @param providerId - SAML provider ID.\r\n */\r\n constructor(providerId) {\r\n _assert(providerId.startsWith(SAML_PROVIDER_PREFIX), \"argument-error\" /* ARGUMENT_ERROR */);\r\n super(providerId);\r\n }\r\n /**\r\n * Generates an {@link AuthCredential} from a {@link UserCredential} after a\r\n * successful SAML flow completes.\r\n *\r\n * @remarks\r\n *\r\n * For example, to get an {@link AuthCredential}, you could write the\r\n * following code:\r\n *\r\n * ```js\r\n * const userCredential = await signInWithPopup(auth, samlProvider);\r\n * const credential = SAMLAuthProvider.credentialFromResult(userCredential);\r\n * ```\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n return SAMLAuthProvider.samlCredentialFromTaggedObject(userCredential);\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromError(error) {\r\n return SAMLAuthProvider.samlCredentialFromTaggedObject((error.customData || {}));\r\n }\r\n /**\r\n * Creates an {@link AuthCredential} from a JSON string or a plain object.\r\n * @param json - A plain object or a JSON string\r\n */\r\n static credentialFromJSON(json) {\r\n const credential = SAMLAuthCredential.fromJSON(json);\r\n _assert(credential, \"argument-error\" /* ARGUMENT_ERROR */);\r\n return credential;\r\n }\r\n static samlCredentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse) {\r\n return null;\r\n }\r\n const { pendingToken, providerId } = tokenResponse;\r\n if (!pendingToken || !providerId) {\r\n return null;\r\n }\r\n try {\r\n return SAMLAuthCredential._create(providerId, pendingToken);\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new TwitterAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Twitter Access Token and Secret.\r\n * const credential = TwitterAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * const secret = credential.secret;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new TwitterAuthProvider();\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Twitter Access Token and Secret.\r\n * const credential = TwitterAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * const secret = credential.secret;\r\n * ```\r\n *\r\n * @public\r\n */\r\nclass TwitterAuthProvider extends BaseOAuthProvider {\r\n constructor() {\r\n super(\"twitter.com\" /* TWITTER */);\r\n }\r\n /**\r\n * Creates a credential for Twitter.\r\n *\r\n * @param token - Twitter access token.\r\n * @param secret - Twitter secret.\r\n */\r\n static credential(token, secret) {\r\n return OAuthCredential._fromParams({\r\n providerId: TwitterAuthProvider.PROVIDER_ID,\r\n signInMethod: TwitterAuthProvider.TWITTER_SIGN_IN_METHOD,\r\n oauthToken: token,\r\n oauthTokenSecret: secret\r\n });\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n return TwitterAuthProvider.credentialFromTaggedObject(userCredential);\r\n }\r\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromError(error) {\r\n return TwitterAuthProvider.credentialFromTaggedObject((error.customData || {}));\r\n }\r\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse) {\r\n return null;\r\n }\r\n const { oauthAccessToken, oauthTokenSecret } = tokenResponse;\r\n if (!oauthAccessToken || !oauthTokenSecret) {\r\n return null;\r\n }\r\n try {\r\n return TwitterAuthProvider.credential(oauthAccessToken, oauthTokenSecret);\r\n }\r\n catch (_a) {\r\n return null;\r\n }\r\n }\r\n}\r\n/** Always set to {@link SignInMethod}.TWITTER. */\r\nTwitterAuthProvider.TWITTER_SIGN_IN_METHOD = \"twitter.com\" /* TWITTER */;\r\n/** Always set to {@link ProviderId}.TWITTER. */\r\nTwitterAuthProvider.PROVIDER_ID = \"twitter.com\" /* TWITTER */;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function signUp(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signUp\" /* SIGN_UP */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass UserCredentialImpl {\r\n constructor(params) {\r\n this.user = params.user;\r\n this.providerId = params.providerId;\r\n this._tokenResponse = params._tokenResponse;\r\n this.operationType = params.operationType;\r\n }\r\n static async _fromIdTokenResponse(auth, operationType, idTokenResponse, isAnonymous = false) {\r\n const user = await UserImpl._fromIdTokenResponse(auth, idTokenResponse, isAnonymous);\r\n const providerId = providerIdForResponse(idTokenResponse);\r\n const userCred = new UserCredentialImpl({\r\n user,\r\n providerId,\r\n _tokenResponse: idTokenResponse,\r\n operationType\r\n });\r\n return userCred;\r\n }\r\n static async _forOperation(user, operationType, response) {\r\n await user._updateTokensIfNecessary(response, /* reload */ true);\r\n const providerId = providerIdForResponse(response);\r\n return new UserCredentialImpl({\r\n user,\r\n providerId,\r\n _tokenResponse: response,\r\n operationType\r\n });\r\n }\r\n}\r\nfunction providerIdForResponse(response) {\r\n if (response.providerId) {\r\n return response.providerId;\r\n }\r\n if ('phoneNumber' in response) {\r\n return \"phone\" /* PHONE */;\r\n }\r\n return null;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Asynchronously signs in as an anonymous user.\r\n *\r\n * @remarks\r\n * If there is already an anonymous user signed in, that user will be returned; otherwise, a\r\n * new anonymous user identity will be created and returned.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\r\nasync function signInAnonymously(auth) {\r\n var _a;\r\n const authInternal = _castAuth(auth);\r\n await authInternal._initializationPromise;\r\n if ((_a = authInternal.currentUser) === null || _a === void 0 ? void 0 : _a.isAnonymous) {\r\n // If an anonymous user is already signed in, no need to sign them in again.\r\n return new UserCredentialImpl({\r\n user: authInternal.currentUser,\r\n providerId: null,\r\n operationType: \"signIn\" /* SIGN_IN */\r\n });\r\n }\r\n const response = await signUp(authInternal, {\r\n returnSecureToken: true\r\n });\r\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, \"signIn\" /* SIGN_IN */, response, true);\r\n await authInternal._updateCurrentUser(userCredential.user);\r\n return userCredential;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass MultiFactorError extends FirebaseError {\r\n constructor(auth, error, operationType, user) {\r\n var _a;\r\n super(error.code, error.message);\r\n this.operationType = operationType;\r\n this.user = user;\r\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n Object.setPrototypeOf(this, MultiFactorError.prototype);\r\n this.customData = {\r\n appName: auth.name,\r\n tenantId: (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined,\r\n _serverResponse: error.customData._serverResponse,\r\n operationType,\r\n };\r\n }\r\n static _fromErrorAndOperation(auth, error, operationType, user) {\r\n return new MultiFactorError(auth, error, operationType, user);\r\n }\r\n}\r\nfunction _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {\r\n const idTokenProvider = operationType === \"reauthenticate\" /* REAUTHENTICATE */\r\n ? credential._getReauthenticationResolver(auth)\r\n : credential._getIdTokenResponse(auth);\r\n return idTokenProvider.catch(error => {\r\n if (error.code === `auth/${\"multi-factor-auth-required\" /* MFA_REQUIRED */}`) {\r\n throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);\r\n }\r\n throw error;\r\n });\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Takes a set of UserInfo provider data and converts it to a set of names\r\n */\r\nfunction providerDataAsNames(providerData) {\r\n return new Set(providerData\r\n .map(({ providerId }) => providerId)\r\n .filter(pid => !!pid));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Unlinks a provider from a user account.\r\n *\r\n * @param user - The user.\r\n * @param providerId - The provider to unlink.\r\n *\r\n * @public\r\n */\r\nasync function unlink(user, providerId) {\r\n const userInternal = getModularInstance(user);\r\n await _assertLinkedStatus(true, userInternal, providerId);\r\n const { providerUserInfo } = await deleteLinkedAccounts(userInternal.auth, {\r\n idToken: await userInternal.getIdToken(),\r\n deleteProvider: [providerId]\r\n });\r\n const providersLeft = providerDataAsNames(providerUserInfo || []);\r\n userInternal.providerData = userInternal.providerData.filter(pd => providersLeft.has(pd.providerId));\r\n if (!providersLeft.has(\"phone\" /* PHONE */)) {\r\n userInternal.phoneNumber = null;\r\n }\r\n await userInternal.auth._persistUserIfCurrent(userInternal);\r\n return userInternal;\r\n}\r\nasync function _link$1(user, credential, bypassAuthState = false) {\r\n const response = await _logoutIfInvalidated(user, credential._linkToIdToken(user.auth, await user.getIdToken()), bypassAuthState);\r\n return UserCredentialImpl._forOperation(user, \"link\" /* LINK */, response);\r\n}\r\nasync function _assertLinkedStatus(expected, user, provider) {\r\n await _reloadWithoutSaving(user);\r\n const providerIds = providerDataAsNames(user.providerData);\r\n const code = expected === false\r\n ? \"provider-already-linked\" /* PROVIDER_ALREADY_LINKED */\r\n : \"no-such-provider\" /* NO_SUCH_PROVIDER */;\r\n _assert(providerIds.has(provider) === expected, user.auth, code);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function _reauthenticate(user, credential, bypassAuthState = false) {\r\n const { auth } = user;\r\n const operationType = \"reauthenticate\" /* REAUTHENTICATE */;\r\n try {\r\n const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);\r\n _assert(response.idToken, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const parsed = _parseToken(response.idToken);\r\n _assert(parsed, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const { sub: localId } = parsed;\r\n _assert(user.uid === localId, auth, \"user-mismatch\" /* USER_MISMATCH */);\r\n return UserCredentialImpl._forOperation(user, operationType, response);\r\n }\r\n catch (e) {\r\n // Convert user deleted error into user mismatch\r\n if ((e === null || e === void 0 ? void 0 : e.code) === `auth/${\"user-not-found\" /* USER_DELETED */}`) {\r\n _fail(auth, \"user-mismatch\" /* USER_MISMATCH */);\r\n }\r\n throw e;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function _signInWithCredential(auth, credential, bypassAuthState = false) {\r\n const operationType = \"signIn\" /* SIGN_IN */;\r\n const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);\r\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);\r\n if (!bypassAuthState) {\r\n await auth._updateCurrentUser(userCredential.user);\r\n }\r\n return userCredential;\r\n}\r\n/**\r\n * Asynchronously signs in with the given credentials.\r\n *\r\n * @remarks\r\n * An {@link AuthProvider} can be used to generate the credential.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param credential - The auth credential.\r\n *\r\n * @public\r\n */\r\nasync function signInWithCredential(auth, credential) {\r\n return _signInWithCredential(_castAuth(auth), credential);\r\n}\r\n/**\r\n * Links the user account with the given credentials.\r\n *\r\n * @remarks\r\n * An {@link AuthProvider} can be used to generate the credential.\r\n *\r\n * @param user - The user.\r\n * @param credential - The auth credential.\r\n *\r\n * @public\r\n */\r\nasync function linkWithCredential(user, credential) {\r\n const userInternal = getModularInstance(user);\r\n await _assertLinkedStatus(false, userInternal, credential.providerId);\r\n return _link$1(userInternal, credential);\r\n}\r\n/**\r\n * Re-authenticates a user using a fresh credential.\r\n *\r\n * @remarks\r\n * Use before operations such as {@link updatePassword} that require tokens from recent sign-in\r\n * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error.\r\n *\r\n * @param user - The user.\r\n * @param credential - The auth credential.\r\n *\r\n * @public\r\n */\r\nasync function reauthenticateWithCredential(user, credential) {\r\n return _reauthenticate(getModularInstance(user), credential);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function signInWithCustomToken$1(auth, request) {\r\n return _performSignInRequest(auth, \"POST\" /* POST */, \"/v1/accounts:signInWithCustomToken\" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Asynchronously signs in using a custom token.\r\n *\r\n * @remarks\r\n * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must\r\n * be generated by an auth backend using the\r\n * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken}\r\n * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} .\r\n *\r\n * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param customToken - The custom token to sign in with.\r\n *\r\n * @public\r\n */\r\nasync function signInWithCustomToken(auth, customToken) {\r\n const authInternal = _castAuth(auth);\r\n const response = await signInWithCustomToken$1(authInternal, {\r\n token: customToken,\r\n returnSecureToken: true\r\n });\r\n const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, \"signIn\" /* SIGN_IN */, response);\r\n await authInternal._updateCurrentUser(cred.user);\r\n return cred;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass MultiFactorInfoImpl {\r\n constructor(factorId, response) {\r\n this.factorId = factorId;\r\n this.uid = response.mfaEnrollmentId;\r\n this.enrollmentTime = new Date(response.enrolledAt).toUTCString();\r\n this.displayName = response.displayName;\r\n }\r\n static _fromServerResponse(auth, enrollment) {\r\n if ('phoneInfo' in enrollment) {\r\n return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);\r\n }\r\n return _fail(auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n}\r\nclass PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl {\r\n constructor(response) {\r\n super(\"phone\" /* PHONE */, response);\r\n this.phoneNumber = response.phoneInfo;\r\n }\r\n static _fromServerResponse(_auth, enrollment) {\r\n return new PhoneMultiFactorInfoImpl(enrollment);\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {\r\n var _a;\r\n _assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, \"invalid-continue-uri\" /* INVALID_CONTINUE_URI */);\r\n _assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||\r\n actionCodeSettings.dynamicLinkDomain.length > 0, auth, \"invalid-dynamic-link-domain\" /* INVALID_DYNAMIC_LINK_DOMAIN */);\r\n request.continueUrl = actionCodeSettings.url;\r\n request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;\r\n request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;\r\n if (actionCodeSettings.iOS) {\r\n _assert(actionCodeSettings.iOS.bundleId.length > 0, auth, \"missing-ios-bundle-id\" /* MISSING_IOS_BUNDLE_ID */);\r\n request.iOSBundleId = actionCodeSettings.iOS.bundleId;\r\n }\r\n if (actionCodeSettings.android) {\r\n _assert(actionCodeSettings.android.packageName.length > 0, auth, \"missing-android-pkg-name\" /* MISSING_ANDROID_PACKAGE_NAME */);\r\n request.androidInstallApp = actionCodeSettings.android.installApp;\r\n request.androidMinimumVersionCode =\r\n actionCodeSettings.android.minimumVersion;\r\n request.androidPackageName = actionCodeSettings.android.packageName;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Sends a password reset email to the given email address.\r\n *\r\n * @remarks\r\n * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in\r\n * the email sent to the user, along with the new password specified by the user.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);\r\n * // Obtain code from user.\r\n * await confirmPasswordReset('user@example.com', code);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\r\nasync function sendPasswordResetEmail(auth, email, actionCodeSettings) {\r\n const authModular = getModularInstance(auth);\r\n const request = {\r\n requestType: \"PASSWORD_RESET\" /* PASSWORD_RESET */,\r\n email\r\n };\r\n if (actionCodeSettings) {\r\n _setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);\r\n }\r\n await sendPasswordResetEmail$1(authModular, request);\r\n}\r\n/**\r\n * Completes the password reset process, given a confirmation code and new password.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param oobCode - A confirmation code sent to the user.\r\n * @param newPassword - The new password.\r\n *\r\n * @public\r\n */\r\nasync function confirmPasswordReset(auth, oobCode, newPassword) {\r\n await resetPassword(getModularInstance(auth), {\r\n oobCode,\r\n newPassword\r\n });\r\n // Do not return the email.\r\n}\r\n/**\r\n * Applies a verification code sent to the user by email or other out-of-band mechanism.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param oobCode - A verification code sent to the user.\r\n *\r\n * @public\r\n */\r\nasync function applyActionCode(auth, oobCode) {\r\n await applyActionCode$1(getModularInstance(auth), { oobCode });\r\n}\r\n/**\r\n * Checks a verification code sent to the user by email or other out-of-band mechanism.\r\n *\r\n * @returns metadata about the code.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param oobCode - A verification code sent to the user.\r\n *\r\n * @public\r\n */\r\nasync function checkActionCode(auth, oobCode) {\r\n const authModular = getModularInstance(auth);\r\n const response = await resetPassword(authModular, { oobCode });\r\n // Email could be empty only if the request type is EMAIL_SIGNIN or\r\n // VERIFY_AND_CHANGE_EMAIL.\r\n // New email should not be empty if the request type is\r\n // VERIFY_AND_CHANGE_EMAIL.\r\n // Multi-factor info could not be empty if the request type is\r\n // REVERT_SECOND_FACTOR_ADDITION.\r\n const operation = response.requestType;\r\n _assert(operation, authModular, \"internal-error\" /* INTERNAL_ERROR */);\r\n switch (operation) {\r\n case \"EMAIL_SIGNIN\" /* EMAIL_SIGNIN */:\r\n break;\r\n case \"VERIFY_AND_CHANGE_EMAIL\" /* VERIFY_AND_CHANGE_EMAIL */:\r\n _assert(response.newEmail, authModular, \"internal-error\" /* INTERNAL_ERROR */);\r\n break;\r\n case \"REVERT_SECOND_FACTOR_ADDITION\" /* REVERT_SECOND_FACTOR_ADDITION */:\r\n _assert(response.mfaInfo, authModular, \"internal-error\" /* INTERNAL_ERROR */);\r\n // fall through\r\n default:\r\n _assert(response.email, authModular, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n // The multi-factor info for revert second factor addition\r\n let multiFactorInfo = null;\r\n if (response.mfaInfo) {\r\n multiFactorInfo = MultiFactorInfoImpl._fromServerResponse(_castAuth(authModular), response.mfaInfo);\r\n }\r\n return {\r\n data: {\r\n email: (response.requestType === \"VERIFY_AND_CHANGE_EMAIL\" /* VERIFY_AND_CHANGE_EMAIL */\r\n ? response.newEmail\r\n : response.email) || null,\r\n previousEmail: (response.requestType === \"VERIFY_AND_CHANGE_EMAIL\" /* VERIFY_AND_CHANGE_EMAIL */\r\n ? response.email\r\n : response.newEmail) || null,\r\n multiFactorInfo\r\n },\r\n operation\r\n };\r\n}\r\n/**\r\n * Checks a password reset code sent to the user by email or other out-of-band mechanism.\r\n *\r\n * @returns the user's email address if valid.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param code - A verification code sent to the user.\r\n *\r\n * @public\r\n */\r\nasync function verifyPasswordResetCode(auth, code) {\r\n const { data } = await checkActionCode(getModularInstance(auth), code);\r\n // Email should always be present since a code was sent to it\r\n return data.email;\r\n}\r\n/**\r\n * Creates a new user account associated with the specified email address and password.\r\n *\r\n * @remarks\r\n * On successful creation of the user account, this user will also be signed in to your application.\r\n *\r\n * User account creation can fail if the account already exists or the password is invalid.\r\n *\r\n * Note: The email address acts as a unique identifier for the user and enables an email-based\r\n * password reset. This function will create a new user account and set the initial user password.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param password - The user's chosen password.\r\n *\r\n * @public\r\n */\r\nasync function createUserWithEmailAndPassword(auth, email, password) {\r\n const authInternal = _castAuth(auth);\r\n const response = await signUp(authInternal, {\r\n returnSecureToken: true,\r\n email,\r\n password\r\n });\r\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, \"signIn\" /* SIGN_IN */, response);\r\n await authInternal._updateCurrentUser(userCredential.user);\r\n return userCredential;\r\n}\r\n/**\r\n * Asynchronously signs in using an email and password.\r\n *\r\n * @remarks\r\n * Fails with an error if the email address and password do not match.\r\n *\r\n * Note: The user's password is NOT the password used to access the user's email account. The\r\n * email address serves as a unique identifier for the user, and the password is used to access\r\n * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The users email address.\r\n * @param password - The users password.\r\n *\r\n * @public\r\n */\r\nfunction signInWithEmailAndPassword(auth, email, password) {\r\n return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Sends a sign-in email link to the user with the specified email.\r\n *\r\n * @remarks\r\n * The sign-in operation has to always be completed in the app unlike other out of band email\r\n * actions (password reset and email verifications). This is because, at the end of the flow,\r\n * the user is expected to be signed in and their Auth state persisted within the app.\r\n *\r\n * To complete sign in with the email link, call {@link signInWithEmailLink} with the email\r\n * address and the email link supplied in the email sent to the user.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);\r\n * // Obtain emailLink from the user.\r\n * if(isSignInWithEmailLink(auth, emailLink)) {\r\n * await signInWithEmailLink(auth, 'user@example.com', emailLink);\r\n * }\r\n * ```\r\n *\r\n * @param authInternal - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\r\nasync function sendSignInLinkToEmail(auth, email, actionCodeSettings) {\r\n const authModular = getModularInstance(auth);\r\n const request = {\r\n requestType: \"EMAIL_SIGNIN\" /* EMAIL_SIGNIN */,\r\n email\r\n };\r\n _assert(actionCodeSettings.handleCodeInApp, authModular, \"argument-error\" /* ARGUMENT_ERROR */);\r\n if (actionCodeSettings) {\r\n _setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);\r\n }\r\n await sendSignInLinkToEmail$1(authModular, request);\r\n}\r\n/**\r\n * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param emailLink - The link sent to the user's email address.\r\n *\r\n * @public\r\n */\r\nfunction isSignInWithEmailLink(auth, emailLink) {\r\n const actionCodeUrl = ActionCodeURL.parseLink(emailLink);\r\n return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === \"EMAIL_SIGNIN\" /* EMAIL_SIGNIN */;\r\n}\r\n/**\r\n * Asynchronously signs in using an email and sign-in email link.\r\n *\r\n * @remarks\r\n * If no link is passed, the link is inferred from the current URL.\r\n *\r\n * Fails with an error if the email address is invalid or OTP in email link expires.\r\n *\r\n * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);\r\n * // Obtain emailLink from the user.\r\n * if(isSignInWithEmailLink(auth, emailLink)) {\r\n * await signInWithEmailLink(auth, 'user@example.com', emailLink);\r\n * }\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param emailLink - The link sent to the user's email address.\r\n *\r\n * @public\r\n */\r\nasync function signInWithEmailLink(auth, email, emailLink) {\r\n const authModular = getModularInstance(auth);\r\n const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());\r\n // Check if the tenant ID in the email link matches the tenant ID on Auth\r\n // instance.\r\n _assert(credential._tenantId === (authModular.tenantId || null), authModular, \"tenant-id-mismatch\" /* TENANT_ID_MISMATCH */);\r\n return signInWithCredential(authModular, credential);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function createAuthUri(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:createAuthUri\" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Gets the list of possible sign in methods for the given email address.\r\n *\r\n * @remarks\r\n * This is useful to differentiate methods of sign-in for the same provider, eg.\r\n * {@link EmailAuthProvider} which has 2 methods of sign-in,\r\n * {@link SignInMethod}.EMAIL_PASSWORD and\r\n * {@link SignInMethod}.EMAIL_LINK.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n *\r\n * @public\r\n */\r\nasync function fetchSignInMethodsForEmail(auth, email) {\r\n // createAuthUri returns an error if continue URI is not http or https.\r\n // For environments like Cordova, Chrome extensions, native frameworks, file\r\n // systems, etc, use http://localhost as continue URL.\r\n const continueUri = _isHttpOrHttps() ? _getCurrentUrl() : 'http://localhost';\r\n const request = {\r\n identifier: email,\r\n continueUri\r\n };\r\n const { signinMethods } = await createAuthUri(getModularInstance(auth), request);\r\n return signinMethods || [];\r\n}\r\n/**\r\n * Sends a verification email to a user.\r\n *\r\n * @remarks\r\n * The verification process is completed by calling {@link applyActionCode}.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendEmailVerification(user, actionCodeSettings);\r\n * // Obtain code from the user.\r\n * await applyActionCode(auth, code);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\r\nasync function sendEmailVerification(user, actionCodeSettings) {\r\n const userInternal = getModularInstance(user);\r\n const idToken = await user.getIdToken();\r\n const request = {\r\n requestType: \"VERIFY_EMAIL\" /* VERIFY_EMAIL */,\r\n idToken\r\n };\r\n if (actionCodeSettings) {\r\n _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings);\r\n }\r\n const { email } = await sendEmailVerification$1(userInternal.auth, request);\r\n if (email !== user.email) {\r\n await user.reload();\r\n }\r\n}\r\n/**\r\n * Sends a verification email to a new email address.\r\n *\r\n * @remarks\r\n * The user's email will be updated to the new one after being verified.\r\n *\r\n * If you have a custom email action handler, you can complete the verification process by calling\r\n * {@link applyActionCode}.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);\r\n * // Obtain code from the user.\r\n * await applyActionCode(auth, code);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param newEmail - The new email address to be verified before update.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\r\nasync function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {\r\n const userInternal = getModularInstance(user);\r\n const idToken = await user.getIdToken();\r\n const request = {\r\n requestType: \"VERIFY_AND_CHANGE_EMAIL\" /* VERIFY_AND_CHANGE_EMAIL */,\r\n idToken,\r\n newEmail\r\n };\r\n if (actionCodeSettings) {\r\n _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings);\r\n }\r\n const { email } = await verifyAndChangeEmail(userInternal.auth, request);\r\n if (email !== user.email) {\r\n // If the local copy of the email on user is outdated, reload the\r\n // user.\r\n await user.reload();\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function updateProfile$1(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v1/accounts:update\" /* SET_ACCOUNT_INFO */, request);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Updates a user's profile data.\r\n *\r\n * @param user - The user.\r\n * @param profile - The profile's `displayName` and `photoURL` to update.\r\n *\r\n * @public\r\n */\r\nasync function updateProfile(user, { displayName, photoURL: photoUrl }) {\r\n if (displayName === undefined && photoUrl === undefined) {\r\n return;\r\n }\r\n const userInternal = getModularInstance(user);\r\n const idToken = await userInternal.getIdToken();\r\n const profileRequest = {\r\n idToken,\r\n displayName,\r\n photoUrl,\r\n returnSecureToken: true\r\n };\r\n const response = await _logoutIfInvalidated(userInternal, updateProfile$1(userInternal.auth, profileRequest));\r\n userInternal.displayName = response.displayName || null;\r\n userInternal.photoURL = response.photoUrl || null;\r\n // Update the password provider as well\r\n const passwordProvider = userInternal.providerData.find(({ providerId }) => providerId === \"password\" /* PASSWORD */);\r\n if (passwordProvider) {\r\n passwordProvider.displayName = userInternal.displayName;\r\n passwordProvider.photoURL = userInternal.photoURL;\r\n }\r\n await userInternal._updateTokensIfNecessary(response);\r\n}\r\n/**\r\n * Updates the user's email address.\r\n *\r\n * @remarks\r\n * An email will be sent to the original email address (if it was set) that allows to revoke the\r\n * email address change, in order to protect them from account hijacking.\r\n *\r\n * Important: this is a security sensitive operation that requires the user to have recently signed\r\n * in. If this requirement isn't met, ask the user to authenticate again and then call\r\n * {@link reauthenticateWithCredential}.\r\n *\r\n * @param user - The user.\r\n * @param newEmail - The new email address.\r\n *\r\n * @public\r\n */\r\nfunction updateEmail(user, newEmail) {\r\n return updateEmailOrPassword(getModularInstance(user), newEmail, null);\r\n}\r\n/**\r\n * Updates the user's password.\r\n *\r\n * @remarks\r\n * Important: this is a security sensitive operation that requires the user to have recently signed\r\n * in. If this requirement isn't met, ask the user to authenticate again and then call\r\n * {@link reauthenticateWithCredential}.\r\n *\r\n * @param user - The user.\r\n * @param newPassword - The new password.\r\n *\r\n * @public\r\n */\r\nfunction updatePassword(user, newPassword) {\r\n return updateEmailOrPassword(getModularInstance(user), null, newPassword);\r\n}\r\nasync function updateEmailOrPassword(user, email, password) {\r\n const { auth } = user;\r\n const idToken = await user.getIdToken();\r\n const request = {\r\n idToken,\r\n returnSecureToken: true\r\n };\r\n if (email) {\r\n request.email = email;\r\n }\r\n if (password) {\r\n request.password = password;\r\n }\r\n const response = await _logoutIfInvalidated(user, updateEmailPassword(auth, request));\r\n await user._updateTokensIfNecessary(response, /* reload */ true);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Parse the `AdditionalUserInfo` from the ID token response.\r\n *\r\n */\r\nfunction _fromIdTokenResponse(idTokenResponse) {\r\n var _a, _b;\r\n if (!idTokenResponse) {\r\n return null;\r\n }\r\n const { providerId } = idTokenResponse;\r\n const profile = idTokenResponse.rawUserInfo\r\n ? JSON.parse(idTokenResponse.rawUserInfo)\r\n : {};\r\n const isNewUser = idTokenResponse.isNewUser ||\r\n idTokenResponse.kind === \"identitytoolkit#SignupNewUserResponse\" /* SignupNewUser */;\r\n if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {\r\n const signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];\r\n if (signInProvider) {\r\n const filteredProviderId = signInProvider !== \"anonymous\" /* ANONYMOUS */ &&\r\n signInProvider !== \"custom\" /* CUSTOM */\r\n ? signInProvider\r\n : null;\r\n // Uses generic class in accordance with the legacy SDK.\r\n return new GenericAdditionalUserInfo(isNewUser, filteredProviderId);\r\n }\r\n }\r\n if (!providerId) {\r\n return null;\r\n }\r\n switch (providerId) {\r\n case \"facebook.com\" /* FACEBOOK */:\r\n return new FacebookAdditionalUserInfo(isNewUser, profile);\r\n case \"github.com\" /* GITHUB */:\r\n return new GithubAdditionalUserInfo(isNewUser, profile);\r\n case \"google.com\" /* GOOGLE */:\r\n return new GoogleAdditionalUserInfo(isNewUser, profile);\r\n case \"twitter.com\" /* TWITTER */:\r\n return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);\r\n case \"custom\" /* CUSTOM */:\r\n case \"anonymous\" /* ANONYMOUS */:\r\n return new GenericAdditionalUserInfo(isNewUser, null);\r\n default:\r\n return new GenericAdditionalUserInfo(isNewUser, providerId, profile);\r\n }\r\n}\r\nclass GenericAdditionalUserInfo {\r\n constructor(isNewUser, providerId, profile = {}) {\r\n this.isNewUser = isNewUser;\r\n this.providerId = providerId;\r\n this.profile = profile;\r\n }\r\n}\r\nclass FederatedAdditionalUserInfoWithUsername extends GenericAdditionalUserInfo {\r\n constructor(isNewUser, providerId, profile, username) {\r\n super(isNewUser, providerId, profile);\r\n this.username = username;\r\n }\r\n}\r\nclass FacebookAdditionalUserInfo extends GenericAdditionalUserInfo {\r\n constructor(isNewUser, profile) {\r\n super(isNewUser, \"facebook.com\" /* FACEBOOK */, profile);\r\n }\r\n}\r\nclass GithubAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {\r\n constructor(isNewUser, profile) {\r\n super(isNewUser, \"github.com\" /* GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null);\r\n }\r\n}\r\nclass GoogleAdditionalUserInfo extends GenericAdditionalUserInfo {\r\n constructor(isNewUser, profile) {\r\n super(isNewUser, \"google.com\" /* GOOGLE */, profile);\r\n }\r\n}\r\nclass TwitterAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {\r\n constructor(isNewUser, profile, screenName) {\r\n super(isNewUser, \"twitter.com\" /* TWITTER */, profile, screenName);\r\n }\r\n}\r\n/**\r\n * Extracts provider specific {@link AdditionalUserInfo} for the given credential.\r\n *\r\n * @param userCredential - The user credential.\r\n *\r\n * @public\r\n */\r\nfunction getAdditionalUserInfo(userCredential) {\r\n const { user, _tokenResponse } = userCredential;\r\n if (user.isAnonymous && !_tokenResponse) {\r\n // Handle the special case where signInAnonymously() gets called twice.\r\n // No network call is made so there's nothing to actually fill this in\r\n return {\r\n providerId: null,\r\n isNewUser: false,\r\n profile: null\r\n };\r\n }\r\n return _fromIdTokenResponse(_tokenResponse);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// Non-optional auth methods.\r\n/**\r\n * Changes the type of persistence on the {@link Auth} instance for the currently saved\r\n * `Auth` session and applies this type of persistence for future sign-in requests, including\r\n * sign-in with redirect requests.\r\n *\r\n * @remarks\r\n * This makes it easy for a user signing in to specify whether their session should be\r\n * remembered or not. It also makes it easier to never persist the `Auth` state for applications\r\n * that are shared by other users or have sensitive data.\r\n *\r\n * @example\r\n * ```javascript\r\n * setPersistence(auth, browserSessionPersistence);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param persistence - The {@link Persistence} to use.\r\n * @returns A `Promise` that resolves once the persistence change has completed\r\n *\r\n * @public\r\n */\r\nfunction setPersistence(auth, persistence) {\r\n return getModularInstance(auth).setPersistence(persistence);\r\n}\r\n/**\r\n * Adds an observer for changes to the signed-in user's ID token, which includes sign-in,\r\n * sign-out, and token refresh events.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param nextOrObserver - callback triggered on change.\r\n * @param error - callback triggered on error.\r\n * @param completed - callback triggered when observer is removed.\r\n *\r\n * @public\r\n */\r\nfunction onIdTokenChanged(auth, nextOrObserver, error, completed) {\r\n return getModularInstance(auth).onIdTokenChanged(nextOrObserver, error, completed);\r\n}\r\n/**\r\n * Adds an observer for changes to the user's sign-in state.\r\n *\r\n * @remarks\r\n * To keep the old behavior, see {@link onIdTokenChanged}.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param nextOrObserver - callback triggered on change.\r\n * @param error - callback triggered on error.\r\n * @param completed - callback triggered when observer is removed.\r\n *\r\n * @public\r\n */\r\nfunction onAuthStateChanged(auth, nextOrObserver, error, completed) {\r\n return getModularInstance(auth).onAuthStateChanged(nextOrObserver, error, completed);\r\n}\r\n/**\r\n * Sets the current language to the default device/browser preference.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\r\nfunction useDeviceLanguage(auth) {\r\n getModularInstance(auth).useDeviceLanguage();\r\n}\r\n/**\r\n * Asynchronously sets the provided user as {@link Auth.currentUser} on the\r\n * {@link Auth} instance.\r\n *\r\n * @remarks\r\n * A new instance copy of the user provided will be made and set as currentUser.\r\n *\r\n * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners\r\n * like other sign in methods.\r\n *\r\n * The operation fails with an error if the user to be updated belongs to a different Firebase\r\n * project.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param user - The new {@link User}.\r\n *\r\n * @public\r\n */\r\nfunction updateCurrentUser(auth, user) {\r\n return getModularInstance(auth).updateCurrentUser(user);\r\n}\r\n/**\r\n * Signs out the current user.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\r\nfunction signOut(auth) {\r\n return getModularInstance(auth).signOut();\r\n}\r\n/**\r\n * Deletes and signs out the user.\r\n *\r\n * @remarks\r\n * Important: this is a security-sensitive operation that requires the user to have recently\r\n * signed in. If this requirement isn't met, ask the user to authenticate again and then call\r\n * {@link reauthenticateWithCredential}.\r\n *\r\n * @param user - The user.\r\n *\r\n * @public\r\n */\r\nasync function deleteUser(user) {\r\n return getModularInstance(user).delete();\r\n}\n\nclass MultiFactorSessionImpl {\r\n constructor(type, credential) {\r\n this.type = type;\r\n this.credential = credential;\r\n }\r\n static _fromIdtoken(idToken) {\r\n return new MultiFactorSessionImpl(\"enroll\" /* ENROLL */, idToken);\r\n }\r\n static _fromMfaPendingCredential(mfaPendingCredential) {\r\n return new MultiFactorSessionImpl(\"signin\" /* SIGN_IN */, mfaPendingCredential);\r\n }\r\n toJSON() {\r\n const key = this.type === \"enroll\" /* ENROLL */\r\n ? 'idToken'\r\n : 'pendingCredential';\r\n return {\r\n multiFactorSession: {\r\n [key]: this.credential\r\n }\r\n };\r\n }\r\n static fromJSON(obj) {\r\n var _a, _b;\r\n if (obj === null || obj === void 0 ? void 0 : obj.multiFactorSession) {\r\n if ((_a = obj.multiFactorSession) === null || _a === void 0 ? void 0 : _a.pendingCredential) {\r\n return MultiFactorSessionImpl._fromMfaPendingCredential(obj.multiFactorSession.pendingCredential);\r\n }\r\n else if ((_b = obj.multiFactorSession) === null || _b === void 0 ? void 0 : _b.idToken) {\r\n return MultiFactorSessionImpl._fromIdtoken(obj.multiFactorSession.idToken);\r\n }\r\n }\r\n return null;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass MultiFactorResolverImpl {\r\n constructor(session, hints, signInResolver) {\r\n this.session = session;\r\n this.hints = hints;\r\n this.signInResolver = signInResolver;\r\n }\r\n /** @internal */\r\n static _fromError(authExtern, error) {\r\n const auth = _castAuth(authExtern);\r\n const serverResponse = error.customData._serverResponse;\r\n const hints = (serverResponse.mfaInfo || []).map(enrollment => MultiFactorInfoImpl._fromServerResponse(auth, enrollment));\r\n _assert(serverResponse.mfaPendingCredential, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);\r\n return new MultiFactorResolverImpl(session, hints, async (assertion) => {\r\n const mfaResponse = await assertion._process(auth, session);\r\n // Clear out the unneeded fields from the old login response\r\n delete serverResponse.mfaInfo;\r\n delete serverResponse.mfaPendingCredential;\r\n // Use in the new token & refresh token in the old response\r\n const idTokenResponse = Object.assign(Object.assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });\r\n // TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case\r\n switch (error.operationType) {\r\n case \"signIn\" /* SIGN_IN */:\r\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse);\r\n await auth._updateCurrentUser(userCredential.user);\r\n return userCredential;\r\n case \"reauthenticate\" /* REAUTHENTICATE */:\r\n _assert(error.user, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse);\r\n default:\r\n _fail(auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n });\r\n }\r\n async resolveSignIn(assertionExtern) {\r\n const assertion = assertionExtern;\r\n return this.signInResolver(assertion);\r\n }\r\n}\r\n/**\r\n * Provides a {@link MultiFactorResolver} suitable for completion of a\r\n * multi-factor flow.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param error - The {@link MultiFactorError} raised during a sign-in, or\r\n * reauthentication operation.\r\n *\r\n * @public\r\n */\r\nfunction getMultiFactorResolver(auth, error) {\r\n var _a;\r\n const authModular = getModularInstance(auth);\r\n const errorInternal = error;\r\n _assert(error.customData.operationType, authModular, \"argument-error\" /* ARGUMENT_ERROR */);\r\n _assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, \"argument-error\" /* ARGUMENT_ERROR */);\r\n return MultiFactorResolverImpl._fromError(authModular, errorInternal);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction startEnrollPhoneMfa(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v2/accounts/mfaEnrollment:start\" /* START_PHONE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));\r\n}\r\nfunction finalizeEnrollPhoneMfa(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v2/accounts/mfaEnrollment:finalize\" /* FINALIZE_PHONE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));\r\n}\r\nfunction withdrawMfa(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v2/accounts/mfaEnrollment:withdraw\" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));\r\n}\n\nclass MultiFactorUserImpl {\r\n constructor(user) {\r\n this.user = user;\r\n this.enrolledFactors = [];\r\n user._onReload(userInfo => {\r\n if (userInfo.mfaInfo) {\r\n this.enrolledFactors = userInfo.mfaInfo.map(enrollment => MultiFactorInfoImpl._fromServerResponse(user.auth, enrollment));\r\n }\r\n });\r\n }\r\n static _fromUser(user) {\r\n return new MultiFactorUserImpl(user);\r\n }\r\n async getSession() {\r\n return MultiFactorSessionImpl._fromIdtoken(await this.user.getIdToken());\r\n }\r\n async enroll(assertionExtern, displayName) {\r\n const assertion = assertionExtern;\r\n const session = (await this.getSession());\r\n const finalizeMfaResponse = await _logoutIfInvalidated(this.user, assertion._process(this.user.auth, session, displayName));\r\n // New tokens will be issued after enrollment of the new second factors.\r\n // They need to be updated on the user.\r\n await this.user._updateTokensIfNecessary(finalizeMfaResponse);\r\n // The user needs to be reloaded to get the new multi-factor information\r\n // from server. USER_RELOADED event will be triggered and `enrolledFactors`\r\n // will be updated.\r\n return this.user.reload();\r\n }\r\n async unenroll(infoOrUid) {\r\n const mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;\r\n const idToken = await this.user.getIdToken();\r\n const idTokenResponse = await _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {\r\n idToken,\r\n mfaEnrollmentId\r\n }));\r\n // Remove the second factor from the user's list.\r\n this.enrolledFactors = this.enrolledFactors.filter(({ uid }) => uid !== mfaEnrollmentId);\r\n // Depending on whether the backend decided to revoke the user's session,\r\n // the tokenResponse may be empty. If the tokens were not updated (and they\r\n // are now invalid), reloading the user will discover this and invalidate\r\n // the user's state accordingly.\r\n await this.user._updateTokensIfNecessary(idTokenResponse);\r\n try {\r\n await this.user.reload();\r\n }\r\n catch (e) {\r\n if (e.code !== `auth/${\"user-token-expired\" /* TOKEN_EXPIRED */}`) {\r\n throw e;\r\n }\r\n }\r\n }\r\n}\r\nconst multiFactorUserCache = new WeakMap();\r\n/**\r\n * The {@link MultiFactorUser} corresponding to the user.\r\n *\r\n * @remarks\r\n * This is used to access all multi-factor properties and operations related to the user.\r\n *\r\n * @param user - The user.\r\n *\r\n * @public\r\n */\r\nfunction multiFactor(user) {\r\n const userModular = getModularInstance(user);\r\n if (!multiFactorUserCache.has(userModular)) {\r\n multiFactorUserCache.set(userModular, MultiFactorUserImpl._fromUser(userModular));\r\n }\r\n return multiFactorUserCache.get(userModular);\r\n}\n\nconst STORAGE_AVAILABLE_KEY = '__sak';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// There are two different browser persistence types: local and session.\r\n// Both have the same implementation but use a different underlying storage\r\n// object.\r\nclass BrowserPersistenceClass {\r\n constructor(storageRetriever, type) {\r\n this.storageRetriever = storageRetriever;\r\n this.type = type;\r\n }\r\n _isAvailable() {\r\n try {\r\n if (!this.storage) {\r\n return Promise.resolve(false);\r\n }\r\n this.storage.setItem(STORAGE_AVAILABLE_KEY, '1');\r\n this.storage.removeItem(STORAGE_AVAILABLE_KEY);\r\n return Promise.resolve(true);\r\n }\r\n catch (_a) {\r\n return Promise.resolve(false);\r\n }\r\n }\r\n _set(key, value) {\r\n this.storage.setItem(key, JSON.stringify(value));\r\n return Promise.resolve();\r\n }\r\n _get(key) {\r\n const json = this.storage.getItem(key);\r\n return Promise.resolve(json ? JSON.parse(json) : null);\r\n }\r\n _remove(key) {\r\n this.storage.removeItem(key);\r\n return Promise.resolve();\r\n }\r\n get storage() {\r\n return this.storageRetriever();\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _iframeCannotSyncWebStorage() {\r\n const ua = getUA();\r\n return _isSafari(ua) || _isIOS(ua);\r\n}\r\n// The polling period in case events are not supported\r\nconst _POLLING_INTERVAL_MS$1 = 1000;\r\n// The IE 10 localStorage cross tab synchronization delay in milliseconds\r\nconst IE10_LOCAL_STORAGE_SYNC_DELAY = 10;\r\nclass BrowserLocalPersistence extends BrowserPersistenceClass {\r\n constructor() {\r\n super(() => window.localStorage, \"LOCAL\" /* LOCAL */);\r\n this.boundEventHandler = (event, poll) => this.onStorageEvent(event, poll);\r\n this.listeners = {};\r\n this.localCache = {};\r\n // setTimeout return value is platform specific\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n this.pollTimer = null;\r\n // Safari or iOS browser and embedded in an iframe.\r\n this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() && _isIframe();\r\n // Whether to use polling instead of depending on window events\r\n this.fallbackToPolling = _isMobileBrowser();\r\n this._shouldAllowMigration = true;\r\n }\r\n forAllChangedKeys(cb) {\r\n // Check all keys with listeners on them.\r\n for (const key of Object.keys(this.listeners)) {\r\n // Get value from localStorage.\r\n const newValue = this.storage.getItem(key);\r\n const oldValue = this.localCache[key];\r\n // If local map value does not match, trigger listener with storage event.\r\n // Differentiate this simulated event from the real storage event.\r\n if (newValue !== oldValue) {\r\n cb(key, oldValue, newValue);\r\n }\r\n }\r\n }\r\n onStorageEvent(event, poll = false) {\r\n // Key would be null in some situations, like when localStorage is cleared\r\n if (!event.key) {\r\n this.forAllChangedKeys((key, _oldValue, newValue) => {\r\n this.notifyListeners(key, newValue);\r\n });\r\n return;\r\n }\r\n const key = event.key;\r\n // Check the mechanism how this event was detected.\r\n // The first event will dictate the mechanism to be used.\r\n if (poll) {\r\n // Environment detects storage changes via polling.\r\n // Remove storage event listener to prevent possible event duplication.\r\n this.detachListener();\r\n }\r\n else {\r\n // Environment detects storage changes via storage event listener.\r\n // Remove polling listener to prevent possible event duplication.\r\n this.stopPolling();\r\n }\r\n // Safari embedded iframe. Storage event will trigger with the delta\r\n // changes but no changes will be applied to the iframe localStorage.\r\n if (this.safariLocalStorageNotSynced) {\r\n // Get current iframe page value.\r\n const storedValue = this.storage.getItem(key);\r\n // Value not synchronized, synchronize manually.\r\n if (event.newValue !== storedValue) {\r\n if (event.newValue !== null) {\r\n // Value changed from current value.\r\n this.storage.setItem(key, event.newValue);\r\n }\r\n else {\r\n // Current value deleted.\r\n this.storage.removeItem(key);\r\n }\r\n }\r\n else if (this.localCache[key] === event.newValue && !poll) {\r\n // Already detected and processed, do not trigger listeners again.\r\n return;\r\n }\r\n }\r\n const triggerListeners = () => {\r\n // Keep local map up to date in case storage event is triggered before\r\n // poll.\r\n const storedValue = this.storage.getItem(key);\r\n if (!poll && this.localCache[key] === storedValue) {\r\n // Real storage event which has already been detected, do nothing.\r\n // This seems to trigger in some IE browsers for some reason.\r\n return;\r\n }\r\n this.notifyListeners(key, storedValue);\r\n };\r\n const storedValue = this.storage.getItem(key);\r\n if (_isIE10() &&\r\n storedValue !== event.newValue &&\r\n event.newValue !== event.oldValue) {\r\n // IE 10 has this weird bug where a storage event would trigger with the\r\n // correct key, oldValue and newValue but localStorage.getItem(key) does\r\n // not yield the updated value until a few milliseconds. This ensures\r\n // this recovers from that situation.\r\n setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY);\r\n }\r\n else {\r\n triggerListeners();\r\n }\r\n }\r\n notifyListeners(key, value) {\r\n this.localCache[key] = value;\r\n const listeners = this.listeners[key];\r\n if (listeners) {\r\n for (const listener of Array.from(listeners)) {\r\n listener(value ? JSON.parse(value) : value);\r\n }\r\n }\r\n }\r\n startPolling() {\r\n this.stopPolling();\r\n this.pollTimer = setInterval(() => {\r\n this.forAllChangedKeys((key, oldValue, newValue) => {\r\n this.onStorageEvent(new StorageEvent('storage', {\r\n key,\r\n oldValue,\r\n newValue\r\n }), \r\n /* poll */ true);\r\n });\r\n }, _POLLING_INTERVAL_MS$1);\r\n }\r\n stopPolling() {\r\n if (this.pollTimer) {\r\n clearInterval(this.pollTimer);\r\n this.pollTimer = null;\r\n }\r\n }\r\n attachListener() {\r\n window.addEventListener('storage', this.boundEventHandler);\r\n }\r\n detachListener() {\r\n window.removeEventListener('storage', this.boundEventHandler);\r\n }\r\n _addListener(key, listener) {\r\n if (Object.keys(this.listeners).length === 0) {\r\n // Whether browser can detect storage event when it had already been pushed to the background.\r\n // This may happen in some mobile browsers. A localStorage change in the foreground window\r\n // will not be detected in the background window via the storage event.\r\n // This was detected in iOS 7.x mobile browsers\r\n if (this.fallbackToPolling) {\r\n this.startPolling();\r\n }\r\n else {\r\n this.attachListener();\r\n }\r\n }\r\n if (!this.listeners[key]) {\r\n this.listeners[key] = new Set();\r\n // Populate the cache to avoid spuriously triggering on first poll.\r\n this.localCache[key] = this.storage.getItem(key);\r\n }\r\n this.listeners[key].add(listener);\r\n }\r\n _removeListener(key, listener) {\r\n if (this.listeners[key]) {\r\n this.listeners[key].delete(listener);\r\n if (this.listeners[key].size === 0) {\r\n delete this.listeners[key];\r\n }\r\n }\r\n if (Object.keys(this.listeners).length === 0) {\r\n this.detachListener();\r\n this.stopPolling();\r\n }\r\n }\r\n // Update local cache on base operations:\r\n async _set(key, value) {\r\n await super._set(key, value);\r\n this.localCache[key] = JSON.stringify(value);\r\n }\r\n async _get(key) {\r\n const value = await super._get(key);\r\n this.localCache[key] = JSON.stringify(value);\r\n return value;\r\n }\r\n async _remove(key) {\r\n await super._remove(key);\r\n delete this.localCache[key];\r\n }\r\n}\r\nBrowserLocalPersistence.type = 'LOCAL';\r\n/**\r\n * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`\r\n * for the underlying storage.\r\n *\r\n * @public\r\n */\r\nconst browserLocalPersistence = BrowserLocalPersistence;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass BrowserSessionPersistence extends BrowserPersistenceClass {\r\n constructor() {\r\n super(() => window.sessionStorage, \"SESSION\" /* SESSION */);\r\n }\r\n _addListener(_key, _listener) {\r\n // Listeners are not supported for session storage since it cannot be shared across windows\r\n return;\r\n }\r\n _removeListener(_key, _listener) {\r\n // Listeners are not supported for session storage since it cannot be shared across windows\r\n return;\r\n }\r\n}\r\nBrowserSessionPersistence.type = 'SESSION';\r\n/**\r\n * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`\r\n * for the underlying storage.\r\n *\r\n * @public\r\n */\r\nconst browserSessionPersistence = BrowserSessionPersistence;\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`.\r\n *\r\n * @param promises - Array of promises to wait on.\r\n */\r\nfunction _allSettled(promises) {\r\n return Promise.all(promises.map(async (promise) => {\r\n try {\r\n const value = await promise;\r\n return {\r\n fulfilled: true,\r\n value\r\n };\r\n }\r\n catch (reason) {\r\n return {\r\n fulfilled: false,\r\n reason\r\n };\r\n }\r\n }));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Interface class for receiving messages.\r\n *\r\n */\r\nclass Receiver {\r\n constructor(eventTarget) {\r\n this.eventTarget = eventTarget;\r\n this.handlersMap = {};\r\n this.boundEventHandler = this.handleEvent.bind(this);\r\n }\r\n /**\r\n * Obtain an instance of a Receiver for a given event target, if none exists it will be created.\r\n *\r\n * @param eventTarget - An event target (such as window or self) through which the underlying\r\n * messages will be received.\r\n */\r\n static _getInstance(eventTarget) {\r\n // The results are stored in an array since objects can't be keys for other\r\n // objects. In addition, setting a unique property on an event target as a\r\n // hash map key may not be allowed due to CORS restrictions.\r\n const existingInstance = this.receivers.find(receiver => receiver.isListeningto(eventTarget));\r\n if (existingInstance) {\r\n return existingInstance;\r\n }\r\n const newInstance = new Receiver(eventTarget);\r\n this.receivers.push(newInstance);\r\n return newInstance;\r\n }\r\n isListeningto(eventTarget) {\r\n return this.eventTarget === eventTarget;\r\n }\r\n /**\r\n * Fans out a MessageEvent to the appropriate listeners.\r\n *\r\n * @remarks\r\n * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have\r\n * finished processing.\r\n *\r\n * @param event - The MessageEvent.\r\n *\r\n */\r\n async handleEvent(event) {\r\n const messageEvent = event;\r\n const { eventId, eventType, data } = messageEvent.data;\r\n const handlers = this.handlersMap[eventType];\r\n if (!(handlers === null || handlers === void 0 ? void 0 : handlers.size)) {\r\n return;\r\n }\r\n messageEvent.ports[0].postMessage({\r\n status: \"ack\" /* ACK */,\r\n eventId,\r\n eventType\r\n });\r\n const promises = Array.from(handlers).map(async (handler) => handler(messageEvent.origin, data));\r\n const response = await _allSettled(promises);\r\n messageEvent.ports[0].postMessage({\r\n status: \"done\" /* DONE */,\r\n eventId,\r\n eventType,\r\n response\r\n });\r\n }\r\n /**\r\n * Subscribe an event handler for a particular event.\r\n *\r\n * @param eventType - Event name to subscribe to.\r\n * @param eventHandler - The event handler which should receive the events.\r\n *\r\n */\r\n _subscribe(eventType, eventHandler) {\r\n if (Object.keys(this.handlersMap).length === 0) {\r\n this.eventTarget.addEventListener('message', this.boundEventHandler);\r\n }\r\n if (!this.handlersMap[eventType]) {\r\n this.handlersMap[eventType] = new Set();\r\n }\r\n this.handlersMap[eventType].add(eventHandler);\r\n }\r\n /**\r\n * Unsubscribe an event handler from a particular event.\r\n *\r\n * @param eventType - Event name to unsubscribe from.\r\n * @param eventHandler - Optinoal event handler, if none provided, unsubscribe all handlers on this event.\r\n *\r\n */\r\n _unsubscribe(eventType, eventHandler) {\r\n if (this.handlersMap[eventType] && eventHandler) {\r\n this.handlersMap[eventType].delete(eventHandler);\r\n }\r\n if (!eventHandler || this.handlersMap[eventType].size === 0) {\r\n delete this.handlersMap[eventType];\r\n }\r\n if (Object.keys(this.handlersMap).length === 0) {\r\n this.eventTarget.removeEventListener('message', this.boundEventHandler);\r\n }\r\n }\r\n}\r\nReceiver.receivers = [];\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _generateEventId(prefix = '', digits = 10) {\r\n let random = '';\r\n for (let i = 0; i < digits; i++) {\r\n random += Math.floor(Math.random() * 10);\r\n }\r\n return prefix + random;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Interface for sending messages and waiting for a completion response.\r\n *\r\n */\r\nclass Sender {\r\n constructor(target) {\r\n this.target = target;\r\n this.handlers = new Set();\r\n }\r\n /**\r\n * Unsubscribe the handler and remove it from our tracking Set.\r\n *\r\n * @param handler - The handler to unsubscribe.\r\n */\r\n removeMessageHandler(handler) {\r\n if (handler.messageChannel) {\r\n handler.messageChannel.port1.removeEventListener('message', handler.onMessage);\r\n handler.messageChannel.port1.close();\r\n }\r\n this.handlers.delete(handler);\r\n }\r\n /**\r\n * Send a message to the Receiver located at {@link target}.\r\n *\r\n * @remarks\r\n * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the\r\n * receiver has had a chance to fully process the event.\r\n *\r\n * @param eventType - Type of event to send.\r\n * @param data - The payload of the event.\r\n * @param timeout - Timeout for waiting on an ACK from the receiver.\r\n *\r\n * @returns An array of settled promises from all the handlers that were listening on the receiver.\r\n */\r\n async _send(eventType, data, timeout = 50 /* ACK */) {\r\n const messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;\r\n if (!messageChannel) {\r\n throw new Error(\"connection_unavailable\" /* CONNECTION_UNAVAILABLE */);\r\n }\r\n // Node timers and browser timers return fundamentally different types.\r\n // We don't actually care what the value is but TS won't accept unknown and\r\n // we can't cast properly in both environments.\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n let completionTimer;\r\n let handler;\r\n return new Promise((resolve, reject) => {\r\n const eventId = _generateEventId('', 20);\r\n messageChannel.port1.start();\r\n const ackTimer = setTimeout(() => {\r\n reject(new Error(\"unsupported_event\" /* UNSUPPORTED_EVENT */));\r\n }, timeout);\r\n handler = {\r\n messageChannel,\r\n onMessage(event) {\r\n const messageEvent = event;\r\n if (messageEvent.data.eventId !== eventId) {\r\n return;\r\n }\r\n switch (messageEvent.data.status) {\r\n case \"ack\" /* ACK */:\r\n // The receiver should ACK first.\r\n clearTimeout(ackTimer);\r\n completionTimer = setTimeout(() => {\r\n reject(new Error(\"timeout\" /* TIMEOUT */));\r\n }, 3000 /* COMPLETION */);\r\n break;\r\n case \"done\" /* DONE */:\r\n // Once the receiver's handlers are finished we will get the results.\r\n clearTimeout(completionTimer);\r\n resolve(messageEvent.data.response);\r\n break;\r\n default:\r\n clearTimeout(ackTimer);\r\n clearTimeout(completionTimer);\r\n reject(new Error(\"invalid_response\" /* INVALID_RESPONSE */));\r\n break;\r\n }\r\n }\r\n };\r\n this.handlers.add(handler);\r\n messageChannel.port1.addEventListener('message', handler.onMessage);\r\n this.target.postMessage({\r\n eventType,\r\n eventId,\r\n data\r\n }, [messageChannel.port2]);\r\n }).finally(() => {\r\n if (handler) {\r\n this.removeMessageHandler(handler);\r\n }\r\n });\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Lazy accessor for window, since the compat layer won't tree shake this out,\r\n * we need to make sure not to mess with window unless we have to\r\n */\r\nfunction _window() {\r\n return window;\r\n}\r\nfunction _setWindowLocation(url) {\r\n _window().location.href = url;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction _isWorker() {\r\n return (typeof _window()['WorkerGlobalScope'] !== 'undefined' &&\r\n typeof _window()['importScripts'] === 'function');\r\n}\r\nasync function _getActiveServiceWorker() {\r\n if (!(navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker)) {\r\n return null;\r\n }\r\n try {\r\n const registration = await navigator.serviceWorker.ready;\r\n return registration.active;\r\n }\r\n catch (_a) {\r\n return null;\r\n }\r\n}\r\nfunction _getServiceWorkerController() {\r\n var _a;\r\n return ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) === null || _a === void 0 ? void 0 : _a.controller) || null;\r\n}\r\nfunction _getWorkerGlobalScope() {\r\n return _isWorker() ? self : null;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst DB_NAME = 'firebaseLocalStorageDb';\r\nconst DB_VERSION = 1;\r\nconst DB_OBJECTSTORE_NAME = 'firebaseLocalStorage';\r\nconst DB_DATA_KEYPATH = 'fbase_key';\r\n/**\r\n * Promise wrapper for IDBRequest\r\n *\r\n * Unfortunately we can't cleanly extend Promise since promises are not callable in ES6\r\n *\r\n */\r\nclass DBPromise {\r\n constructor(request) {\r\n this.request = request;\r\n }\r\n toPromise() {\r\n return new Promise((resolve, reject) => {\r\n this.request.addEventListener('success', () => {\r\n resolve(this.request.result);\r\n });\r\n this.request.addEventListener('error', () => {\r\n reject(this.request.error);\r\n });\r\n });\r\n }\r\n}\r\nfunction getObjectStore(db, isReadWrite) {\r\n return db\r\n .transaction([DB_OBJECTSTORE_NAME], isReadWrite ? 'readwrite' : 'readonly')\r\n .objectStore(DB_OBJECTSTORE_NAME);\r\n}\r\nfunction _deleteDatabase() {\r\n const request = indexedDB.deleteDatabase(DB_NAME);\r\n return new DBPromise(request).toPromise();\r\n}\r\nfunction _openDatabase() {\r\n const request = indexedDB.open(DB_NAME, DB_VERSION);\r\n return new Promise((resolve, reject) => {\r\n request.addEventListener('error', () => {\r\n reject(request.error);\r\n });\r\n request.addEventListener('upgradeneeded', () => {\r\n const db = request.result;\r\n try {\r\n db.createObjectStore(DB_OBJECTSTORE_NAME, { keyPath: DB_DATA_KEYPATH });\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n request.addEventListener('success', async () => {\r\n const db = request.result;\r\n // Strange bug that occurs in Firefox when multiple tabs are opened at the\r\n // same time. The only way to recover seems to be deleting the database\r\n // and re-initializing it.\r\n // https://github.com/firebase/firebase-js-sdk/issues/634\r\n if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) {\r\n // Need to close the database or else you get a `blocked` event\r\n db.close();\r\n await _deleteDatabase();\r\n resolve(await _openDatabase());\r\n }\r\n else {\r\n resolve(db);\r\n }\r\n });\r\n });\r\n}\r\nasync function _putObject(db, key, value) {\r\n const request = getObjectStore(db, true).put({\r\n [DB_DATA_KEYPATH]: key,\r\n value\r\n });\r\n return new DBPromise(request).toPromise();\r\n}\r\nasync function getObject(db, key) {\r\n const request = getObjectStore(db, false).get(key);\r\n const data = await new DBPromise(request).toPromise();\r\n return data === undefined ? null : data.value;\r\n}\r\nfunction _deleteObject(db, key) {\r\n const request = getObjectStore(db, true).delete(key);\r\n return new DBPromise(request).toPromise();\r\n}\r\nconst _POLLING_INTERVAL_MS = 800;\r\nconst _TRANSACTION_RETRY_COUNT = 3;\r\nclass IndexedDBLocalPersistence {\r\n constructor() {\r\n this.type = \"LOCAL\" /* LOCAL */;\r\n this._shouldAllowMigration = true;\r\n this.listeners = {};\r\n this.localCache = {};\r\n // setTimeout return value is platform specific\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n this.pollTimer = null;\r\n this.pendingWrites = 0;\r\n this.receiver = null;\r\n this.sender = null;\r\n this.serviceWorkerReceiverAvailable = false;\r\n this.activeServiceWorker = null;\r\n // Fire & forget the service worker registration as it may never resolve\r\n this._workerInitializationPromise =\r\n this.initializeServiceWorkerMessaging().then(() => { }, () => { });\r\n }\r\n async _openDb() {\r\n if (this.db) {\r\n return this.db;\r\n }\r\n this.db = await _openDatabase();\r\n return this.db;\r\n }\r\n async _withRetries(op) {\r\n let numAttempts = 0;\r\n while (true) {\r\n try {\r\n const db = await this._openDb();\r\n return await op(db);\r\n }\r\n catch (e) {\r\n if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {\r\n throw e;\r\n }\r\n if (this.db) {\r\n this.db.close();\r\n this.db = undefined;\r\n }\r\n // TODO: consider adding exponential backoff\r\n }\r\n }\r\n }\r\n /**\r\n * IndexedDB events do not propagate from the main window to the worker context. We rely on a\r\n * postMessage interface to send these events to the worker ourselves.\r\n */\r\n async initializeServiceWorkerMessaging() {\r\n return _isWorker() ? this.initializeReceiver() : this.initializeSender();\r\n }\r\n /**\r\n * As the worker we should listen to events from the main window.\r\n */\r\n async initializeReceiver() {\r\n this.receiver = Receiver._getInstance(_getWorkerGlobalScope());\r\n // Refresh from persistence if we receive a KeyChanged message.\r\n this.receiver._subscribe(\"keyChanged\" /* KEY_CHANGED */, async (_origin, data) => {\r\n const keys = await this._poll();\r\n return {\r\n keyProcessed: keys.includes(data.key)\r\n };\r\n });\r\n // Let the sender know that we are listening so they give us more timeout.\r\n this.receiver._subscribe(\"ping\" /* PING */, async (_origin, _data) => {\r\n return [\"keyChanged\" /* KEY_CHANGED */];\r\n });\r\n }\r\n /**\r\n * As the main window, we should let the worker know when keys change (set and remove).\r\n *\r\n * @remarks\r\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready}\r\n * may not resolve.\r\n */\r\n async initializeSender() {\r\n var _a, _b;\r\n // Check to see if there's an active service worker.\r\n this.activeServiceWorker = await _getActiveServiceWorker();\r\n if (!this.activeServiceWorker) {\r\n return;\r\n }\r\n this.sender = new Sender(this.activeServiceWorker);\r\n // Ping the service worker to check what events they can handle.\r\n const results = await this.sender._send(\"ping\" /* PING */, {}, 800 /* LONG_ACK */);\r\n if (!results) {\r\n return;\r\n }\r\n if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) &&\r\n ((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes(\"keyChanged\" /* KEY_CHANGED */))) {\r\n this.serviceWorkerReceiverAvailable = true;\r\n }\r\n }\r\n /**\r\n * Let the worker know about a changed key, the exact key doesn't technically matter since the\r\n * worker will just trigger a full sync anyway.\r\n *\r\n * @remarks\r\n * For now, we only support one service worker per page.\r\n *\r\n * @param key - Storage key which changed.\r\n */\r\n async notifyServiceWorker(key) {\r\n if (!this.sender ||\r\n !this.activeServiceWorker ||\r\n _getServiceWorkerController() !== this.activeServiceWorker) {\r\n return;\r\n }\r\n try {\r\n await this.sender._send(\"keyChanged\" /* KEY_CHANGED */, { key }, \r\n // Use long timeout if receiver has previously responded to a ping from us.\r\n this.serviceWorkerReceiverAvailable\r\n ? 800 /* LONG_ACK */\r\n : 50 /* ACK */);\r\n }\r\n catch (_a) {\r\n // This is a best effort approach. Ignore errors.\r\n }\r\n }\r\n async _isAvailable() {\r\n try {\r\n if (!indexedDB) {\r\n return false;\r\n }\r\n const db = await _openDatabase();\r\n await _putObject(db, STORAGE_AVAILABLE_KEY, '1');\r\n await _deleteObject(db, STORAGE_AVAILABLE_KEY);\r\n return true;\r\n }\r\n catch (_a) { }\r\n return false;\r\n }\r\n async _withPendingWrite(write) {\r\n this.pendingWrites++;\r\n try {\r\n await write();\r\n }\r\n finally {\r\n this.pendingWrites--;\r\n }\r\n }\r\n async _set(key, value) {\r\n return this._withPendingWrite(async () => {\r\n await this._withRetries((db) => _putObject(db, key, value));\r\n this.localCache[key] = value;\r\n return this.notifyServiceWorker(key);\r\n });\r\n }\r\n async _get(key) {\r\n const obj = (await this._withRetries((db) => getObject(db, key)));\r\n this.localCache[key] = obj;\r\n return obj;\r\n }\r\n async _remove(key) {\r\n return this._withPendingWrite(async () => {\r\n await this._withRetries((db) => _deleteObject(db, key));\r\n delete this.localCache[key];\r\n return this.notifyServiceWorker(key);\r\n });\r\n }\r\n async _poll() {\r\n // TODO: check if we need to fallback if getAll is not supported\r\n const result = await this._withRetries((db) => {\r\n const getAllRequest = getObjectStore(db, false).getAll();\r\n return new DBPromise(getAllRequest).toPromise();\r\n });\r\n if (!result) {\r\n return [];\r\n }\r\n // If we have pending writes in progress abort, we'll get picked up on the next poll\r\n if (this.pendingWrites !== 0) {\r\n return [];\r\n }\r\n const keys = [];\r\n const keysInResult = new Set();\r\n for (const { fbase_key: key, value } of result) {\r\n keysInResult.add(key);\r\n if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {\r\n this.notifyListeners(key, value);\r\n keys.push(key);\r\n }\r\n }\r\n for (const localKey of Object.keys(this.localCache)) {\r\n if (this.localCache[localKey] && !keysInResult.has(localKey)) {\r\n // Deleted\r\n this.notifyListeners(localKey, null);\r\n keys.push(localKey);\r\n }\r\n }\r\n return keys;\r\n }\r\n notifyListeners(key, newValue) {\r\n this.localCache[key] = newValue;\r\n const listeners = this.listeners[key];\r\n if (listeners) {\r\n for (const listener of Array.from(listeners)) {\r\n listener(newValue);\r\n }\r\n }\r\n }\r\n startPolling() {\r\n this.stopPolling();\r\n this.pollTimer = setInterval(async () => this._poll(), _POLLING_INTERVAL_MS);\r\n }\r\n stopPolling() {\r\n if (this.pollTimer) {\r\n clearInterval(this.pollTimer);\r\n this.pollTimer = null;\r\n }\r\n }\r\n _addListener(key, listener) {\r\n if (Object.keys(this.listeners).length === 0) {\r\n this.startPolling();\r\n }\r\n if (!this.listeners[key]) {\r\n this.listeners[key] = new Set();\r\n // Populate the cache to avoid spuriously triggering on first poll.\r\n void this._get(key); // This can happen in the background async and we can return immediately.\r\n }\r\n this.listeners[key].add(listener);\r\n }\r\n _removeListener(key, listener) {\r\n if (this.listeners[key]) {\r\n this.listeners[key].delete(listener);\r\n if (this.listeners[key].size === 0) {\r\n delete this.listeners[key];\r\n }\r\n }\r\n if (Object.keys(this.listeners).length === 0) {\r\n this.stopPolling();\r\n }\r\n }\r\n}\r\nIndexedDBLocalPersistence.type = 'LOCAL';\r\n/**\r\n * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`\r\n * for the underlying storage.\r\n *\r\n * @public\r\n */\r\nconst indexedDBLocalPersistence = IndexedDBLocalPersistence;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction startSignInPhoneMfa(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v2/accounts/mfaSignIn:start\" /* START_PHONE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));\r\n}\r\nfunction finalizeSignInPhoneMfa(auth, request) {\r\n return _performApiRequest(auth, \"POST\" /* POST */, \"/v2/accounts/mfaSignIn:finalize\" /* FINALIZE_PHONE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function getRecaptchaParams(auth) {\r\n return ((await _performApiRequest(auth, \"GET\" /* GET */, \"/v1/recaptchaParams\" /* GET_RECAPTCHA_PARAM */)).recaptchaSiteKey || '');\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction getScriptParentElement() {\r\n var _a, _b;\r\n return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;\r\n}\r\nfunction _loadJS(url) {\r\n // TODO: consider adding timeout support & cancellation\r\n return new Promise((resolve, reject) => {\r\n const el = document.createElement('script');\r\n el.setAttribute('src', url);\r\n el.onload = resolve;\r\n el.onerror = e => {\r\n const error = _createError(\"internal-error\" /* INTERNAL_ERROR */);\r\n error.customData = e;\r\n reject(error);\r\n };\r\n el.type = 'text/javascript';\r\n el.charset = 'UTF-8';\r\n getScriptParentElement().appendChild(el);\r\n });\r\n}\r\nfunction _generateCallbackName(prefix) {\r\n return `__${prefix}${Math.floor(Math.random() * 1000000)}`;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst _SOLVE_TIME_MS = 500;\r\nconst _EXPIRATION_TIME_MS = 60000;\r\nconst _WIDGET_ID_START = 1000000000000;\r\nclass MockReCaptcha {\r\n constructor(auth) {\r\n this.auth = auth;\r\n this.counter = _WIDGET_ID_START;\r\n this._widgets = new Map();\r\n }\r\n render(container, parameters) {\r\n const id = this.counter;\r\n this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {}));\r\n this.counter++;\r\n return id;\r\n }\r\n reset(optWidgetId) {\r\n var _a;\r\n const id = optWidgetId || _WIDGET_ID_START;\r\n void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.delete());\r\n this._widgets.delete(id);\r\n }\r\n getResponse(optWidgetId) {\r\n var _a;\r\n const id = optWidgetId || _WIDGET_ID_START;\r\n return ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.getResponse()) || '';\r\n }\r\n async execute(optWidgetId) {\r\n var _a;\r\n const id = optWidgetId || _WIDGET_ID_START;\r\n void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.execute());\r\n return '';\r\n }\r\n}\r\nclass MockWidget {\r\n constructor(containerOrId, appName, params) {\r\n this.params = params;\r\n this.timerId = null;\r\n this.deleted = false;\r\n this.responseToken = null;\r\n this.clickHandler = () => {\r\n this.execute();\r\n };\r\n const container = typeof containerOrId === 'string'\r\n ? document.getElementById(containerOrId)\r\n : containerOrId;\r\n _assert(container, \"argument-error\" /* ARGUMENT_ERROR */, { appName });\r\n this.container = container;\r\n this.isVisible = this.params.size !== 'invisible';\r\n if (this.isVisible) {\r\n this.execute();\r\n }\r\n else {\r\n this.container.addEventListener('click', this.clickHandler);\r\n }\r\n }\r\n getResponse() {\r\n this.checkIfDeleted();\r\n return this.responseToken;\r\n }\r\n delete() {\r\n this.checkIfDeleted();\r\n this.deleted = true;\r\n if (this.timerId) {\r\n clearTimeout(this.timerId);\r\n this.timerId = null;\r\n }\r\n this.container.removeEventListener('click', this.clickHandler);\r\n }\r\n execute() {\r\n this.checkIfDeleted();\r\n if (this.timerId) {\r\n return;\r\n }\r\n this.timerId = window.setTimeout(() => {\r\n this.responseToken = generateRandomAlphaNumericString(50);\r\n const { callback, 'expired-callback': expiredCallback } = this.params;\r\n if (callback) {\r\n try {\r\n callback(this.responseToken);\r\n }\r\n catch (e) { }\r\n }\r\n this.timerId = window.setTimeout(() => {\r\n this.timerId = null;\r\n this.responseToken = null;\r\n if (expiredCallback) {\r\n try {\r\n expiredCallback();\r\n }\r\n catch (e) { }\r\n }\r\n if (this.isVisible) {\r\n this.execute();\r\n }\r\n }, _EXPIRATION_TIME_MS);\r\n }, _SOLVE_TIME_MS);\r\n }\r\n checkIfDeleted() {\r\n if (this.deleted) {\r\n throw new Error('reCAPTCHA mock was already deleted!');\r\n }\r\n }\r\n}\r\nfunction generateRandomAlphaNumericString(len) {\r\n const chars = [];\r\n const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\r\n for (let i = 0; i < len; i++) {\r\n chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)));\r\n }\r\n return chars.join('');\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// ReCaptcha will load using the same callback, so the callback function needs\r\n// to be kept around\r\nconst _JSLOAD_CALLBACK = _generateCallbackName('rcb');\r\nconst NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000);\r\nconst RECAPTCHA_BASE = 'https://www.google.com/recaptcha/api.js?';\r\n/**\r\n * Loader for the GReCaptcha library. There should only ever be one of this.\r\n */\r\nclass ReCaptchaLoaderImpl {\r\n constructor() {\r\n this.hostLanguage = '';\r\n this.counter = 0;\r\n this.librarySeparatelyLoaded = !!_window().grecaptcha;\r\n }\r\n load(auth, hl = '') {\r\n _assert(isHostLanguageValid(hl), auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n if (this.shouldResolveImmediately(hl)) {\r\n return Promise.resolve(_window().grecaptcha);\r\n }\r\n return new Promise((resolve, reject) => {\r\n const networkTimeout = _window().setTimeout(() => {\r\n reject(_createError(auth, \"network-request-failed\" /* NETWORK_REQUEST_FAILED */));\r\n }, NETWORK_TIMEOUT_DELAY.get());\r\n _window()[_JSLOAD_CALLBACK] = () => {\r\n _window().clearTimeout(networkTimeout);\r\n delete _window()[_JSLOAD_CALLBACK];\r\n const recaptcha = _window().grecaptcha;\r\n if (!recaptcha) {\r\n reject(_createError(auth, \"internal-error\" /* INTERNAL_ERROR */));\r\n return;\r\n }\r\n // Wrap the greptcha render function so that we know if the developer has\r\n // called it separately\r\n const render = recaptcha.render;\r\n recaptcha.render = (container, params) => {\r\n const widgetId = render(container, params);\r\n this.counter++;\r\n return widgetId;\r\n };\r\n this.hostLanguage = hl;\r\n resolve(recaptcha);\r\n };\r\n const url = `${RECAPTCHA_BASE}?${querystring({\r\n onload: _JSLOAD_CALLBACK,\r\n render: 'explicit',\r\n hl\r\n })}`;\r\n _loadJS(url).catch(() => {\r\n clearTimeout(networkTimeout);\r\n reject(_createError(auth, \"internal-error\" /* INTERNAL_ERROR */));\r\n });\r\n });\r\n }\r\n clearedOneInstance() {\r\n this.counter--;\r\n }\r\n shouldResolveImmediately(hl) {\r\n // We can resolve immediately if:\r\n // • grecaptcha is already defined AND (\r\n // 1. the requested language codes are the same OR\r\n // 2. there exists already a ReCaptcha on the page\r\n // 3. the library was already loaded by the app\r\n // In cases (2) and (3), we _can't_ reload as it would break the recaptchas\r\n // that are already in the page\r\n return (!!_window().grecaptcha &&\r\n (hl === this.hostLanguage ||\r\n this.counter > 0 ||\r\n this.librarySeparatelyLoaded));\r\n }\r\n}\r\nfunction isHostLanguageValid(hl) {\r\n return hl.length <= 6 && /^\\s*[a-zA-Z0-9\\-]*\\s*$/.test(hl);\r\n}\r\nclass MockReCaptchaLoaderImpl {\r\n async load(auth) {\r\n return new MockReCaptcha(auth);\r\n }\r\n clearedOneInstance() { }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst RECAPTCHA_VERIFIER_TYPE = 'recaptcha';\r\nconst DEFAULT_PARAMS = {\r\n theme: 'light',\r\n type: 'image'\r\n};\r\n/**\r\n * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier.\r\n *\r\n * @public\r\n */\r\nclass RecaptchaVerifier {\r\n /**\r\n *\r\n * @param containerOrId - The reCAPTCHA container parameter.\r\n *\r\n * @remarks\r\n * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a\r\n * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to\r\n * an element ID. The corresponding element must also must be in the DOM at the time of\r\n * initialization.\r\n *\r\n * @param parameters - The optional reCAPTCHA parameters.\r\n *\r\n * @remarks\r\n * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for\r\n * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will\r\n * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value\r\n * 'invisible'.\r\n *\r\n * @param authExtern - The corresponding Firebase {@link Auth} instance.\r\n *\r\n * @remarks\r\n * If none is provided, the default Firebase {@link Auth} instance is used. A Firebase {@link Auth} instance\r\n * must be initialized with an API key, otherwise an error will be thrown.\r\n */\r\n constructor(containerOrId, parameters = Object.assign({}, DEFAULT_PARAMS), authExtern) {\r\n this.parameters = parameters;\r\n /**\r\n * The application verifier type.\r\n *\r\n * @remarks\r\n * For a reCAPTCHA verifier, this is 'recaptcha'.\r\n */\r\n this.type = RECAPTCHA_VERIFIER_TYPE;\r\n this.destroyed = false;\r\n this.widgetId = null;\r\n this.tokenChangeListeners = new Set();\r\n this.renderPromise = null;\r\n this.recaptcha = null;\r\n this.auth = _castAuth(authExtern);\r\n this.isInvisible = this.parameters.size === 'invisible';\r\n _assert(typeof document !== 'undefined', this.auth, \"operation-not-supported-in-this-environment\" /* OPERATION_NOT_SUPPORTED */);\r\n const container = typeof containerOrId === 'string'\r\n ? document.getElementById(containerOrId)\r\n : containerOrId;\r\n _assert(container, this.auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n this.container = container;\r\n this.parameters.callback = this.makeTokenCallback(this.parameters.callback);\r\n this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting\r\n ? new MockReCaptchaLoaderImpl()\r\n : new ReCaptchaLoaderImpl();\r\n this.validateStartingState();\r\n // TODO: Figure out if sdk version is needed\r\n }\r\n /**\r\n * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.\r\n *\r\n * @returns A Promise for the reCAPTCHA token.\r\n */\r\n async verify() {\r\n this.assertNotDestroyed();\r\n const id = await this.render();\r\n const recaptcha = this.getAssertedRecaptcha();\r\n const response = recaptcha.getResponse(id);\r\n if (response) {\r\n return response;\r\n }\r\n return new Promise(resolve => {\r\n const tokenChange = (token) => {\r\n if (!token) {\r\n return; // Ignore token expirations.\r\n }\r\n this.tokenChangeListeners.delete(tokenChange);\r\n resolve(token);\r\n };\r\n this.tokenChangeListeners.add(tokenChange);\r\n if (this.isInvisible) {\r\n recaptcha.execute(id);\r\n }\r\n });\r\n }\r\n /**\r\n * Renders the reCAPTCHA widget on the page.\r\n *\r\n * @returns A Promise that resolves with the reCAPTCHA widget ID.\r\n */\r\n render() {\r\n try {\r\n this.assertNotDestroyed();\r\n }\r\n catch (e) {\r\n // This method returns a promise. Since it's not async (we want to return the\r\n // _same_ promise if rendering is still occurring), the API surface should\r\n // reject with the error rather than just throw\r\n return Promise.reject(e);\r\n }\r\n if (this.renderPromise) {\r\n return this.renderPromise;\r\n }\r\n this.renderPromise = this.makeRenderPromise().catch(e => {\r\n this.renderPromise = null;\r\n throw e;\r\n });\r\n return this.renderPromise;\r\n }\r\n /** @internal */\r\n _reset() {\r\n this.assertNotDestroyed();\r\n if (this.widgetId !== null) {\r\n this.getAssertedRecaptcha().reset(this.widgetId);\r\n }\r\n }\r\n /**\r\n * Clears the reCAPTCHA widget from the page and destroys the instance.\r\n */\r\n clear() {\r\n this.assertNotDestroyed();\r\n this.destroyed = true;\r\n this._recaptchaLoader.clearedOneInstance();\r\n if (!this.isInvisible) {\r\n this.container.childNodes.forEach(node => {\r\n this.container.removeChild(node);\r\n });\r\n }\r\n }\r\n validateStartingState() {\r\n _assert(!this.parameters.sitekey, this.auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n _assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n _assert(typeof document !== 'undefined', this.auth, \"operation-not-supported-in-this-environment\" /* OPERATION_NOT_SUPPORTED */);\r\n }\r\n makeTokenCallback(existing) {\r\n return token => {\r\n this.tokenChangeListeners.forEach(listener => listener(token));\r\n if (typeof existing === 'function') {\r\n existing(token);\r\n }\r\n else if (typeof existing === 'string') {\r\n const globalFunc = _window()[existing];\r\n if (typeof globalFunc === 'function') {\r\n globalFunc(token);\r\n }\r\n }\r\n };\r\n }\r\n assertNotDestroyed() {\r\n _assert(!this.destroyed, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n async makeRenderPromise() {\r\n await this.init();\r\n if (!this.widgetId) {\r\n let container = this.container;\r\n if (!this.isInvisible) {\r\n const guaranteedEmpty = document.createElement('div');\r\n container.appendChild(guaranteedEmpty);\r\n container = guaranteedEmpty;\r\n }\r\n this.widgetId = this.getAssertedRecaptcha().render(container, this.parameters);\r\n }\r\n return this.widgetId;\r\n }\r\n async init() {\r\n _assert(_isHttpOrHttps() && !_isWorker(), this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n await domReady();\r\n this.recaptcha = await this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined);\r\n const siteKey = await getRecaptchaParams(this.auth);\r\n _assert(siteKey, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n this.parameters.sitekey = siteKey;\r\n }\r\n getAssertedRecaptcha() {\r\n _assert(this.recaptcha, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return this.recaptcha;\r\n }\r\n}\r\nfunction domReady() {\r\n let resolver = null;\r\n return new Promise(resolve => {\r\n if (document.readyState === 'complete') {\r\n resolve();\r\n return;\r\n }\r\n // Document not ready, wait for load before resolving.\r\n // Save resolver, so we can remove listener in case it was externally\r\n // cancelled.\r\n resolver = () => resolve();\r\n window.addEventListener('load', resolver);\r\n }).catch(e => {\r\n if (resolver) {\r\n window.removeEventListener('load', resolver);\r\n }\r\n throw e;\r\n });\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass ConfirmationResultImpl {\r\n constructor(verificationId, onConfirmation) {\r\n this.verificationId = verificationId;\r\n this.onConfirmation = onConfirmation;\r\n }\r\n confirm(verificationCode) {\r\n const authCredential = PhoneAuthCredential._fromVerification(this.verificationId, verificationCode);\r\n return this.onConfirmation(authCredential);\r\n }\r\n}\r\n/**\r\n * Asynchronously signs in using a phone number.\r\n *\r\n * @remarks\r\n * This method sends a code via SMS to the given\r\n * phone number, and returns a {@link ConfirmationResult}. After the user\r\n * provides the code sent to their phone, call {@link ConfirmationResult.confirm}\r\n * with the code to sign the user in.\r\n *\r\n * For abuse prevention, this method also requires a {@link ApplicationVerifier}.\r\n * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.\r\n * This function can work on other platforms that do not support the\r\n * {@link RecaptchaVerifier} (like React Native), but you need to use a\r\n * third-party {@link ApplicationVerifier} implementation.\r\n *\r\n * @example\r\n * ```javascript\r\n * // 'recaptcha-container' is the ID of an element in the DOM.\r\n * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');\r\n * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\r\n * // Obtain a verificationCode from the user.\r\n * const credential = await confirmationResult.confirm(verificationCode);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\r\n * @param appVerifier - The {@link ApplicationVerifier}.\r\n *\r\n * @public\r\n */\r\nasync function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {\r\n const authInternal = _castAuth(auth);\r\n const verificationId = await _verifyPhoneNumber(authInternal, phoneNumber, getModularInstance(appVerifier));\r\n return new ConfirmationResultImpl(verificationId, cred => signInWithCredential(authInternal, cred));\r\n}\r\n/**\r\n * Links the user account with the given phone number.\r\n *\r\n * @param user - The user.\r\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\r\n * @param appVerifier - The {@link ApplicationVerifier}.\r\n *\r\n * @public\r\n */\r\nasync function linkWithPhoneNumber(user, phoneNumber, appVerifier) {\r\n const userInternal = getModularInstance(user);\r\n await _assertLinkedStatus(false, userInternal, \"phone\" /* PHONE */);\r\n const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));\r\n return new ConfirmationResultImpl(verificationId, cred => linkWithCredential(userInternal, cred));\r\n}\r\n/**\r\n * Re-authenticates a user using a fresh phone credential.\r\n *\r\n * @remarks Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.\r\n *\r\n * @param user - The user.\r\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\r\n * @param appVerifier - The {@link ApplicationVerifier}.\r\n *\r\n * @public\r\n */\r\nasync function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {\r\n const userInternal = getModularInstance(user);\r\n const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));\r\n return new ConfirmationResultImpl(verificationId, cred => reauthenticateWithCredential(userInternal, cred));\r\n}\r\n/**\r\n * Returns a verification ID to be used in conjunction with the SMS code that is sent.\r\n *\r\n */\r\nasync function _verifyPhoneNumber(auth, options, verifier) {\r\n var _a;\r\n const recaptchaToken = await verifier.verify();\r\n try {\r\n _assert(typeof recaptchaToken === 'string', auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n _assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n let phoneInfoOptions;\r\n if (typeof options === 'string') {\r\n phoneInfoOptions = {\r\n phoneNumber: options\r\n };\r\n }\r\n else {\r\n phoneInfoOptions = options;\r\n }\r\n if ('session' in phoneInfoOptions) {\r\n const session = phoneInfoOptions.session;\r\n if ('phoneNumber' in phoneInfoOptions) {\r\n _assert(session.type === \"enroll\" /* ENROLL */, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const response = await startEnrollPhoneMfa(auth, {\r\n idToken: session.credential,\r\n phoneEnrollmentInfo: {\r\n phoneNumber: phoneInfoOptions.phoneNumber,\r\n recaptchaToken\r\n }\r\n });\r\n return response.phoneSessionInfo.sessionInfo;\r\n }\r\n else {\r\n _assert(session.type === \"signin\" /* SIGN_IN */, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n const mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) ||\r\n phoneInfoOptions.multiFactorUid;\r\n _assert(mfaEnrollmentId, auth, \"missing-multi-factor-info\" /* MISSING_MFA_INFO */);\r\n const response = await startSignInPhoneMfa(auth, {\r\n mfaPendingCredential: session.credential,\r\n mfaEnrollmentId,\r\n phoneSignInInfo: {\r\n recaptchaToken\r\n }\r\n });\r\n return response.phoneResponseInfo.sessionInfo;\r\n }\r\n }\r\n else {\r\n const { sessionInfo } = await sendPhoneVerificationCode(auth, {\r\n phoneNumber: phoneInfoOptions.phoneNumber,\r\n recaptchaToken\r\n });\r\n return sessionInfo;\r\n }\r\n }\r\n finally {\r\n verifier._reset();\r\n }\r\n}\r\n/**\r\n * Updates the user's phone number.\r\n *\r\n * @example\r\n * ```\r\n * // 'recaptcha-container' is the ID of an element in the DOM.\r\n * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);\r\n * // Obtain the verificationCode from the user.\r\n * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * await updatePhoneNumber(user, phoneCredential);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param credential - A credential authenticating the new phone number.\r\n *\r\n * @public\r\n */\r\nasync function updatePhoneNumber(user, credential) {\r\n await _link$1(getModularInstance(user), credential);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Provider for generating an {@link PhoneAuthCredential}.\r\n *\r\n * @example\r\n * ```javascript\r\n * // 'recaptcha-container' is the ID of an element in the DOM.\r\n * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);\r\n * // Obtain the verificationCode from the user.\r\n * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * const userCredential = await signInWithCredential(auth, phoneCredential);\r\n * ```\r\n *\r\n * @public\r\n */\r\nclass PhoneAuthProvider {\r\n /**\r\n * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur.\r\n *\r\n */\r\n constructor(auth) {\r\n /** Always set to {@link ProviderId}.PHONE. */\r\n this.providerId = PhoneAuthProvider.PROVIDER_ID;\r\n this.auth = _castAuth(auth);\r\n }\r\n /**\r\n *\r\n * Starts a phone number authentication flow by sending a verification code to the given phone\r\n * number.\r\n *\r\n * @example\r\n * ```javascript\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * const userCredential = await signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * An alternative flow is provided using the `signInWithPhoneNumber` method.\r\n * ```javascript\r\n * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const userCredential = confirmationResult.confirm(verificationCode);\r\n * ```\r\n *\r\n * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in\r\n * E.164 format (e.g. +16505550101).\r\n * @param applicationVerifier - For abuse prevention, this method also requires a\r\n * {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation,\r\n * {@link RecaptchaVerifier}.\r\n *\r\n * @returns A Promise for a verification ID that can be passed to\r\n * {@link PhoneAuthProvider.credential} to identify this flow..\r\n */\r\n verifyPhoneNumber(phoneOptions, applicationVerifier) {\r\n return _verifyPhoneNumber(this.auth, phoneOptions, getModularInstance(applicationVerifier));\r\n }\r\n /**\r\n * Creates a phone auth credential, given the verification ID from\r\n * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's\r\n * mobile device.\r\n *\r\n * @example\r\n * ```javascript\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * const userCredential = signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * An alternative flow is provided using the `signInWithPhoneNumber` method.\r\n * ```javascript\r\n * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const userCredential = await confirmationResult.confirm(verificationCode);\r\n * ```\r\n *\r\n * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}.\r\n * @param verificationCode - The verification code sent to the user's mobile device.\r\n *\r\n * @returns The auth provider credential.\r\n */\r\n static credential(verificationId, verificationCode) {\r\n return PhoneAuthCredential._fromVerification(verificationId, verificationCode);\r\n }\r\n /**\r\n * Generates an {@link AuthCredential} from a {@link UserCredential}.\r\n * @param userCredential - The user credential.\r\n */\r\n static credentialFromResult(userCredential) {\r\n const credential = userCredential;\r\n return PhoneAuthProvider.credentialFromTaggedObject(credential);\r\n }\r\n /**\r\n * Returns an {@link AuthCredential} when passed an error.\r\n *\r\n * @remarks\r\n *\r\n * This method works for errors like\r\n * `auth/account-exists-with-different-credentials`. This is useful for\r\n * recovering when attempting to set a user's phone number but the number\r\n * in question is already tied to another account. For example, the following\r\n * code tries to update the current user's phone number, and if that\r\n * fails, links the user with the account associated with that number:\r\n *\r\n * ```js\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber(number, verifier);\r\n * try {\r\n * const code = ''; // Prompt the user for the verification code\r\n * await updatePhoneNumber(\r\n * auth.currentUser,\r\n * PhoneAuthProvider.credential(verificationId, code));\r\n * } catch (e) {\r\n * if (e.code === 'auth/account-exists-with-different-credential') {\r\n * const cred = PhoneAuthProvider.credentialFromError(e);\r\n * await linkWithCredential(auth.currentUser, cred);\r\n * }\r\n * }\r\n *\r\n * // At this point, auth.currentUser.phoneNumber === number.\r\n * ```\r\n *\r\n * @param error - The error to generate a credential from.\r\n */\r\n static credentialFromError(error) {\r\n return PhoneAuthProvider.credentialFromTaggedObject((error.customData || {}));\r\n }\r\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\r\n if (!tokenResponse) {\r\n return null;\r\n }\r\n const { phoneNumber, temporaryProof } = tokenResponse;\r\n if (phoneNumber && temporaryProof) {\r\n return PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof);\r\n }\r\n return null;\r\n }\r\n}\r\n/** Always set to {@link ProviderId}.PHONE. */\r\nPhoneAuthProvider.PROVIDER_ID = \"phone\" /* PHONE */;\r\n/** Always set to {@link SignInMethod}.PHONE. */\r\nPhoneAuthProvider.PHONE_SIGN_IN_METHOD = \"phone\" /* PHONE */;\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Chooses a popup/redirect resolver to use. This prefers the override (which\r\n * is directly passed in), and falls back to the property set on the auth\r\n * object. If neither are available, this function errors w/ an argument error.\r\n */\r\nfunction _withDefaultResolver(auth, resolverOverride) {\r\n if (resolverOverride) {\r\n return _getInstance(resolverOverride);\r\n }\r\n _assert(auth._popupRedirectResolver, auth, \"argument-error\" /* ARGUMENT_ERROR */);\r\n return auth._popupRedirectResolver;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass IdpCredential extends AuthCredential {\r\n constructor(params) {\r\n super(\"custom\" /* CUSTOM */, \"custom\" /* CUSTOM */);\r\n this.params = params;\r\n }\r\n _getIdTokenResponse(auth) {\r\n return signInWithIdp(auth, this._buildIdpRequest());\r\n }\r\n _linkToIdToken(auth, idToken) {\r\n return signInWithIdp(auth, this._buildIdpRequest(idToken));\r\n }\r\n _getReauthenticationResolver(auth) {\r\n return signInWithIdp(auth, this._buildIdpRequest());\r\n }\r\n _buildIdpRequest(idToken) {\r\n const request = {\r\n requestUri: this.params.requestUri,\r\n sessionId: this.params.sessionId,\r\n postBody: this.params.postBody,\r\n tenantId: this.params.tenantId,\r\n pendingToken: this.params.pendingToken,\r\n returnSecureToken: true,\r\n returnIdpCredential: true\r\n };\r\n if (idToken) {\r\n request.idToken = idToken;\r\n }\r\n return request;\r\n }\r\n}\r\nfunction _signIn(params) {\r\n return _signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState);\r\n}\r\nfunction _reauth(params) {\r\n const { auth, user } = params;\r\n _assert(user, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState);\r\n}\r\nasync function _link(params) {\r\n const { auth, user } = params;\r\n _assert(user, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return _link$1(user, new IdpCredential(params), params.bypassAuthState);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\r\n * events\r\n */\r\nclass AbstractPopupRedirectOperation {\r\n constructor(auth, filter, resolver, user, bypassAuthState = false) {\r\n this.auth = auth;\r\n this.resolver = resolver;\r\n this.user = user;\r\n this.bypassAuthState = bypassAuthState;\r\n this.pendingPromise = null;\r\n this.eventManager = null;\r\n this.filter = Array.isArray(filter) ? filter : [filter];\r\n }\r\n execute() {\r\n return new Promise(async (resolve, reject) => {\r\n this.pendingPromise = { resolve, reject };\r\n try {\r\n this.eventManager = await this.resolver._initialize(this.auth);\r\n await this.onExecution();\r\n this.eventManager.registerConsumer(this);\r\n }\r\n catch (e) {\r\n this.reject(e);\r\n }\r\n });\r\n }\r\n async onAuthEvent(event) {\r\n const { urlResponse, sessionId, postBody, tenantId, error, type } = event;\r\n if (error) {\r\n this.reject(error);\r\n return;\r\n }\r\n const params = {\r\n auth: this.auth,\r\n requestUri: urlResponse,\r\n sessionId: sessionId,\r\n tenantId: tenantId || undefined,\r\n postBody: postBody || undefined,\r\n user: this.user,\r\n bypassAuthState: this.bypassAuthState\r\n };\r\n try {\r\n this.resolve(await this.getIdpTask(type)(params));\r\n }\r\n catch (e) {\r\n this.reject(e);\r\n }\r\n }\r\n onError(error) {\r\n this.reject(error);\r\n }\r\n getIdpTask(type) {\r\n switch (type) {\r\n case \"signInViaPopup\" /* SIGN_IN_VIA_POPUP */:\r\n case \"signInViaRedirect\" /* SIGN_IN_VIA_REDIRECT */:\r\n return _signIn;\r\n case \"linkViaPopup\" /* LINK_VIA_POPUP */:\r\n case \"linkViaRedirect\" /* LINK_VIA_REDIRECT */:\r\n return _link;\r\n case \"reauthViaPopup\" /* REAUTH_VIA_POPUP */:\r\n case \"reauthViaRedirect\" /* REAUTH_VIA_REDIRECT */:\r\n return _reauth;\r\n default:\r\n _fail(this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }\r\n }\r\n resolve(cred) {\r\n debugAssert(this.pendingPromise, 'Pending promise was never set');\r\n this.pendingPromise.resolve(cred);\r\n this.unregisterAndCleanUp();\r\n }\r\n reject(error) {\r\n debugAssert(this.pendingPromise, 'Pending promise was never set');\r\n this.pendingPromise.reject(error);\r\n this.unregisterAndCleanUp();\r\n }\r\n unregisterAndCleanUp() {\r\n if (this.eventManager) {\r\n this.eventManager.unregisterConsumer(this);\r\n }\r\n this.pendingPromise = null;\r\n this.cleanUp();\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);\r\n/**\r\n * Authenticates a Firebase client using a popup-based OAuth authentication flow.\r\n *\r\n * @remarks\r\n * If succeeds, returns the signed in user along with the provider's credential. If sign in was\r\n * unsuccessful, returns an error object containing additional information about the error.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n *\r\n * @public\r\n */\r\nasync function signInWithPopup(auth, provider, resolver) {\r\n const authInternal = _castAuth(auth);\r\n _assertInstanceOf(auth, provider, FederatedAuthProvider);\r\n const resolverInternal = _withDefaultResolver(authInternal, resolver);\r\n const action = new PopupOperation(authInternal, \"signInViaPopup\" /* SIGN_IN_VIA_POPUP */, provider, resolverInternal);\r\n return action.executeNotNull();\r\n}\r\n/**\r\n * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based\r\n * OAuth flow.\r\n *\r\n * @remarks\r\n * If the reauthentication is successful, the returned result will contain the user and the\r\n * provider's credential.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * const result = await signInWithPopup(auth, provider);\r\n * // Reauthenticate using a popup.\r\n * await reauthenticateWithPopup(result.user, provider);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\r\nasync function reauthenticateWithPopup(user, provider, resolver) {\r\n const userInternal = getModularInstance(user);\r\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\r\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\r\n const action = new PopupOperation(userInternal.auth, \"reauthViaPopup\" /* REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);\r\n return action.executeNotNull();\r\n}\r\n/**\r\n * Links the authenticated provider to the user account using a pop-up based OAuth flow.\r\n *\r\n * @remarks\r\n * If the linking is successful, the returned result will contain the user and the provider's credential.\r\n *\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using some other provider.\r\n * const result = await signInWithEmailAndPassword(auth, email, password);\r\n * // Link using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * await linkWithPopup(result.user, provider);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\r\nasync function linkWithPopup(user, provider, resolver) {\r\n const userInternal = getModularInstance(user);\r\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\r\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\r\n const action = new PopupOperation(userInternal.auth, \"linkViaPopup\" /* LINK_VIA_POPUP */, provider, resolverInternal, userInternal);\r\n return action.executeNotNull();\r\n}\r\n/**\r\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\r\n * events\r\n *\r\n */\r\nclass PopupOperation extends AbstractPopupRedirectOperation {\r\n constructor(auth, filter, provider, resolver, user) {\r\n super(auth, filter, resolver, user);\r\n this.provider = provider;\r\n this.authWindow = null;\r\n this.pollId = null;\r\n if (PopupOperation.currentPopupAction) {\r\n PopupOperation.currentPopupAction.cancel();\r\n }\r\n PopupOperation.currentPopupAction = this;\r\n }\r\n async executeNotNull() {\r\n const result = await this.execute();\r\n _assert(result, this.auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return result;\r\n }\r\n async onExecution() {\r\n debugAssert(this.filter.length === 1, 'Popup operations only handle one event');\r\n const eventId = _generateEventId();\r\n this.authWindow = await this.resolver._openPopup(this.auth, this.provider, this.filter[0], // There's always one, see constructor\r\n eventId);\r\n this.authWindow.associatedEvent = eventId;\r\n // Check for web storage support and origin validation _after_ the popup is\r\n // loaded. These operations are slow (~1 second or so) Rather than\r\n // waiting on them before opening the window, optimistically open the popup\r\n // and check for storage support at the same time. If storage support is\r\n // not available, this will cause the whole thing to reject properly. It\r\n // will also close the popup, but since the promise has already rejected,\r\n // the popup closed by user poll will reject into the void.\r\n this.resolver._originValidation(this.auth).catch(e => {\r\n this.reject(e);\r\n });\r\n this.resolver._isIframeWebStorageSupported(this.auth, isSupported => {\r\n if (!isSupported) {\r\n this.reject(_createError(this.auth, \"web-storage-unsupported\" /* WEB_STORAGE_UNSUPPORTED */));\r\n }\r\n });\r\n // Handle user closure. Notice this does *not* use await\r\n this.pollUserCancellation();\r\n }\r\n get eventId() {\r\n var _a;\r\n return ((_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.associatedEvent) || null;\r\n }\r\n cancel() {\r\n this.reject(_createError(this.auth, \"cancelled-popup-request\" /* EXPIRED_POPUP_REQUEST */));\r\n }\r\n cleanUp() {\r\n if (this.authWindow) {\r\n this.authWindow.close();\r\n }\r\n if (this.pollId) {\r\n window.clearTimeout(this.pollId);\r\n }\r\n this.authWindow = null;\r\n this.pollId = null;\r\n PopupOperation.currentPopupAction = null;\r\n }\r\n pollUserCancellation() {\r\n const poll = () => {\r\n var _a, _b;\r\n if ((_b = (_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.closed) {\r\n // Make sure that there is sufficient time for whatever action to\r\n // complete. The window could have closed but the sign in network\r\n // call could still be in flight.\r\n this.pollId = window.setTimeout(() => {\r\n this.pollId = null;\r\n this.reject(_createError(this.auth, \"popup-closed-by-user\" /* POPUP_CLOSED_BY_USER */));\r\n }, 2000 /* AUTH_EVENT */);\r\n return;\r\n }\r\n this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());\r\n };\r\n poll();\r\n }\r\n}\r\n// Only one popup is ever shown at once. The lifecycle of the current popup\r\n// can be managed / cancelled by the constructor.\r\nPopupOperation.currentPopupAction = null;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst PENDING_REDIRECT_KEY = 'pendingRedirect';\r\n// We only get one redirect outcome for any one auth, so just store it\r\n// in here.\r\nconst redirectOutcomeMap = new Map();\r\nclass RedirectAction extends AbstractPopupRedirectOperation {\r\n constructor(auth, resolver, bypassAuthState = false) {\r\n super(auth, [\r\n \"signInViaRedirect\" /* SIGN_IN_VIA_REDIRECT */,\r\n \"linkViaRedirect\" /* LINK_VIA_REDIRECT */,\r\n \"reauthViaRedirect\" /* REAUTH_VIA_REDIRECT */,\r\n \"unknown\" /* UNKNOWN */\r\n ], resolver, undefined, bypassAuthState);\r\n this.eventId = null;\r\n }\r\n /**\r\n * Override the execute function; if we already have a redirect result, then\r\n * just return it.\r\n */\r\n async execute() {\r\n let readyOutcome = redirectOutcomeMap.get(this.auth._key());\r\n if (!readyOutcome) {\r\n try {\r\n const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth);\r\n const result = hasPendingRedirect ? await super.execute() : null;\r\n readyOutcome = () => Promise.resolve(result);\r\n }\r\n catch (e) {\r\n readyOutcome = () => Promise.reject(e);\r\n }\r\n redirectOutcomeMap.set(this.auth._key(), readyOutcome);\r\n }\r\n // If we're not bypassing auth state, the ready outcome should be set to\r\n // null.\r\n if (!this.bypassAuthState) {\r\n redirectOutcomeMap.set(this.auth._key(), () => Promise.resolve(null));\r\n }\r\n return readyOutcome();\r\n }\r\n async onAuthEvent(event) {\r\n if (event.type === \"signInViaRedirect\" /* SIGN_IN_VIA_REDIRECT */) {\r\n return super.onAuthEvent(event);\r\n }\r\n else if (event.type === \"unknown\" /* UNKNOWN */) {\r\n // This is a sentinel value indicating there's no pending redirect\r\n this.resolve(null);\r\n return;\r\n }\r\n if (event.eventId) {\r\n const user = await this.auth._redirectUserForId(event.eventId);\r\n if (user) {\r\n this.user = user;\r\n return super.onAuthEvent(event);\r\n }\r\n else {\r\n this.resolve(null);\r\n }\r\n }\r\n }\r\n async onExecution() { }\r\n cleanUp() { }\r\n}\r\nasync function _getAndClearPendingRedirectStatus(resolver, auth) {\r\n const key = pendingRedirectKey(auth);\r\n const persistence = resolverPersistence(resolver);\r\n if (!(await persistence._isAvailable())) {\r\n return false;\r\n }\r\n const hasPendingRedirect = (await persistence._get(key)) === 'true';\r\n await persistence._remove(key);\r\n return hasPendingRedirect;\r\n}\r\nasync function _setPendingRedirectStatus(resolver, auth) {\r\n return resolverPersistence(resolver)._set(pendingRedirectKey(auth), 'true');\r\n}\r\nfunction _clearRedirectOutcomes() {\r\n redirectOutcomeMap.clear();\r\n}\r\nfunction resolverPersistence(resolver) {\r\n return _getInstance(resolver._redirectPersistence);\r\n}\r\nfunction pendingRedirectKey(auth) {\r\n return _persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Authenticates a Firebase client using a full-page redirect flow.\r\n *\r\n * @remarks\r\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * // You can add additional scopes to the provider:\r\n * provider.addScope('user_birthday');\r\n * // Start a sign in process for an unauthenticated user.\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * }\r\n * // As this API can be used for sign-in, linking and reauthentication,\r\n * // check the operationType to determine what triggered this redirect\r\n * // operation.\r\n * const operationType = result.operationType;\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\r\nfunction signInWithRedirect(auth, provider, resolver) {\r\n return _signInWithRedirect(auth, provider, resolver);\r\n}\r\nasync function _signInWithRedirect(auth, provider, resolver) {\r\n const authInternal = _castAuth(auth);\r\n _assertInstanceOf(auth, provider, FederatedAuthProvider);\r\n const resolverInternal = _withDefaultResolver(authInternal, resolver);\r\n await _setPendingRedirectStatus(resolverInternal, authInternal);\r\n return resolverInternal._openRedirect(authInternal, provider, \"signInViaRedirect\" /* SIGN_IN_VIA_REDIRECT */);\r\n}\r\n/**\r\n * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * const result = await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * // Link using a redirect.\r\n * await linkWithRedirect(result.user, provider);\r\n * // This will again trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\r\nfunction reauthenticateWithRedirect(user, provider, resolver) {\r\n return _reauthenticateWithRedirect(user, provider, resolver);\r\n}\r\nasync function _reauthenticateWithRedirect(user, provider, resolver) {\r\n const userInternal = getModularInstance(user);\r\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\r\n // Allow the resolver to error before persisting the redirect user\r\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\r\n await _setPendingRedirectStatus(resolverInternal, userInternal.auth);\r\n const eventId = await prepareUserForRedirect(userInternal);\r\n return resolverInternal._openRedirect(userInternal.auth, provider, \"reauthViaRedirect\" /* REAUTH_VIA_REDIRECT */, eventId);\r\n}\r\n/**\r\n * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using some other provider.\r\n * const result = await signInWithEmailAndPassword(auth, email, password);\r\n * // Link using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * await linkWithRedirect(result.user, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n *\r\n * @public\r\n */\r\nfunction linkWithRedirect(user, provider, resolver) {\r\n return _linkWithRedirect(user, provider, resolver);\r\n}\r\nasync function _linkWithRedirect(user, provider, resolver) {\r\n const userInternal = getModularInstance(user);\r\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\r\n // Allow the resolver to error before persisting the redirect user\r\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\r\n await _assertLinkedStatus(false, userInternal, provider.providerId);\r\n await _setPendingRedirectStatus(resolverInternal, userInternal.auth);\r\n const eventId = await prepareUserForRedirect(userInternal);\r\n return resolverInternal._openRedirect(userInternal.auth, provider, \"linkViaRedirect\" /* LINK_VIA_REDIRECT */, eventId);\r\n}\r\n/**\r\n * Returns a {@link UserCredential} from the redirect-based sign-in flow.\r\n *\r\n * @remarks\r\n * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an\r\n * error. If no redirect operation was called, returns a {@link UserCredential}\r\n * with a null `user`.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * // You can add additional scopes to the provider:\r\n * provider.addScope('user_birthday');\r\n * // Start a sign in process for an unauthenticated user.\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * }\r\n * // As this API can be used for sign-in, linking and reauthentication,\r\n * // check the operationType to determine what triggered this redirect\r\n * // operation.\r\n * const operationType = result.operationType;\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\r\nasync function getRedirectResult(auth, resolver) {\r\n await _castAuth(auth)._initializationPromise;\r\n return _getRedirectResult(auth, resolver, false);\r\n}\r\nasync function _getRedirectResult(auth, resolverExtern, bypassAuthState = false) {\r\n const authInternal = _castAuth(auth);\r\n const resolver = _withDefaultResolver(authInternal, resolverExtern);\r\n const action = new RedirectAction(authInternal, resolver, bypassAuthState);\r\n const result = await action.execute();\r\n if (result && !bypassAuthState) {\r\n delete result.user._redirectEventId;\r\n await authInternal._persistUserIfCurrent(result.user);\r\n await authInternal._setRedirectUser(null, resolverExtern);\r\n }\r\n return result;\r\n}\r\nasync function prepareUserForRedirect(user) {\r\n const eventId = _generateEventId(`${user.uid}:::`);\r\n user._redirectEventId = eventId;\r\n await user.auth._setRedirectUser(user);\r\n await user.auth._persistUserIfCurrent(user);\r\n return eventId;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// The amount of time to store the UIDs of seen events; this is\r\n// set to 10 min by default\r\nconst EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000;\r\nclass AuthEventManager {\r\n constructor(auth) {\r\n this.auth = auth;\r\n this.cachedEventUids = new Set();\r\n this.consumers = new Set();\r\n this.queuedRedirectEvent = null;\r\n this.hasHandledPotentialRedirect = false;\r\n this.lastProcessedEventTime = Date.now();\r\n }\r\n registerConsumer(authEventConsumer) {\r\n this.consumers.add(authEventConsumer);\r\n if (this.queuedRedirectEvent &&\r\n this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)) {\r\n this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer);\r\n this.saveEventToCache(this.queuedRedirectEvent);\r\n this.queuedRedirectEvent = null;\r\n }\r\n }\r\n unregisterConsumer(authEventConsumer) {\r\n this.consumers.delete(authEventConsumer);\r\n }\r\n onEvent(event) {\r\n // Check if the event has already been handled\r\n if (this.hasEventBeenHandled(event)) {\r\n return false;\r\n }\r\n let handled = false;\r\n this.consumers.forEach(consumer => {\r\n if (this.isEventForConsumer(event, consumer)) {\r\n handled = true;\r\n this.sendToConsumer(event, consumer);\r\n this.saveEventToCache(event);\r\n }\r\n });\r\n if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) {\r\n // If we've already seen a redirect before, or this is a popup event,\r\n // bail now\r\n return handled;\r\n }\r\n this.hasHandledPotentialRedirect = true;\r\n // If the redirect wasn't handled, hang on to it\r\n if (!handled) {\r\n this.queuedRedirectEvent = event;\r\n handled = true;\r\n }\r\n return handled;\r\n }\r\n sendToConsumer(event, consumer) {\r\n var _a;\r\n if (event.error && !isNullRedirectEvent(event)) {\r\n const code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||\r\n \"internal-error\" /* INTERNAL_ERROR */;\r\n consumer.onError(_createError(this.auth, code));\r\n }\r\n else {\r\n consumer.onAuthEvent(event);\r\n }\r\n }\r\n isEventForConsumer(event, consumer) {\r\n const eventIdMatches = consumer.eventId === null ||\r\n (!!event.eventId && event.eventId === consumer.eventId);\r\n return consumer.filter.includes(event.type) && eventIdMatches;\r\n }\r\n hasEventBeenHandled(event) {\r\n if (Date.now() - this.lastProcessedEventTime >=\r\n EVENT_DUPLICATION_CACHE_DURATION_MS) {\r\n this.cachedEventUids.clear();\r\n }\r\n return this.cachedEventUids.has(eventUid(event));\r\n }\r\n saveEventToCache(event) {\r\n this.cachedEventUids.add(eventUid(event));\r\n this.lastProcessedEventTime = Date.now();\r\n }\r\n}\r\nfunction eventUid(e) {\r\n return [e.type, e.eventId, e.sessionId, e.tenantId].filter(v => v).join('-');\r\n}\r\nfunction isNullRedirectEvent({ type, error }) {\r\n return (type === \"unknown\" /* UNKNOWN */ &&\r\n (error === null || error === void 0 ? void 0 : error.code) === `auth/${\"no-auth-event\" /* NO_AUTH_EVENT */}`);\r\n}\r\nfunction isRedirectEvent(event) {\r\n switch (event.type) {\r\n case \"signInViaRedirect\" /* SIGN_IN_VIA_REDIRECT */:\r\n case \"linkViaRedirect\" /* LINK_VIA_REDIRECT */:\r\n case \"reauthViaRedirect\" /* REAUTH_VIA_REDIRECT */:\r\n return true;\r\n case \"unknown\" /* UNKNOWN */:\r\n return isNullRedirectEvent(event);\r\n default:\r\n return false;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function _getProjectConfig(auth, request = {}) {\r\n return _performApiRequest(auth, \"GET\" /* GET */, \"/v1/projects\" /* GET_PROJECT_CONFIG */, request);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst IP_ADDRESS_REGEX = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\r\nconst HTTP_REGEX = /^https?/;\r\nasync function _validateOrigin(auth) {\r\n // Skip origin validation if we are in an emulated environment\r\n if (auth.config.emulator) {\r\n return;\r\n }\r\n const { authorizedDomains } = await _getProjectConfig(auth);\r\n for (const domain of authorizedDomains) {\r\n try {\r\n if (matchDomain(domain)) {\r\n return;\r\n }\r\n }\r\n catch (_a) {\r\n // Do nothing if there's a URL error; just continue searching\r\n }\r\n }\r\n // In the old SDK, this error also provides helpful messages.\r\n _fail(auth, \"unauthorized-domain\" /* INVALID_ORIGIN */);\r\n}\r\nfunction matchDomain(expected) {\r\n const currentUrl = _getCurrentUrl();\r\n const { protocol, hostname } = new URL(currentUrl);\r\n if (expected.startsWith('chrome-extension://')) {\r\n const ceUrl = new URL(expected);\r\n if (ceUrl.hostname === '' && hostname === '') {\r\n // For some reason we're not parsing chrome URLs properly\r\n return (protocol === 'chrome-extension:' &&\r\n expected.replace('chrome-extension://', '') ===\r\n currentUrl.replace('chrome-extension://', ''));\r\n }\r\n return protocol === 'chrome-extension:' && ceUrl.hostname === hostname;\r\n }\r\n if (!HTTP_REGEX.test(protocol)) {\r\n return false;\r\n }\r\n if (IP_ADDRESS_REGEX.test(expected)) {\r\n // The domain has to be exactly equal to the pattern, as an IP domain will\r\n // only contain the IP, no extra character.\r\n return hostname === expected;\r\n }\r\n // Dots in pattern should be escaped.\r\n const escapedDomainPattern = expected.replace(/\\./g, '\\\\.');\r\n // Non ip address domains.\r\n // domain.com = *.domain.com OR domain.com\r\n const re = new RegExp('^(.+\\\\.' + escapedDomainPattern + '|' + escapedDomainPattern + ')$', 'i');\r\n return re.test(hostname);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst NETWORK_TIMEOUT = new Delay(30000, 60000);\r\n/**\r\n * Reset unlaoded GApi modules. If gapi.load fails due to a network error,\r\n * it will stop working after a retrial. This is a hack to fix this issue.\r\n */\r\nfunction resetUnloadedGapiModules() {\r\n // Clear last failed gapi.load state to force next gapi.load to first\r\n // load the failed gapi.iframes module.\r\n // Get gapix.beacon context.\r\n const beacon = _window().___jsl;\r\n // Get current hint.\r\n if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {\r\n // Get gapi hint.\r\n for (const hint of Object.keys(beacon.H)) {\r\n // Requested modules.\r\n beacon.H[hint].r = beacon.H[hint].r || [];\r\n // Loaded modules.\r\n beacon.H[hint].L = beacon.H[hint].L || [];\r\n // Set requested modules to a copy of the loaded modules.\r\n beacon.H[hint].r = [...beacon.H[hint].L];\r\n // Clear pending callbacks.\r\n if (beacon.CP) {\r\n for (let i = 0; i < beacon.CP.length; i++) {\r\n // Remove all failed pending callbacks.\r\n beacon.CP[i] = null;\r\n }\r\n }\r\n }\r\n }\r\n}\r\nfunction loadGapi(auth) {\r\n return new Promise((resolve, reject) => {\r\n var _a, _b, _c;\r\n // Function to run when gapi.load is ready.\r\n function loadGapiIframe() {\r\n // The developer may have tried to previously run gapi.load and failed.\r\n // Run this to fix that.\r\n resetUnloadedGapiModules();\r\n gapi.load('gapi.iframes', {\r\n callback: () => {\r\n resolve(gapi.iframes.getContext());\r\n },\r\n ontimeout: () => {\r\n // The above reset may be sufficient, but having this reset after\r\n // failure ensures that if the developer calls gapi.load after the\r\n // connection is re-established and before another attempt to embed\r\n // the iframe, it would work and would not be broken because of our\r\n // failed attempt.\r\n // Timeout when gapi.iframes.Iframe not loaded.\r\n resetUnloadedGapiModules();\r\n reject(_createError(auth, \"network-request-failed\" /* NETWORK_REQUEST_FAILED */));\r\n },\r\n timeout: NETWORK_TIMEOUT.get()\r\n });\r\n }\r\n if ((_b = (_a = _window().gapi) === null || _a === void 0 ? void 0 : _a.iframes) === null || _b === void 0 ? void 0 : _b.Iframe) {\r\n // If gapi.iframes.Iframe available, resolve.\r\n resolve(gapi.iframes.getContext());\r\n }\r\n else if (!!((_c = _window().gapi) === null || _c === void 0 ? void 0 : _c.load)) {\r\n // Gapi loader ready, load gapi.iframes.\r\n loadGapiIframe();\r\n }\r\n else {\r\n // Create a new iframe callback when this is called so as not to overwrite\r\n // any previous defined callback. This happens if this method is called\r\n // multiple times in parallel and could result in the later callback\r\n // overwriting the previous one. This would end up with a iframe\r\n // timeout.\r\n const cbName = _generateCallbackName('iframefcb');\r\n // GApi loader not available, dynamically load platform.js.\r\n _window()[cbName] = () => {\r\n // GApi loader should be ready.\r\n if (!!gapi.load) {\r\n loadGapiIframe();\r\n }\r\n else {\r\n // Gapi loader failed, throw error.\r\n reject(_createError(auth, \"network-request-failed\" /* NETWORK_REQUEST_FAILED */));\r\n }\r\n };\r\n // Load GApi loader.\r\n return _loadJS(`https://apis.google.com/js/api.js?onload=${cbName}`).catch(e => reject(e));\r\n }\r\n }).catch(error => {\r\n // Reset cached promise to allow for retrial.\r\n cachedGApiLoader = null;\r\n throw error;\r\n });\r\n}\r\nlet cachedGApiLoader = null;\r\nfunction _loadGapi(auth) {\r\n cachedGApiLoader = cachedGApiLoader || loadGapi(auth);\r\n return cachedGApiLoader;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst PING_TIMEOUT = new Delay(5000, 15000);\r\nconst IFRAME_PATH = '__/auth/iframe';\r\nconst EMULATED_IFRAME_PATH = 'emulator/auth/iframe';\r\nconst IFRAME_ATTRIBUTES = {\r\n style: {\r\n position: 'absolute',\r\n top: '-100px',\r\n width: '1px',\r\n height: '1px'\r\n },\r\n 'aria-hidden': 'true',\r\n tabindex: '-1'\r\n};\r\n// Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to\r\n// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get.\r\nconst EID_FROM_APIHOST = new Map([\r\n [\"identitytoolkit.googleapis.com\" /* API_HOST */, 'p'],\r\n ['staging-identitytoolkit.sandbox.googleapis.com', 's'],\r\n ['test-identitytoolkit.sandbox.googleapis.com', 't'] // test\r\n]);\r\nfunction getIframeUrl(auth) {\r\n const config = auth.config;\r\n _assert(config.authDomain, auth, \"auth-domain-config-required\" /* MISSING_AUTH_DOMAIN */);\r\n const url = config.emulator\r\n ? _emulatorUrl(config, EMULATED_IFRAME_PATH)\r\n : `https://${auth.config.authDomain}/${IFRAME_PATH}`;\r\n const params = {\r\n apiKey: config.apiKey,\r\n appName: auth.name,\r\n v: SDK_VERSION\r\n };\r\n const eid = EID_FROM_APIHOST.get(auth.config.apiHost);\r\n if (eid) {\r\n params.eid = eid;\r\n }\r\n const frameworks = auth._getFrameworks();\r\n if (frameworks.length) {\r\n params.fw = frameworks.join(',');\r\n }\r\n return `${url}?${querystring(params).slice(1)}`;\r\n}\r\nasync function _openIframe(auth) {\r\n const context = await _loadGapi(auth);\r\n const gapi = _window().gapi;\r\n _assert(gapi, auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n return context.open({\r\n where: document.body,\r\n url: getIframeUrl(auth),\r\n messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER,\r\n attributes: IFRAME_ATTRIBUTES,\r\n dontclear: true\r\n }, (iframe) => new Promise(async (resolve, reject) => {\r\n await iframe.restyle({\r\n // Prevent iframe from closing on mouse out.\r\n setHideOnLeave: false\r\n });\r\n const networkError = _createError(auth, \"network-request-failed\" /* NETWORK_REQUEST_FAILED */);\r\n // Confirm iframe is correctly loaded.\r\n // To fallback on failure, set a timeout.\r\n const networkErrorTimer = _window().setTimeout(() => {\r\n reject(networkError);\r\n }, PING_TIMEOUT.get());\r\n // Clear timer and resolve pending iframe ready promise.\r\n function clearTimerAndResolve() {\r\n _window().clearTimeout(networkErrorTimer);\r\n resolve(iframe);\r\n }\r\n // This returns an IThenable. However the reject part does not call\r\n // when the iframe is not loaded.\r\n iframe.ping(clearTimerAndResolve).then(clearTimerAndResolve, () => {\r\n reject(networkError);\r\n });\r\n }));\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst BASE_POPUP_OPTIONS = {\r\n location: 'yes',\r\n resizable: 'yes',\r\n statusbar: 'yes',\r\n toolbar: 'no'\r\n};\r\nconst DEFAULT_WIDTH = 500;\r\nconst DEFAULT_HEIGHT = 600;\r\nconst TARGET_BLANK = '_blank';\r\nconst FIREFOX_EMPTY_URL = 'http://localhost';\r\nclass AuthPopup {\r\n constructor(window) {\r\n this.window = window;\r\n this.associatedEvent = null;\r\n }\r\n close() {\r\n if (this.window) {\r\n try {\r\n this.window.close();\r\n }\r\n catch (e) { }\r\n }\r\n }\r\n}\r\nfunction _open(auth, url, name, width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT) {\r\n const top = Math.max((window.screen.availHeight - height) / 2, 0).toString();\r\n const left = Math.max((window.screen.availWidth - width) / 2, 0).toString();\r\n let target = '';\r\n const options = Object.assign(Object.assign({}, BASE_POPUP_OPTIONS), { width: width.toString(), height: height.toString(), top,\r\n left });\r\n // Chrome iOS 7 and 8 is returning an undefined popup win when target is\r\n // specified, even though the popup is not necessarily blocked.\r\n const ua = getUA().toLowerCase();\r\n if (name) {\r\n target = _isChromeIOS(ua) ? TARGET_BLANK : name;\r\n }\r\n if (_isFirefox(ua)) {\r\n // Firefox complains when invalid URLs are popped out. Hacky way to bypass.\r\n url = url || FIREFOX_EMPTY_URL;\r\n // Firefox disables by default scrolling on popup windows, which can create\r\n // issues when the user has many Google accounts, for instance.\r\n options.scrollbars = 'yes';\r\n }\r\n const optionsString = Object.entries(options).reduce((accum, [key, value]) => `${accum}${key}=${value},`, '');\r\n if (_isIOSStandalone(ua) && target !== '_self') {\r\n openAsNewWindowIOS(url || '', target);\r\n return new AuthPopup(null);\r\n }\r\n // about:blank getting sanitized causing browsers like IE/Edge to display\r\n // brief error message before redirecting to handler.\r\n const newWin = window.open(url || '', target, optionsString);\r\n _assert(newWin, auth, \"popup-blocked\" /* POPUP_BLOCKED */);\r\n // Flaky on IE edge, encapsulate with a try and catch.\r\n try {\r\n newWin.focus();\r\n }\r\n catch (e) { }\r\n return new AuthPopup(newWin);\r\n}\r\nfunction openAsNewWindowIOS(url, target) {\r\n const el = document.createElement('a');\r\n el.href = url;\r\n el.target = target;\r\n const click = document.createEvent('MouseEvent');\r\n click.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 1, null);\r\n el.dispatchEvent(click);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * URL for Authentication widget which will initiate the OAuth handshake\r\n *\r\n * @internal\r\n */\r\nconst WIDGET_PATH = '__/auth/handler';\r\n/**\r\n * URL for emulated environment\r\n *\r\n * @internal\r\n */\r\nconst EMULATOR_WIDGET_PATH = 'emulator/auth/handler';\r\nfunction _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {\r\n _assert(auth.config.authDomain, auth, \"auth-domain-config-required\" /* MISSING_AUTH_DOMAIN */);\r\n _assert(auth.config.apiKey, auth, \"invalid-api-key\" /* INVALID_API_KEY */);\r\n const params = {\r\n apiKey: auth.config.apiKey,\r\n appName: auth.name,\r\n authType,\r\n redirectUrl,\r\n v: SDK_VERSION,\r\n eventId\r\n };\r\n if (provider instanceof FederatedAuthProvider) {\r\n provider.setDefaultLanguage(auth.languageCode);\r\n params.providerId = provider.providerId || '';\r\n if (!isEmpty(provider.getCustomParameters())) {\r\n params.customParameters = JSON.stringify(provider.getCustomParameters());\r\n }\r\n // TODO set additionalParams from the provider as well?\r\n for (const [key, value] of Object.entries(additionalParams || {})) {\r\n params[key] = value;\r\n }\r\n }\r\n if (provider instanceof BaseOAuthProvider) {\r\n const scopes = provider.getScopes().filter(scope => scope !== '');\r\n if (scopes.length > 0) {\r\n params.scopes = scopes.join(',');\r\n }\r\n }\r\n if (auth.tenantId) {\r\n params.tid = auth.tenantId;\r\n }\r\n // TODO: maybe set eid as endipointId\r\n // TODO: maybe set fw as Frameworks.join(\",\")\r\n const paramsDict = params;\r\n for (const key of Object.keys(paramsDict)) {\r\n if (paramsDict[key] === undefined) {\r\n delete paramsDict[key];\r\n }\r\n }\r\n return `${getHandlerBase(auth)}?${querystring(paramsDict).slice(1)}`;\r\n}\r\nfunction getHandlerBase({ config }) {\r\n if (!config.emulator) {\r\n return `https://${config.authDomain}/${WIDGET_PATH}`;\r\n }\r\n return _emulatorUrl(config, EMULATOR_WIDGET_PATH);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * The special web storage event\r\n *\r\n */\r\nconst WEB_STORAGE_SUPPORT_KEY = 'webStorageSupport';\r\nclass BrowserPopupRedirectResolver {\r\n constructor() {\r\n this.eventManagers = {};\r\n this.iframes = {};\r\n this.originValidationPromises = {};\r\n this._redirectPersistence = browserSessionPersistence;\r\n this._completeRedirectFn = _getRedirectResult;\r\n }\r\n // Wrapping in async even though we don't await anywhere in order\r\n // to make sure errors are raised as promise rejections\r\n async _openPopup(auth, provider, authType, eventId) {\r\n var _a;\r\n debugAssert((_a = this.eventManagers[auth._key()]) === null || _a === void 0 ? void 0 : _a.manager, '_initialize() not called before _openPopup()');\r\n const url = _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);\r\n return _open(auth, url, _generateEventId());\r\n }\r\n async _openRedirect(auth, provider, authType, eventId) {\r\n await this._originValidation(auth);\r\n _setWindowLocation(_getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId));\r\n return new Promise(() => { });\r\n }\r\n _initialize(auth) {\r\n const key = auth._key();\r\n if (this.eventManagers[key]) {\r\n const { manager, promise } = this.eventManagers[key];\r\n if (manager) {\r\n return Promise.resolve(manager);\r\n }\r\n else {\r\n debugAssert(promise, 'If manager is not set, promise should be');\r\n return promise;\r\n }\r\n }\r\n const promise = this.initAndGetManager(auth);\r\n this.eventManagers[key] = { promise };\r\n // If the promise is rejected, the key should be removed so that the\r\n // operation can be retried later.\r\n promise.catch(() => {\r\n delete this.eventManagers[key];\r\n });\r\n return promise;\r\n }\r\n async initAndGetManager(auth) {\r\n const iframe = await _openIframe(auth);\r\n const manager = new AuthEventManager(auth);\r\n iframe.register('authEvent', (iframeEvent) => {\r\n _assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, \"invalid-auth-event\" /* INVALID_AUTH_EVENT */);\r\n // TODO: Consider splitting redirect and popup events earlier on\r\n const handled = manager.onEvent(iframeEvent.authEvent);\r\n return { status: handled ? \"ACK\" /* ACK */ : \"ERROR\" /* ERROR */ };\r\n }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);\r\n this.eventManagers[auth._key()] = { manager };\r\n this.iframes[auth._key()] = iframe;\r\n return manager;\r\n }\r\n _isIframeWebStorageSupported(auth, cb) {\r\n const iframe = this.iframes[auth._key()];\r\n iframe.send(WEB_STORAGE_SUPPORT_KEY, { type: WEB_STORAGE_SUPPORT_KEY }, result => {\r\n var _a;\r\n const isSupported = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a[WEB_STORAGE_SUPPORT_KEY];\r\n if (isSupported !== undefined) {\r\n cb(!!isSupported);\r\n }\r\n _fail(auth, \"internal-error\" /* INTERNAL_ERROR */);\r\n }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);\r\n }\r\n _originValidation(auth) {\r\n const key = auth._key();\r\n if (!this.originValidationPromises[key]) {\r\n this.originValidationPromises[key] = _validateOrigin(auth);\r\n }\r\n return this.originValidationPromises[key];\r\n }\r\n get _shouldInitProactively() {\r\n // Mobile browsers and Safari need to optimistically initialize\r\n return _isMobileBrowser() || _isSafari() || _isIOS();\r\n }\r\n}\r\n/**\r\n * An implementation of {@link PopupRedirectResolver} suitable for browser\r\n * based applications.\r\n *\r\n * @public\r\n */\r\nconst browserPopupRedirectResolver = BrowserPopupRedirectResolver;\n\nclass MultiFactorAssertionImpl {\r\n constructor(factorId) {\r\n this.factorId = factorId;\r\n }\r\n _process(auth, session, displayName) {\r\n switch (session.type) {\r\n case \"enroll\" /* ENROLL */:\r\n return this._finalizeEnroll(auth, session.credential, displayName);\r\n case \"signin\" /* SIGN_IN */:\r\n return this._finalizeSignIn(auth, session.credential);\r\n default:\r\n return debugFail('unexpected MultiFactorSessionType');\r\n }\r\n }\r\n}\n\n/**\r\n * {@inheritdoc PhoneMultiFactorAssertion}\r\n *\r\n * @public\r\n */\r\nclass PhoneMultiFactorAssertionImpl extends MultiFactorAssertionImpl {\r\n constructor(credential) {\r\n super(\"phone\" /* PHONE */);\r\n this.credential = credential;\r\n }\r\n /** @internal */\r\n static _fromCredential(credential) {\r\n return new PhoneMultiFactorAssertionImpl(credential);\r\n }\r\n /** @internal */\r\n _finalizeEnroll(auth, idToken, displayName) {\r\n return finalizeEnrollPhoneMfa(auth, {\r\n idToken,\r\n displayName,\r\n phoneVerificationInfo: this.credential._makeVerificationRequest()\r\n });\r\n }\r\n /** @internal */\r\n _finalizeSignIn(auth, mfaPendingCredential) {\r\n return finalizeSignInPhoneMfa(auth, {\r\n mfaPendingCredential,\r\n phoneVerificationInfo: this.credential._makeVerificationRequest()\r\n });\r\n }\r\n}\r\n/**\r\n * Provider for generating a {@link PhoneMultiFactorAssertion}.\r\n *\r\n * @public\r\n */\r\nclass PhoneMultiFactorGenerator {\r\n constructor() { }\r\n /**\r\n * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor.\r\n *\r\n * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}.\r\n * @returns A {@link PhoneMultiFactorAssertion} which can be used with\r\n * {@link MultiFactorResolver.resolveSignIn}\r\n */\r\n static assertion(credential) {\r\n return PhoneMultiFactorAssertionImpl._fromCredential(credential);\r\n }\r\n}\r\n/**\r\n * The identifier of the phone second factor: `phone`.\r\n */\r\nPhoneMultiFactorGenerator.FACTOR_ID = 'phone';\n\nvar name = \"@firebase/auth\";\nvar version = \"0.19.8\";\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nclass AuthInterop {\r\n constructor(auth) {\r\n this.auth = auth;\r\n this.internalListeners = new Map();\r\n }\r\n getUid() {\r\n var _a;\r\n this.assertAuthConfigured();\r\n return ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.uid) || null;\r\n }\r\n async getToken(forceRefresh) {\r\n this.assertAuthConfigured();\r\n await this.auth._initializationPromise;\r\n if (!this.auth.currentUser) {\r\n return null;\r\n }\r\n const accessToken = await this.auth.currentUser.getIdToken(forceRefresh);\r\n return { accessToken };\r\n }\r\n addAuthTokenListener(listener) {\r\n this.assertAuthConfigured();\r\n if (this.internalListeners.has(listener)) {\r\n return;\r\n }\r\n const unsubscribe = this.auth.onIdTokenChanged(user => {\r\n var _a;\r\n listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);\r\n });\r\n this.internalListeners.set(listener, unsubscribe);\r\n this.updateProactiveRefresh();\r\n }\r\n removeAuthTokenListener(listener) {\r\n this.assertAuthConfigured();\r\n const unsubscribe = this.internalListeners.get(listener);\r\n if (!unsubscribe) {\r\n return;\r\n }\r\n this.internalListeners.delete(listener);\r\n unsubscribe();\r\n this.updateProactiveRefresh();\r\n }\r\n assertAuthConfigured() {\r\n _assert(this.auth._initializationPromise, \"dependent-sdk-initialized-before-auth\" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);\r\n }\r\n updateProactiveRefresh() {\r\n if (this.internalListeners.size > 0) {\r\n this.auth._startProactiveRefresh();\r\n }\r\n else {\r\n this.auth._stopProactiveRefresh();\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction getVersionForPlatform(clientPlatform) {\r\n switch (clientPlatform) {\r\n case \"Node\" /* NODE */:\r\n return 'node';\r\n case \"ReactNative\" /* REACT_NATIVE */:\r\n return 'rn';\r\n case \"Worker\" /* WORKER */:\r\n return 'webworker';\r\n case \"Cordova\" /* CORDOVA */:\r\n return 'cordova';\r\n default:\r\n return undefined;\r\n }\r\n}\r\n/** @internal */\r\nfunction registerAuth(clientPlatform) {\r\n _registerComponent(new Component(\"auth\" /* AUTH */, (container, { options: deps }) => {\r\n const app = container.getProvider('app').getImmediate();\r\n const { apiKey, authDomain } = app.options;\r\n return (app => {\r\n _assert(apiKey && !apiKey.includes(':'), \"invalid-api-key\" /* INVALID_API_KEY */, { appName: app.name });\r\n // Auth domain is optional if IdP sign in isn't being used\r\n _assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), \"argument-error\" /* ARGUMENT_ERROR */, {\r\n appName: app.name\r\n });\r\n const config = {\r\n apiKey,\r\n authDomain,\r\n clientPlatform,\r\n apiHost: \"identitytoolkit.googleapis.com\" /* API_HOST */,\r\n tokenApiHost: \"securetoken.googleapis.com\" /* TOKEN_API_HOST */,\r\n apiScheme: \"https\" /* API_SCHEME */,\r\n sdkClientVersion: _getClientVersion(clientPlatform)\r\n };\r\n const authInstance = new AuthImpl(app, config);\r\n _initializeAuthInstance(authInstance, deps);\r\n return authInstance;\r\n })(app);\r\n }, \"PUBLIC\" /* PUBLIC */)\r\n /**\r\n * Auth can only be initialized by explicitly calling getAuth() or initializeAuth()\r\n * For why we do this, See go/firebase-next-auth-init\r\n */\r\n .setInstantiationMode(\"EXPLICIT\" /* EXPLICIT */)\r\n /**\r\n * Because all firebase products that depend on auth depend on auth-internal directly,\r\n * we need to initialize auth-internal after auth is initialized to make it available to other firebase products.\r\n */\r\n .setInstanceCreatedCallback((container, _instanceIdentifier, _instance) => {\r\n const authInternalProvider = container.getProvider(\"auth-internal\" /* AUTH_INTERNAL */);\r\n authInternalProvider.initialize();\r\n }));\r\n _registerComponent(new Component(\"auth-internal\" /* AUTH_INTERNAL */, container => {\r\n const auth = _castAuth(container.getProvider(\"auth\" /* AUTH */).getImmediate());\r\n return (auth => new AuthInterop(auth))(auth);\r\n }, \"PRIVATE\" /* PRIVATE */).setInstantiationMode(\"EXPLICIT\" /* EXPLICIT */));\r\n registerVersion(name, version, getVersionForPlatform(clientPlatform));\r\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\r\n registerVersion(name, version, 'esm2017');\r\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.\r\n * If no instance exists, initializes an Auth instance with platform-specific default dependencies.\r\n *\r\n * @param app - The Firebase App.\r\n *\r\n * @public\r\n */\r\nfunction getAuth(app = getApp()) {\r\n const provider = _getProvider(app, 'auth');\r\n if (provider.isInitialized()) {\r\n return provider.getImmediate();\r\n }\r\n return initializeAuth(app, {\r\n popupRedirectResolver: browserPopupRedirectResolver,\r\n persistence: [\r\n indexedDBLocalPersistence,\r\n browserLocalPersistence,\r\n browserSessionPersistence\r\n ]\r\n });\r\n}\r\nregisterAuth(\"Browser\" /* BROWSER */);\n\nexport { sendPasswordResetEmail as $, ActionCodeOperation as A, prodErrorMap as B, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as C, initializeAuth as D, connectAuthEmulator as E, FactorId as F, AuthCredential as G, EmailAuthCredential as H, OAuthCredential as I, PhoneAuthCredential as J, inMemoryPersistence as K, EmailAuthProvider as L, FacebookAuthProvider as M, GoogleAuthProvider as N, OperationType as O, PhoneAuthProvider as P, GithubAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, OAuthProvider as T, SAMLAuthProvider as U, TwitterAuthProvider as V, signInAnonymously as W, signInWithCredential as X, linkWithCredential as Y, reauthenticateWithCredential as Z, signInWithCustomToken as _, browserSessionPersistence as a, confirmPasswordReset as a0, applyActionCode as a1, checkActionCode as a2, verifyPasswordResetCode as a3, createUserWithEmailAndPassword as a4, signInWithEmailAndPassword as a5, sendSignInLinkToEmail as a6, isSignInWithEmailLink as a7, signInWithEmailLink as a8, fetchSignInMethodsForEmail as a9, _getRedirectResult as aA, _clearRedirectOutcomes as aB, _castAuth as aC, UserImpl as aD, AuthImpl as aE, _getClientVersion as aF, _generateEventId as aG, AuthPopup as aH, FetchProvider as aI, SAMLAuthCredential as aJ, sendEmailVerification as aa, verifyBeforeUpdateEmail as ab, ActionCodeURL as ac, parseActionCodeURL as ad, updateProfile as ae, updateEmail as af, updatePassword as ag, getIdToken as ah, getIdTokenResult as ai, unlink as aj, getAdditionalUserInfo as ak, reload as al, getMultiFactorResolver as am, multiFactor as an, _isIOS7Or8 as ao, debugAssert as ap, _isIOS as aq, _isAndroid as ar, _fail as as, _getRedirectUrl as at, _getProjectConfig as au, _createError as av, _assert as aw, _getInstance as ax, _persistenceKeyName as ay, AuthEventManager as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, getAuth as n, ProviderId as o, setPersistence as p, onIdTokenChanged as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, onAuthStateChanged as t, updatePhoneNumber as u, useDeviceLanguage as v, updateCurrentUser as w, signOut as x, deleteUser as y, debugErrorMap as z };\n//# sourceMappingURL=index-342f2197.js.map\n","import { Auth, browserLocalPersistence, browserSessionPersistence,\r\n\tcreateUserWithEmailAndPassword, getAuth, GoogleAuthProvider,\r\n\tinMemoryPersistence, sendEmailVerification, sendPasswordResetEmail,\r\n\tsetPersistence, signInWithEmailAndPassword, signInWithPopup, signOut, User }\r\n\tfrom 'firebase/auth';\r\n\r\nexport class FbAuth {\r\n\t\r\n\tpublic static async createUserWithEmailAndPassword(email:string, \r\n\t\t\tpassword:string):Promise {\r\n\t\ttry {\r\n\t\t\tlet auth = getAuth();\r\n\t\t\tlet credential = await createUserWithEmailAndPassword(auth,\r\n\t\t\t\temail, password);\r\n\t\t\treturn credential.user;\r\n\t\t}\r\n\t\tcatch (err) {\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static emailVerified():boolean {\r\n\t\treturn (FbAuth.getCurrentUser()?.emailVerified)?? false;\r\n\t}\r\n\t\r\n\t/**Attempts to send a verification email to the user. If the email is sent,\r\n\t * returns [true]*/\r\n\tpublic static async sendEmailVerification():Promise {\r\n\t\tlet user = FbAuth.getCurrentUser();\r\n\t\tif (user != null){\r\n\t\t\ttry {\r\n\t\t\t\tawait sendEmailVerification(user);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tcatch (err){\r\n\t\t\t\tconsole.log(err);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tpublic static async signInWithEmailAndPassword(email:string, \r\n\t\t\tpassword:string):Promise {\r\n\t\ttry {\r\n\t\t\tlet auth = getAuth();\r\n\t\t\tlet credential = await signInWithEmailAndPassword(auth,\r\n\t\t\t\temail, password);\r\n\t\t\treturn credential.user;\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static async sendPasswordResetEmail(email:string):Promise {\r\n\t\ttry {\r\n\t\t\tlet auth = getAuth();\r\n\t\t\tlet result = await sendPasswordResetEmail(auth, email);\r\n\t\t\t// console.log(result);\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Shows a Google login popup - returns a Promise that resolves to the\r\n\t * logged in user, or null if login doesn't occur.*/\r\n\tpublic static async showLogin():Promise {\r\n\t\ttry {\r\n\t\t\tlet provider = new GoogleAuthProvider()\r\n\t\t\tprovider.setCustomParameters({ 'prompt': 'select_account'});\r\n\t\t\tlet auth = getAuth();\r\n\t\t\tlet result = await signInWithPopup(auth, provider);\r\n\t\t\t\r\n\t\t\treturn result.user;\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Logs the user out. Returns a Promise that resolves when operation is\r\n\t * complete.*/\r\n\tpublic static async logout():Promise {\r\n\t\ttry {\r\n\t\t\tlet auth = getAuth();\r\n\t\t\tawait signOut(auth);\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Sets the persistance of the user login. [persistance] matches a value\r\n\t * from [fb.Persistence]. Info here:\r\n\t * https://firebase.google.com/docs/auth/web/auth-state-persistence\r\n\t * @param persistence a string that is LOCAL, SESSION, or NONE*/\r\n\tpublic static async setAuthPersistence(persistence:string = \"LOCAL\"\r\n\t\t\t):Promise {\r\n\t\ttry {\r\n\t\t\tlet auth = getAuth();\r\n\t\t\tswitch (persistence){\r\n\t\t\t\tcase \"LOCAL\":\r\n\t\t\t\t\tawait setPersistence(auth, browserLocalPersistence);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"SESSION\":\r\n\t\t\t\t\tawait setPersistence(auth, browserSessionPersistence);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"NONE\":\r\n\t\t\t\t\tawait setPersistence(auth, inMemoryPersistence);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow 'invalid persistence value: ' + persistence;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**gets the currently signed in user*/\r\n\tpublic static getCurrentUser():User {\r\n\t\treturn getAuth().currentUser;\r\n\t}\r\n\t\r\n\tpublic static async reloadUser():Promise {\r\n\t\tlet user = FbAuth.getCurrentUser();\r\n\t\tif (user != null){\r\n\t\t\ttry {\r\n\t\t\t\tawait user.reload();\r\n\t\t\t}\r\n\t\t\tcatch (err){\r\n\t\t\t\tconsole.log(err);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**gets the JWT auth token for the current user - returns null if user\r\n\t * not logged in.*/\r\n\tpublic static async getUserToken(forceRefresh:boolean = false)\r\n\t\t\t:Promise {\r\n\t\ttry {\r\n\t\t\tlet user = getAuth().currentUser;\r\n\t\t\tif (user != null){\r\n\t\t\t\tlet token:string = await user.getIdToken(forceRefresh);\r\n\t\t\t\treturn token;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tcatch(err) {\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static get auth():Auth { return getAuth(); }\r\n}","import { MusicXmlUtils } from \"score_data\";\r\nimport { EmptyDTO, HttpUtils, RDTO } from \"ts_utils\";\r\nimport { ContestEntryDTO, ContestEntryUpdateDTO, CreateUserDTO, TeamDTO,\r\n\tTeamUpdateDTO,\r\n\tTeamUploadDTO, UserDTO } from \"../data/dtos\";\r\nimport { FbAuth } from \"./firebase/FbAuth\";\r\n\r\nexport class Services {\r\n\tpublic static rootApiPath:string;\r\n\tpublic static recorderAceApiPath:string;\r\n\tpublic static usersApiVersion:string = \"2\";\r\n\tpublic static raApiVersion:string = \"1\";\r\n\t\r\n\t/**returns a user's information\r\n\t * If the user is found, the [RDTO.data] property will point to the \r\n\t * [UserDTO] and [RDTO.success] will be true.\r\n\t * \r\n\t * If there is a problem, [RDTO.success] will be false. Additionally, if\r\n\t * the user is not found, the [RDTO.message] property will be set to \r\n\t * [RdtoMessage.NOT_FOUND].*/\r\n\t public static async getUserInfo():Promise> {\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet url = U(`users/`);\r\n\t\t\tlet req = await HttpUtils.get(url, { userToken: token });\r\n\t\t\treturn new RDTO(req.response, () => new UserDTO());\r\n\t\t}\r\n\t\tcatch (e){\r\n\t\t\tconsole.log(e.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = e;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**attempts to create user in database.\r\n\t * \r\n\t * If the creation is successful, the [RDTO.data] property holds the \r\n\t * [UserDTO] object and the [RDTO.success] property is true.\r\n\t * \r\n\t * If there is any problem, [RDTO.success] will be false.\r\n\t * If a matching user been previously uploaded, [RTDO.message] will be set \r\n\t * to [RdtoMessage.ALREADY_EXISTS].*/\r\n\tpublic static async createUser(dto:CreateUserDTO):Promise> {\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet url = U(`users/`);\r\n\t\t\tlet req = await HttpUtils.post(url, { userToken: token,\r\n\t\t\t\tformData: dto.toForm() });\r\n\t\t\t\r\n\t\t\treturn new RDTO(req.response, () => new UserDTO());\r\n\t\t}\r\n\t\tcatch (e){\r\n\t\t\tconsole.log(e.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = e;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static async removeUser(userId:number):Promise> {\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet url = U(`users/${userId}`);\r\n\t\t\tlet req = await HttpUtils.delete(url, { userToken: token });\r\n\t\t\t\r\n\t\t\treturn new RDTO(req.response, () => new EmptyDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static async loadSongXml(path:string):Promise {\r\n\t\ttry {\r\n\t\t\treturn await MusicXmlUtils.getMusicXmlStringFromUrl(path);\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static async getTeamByCode(code:string):Promise> {\r\n\t\tlet url = L(`Teams/ByCode/${code}`);\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.get(url, { userToken: token });\r\n\t\t\treturn new RDTO(req.response, () => new TeamDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static async getTeamsForUser(userId:number)\r\n\t\t\t:Promise>{\r\n\t\tlet url = L(`Teams/ByUser/${userId}`);\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.get(url, { userToken: token });\r\n\t\t\treturn new RDTO(req.response, () => new TeamDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Attempts to upload a team.\r\n\t * If the upload is successful, the [RDTO.data] property holds the \r\n\t * [TeamDTO] object and the [RDTO.success] property is true.\r\n\t * \r\n\t * If there is any problem, [RDTO.success] will be false. If the code\r\n\t * is already taken, [RTDO.message] will be set to \"code taken\". If the name\r\n\t * is already taken, [RDTO.message] will be set to \"name taken\".*/\r\n\tpublic static async addTeam(dto:TeamUploadDTO):Promise> {\r\n\t\tlet url = L(\"Teams\");\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.post(url, { formData: dto.toForm(), \r\n\t\t\t\tuserToken: token });\r\n\t\t\treturn new RDTO(req.response, () => new TeamDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static async updateTeam(dto:TeamUpdateDTO):Promise> {\r\n\t\tlet url = L(`Teams/${dto.id}`);\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.post(url, { formData: dto.toForm(), \r\n\t\t\t\tuserToken: token, method: \"PATCH\" });\r\n\t\t\treturn new RDTO(req.response, () => new TeamDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Attempts to remove a team.\r\n\t * If the removal is successful, the [RDTO.success] property is true.\r\n\t * \r\n\t * If there is any problem, [RDTO.success] will be false. If the team was\r\n\t * not found, [RDTO.message] will contain [RdtoMessage.NOT_FOUND].*/\r\n\tpublic static async removeTeam(teamId:number):Promise> {\r\n\t\tlet url:string = L(`Teams/${teamId}`);\r\n\t\tlet token:string = await FbAuth.getUserToken();\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.delete(url, { userToken: token });\r\n\t\t\treturn new RDTO(req.response, () => new EmptyDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Gets the information for a list of teams. \r\n\t * The [RDTO.dataList] property will point to the [List] \r\n\t * object and [RDTO.success] will be true. If the list is returned \r\n\t * successfully but contains 0 teams, [RDTO.message] will contain \r\n\t * [RdtoMessage.NOT_FOUND].\r\n\t * \r\n\t * If there is a problem, [RDTO.success] will be false. */\r\n\t// public static async getTeams():Promise> {\r\n\t// \tlet url = L(\"Teams\");\r\n\t// \ttry {\r\n\t// \t\tlet req = await HttpUtils.get(url, { });\r\n\t// \t\treturn new RDTO(req.response, () => new TeamDTO());\r\n\t// \t}\r\n\t// \tcatch (err){\r\n\t// \t\tconsole.log(err.toString());\r\n\t// \t\tlet rdto = new RDTO();\r\n\t// \t\trdto.exception = err;\r\n\t// \t\treturn rdto;\r\n\t// \t}\r\n\t// }\r\n\t\r\n\t/**Attempts to update the score for the current contest\r\n\t * If the upload is successful, the [RDTO.success] property is true.\r\n\t * If there is any problem, [RDTO.success] will be false. */\r\n\tpublic static async updateScore(dto:ContestEntryUpdateDTO)\r\n\t\t\t:Promise> {\r\n\t\tlet url = L(`Teams/${dto.teamId}`);\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.post(url, { formData: dto.toForm() });\r\n\t\t\treturn new RDTO(req.response, () => new EmptyDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**Gets the information for a list of contest entries that match the \r\n\t * [dateId]. The [RDTO.dataList] property will point to the \r\n\t * [List] object and [RDTO.success] will be true. If the \r\n\t * list is returned successfully but contains 0 teams, [RDTO.message] will \r\n\t * contain [RdtoMessage.NOT_FOUND].\r\n\t * \r\n\t * If there is a problem, [RDTO.success] will be false. */\r\n\tpublic static async getContestData(dateId:string)\r\n\t\t\t:Promise> {\r\n\t\tlet url = L(`Contests?date=${dateId}`);\r\n\t\ttry {\r\n\t\t\tlet req = await HttpUtils.get(url, {});\r\n\t\t\treturn new RDTO(req.response, \r\n\t\t\t\t() => new ContestEntryDTO());\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tconsole.log(err.toString());\r\n\t\t\tlet rdto = new RDTO();\r\n\t\t\trdto.exception = err;\r\n\t\t\treturn rdto;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nconst U = function(s:string, withTime:boolean = false):string {\r\n\tlet out = (s.indexOf(\"?\") !== -1)\r\n\t\t? `${Services.rootApiPath}${s}&apiv=${Services.usersApiVersion}`\r\n\t\t: `${Services.rootApiPath}${s}?apiv=${Services.usersApiVersion}`;\r\n\tif (withTime){\r\n\t\tout += `&_=${Date.now()}`;\r\n\t}\r\n\t\r\n\treturn out;\r\n}\r\n\r\nconst L = function(s:string, withTime:boolean = false):string {\r\n\tlet out = (s.indexOf(\"?\") !== -1)\r\n\t\t? `${Services.recorderAceApiPath}${s}&apiv=${Services.raApiVersion}`\r\n\t\t: `${Services.recorderAceApiPath}${s}?apiv=${Services.raApiVersion}`;\r\n\tif (withTime){\r\n\t\tout += `&_=${Date.now()}`;\r\n\t}\r\n\t\r\n\treturn out;\r\n}\r\n\r\nconst D = function(s:string):string {\r\n\treturn (s.indexOf(\"?\") !== -1)\r\n\t\t? s + `&_=${Date.now()}`\r\n\t\t: s + `?_=${Date.now()}`;\r\n}","import { TeamDTO } from \"./dtos\";\r\n\r\nexport class TeamDO {\t\r\n\tpublic id:number;\r\n\tpublic name:string;\r\n\tpublic code:string;\r\n\tpublic size:number;\r\n\tpublic userId:number;\r\n\t\r\n\tpublic static fromTeamDto(dto:TeamDTO):TeamDO {\r\n\t\tlet tdo = new TeamDO();\r\n\t\ttdo.id = dto.id;\r\n\t\ttdo.updateFromDto(dto);\r\n\t\t\r\n\t\treturn tdo;\r\n\t}\r\n\t\r\n\tpublic updateFromDto(dto:TeamDTO):void {\r\n\t\tthis.name = dto.name;\r\n\t\tthis.code = dto.code;\r\n\t\tthis.size = dto.size;\r\n\t\tthis.userId = dto.userId;\r\n\t}\r\n}","import { ContestEntryDTO } from \"./dtos\";\r\nimport { TeamDO } from \"./TeamDO\";\r\n\r\nexport class ContestEntryDO {\r\n\tpublic id:number;\r\n\tpublic dateString:string;\r\n\tpublic points:number;\r\n\tpublic teamId:number;\r\n\tpublic team:TeamDO;\r\n\t\r\n\tpublic static fromContestDto(dto:ContestEntryDTO):ContestEntryDO {\r\n\t\tlet cdo = new ContestEntryDO();\r\n\t\tcdo.id = dto.id;\r\n\t\tcdo.dateString = dto.dateString;\r\n\t\tcdo.points = dto.points;\r\n\t\tcdo.teamId = dto.teamId;\r\n\t\tcdo.team = TeamDO.fromTeamDto(dto.teamDto);\r\n\t\t\r\n\t\treturn cdo;\r\n\t}\r\n}","// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n,\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n,\n};\n\nexport const DATE_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n,\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n,\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: s,\n};\n\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: l,\n};\n\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l,\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n const isNeg = input < 0;\n let padded;\n if (isNeg) {\n padded = \"-\" + (\"\" + -input).padStart(n, \"0\");\n } else {\n padded = (\"\" + input).padStart(n, \"0\");\n }\n return padded;\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseFloating(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseFloat(string);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, towardZero = false) {\n const factor = 10 ** digits,\n rounder = towardZero ? Math.trunc : Math.round;\n return rounder(number * factor) / factor;\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// covert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n return +d;\n}\n\nexport function weeksInWeekYear(weekYear) {\n const p1 =\n (weekYear +\n Math.floor(weekYear / 4) -\n Math.floor(weekYear / 100) +\n Math.floor(weekYear / 400)) %\n 7,\n last = weekYear - 1,\n p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;\n return p1 === 4 || p2 === 3 ? 53 : 52;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > 60 ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = { timeZoneName: offsetFormat, ...intlOpts };\n\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find((m) => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || Number.isNaN(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(Math.abs(offset / 60)),\n minutes = Math.trunc(Math.abs(offset % 60)),\n sign = offset >= 0 ? \"+\" : \"-\";\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return `${sign}${hours}${minutes > 0 ? `:${minutes}` : \"\"}`;\n case \"techie\":\n return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n\nexport const ianaRegex = /[A-Za-z_+-]{1,256}(:?\\/[A-Za-z0-9_+-]{1,256}(\\/[A-Za-z0-9_+-]{1,256})?)?/;\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return [...monthsNarrow];\n case \"short\":\n return [...monthsShort];\n case \"long\":\n return [...monthsLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return [...weekdaysNarrow];\n case \"short\":\n return [...weekdaysShort];\n case \"long\":\n return [...weekdaysLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return [...erasNarrow];\n case \"short\":\n return [...erasShort];\n case \"long\":\n return [...erasLong];\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"],\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hourCycle\",\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_MED_WITH_WEEKDAY):\n return \"EEE, LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS,\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: false, val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n formatDateTime(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n formatDateTimeParts(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.formatToParts();\n }\n\n resolvedOptions(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.resolvedOptions();\n }\n\n num(n, p = 0) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = { ...this.opts };\n\n if (p > 0) {\n opts.padTo = p;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\",\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = (opts) => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hourCycle: \"h12\" }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = (token) => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = (length) =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = (token) => {\n // Where possible: http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // fractional seconds\n case \"uu\":\n return this.num(Math.floor(dt.millisecond / 10), 2);\n case \"uuu\":\n return this.num(Math.floor(dt.millisecond / 100));\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const tokenToField = (token) => {\n switch (token[0]) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n default:\n return null;\n }\n },\n tokenToString = (lildur) => (token) => {\n const mapped = tokenToField(token);\n if (mapped) {\n return this.num(lildur.get(mapped), token.length);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));\n return stringifyTokens(tokens, tokenToString(collapsed));\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","import { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get isUniversal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this JavaScript environment.\n * @implements {Zone}\n */\nexport default class SystemZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {SystemZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new SystemZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"system\";\n }\n\n /** @override **/\n get name() {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"system\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, ianaRegex, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst matchingRegex = RegExp(`^${ianaRegex.source}$`);\n\nlet dtfCache = {};\nfunction makeDTF(zone) {\n if (!dtfCache[zone]) {\n dtfCache[zone] = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n }\n return dtfCache[zone];\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5,\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date),\n filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i],\n pos = typeToPos[type];\n\n if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nlet ianaZoneCache = {};\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n if (!ianaZoneCache[name]) {\n ianaZoneCache[name] = new IANAZone(name);\n }\n return ianaZoneCache[name];\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache = {};\n dtfCache = {};\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Fantasia/Castle\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return !!(s && s.match(matchingRegex));\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n if (!zone) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /** @override **/\n get type() {\n return \"iana\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n const date = new Date(ts);\n\n if (isNaN(date)) return NaN;\n\n const dtf = makeDTF(this.name),\n [year, month, day, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date);\n\n // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n const adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0,\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /** @override **/\n get isValid() {\n return this.valid;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /** @override **/\n get type() {\n return \"fixed\";\n }\n\n /** @override **/\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /** @override **/\n offsetName() {\n return this.name;\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /** @override **/\n get isUniversal() {\n return true;\n }\n\n /** @override **/\n offset() {\n return this.fixed;\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"local\" || lowered === \"system\") return defaultZone;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);\n else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && input.offset && typeof input.offset === \"number\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","import SystemZone from \"./zones/systemZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nlet now = () => Date.now(),\n defaultZone = \"system\",\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n throwOnInvalid;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * Use the value \"system\" to reset this value to the system's time zone.\n * @type {string}\n */\n static set defaultZone(zone) {\n defaultZone = zone;\n }\n\n /**\n * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.\n * The default value is the system's time zone (the one set on the machine that runs this code).\n * @type {Zone}\n */\n static get defaultZone() {\n return normalizeZone(defaultZone, SystemZone.instance);\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n }\n}\n","import { padStart, roundTo, hasRelative } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n// todo - remap caching\n\nlet intlLFCache = {};\nfunction getCachedLF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlLFCache[key];\n if (!dtf) {\n dtf = new Intl.ListFormat(locString, opts);\n intlLFCache[key] = dtf;\n }\n return dtf;\n}\n\nlet intlDTCache = {};\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache[key];\n if (!dtf) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache[key] = dtf;\n }\n return dtf;\n}\n\nlet intlNumCache = {};\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache[key];\n if (!inf) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache[key] = inf;\n }\n return inf;\n}\n\nlet intlRelCache = {};\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache[key];\n if (!inf) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache[key] = inf;\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else {\n sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;\n return sysLocaleCache;\n }\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n const smaller = localeStr.substring(0, uIndex);\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n } catch (e) {\n options = getCachedDTF(smaller).resolvedOptions();\n }\n\n const { numberingSystem, calendar } = options;\n // return the smaller one so that we can append the calendar and numbering overrides to it\n return [smaller, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (outputCalendar || numberingSystem) {\n localeStr += \"-u\";\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2016, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, defaultOK, englishFn, intlFn) {\n const mode = loc.listingMode(defaultOK);\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === \"latn\"\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n const { padTo, floor, ...otherOpts } = opts;\n\n if (!forceSimple || Object.keys(otherOpts).length > 0) {\n const intlOpts = { useGrouping: false, ...opts };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n\n let z;\n if (dt.zone.isUniversal) {\n // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.\n // That is why fixed-offset TZ is set to that unless it is:\n // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.\n // 2. Unsupported by the browser:\n // - some do not support Etc/\n // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata\n const gmtOffset = -1 * (dt.offset / 60);\n const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;\n if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {\n z = offsetZ;\n this.dt = dt;\n } else {\n // Not all fixed-offset zones like Etc/+4:30 are present in tzdata.\n // So we have to make do. Two cases:\n // 1. The format options tell us to show the zone. We can't do that, so the best\n // we can do is format the date in UTC.\n // 2. The format options don't tell us to show the zone. Then we can adjust them\n // the time and tell the formatter to show it to us in UTC, so that the time is right\n // and the bad zone doesn't show up.\n z = \"UTC\";\n if (opts.timeZoneName) {\n this.dt = dt;\n } else {\n this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);\n }\n }\n } else if (dt.zone.type === \"system\") {\n this.dt = dt;\n } else {\n this.dt = dt;\n z = dt.zone.name;\n }\n\n const intlOpts = { ...this.opts };\n if (z) {\n intlOpts.timeZone = z;\n }\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n\n format() {\n return this.dtf.format(this.dt.toJSDate());\n }\n\n formatToParts() {\n return this.dtf.formatToParts(this.dt.toJSDate());\n }\n\n resolvedOptions() {\n return this.dtf.resolvedOptions();\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = { style: \"long\", ...opts };\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\n/**\n * @private\n */\n\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);\n }\n\n static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale;\n // the system locale is useful for human readable strings but annoying for parsing/formatting known formats\n const localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale());\n const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;\n const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache = {};\n intlNumCache = {};\n intlRelCache = {};\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar);\n }\n\n constructor(locale, numbering, outputCalendar, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode() {\n const isActuallyEn = this.isEnglish();\n const hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n return isActuallyEn && hasNoWeirdness ? \"en\" : \"intl\";\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone({ ...alts, defaultToEN: true });\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone({ ...alts, defaultToEN: false });\n }\n\n months(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.months, () => {\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, \"month\"));\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays((dt) =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems(defaultOK = true) {\n return listStuff(\n this,\n undefined,\n defaultOK,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hourCycle: \"h12\" };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n (dt) => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.eras, () => {\n const intl = { era: length };\n\n // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find((m) => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n listFormatter(opts = {}) {\n return getCachedLF(this.intl, opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith(\"en-us\")\n );\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n ianaRegex,\n isUndefined,\n parseFloating,\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return (m) =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [{ ...mergedVals, ...val }, mergedZone || zone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:(Z)|([+-]\\d\\d)(?::?(\\d\\d))?)/,\n isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,30}))?)?)?/,\n isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`),\n isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`),\n isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/,\n isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/,\n isoOrdinalRegex = /(\\d{4})-?(\\d{3})/,\n extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\"),\n extractISOOrdinalData = simpleParse(\"year\", \"ordinal\"),\n sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/, // dumbed-down version of the ISO one\n sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n ),\n sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1),\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hours: int(match, cursor, 0),\n minutes: int(match, cursor + 1, 0),\n seconds: int(match, cursor + 2, 0),\n milliseconds: parseMillis(match[cursor + 3]),\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO time parsing\n\nconst isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);\n\n// ISO duration parsing\n\nconst isoDuration =\n /^-?P(?:(?:(-?\\d{1,9}(?:\\.\\d{1,9})?)Y)?(?:(-?\\d{1,9}(?:\\.\\d{1,9})?)M)?(?:(-?\\d{1,9}(?:\\.\\d{1,9})?)W)?(?:(-?\\d{1,9}(?:\\.\\d{1,9})?)D)?(?:T(?:(-?\\d{1,9}(?:\\.\\d{1,9})?)H)?(?:(-?\\d{1,9}(?:\\.\\d{1,9})?)M)?(?:(-?\\d{1,20})(?:[.,](-?\\d{1,9}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =\n match;\n\n const hasNegativePrefix = s[0] === \"-\";\n const negativeSeconds = secondStr && secondStr[0] === \"-\";\n\n const maybeNegate = (num, force = false) =>\n num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;\n\n return [\n {\n years: maybeNegate(parseFloating(yearStr)),\n months: maybeNegate(parseFloating(monthStr)),\n weeks: maybeNegate(parseFloating(weekStr)),\n days: maybeNegate(parseFloating(dayStr)),\n hours: maybeNegate(parseFloating(hourStr)),\n minutes: maybeNegate(parseFloating(minuteStr)),\n seconds: maybeNegate(parseFloating(secondStr), secondStr === \"-0\"),\n milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),\n },\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr),\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr,\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 =\n /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOOrdinalDateAndTime = combineExtractors(\n extractISOOrdinalData,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);\n\n/**\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst extractISOTimeOnly = combineExtractors(extractISOTime);\n\nexport function parseISOTimeOnly(s) {\n return parse(s, [isoTimeOnly, extractISOTimeOnly]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOYmdTimeOffsetAndIANAZone = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration, parseISOTimeOnly } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isInteger,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo,\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nexport const lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000,\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000,\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 },\n },\n casualMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n seconds: 91 * 24 * 60 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000,\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000,\n },\n\n ...lowOrderMatrix,\n },\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4,\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000,\n },\n ...lowOrderMatrix,\n };\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\",\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) },\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,\n };\n return new Duration(conf);\n}\n\nfunction antiTrunc(n) {\n return n < 0 ? Math.floor(n) : Math.ceil(n);\n}\n\n// NB: mutates parameters\nfunction convert(matrix, fromMap, fromUnit, toMap, toUnit) {\n const conv = matrix[toUnit][fromUnit],\n raw = fromMap[fromUnit] / conv,\n sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),\n // ok, so this is wild, but see the matrix in the tests\n added =\n !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);\n toMap[toUnit] += added;\n fromMap[fromUnit] -= added * conv;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n reverseUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n convert(matrix, vals, previous, vals, current);\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration#fromMillis}, {@link Duration#fromObject}, or {@link Duration#fromISO}.\n * * **Unit values** See the {@link Duration#years}, {@link Duration.months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.\n * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = accurate ? accurateMatrix : casualMatrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject({ milliseconds: count }, opts);\n }\n\n /**\n * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {Object} [opts=[]] - options for creating this Duration\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromObject(obj, opts = {}) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit),\n loc: Locale.fromObject(opts),\n conversionAccuracy: opts.conversionAccuracy,\n });\n }\n\n /**\n * Create a Duration from DurationLike.\n *\n * @param {Object | number | Duration} durationLike\n * One of:\n * - object with keys like 'years' and 'hours'.\n * - number representing milliseconds\n * - Duration instance\n * @return {Duration}\n */\n static fromDurationLike(durationLike) {\n if (isNumber(durationLike)) {\n return Duration.fromMillis(durationLike);\n } else if (Duration.isDuration(durationLike)) {\n return durationLike;\n } else if (typeof durationLike === \"object\") {\n return Duration.fromObject(durationLike);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationLike} of type ${typeof durationLike}`\n );\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 time string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }\n * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @return {Duration}\n */\n static fromISOTime(text, opts) {\n const [parsed] = parseISOTimeOnly(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\",\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = {\n ...opts,\n floor: opts.round !== false && opts.floor !== false,\n };\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a string representation of a Duration with all units included\n * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. See {@link Intl.NumberFormat}.\n * @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`.\n * @example\n * ```js\n * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })\n * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'\n * dur.toHuman({ listStyle: \"long\" }) //=> '1 day, 5 hours, and 6 minutes'\n * dur.toHuman({ unitDisplay: \"short\" }) //=> '1 day, 5 hr, 6 min'\n * ```\n */\n toHuman(opts = {}) {\n const l = orderedUnits\n .map((unit) => {\n const val = this.values[unit];\n if (isUndefined(val)) {\n return null;\n }\n return this.loc\n .numberFormatter({ style: \"unit\", unitDisplay: \"long\", ...opts, unit: unit.slice(0, -1) })\n .format(val);\n })\n .filter((n) => n);\n\n return this.loc\n .listFormatter({ type: \"conjunction\", style: opts.listStyle || \"narrow\", ...opts })\n .format(l);\n }\n\n /**\n * Returns a JavaScript object with this Duration's values.\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject() {\n if (!this.isValid) return {};\n return { ...this.values };\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.\n * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'\n * @return {string}\n */\n toISOTime(opts = {}) {\n if (!this.isValid) return null;\n\n const millis = this.toMillis();\n if (millis < 0 || millis >= 86400000) return null;\n\n opts = {\n suppressMilliseconds: false,\n suppressSeconds: false,\n includePrefix: false,\n format: \"extended\",\n ...opts,\n };\n\n const value = this.shiftTo(\"hours\", \"minutes\", \"seconds\", \"milliseconds\");\n\n let fmt = opts.format === \"basic\" ? \"hhmm\" : \"hh:mm\";\n\n if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) {\n fmt += opts.format === \"basic\" ? \"ss\" : \":ss\";\n if (!opts.suppressMilliseconds || value.milliseconds !== 0) {\n fmt += \".SSS\";\n }\n }\n\n let str = value.toFormat(fmt);\n\n if (opts.includePrefix) {\n str = \"T\" + str;\n }\n\n return str;\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n toMillis() {\n return this.as(\"milliseconds\");\n }\n\n /**\n * Returns an milliseconds value of this Duration. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === \"hour\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem }),\n opts = { loc };\n\n if (conversionAccuracy) {\n opts.conversionAccuracy = conversionAccuracy;\n }\n\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map((u) => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = (own * 1000 - i * 1000) / 1000;\n\n // plus anything further down the chain that should be rolled up in to this\n for (const down in vals) {\n if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {\n convert(this.matrix, vals, down, built, k);\n }\n }\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n return clone(this, { values: built }, true).normalize();\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n function eq(v1, v2) {\n // Consider 0 and undefined as equal\n if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;\n return v1 === v2;\n }\n\n for (const u of orderedUnits) {\n if (!eq(this.values[u], other.values[u])) {\n return false;\n }\n }\n return true;\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link Interval#fromDateTimes}, {@link Interval#after}, {@link Interval#before}, or {@link Interval#fromISO}.\n * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval#merge}, {@link Interval#xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.\n * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}\n * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd,\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n let start, startIsValid;\n try {\n start = DateTime.fromISO(s, opts);\n startIsValid = start.isValid;\n } catch (e) {\n startIsValid = false;\n }\n\n let end, endIsValid;\n try {\n end = DateTime.fromISO(e, opts);\n endIsValid = end.isValid;\n } catch (e) {\n endIsValid = false;\n }\n\n if (startIsValid && endIsValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (startIsValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (endIsValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @return {number}\n */\n count(unit = \"milliseconds\") {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit),\n end = this.end.startOf(unit);\n return Math.floor(end.diff(start, unit).get(unit)) + 1;\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...DateTime} dateTimes - the unit of time to count.\n * @return {Array}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter((d) => this.contains(d))\n .sort(),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {Array}\n */\n splitBy(duration) {\n const dur = Duration.fromDurationLike(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n idx = 1,\n next;\n\n const results = [];\n while (s < this.e) {\n const added = this.start.plus(dur.mapUnits((x) => x * idx));\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n idx += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {Array}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Return whether this Interval engulfs the start and end of the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s >= e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into a equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static merge(intervals) {\n const [found, final] = intervals\n .sort((a, b) => a.s - b.s)\n .reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map((i) => [\n { time: i.s, type: \"s\" },\n { time: i.e, type: \"e\" },\n ]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {Array}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map((i) => this.intersection(i))\n .filter((i) => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format string.\n * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime#toFormat} for details.\n * @param {Object} opts - options\n * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.now().setZone(zone).set({ month: 12 });\n\n return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone#isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {Array}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link Info#months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {Array}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the weekday representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {Array}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link Info#weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @return {Array}\n */\n static weekdaysFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {Array}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {Array}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `relative`: whether this environment supports relative time formatting\n * @example Info.features() //=> { relative: false }\n * @return {Object}\n */\n static features() {\n return { relative: hasRelative() };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf(\"day\").valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"quarters\", (a, b) => b.quarter - a.quarter],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n },\n ],\n [\"days\", dayDiff],\n ];\n\n const results = {};\n let lowestOrder, highWater;\n\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n let delta = differ(cursor, later);\n highWater = cursor.plus({ [unit]: delta });\n\n if (highWater > later) {\n cursor = cursor.plus({ [unit]: delta - 1 });\n delta -= 1;\n } else {\n cursor = highWater;\n }\n\n results[unit] = delta;\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function (earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n (u) => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(results, opts);\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\",\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881],\n};\n\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n return new RegExp(`${numberingSystems[numberingSystem || \"latn\"]}${append}`);\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = (i) => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nconst NBSP = String.fromCharCode(160);\nconst spaceOrNBSP = `( |${NBSP})`;\nconst spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, \"g\");\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n // make space and non breakable space characters interchangeable\n return s.replace(/\\./g, \"\\\\.?\").replace(spaceOrNBSPRegExp, spaceOrNBSP);\n}\n\nfunction stripInsensitivities(s) {\n return s\n .replace(/\\./g, \"\") // ignore dots that were made optional\n .replace(spaceOrNBSPRegExp, \" \") // interchange space and nbsp\n .toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex,\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = (t) => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\", false), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\", false), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true, false), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true, false), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false, false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false, false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n case \"uu\":\n return simple(oneOrTwo);\n case \"uuu\":\n return intUnit(one);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false, false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false, false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true, false), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true, false), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP,\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\",\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\",\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\",\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\",\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour: {\n numeric: \"h\",\n \"2-digit\": \"hh\",\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\",\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\",\n },\n};\n\nfunction tokenForPart(part, locale, formatOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n return {\n literal: true,\n val: value,\n };\n }\n\n const style = formatOpts[type];\n\n let val = partTypeStyleToTokenVal[type];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val,\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = (token) => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone = null;\n let specificOffset;\n if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n }\n\n if (!isUndefined(matches.Z)) {\n if (!zone) {\n zone = new FixedOffsetZone(matches.Z);\n }\n specificOffset = matches.Z;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone, specificOffset];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n\n if (!formatOpts) {\n return token;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const parts = formatter.formatDateTimeParts(getDummyDateTime());\n\n const tokens = parts.map((p) => tokenForPart(p, locale, formatOpts));\n\n if (tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nfunction expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport function explainFromTokens(locale, input, format) {\n const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),\n units = tokens.map((t) => unitForToken(t, locale)),\n disqualifyingUnit = units.find((t) => t.invalidReason);\n\n if (disqualifyingUnit) {\n return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };\n } else {\n const [regexString, handlers] = buildRegex(units),\n regex = RegExp(regexString, \"i\"),\n [rawMatches, matches] = match(input, regex, handlers),\n [result, zone, specificOffset] = matches\n ? dateTimeFromMatches(matches)\n : [null, null, undefined];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return { input, tokens, regex, rawMatches, matches, result, zone, specificOffset };\n }\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, specificOffset, invalidReason];\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger,\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nfunction dayOfWeek(year, month, day) {\n const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay();\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex((i) => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = dayOfWeek(year, month, day);\n\n let weekNumber = Math.floor((ordinal - weekday + 10) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear);\n } else if (weekNumber > weeksInWeekYear(year)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };\n}\n\nexport function weekToGregorian(weekData) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(weekData) };\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData;\n const ordinal = computeOrdinal(year, month, day);\n return { year, ordinal, ...timeObject(gregData) };\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData;\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(ordinalData) };\n}\n\nexport function hasInvalidWeekData(obj) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.week);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","import Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS,\n padStart,\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport { parseFromTokens, explainFromTokens } from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData,\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError,\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid,\n };\n return new DateTime({ ...current, ...alts, old: current });\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds(),\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const oPre = inst.o,\n year = inst.c.year + Math.trunc(dur.years),\n month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,\n c = {\n ...inst.c,\n year,\n month,\n day:\n Math.min(inst.c.day, daysInMonth(year, month)) +\n Math.trunc(dur.days) +\n Math.trunc(dur.weeks) * 7,\n },\n millisToAdd = Duration.fromObject({\n years: dur.years - Math.trunc(dur.years),\n quarters: dur.quarters - Math.trunc(dur.quarters),\n months: dur.months - Math.trunc(dur.months),\n weeks: dur.weeks - Math.trunc(dur.weeks),\n days: dur.days - Math.trunc(dur.days),\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds,\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {\n const { setZone, zone } = opts;\n if (parsed && Object.keys(parsed).length !== 0) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(parsed, {\n ...opts,\n zone: interpretationZone,\n specificOffset,\n });\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true,\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\nfunction toISODate(o, extended) {\n const longFormat = o.c.year > 9999 || o.c.year < 0;\n let c = \"\";\n if (longFormat && o.c.year >= 0) c += \"+\";\n c += padStart(o.c.year, longFormat ? 6 : 4);\n\n if (extended) {\n c += \"-\";\n c += padStart(o.c.month);\n c += \"-\";\n c += padStart(o.c.day);\n } else {\n c += padStart(o.c.month);\n c += padStart(o.c.day);\n }\n return c;\n}\n\nfunction toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {\n let c = padStart(o.c.hour);\n if (extended) {\n c += \":\";\n c += padStart(o.c.minute);\n if (o.c.second !== 0 || !suppressSeconds) {\n c += \":\";\n }\n } else {\n c += padStart(o.c.minute);\n }\n\n if (o.c.second !== 0 || !suppressSeconds) {\n c += padStart(o.c.second);\n\n if (o.c.millisecond !== 0 || !suppressMilliseconds) {\n c += \".\";\n c += padStart(o.c.millisecond, 3);\n }\n }\n\n if (includeOffset) {\n if (o.isOffsetFixed && o.offset === 0) {\n c += \"Z\";\n } else if (o.o < 0) {\n c += \"-\";\n c += padStart(Math.trunc(-o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(-o.o % 60));\n } else {\n c += \"+\";\n c += padStart(Math.trunc(o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(o.o % 60));\n }\n }\n return c;\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\",\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\",\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, opts) {\n const zone = normalizeZone(opts.zone, Settings.defaultZone),\n loc = Locale.fromObject(opts),\n tsNow = Settings.now();\n\n let ts, o;\n\n // assume we have the higher-order units\n if (!isUndefined(obj.year)) {\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const offsetProvis = zone.offset(tsNow);\n [ts, o] = objToTS(obj, offsetProvis, zone);\n } else {\n ts = tsNow;\n }\n\n return new DateTime({ ts, zone, loc, o });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, true);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = (unit) => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);\n}\n\nfunction lastOpts(argList) {\n let opts = {},\n args;\n if (argList.length > 0 && typeof argList[argList.length - 1] === \"object\") {\n opts = argList[argList.length - 1];\n args = Array.from(argList).slice(0, argList.length - 1);\n } else {\n args = Array.from(argList);\n }\n return [opts, args];\n}\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime#local}, {@link DateTime#utc}, and (most flexibly) {@link DateTime#fromObject}. To create one from a standard string format, use {@link DateTime#fromISO}, {@link DateTime#fromHTTP}, and {@link DateTime#fromRFC2822}. To create one from a custom string format, use {@link DateTime#fromFormat}. To create one from a native JS date, use {@link DateTime#fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},\n * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.\n * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n const ot = zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a DateTime for the current instant, in the system's time zone.\n *\n * Use Settings to override these default values if needed.\n * @example DateTime.now().toISO() //~> now in the ISO format\n * @return {DateTime}\n */\n static now() {\n return new DateTime({});\n }\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month, 1-indexed\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local({ zone: \"America/New_York\" }) //~> now, in US east coast time\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12, { locale: \"fr\" }) //~> 2017-03-12T00:00:00, with a French locale\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, { zone: \"utc\" }) //~> 2017-03-12T05:00:00, in UTC\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @param {Object} options - configuration options for the DateTime\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: \"fr\" }) //~> 2017-03-12T05:45:00Z with a French locale\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: \"fr\" }) //~> 2017-03-12T05:45:10.765Z with a French locale\n * @return {DateTime}\n */\n static utc() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n\n opts.zone = FixedOffsetZone.utcInstance;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime from a JavaScript Date object. Uses the default zone.\n * @param {Date} date - a JavaScript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options),\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {Object} opts - options for creating this DateTime\n * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @return {DateTime}\n */\n static fromObject(obj, opts = {}) {\n obj = obj || {};\n const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const tsNow = Settings.now(),\n offsetProvis = !isUndefined(opts.specificOffset)\n ? opts.specificOffset\n : zoneToUse.offset(tsNow),\n normalized = normalizeObject(obj, normalizeUnit),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber,\n loc = Locale.fromObject(opts);\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc,\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n }),\n [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is a DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 12, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.now().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.isUniversal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOptions(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link DateTime#setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnit),\n settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian({ ...gregorianToWeek(this.c), ...normalized });\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });\n } else {\n mixed = { ...this.toObject(), ...normalized };\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.now().plus(123) //~> in 123 milliseconds\n * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link DateTime#plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit) {\n if (!this.isValid) return this;\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n o.weekday = 1;\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.now().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.now().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toLocaleString(); //=> 4/20/2017\n * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.now().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @return {string}\n */\n toISO({\n format = \"extended\",\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset = true,\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n const ext = format === \"extended\";\n\n let c = toISODate(this, ext);\n c += \"T\";\n c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);\n return c;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @return {string}\n */\n toISODate({ format = \"extended\" } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return toISODate(this, format === \"extended\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n includePrefix = false,\n format = \"extended\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n let c = includePrefix ? \"T\" : \"\";\n return (\n c +\n toISOTime(this, format === \"extended\", suppressSeconds, suppressMilliseconds, includeOffset)\n );\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string}\n */\n toSQLDate() {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false } = {}) {\n let fmt = \"HH:mm:ss.SSS\";\n\n if (includeZone || includeOffset) {\n fmt += \" \";\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += \"ZZ\";\n }\n }\n\n return toTechFormat(this, fmt, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a JavaScript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = { ...this.c };\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a JavaScript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\"created by diffing an invalid DateTime\");\n }\n\n const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link DateTime#diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.now(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime.\n * Higher-order units must also be identical for this function to return `true`.\n * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit) {\n if (!this.isValid) return false;\n\n const inputMs = otherDateTime.valueOf();\n const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });\n return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);\n }\n\n /**\n * Equality check\n * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds down by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.now().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.now().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({}, { zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n let units = [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"];\n let unit = options.unit;\n if (Array.isArray(options.unit)) {\n units = options.unit;\n unit = undefined;\n }\n return diffRelative(base, this.plus(padding), {\n ...options,\n numeric: \"always\",\n units,\n unit,\n });\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.now().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {\n ...options,\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true,\n });\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link DateTime#toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED_WITH_WEEKDAY() {\n return Formats.DATE_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n","import { Services } from \"../services/Services\";\r\nimport { ContestEntryDO } from \"./ContestEntryDO\";\r\nimport { DateTime, Duration } from \"luxon\";\r\n\r\nexport class ContestManager {\r\n\tstatic get entries(){ return ContestManager._entries; }\r\n\tprivate static _entries:ContestEntryDO[] = [];\r\n\t\r\n\tpublic static async getEntries(dateId:string):Promise {\r\n\t\tlet rdto = await Services.getContestData(dateId);\r\n\t\tif (rdto.success){\r\n\t\t\tthis._entries = rdto.dataList.map((dto) => \r\n\t\t\t\tContestEntryDO.fromContestDto(dto));\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**constructs an id string used to identify a competition in\r\n\t * the database. The form of the string is Month/Day/Year (ex. 12/17/2019)*/\r\n\tpublic static getCompetitionId(startDate:DateTime = null, \r\n\t\t\tweekIndex:number = 0):string {\r\n\t\tif (startDate == null){\r\n\t\t\tstartDate = ContestManager.getCompetitionStartDate(weekIndex);\r\n\t\t}\r\n\t\treturn `${startDate.month}-${startDate.day}-${startDate.year}`;\r\n\t}\r\n\t\r\n\t/**The [weekDelta] is the number of weeks to go backwards in\r\n\t * time. 0 means the current week/competition.*/\r\n\tpublic static getCompetitionStartDate(weekDelta:number):DateTime {\r\n\t\t//calculate the day the competition started\r\n\t\tlet now = DateTime.utc();\r\n\t\tlet weekday:number = now.weekday;\r\n\t\tlet daysDelta:number = (weekday - 1) + weekDelta * 7;\r\n\t\tlet duration = Duration.fromObject({ days: daysDelta});\r\n\t\tlet startDate = now.minus(duration);\r\n\t\treturn startDate;\r\n\t}\r\n}","import { StringUtils } from \"ts_utils\";\r\n\r\nexport class LocalStorageHelper {\r\n\r\n\tprivate static _isNewUser:boolean = null;\r\n\r\n\tpublic static clearAllStoredSettings():void {\r\n\t\tif (localStorage != null){\r\n\t\t\tlocalStorage.clear();\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static getStudentData():string {\r\n\t\tif (localStorage != null){\r\n\t\t\treturn localStorage.getItem(\"students\")?? null;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static saveStudentData(studentsJson:string):void {\r\n\t\tif (localStorage != null){\r\n\t\t\tlocalStorage.setItem('students', studentsJson);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static getShowFingerings():boolean {\r\n\t\tif (localStorage != null){\r\n\t\t\tif (localStorage.getItem('showFingerings') != null){\r\n\t\t\t\treturn (localStorage.getItem('showFingerings') === 'true');\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static setShowFingerings(value:boolean):void {\r\n\t\tif (localStorage != null){\r\n\t\t\tlocalStorage.setItem('showFingerings', (value)? 'true' : 'false');\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static getMicId():string {\r\n\t\tif (localStorage != null){\r\n\t\t\tif (localStorage.getItem('micId') != null){\r\n\t\t\t\treturn localStorage.getItem('micId');\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static setMicId(id:string):void {\r\n\t\tif (localStorage != null){\r\n\t\t\tif (id == null){\r\n\t\t\t\tlocalStorage.removeItem('micId');\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tlocalStorage.setItem('micId', id);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static getRecordDelay():number {\r\n\t\tif (window.localStorage){\r\n\t\t\tlet delay = window.localStorage.getItem(\"recordDelay\");\r\n\t\t\tif (StringUtils.isNullOrEmpty(delay)){\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\ttry {\r\n\t\t\t\t\treturn Number.parseFloat(delay);\r\n\t\t\t\t}\r\n\t\t\t\tcatch {\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tpublic static setRecordDelay(delay:number):void {\r\n\t\tif (window.localStorage){\r\n\t\t\twindow.localStorage.setItem(\"recordDelay\", delay.toString());\r\n\t\t}\r\n\t}\r\n}","import { TeamDO } from \"./TeamDO\";\r\n\r\nexport class Student {\r\n\t/**unique student name for this machine*/\r\n\tpublic name:string;\r\n\t/**defaults to null if no code is provided*/\r\n\tpublic teamCode:string;\r\n\t/**defaults to null if no code is provided*/\r\n\tpublic teamName:string;\r\n\t/**Map of songLibId/percentage score pairs*/\r\n\tpublic scores:Map;\r\n\t\r\n\t/**not stored in local storage - populated for convenience */\r\n\tpublic team:TeamDO;\r\n\t\r\n\t/**updates a score for the student if the new score is higher*/\r\n\tpublic updateScore(songLibId:string, score:number):void {\r\n\t\tlet oldScore:number = this.scores.get(songLibId)?? 0;\r\n\t\tif (score > oldScore && score > 0){\r\n\t\t\tthis.scores.set(songLibId, score);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic parseScores(scoresJson:any):void {\r\n\t\tthis.scores = new Map();\r\n\t\tlet keys = Object.keys(scoresJson);\r\n\t\tkeys.forEach((k) => {\r\n\t\t\tthis.scores.set(k, scoresJson[k]);\r\n\t\t});\r\n\t}\r\n\t\r\n\tpublic getScoresMapAsObject():any {\r\n\t\tlet obj = {};\r\n\t\tlet keys = this.scores.keys();\r\n\t\tfor (let key of keys){\r\n\t\t\tobj[key] = this.scores.get(key);\r\n\t\t}\r\n\t\treturn obj;\r\n\t}\r\n}","import { ArrayUtils, JsonUtils, StringUtils } from \"ts_utils\";\r\nimport { LocalStorageHelper } from \"../utilities/LocalStorageHelper\";\r\nimport { Student } from \"./Student\";\r\nimport { TeamDO } from \"./TeamDO\";\r\n\r\nexport class StudentManager {\r\n\tpublic static students:Array;\r\n\t\r\n\tpublic static currentStudent:Student;\r\n\t\r\n\t/**populates [students] collection from localstorage json*/\r\n\tpublic static loadFromStorage():void {\r\n\t\t//[\r\n\t\t//\t\t{\r\n\t\t//\t\t\t'name' : 'jim',\r\n\t\t//\t\t\t'teamCode' : '73848g',\r\n\t\t//\t\t\t'scores' : {\r\n\t\t//\t\t\t\t'rec1-1' : 95,\r\n\t\t//\t\t\t\t'rec1-4' : 83,\r\n\t\t//\t\t\t\t'rhy1-2' : 100\r\n\t\t//\t\t\t}\r\n\t\t//\t\t},\r\n\t\t// \t\t...\r\n\t\t//]\r\n\t\tStudentManager.students = [];\r\n\t\tlet studentsJsonString = LocalStorageHelper.getStudentData();\r\n\t\tif (studentsJsonString == null){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tlet studentsJson = JsonUtils.decodeAsList(studentsJsonString);\r\n\t\tif (studentsJson != null){\r\n\t\t\tfor (let studentJson of studentsJson){\r\n\t\t\t\tlet student = new Student();\r\n\t\t\t\tstudent.name = studentJson['name'];\r\n\t\t\t\tstudent.teamCode = studentJson['teamCode'];\r\n\t\t\t\tstudent.teamName = studentJson['teamName'];\r\n\t\t\t\tstudent.parseScores(studentJson['scores']?? {});\r\n\t\t\t\tStudentManager.students.push(student);\r\n\t\t\t\t\r\n\t\t\t\t//if we had a currentStudent object, set its reference to the\r\n\t\t\t\t//newly created Student object so we don't have reference bugs.\r\n\t\t\t\tif (StudentManager.currentStudent != null && \r\n\t\t\t\t\t\tStudentManager.currentStudent.name === student.name){\r\n\t\t\t\t\tStudentManager.currentStudent = student;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**saves the [students] collection to storage*/\r\n\tpublic static saveToStorage(moveCurrentStudentToTop:boolean):void {\r\n\t\tlet students = StudentManager.students;\r\n\t\tif (moveCurrentStudentToTop && StudentManager.currentStudent != null){\r\n\t\t\tif (ArrayUtils.remove(StudentManager.currentStudent, students)){\r\n\t\t\t\tstudents.splice(0, 0, StudentManager.currentStudent);\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet output = this._createStudentsJson();\r\n\t\tLocalStorageHelper.saveStudentData(output);\r\n\t}\r\n\t\r\n\t/**creates a new [Student] object. Remember to call [saveToStorage] to save\r\n\t * the student permanently.*/\r\n\tpublic static createStudent(name:string, team:TeamDO,\r\n\t\t\tinsertAtTop:boolean = true):Student {\r\n\t\tlet student = new Student();\r\n\t\tstudent.name = name;\r\n\t\tstudent.teamCode = team?.code;\r\n\t\tstudent.teamName = team?.name;\r\n\t\tstudent.scores = new Map();\r\n\t\tif (insertAtTop){\r\n\t\t\tStudentManager.students.splice(0, 0, student);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tStudentManager.students.push(student);\r\n\t\t}\r\n\t\t\r\n\t\treturn student;\r\n\t}\r\n\t\r\n\t/**returns true if any student has the requested name*/\r\n\tpublic static hasStudentWithName(name:string):boolean {\r\n\t\treturn StudentManager.students.some((u) => u.name === name);\r\n\t}\r\n\t\r\n\t/**sets the [currentStudent]. If no matching name is found, the student is \r\n\t * not changed.*/\r\n\tpublic static setCurrentStudentByName(name:string):void {\r\n\t\tlet student = StudentManager.students.find((u) => u.name === name);\r\n\t\tif (student != null){\r\n\t\t\tStudentManager.currentStudent = student;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**generates a json string that can be saved to localstorage*/\r\n\tprivate static _createStudentsJson():string {\r\n\t\tlet output:Array = [];\r\n\t\tfor (let student of StudentManager.students){\r\n\t\t\tlet studentJson = {\r\n\t\t\t\t'name': student.name,\r\n\t\t\t\t'scores': student.getScoresMapAsObject()\r\n\t\t\t};\r\n\t\t\tif (StringUtils.isNotEmpty(student.teamCode)){\r\n\t\t\t\tstudentJson['teamCode'] = student.teamCode;\r\n\t\t\t}\r\n\t\t\tif (StringUtils.isNotEmpty(student.teamName)){\r\n\t\t\t\tstudentJson['teamName'] = student.teamName;\r\n\t\t\t}\r\n\t\t\toutput.push(studentJson);\r\n\t\t}\r\n\t\treturn JsonUtils.encode(output);\r\n\t}\r\n}","import { createEmitter } from 'ts_utils';\r\n\r\nexport class RAButton {\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _enabled:boolean = false;\r\n\t\r\n\tprivate _clickEmitter = createEmitter();\r\n\tpublic get click() { return this._clickEmitter.event; }\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._ui.addEventListener(\"click\", (e) => {\r\n\t\t\tif (this._enabled){\r\n\t\t\t\tthis._clickEmitter.emit(e);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t\r\n\tpublic addCssClass(className:string):void {\r\n\t\tif (!this._ui.classList.contains(className)){\r\n\t\t\tthis._ui.classList.add(className);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic removeCssClass(className:string):void {\r\n\t\tthis._ui.classList.remove(className);\r\n\t}\r\n\t\r\n\tpublic get enabled() { return this._enabled; }\r\n\tpublic set enabled(value:boolean){ \r\n\t\tthis._enabled = value;\r\n\t\tif (this._enabled){\r\n\t\t\tthis._ui.classList.remove('disabled');\r\n\t\t}\r\n\t\telse if (!this._ui.classList.contains('disabled')){\r\n\t\t\tthis._ui.classList.add('disabled');\r\n\t\t}\r\n\t}\r\n}","import { Templates } from \"./Templates\";\r\nimport { scoreMessage } from \"./templates/scoreMessageTemplates\";\r\n\r\nexport class ScoreMessageBox {\r\n\tconstructor(points:number){\r\n\t\tthis._displayScore(points);\r\n\t}\r\n\t\r\n\tprivate _displayScore(points:number):void {\r\n\t\tlet msgBox = Templates.createDiv(scoreMessage);\r\n\t\t\r\n\t\tlet msgDiv = msgBox.querySelector(\".scoreMes-message\");\r\n\t\tmsgDiv.innerHTML = `You earned ${points} points for your team!`;\r\n\t\tdocument.querySelector(\"body\").append(msgBox);\r\n\t\t\r\n\t\twindow.setTimeout(() => {\r\n\t\t\tmsgBox.classList.add(\"scoreMes-fade\");\r\n\t\t\twindow.setTimeout(() => {\r\n\t\t\t\tmsgBox.remove();\r\n\t\t\t\tmsgBox = null;\r\n\t\t\t}, 500);\r\n\t\t}, 2000);\r\n\t}\r\n}","export const scoreMessage = `\r\n

\r\n\t
\r\n\t\t

\r\n\t
\r\n
\r\n`;","import { Templates } from \"../ui/Templates\";\r\nimport { playerSettingsDg } from \"../ui/templates/playerSettingsTemplates\";\r\nimport { LocalStorageHelper } from \"../utilities/LocalStorageHelper\";\r\nimport { RAPlayer } from \"./RAPlayer\";\r\n\r\nexport class RAPlayerSettingsWindow {\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _player:RAPlayer;\r\n\t\r\n\tprivate _noteNamesCb:HTMLInputElement;\r\n\tprivate _closeBtn:HTMLButtonElement;\r\n\t\r\n\tprivate _sessionResolver:(msg:string) => void;\r\n\t\r\n\tconstructor(player:RAPlayer){\r\n\t\tthis._player = player;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\t/**Displays the settings dialog. The Promise will be completed when the user\r\n\t * dismisses the dialog. An optional message string matching a constant from\r\n\t * this class may be included. If not, the string parameter will be null.*/\r\n\tpublic display():Promise {\r\n\t\treturn new Promise((resolve, reject) => {\r\n\t\t\tthis._sessionResolver = resolve;\r\n\t\t\t\r\n\t\t\tdocument.body.append(this._ui);\r\n\t\t\tthis._addListeners();\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._draw();\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\tthis._ui = Templates.createDiv(playerSettingsDg);\r\n\t\t\r\n\t\tthis._noteNamesCb = this._ui.querySelector(\".psw-fingeringsCb\");\r\n\t\tthis._closeBtn = this._ui.querySelector(\".psw-closeBtn\");\r\n\t\t\r\n\t\tthis._noteNamesCb.checked = this._player.showNoteNames;\r\n\t}\r\n\t\r\n\tprivate _onNoteNamesCbChange = (e:Event):void => {\r\n\t\tthis._player.changeShowNotesAndFingerings(this._noteNamesCb.checked);\r\n\t\tthis._player.renderMusic();\r\n\t\tLocalStorageHelper.setShowFingerings(this._noteNamesCb.checked);\r\n\t}\r\n\t\r\n\tprivate _onCloseBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._close(null);\r\n\t}\r\n\t\r\n\tprivate _close(message:string):void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._ui.remove();\r\n\t\tthis._sessionResolver(message);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._noteNamesCb.addEventListener(\"change\", this._onNoteNamesCbChange);\r\n\t\tthis._closeBtn.addEventListener(\"click\", this._onCloseBtnClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._noteNamesCb.removeEventListener(\"change\",\r\n\t\t\tthis._onNoteNamesCbChange);\r\n\t\tthis._closeBtn.removeEventListener(\"click\", this._onCloseBtnClick);\r\n\t}\r\n}","export const playerSettingsDg = `\r\n\t
\r\n\t\t
\r\n\t\t\t
Player Settings
\r\n\t\t\t
\r\n\t\t\t\t
Note Names
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n\t`;","import { AssessmentType } from \"score_performance\";\r\nimport { createEmitter } from \"ts_utils\";\r\nimport { StringUtils } from \"ts_utils\";\r\nimport { SfxPlayer } from \"../audio/SfxPlayer\";\r\nimport { ContestManager } from \"../data/ContestManager\";\r\nimport { ContestEntryUpdateDTO } from \"../data/dtos\";\r\nimport { SongDO } from \"../data/SongDO\";\r\nimport { StudentManager } from \"../data/StudentManager\";\r\nimport { Services } from \"../services/Services\";\r\nimport { AppSettings } from \"../settings/AppSettings\";\r\nimport { pixiAppHelper } from \"../ui/pixi_apps\";\r\nimport { RAButton } from \"../ui/RAButton\";\r\nimport { ScoreMessageBox } from \"../ui/ScoreMessageBox\";\r\nimport { RAPlayer, RAPlayerEvent } from \"./RAPlayer\";\r\nimport { RAPlayerSettingsWindow } from \"./RAPlayerSettingsWindow\";\r\n\r\nexport class RAControls {\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _head:HTMLDivElement;\r\n\tprivate _fingeringsDiv:HTMLDivElement;\r\n\t\r\n\tprivate _playBtnImg:HTMLImageElement;\r\n\tprivate _playBtn:RAButton;\r\n\tprivate _songMenuBtn:RAButton;\r\n\tprivate _settingsBtn:RAButton;\r\n\tprivate _upTempoBtn:RAButton;\r\n\tprivate _downTempoBtn:RAButton;\r\n\t\r\n\tprivate _player:RAPlayer;\r\n\t\r\n\tprivate _resizeTimerId:number;\r\n\t\r\n\tprivate _isFirstSongLoad:boolean = true;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\r\n\tconstructor(ui:HTMLDivElement, player:RAPlayer) {\r\n\t\tthis._ui = ui;\r\n\t\tthis._player = player;\r\n\t\t\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tpublic async openSong(songDO:SongDO):Promise {\r\n\t\tif (this._isFirstSongLoad){\r\n\t\t\tpixiAppHelper.resizeToParent();\r\n\t\t\tawait SfxPlayer.loadSounds();\r\n\t\t\tthis._isFirstSongLoad = false;\r\n\t\t}\r\n\t\tawait this._player.openSong(songDO);\r\n\t\tthis._updateTitle();\r\n\t\tthis._updateAssessmentMessage();\r\n\t\tthis._setMode(ControlsMode.stopped);\r\n\t}\r\n\t\r\n\tpublic closeSong():void {\r\n\t\tthis._setMode(ControlsMode.disabled);\r\n\t\t\r\n\t\tthis._player.closeSong();\r\n\t\tthis._hideScorePercentage();\r\n\t\tthis._player.tempoRatio = 1.0;\r\n\t\tthis._updateTempoDisplay();\r\n\t}\r\n\t\r\n\tpublic displayMessage(message:string):void {\r\n\t\tlet msgRow = this._ui.querySelector(\"#p-head-messageRow\") as\r\n\t\t\tHTMLDivElement;\r\n\t\tmsgRow.style.display = \"initial\";\r\n\t\tlet msgDiv = msgRow.querySelector(\"#p-head-message\") as\r\n\t\t\tHTMLDivElement;\r\n\t\tmsgDiv.innerText = message;\r\n\t}\r\n\t\r\n\tpublic hideMessage():void {\r\n\t\tlet msgRow = this._ui.querySelector(\"#p-head-messageRow\") as\r\n\t\t\tHTMLDivElement;\r\n\t\tmsgRow.style.display = \"none\";\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._draw();\r\n\t\tthis._addListeners();\r\n\t}\r\n\r\n\tprivate _setMode(mode:number):void {\r\n\t\tif (mode === ControlsMode.disabled){\r\n\t\t\tthis._settingsBtn.enabled = false;\r\n\t\t\tthis._songMenuBtn.enabled = false;\r\n\t\t\tthis._playBtn.enabled = false;\r\n\t\t\tthis._upTempoBtn.enabled = false;\r\n\t\t\tthis._downTempoBtn.enabled = false;\r\n\t\t\tthis._playBtnImg.src = AppSettings.resourcesPath +\r\n\t\t\t\t\"images/playerScreen/playBtn.png\";\r\n\t\t}\r\n\t\telse if (mode === ControlsMode.stopped){\r\n\t\t\tthis._settingsBtn.enabled = true;\r\n\t\t\tthis._songMenuBtn.enabled = true;\r\n\t\t\tthis._playBtn.enabled = true;\r\n\t\t\tthis._upTempoBtn.enabled = true;\r\n\t\t\tthis._downTempoBtn.enabled = true;\r\n\t\t\tthis._playBtnImg.src = AppSettings.resourcesPath +\r\n\t\t\t\t\"images/playerScreen/playBtn.png\";\r\n\t\t}\r\n\t\telse if (mode === ControlsMode.playing){\r\n\t\t\tthis._settingsBtn.enabled = false;\r\n\t\t\tthis._songMenuBtn.enabled = false;\r\n\t\t\tthis._playBtn.enabled = true;\r\n\t\t\tthis._upTempoBtn.enabled = false;\r\n\t\t\tthis._downTempoBtn.enabled = false;\r\n\t\t\tthis._playBtnImg.src = AppSettings.resourcesPath +\r\n\t\t\t\t\"images/playerScreen/stopBtn.png\";\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _draw():void {\r\n\t\tlet qs = this._ui.querySelector.bind(this._ui);\r\n\t\tthis._head = qs(\"#p-head\");\r\n\t\t\r\n\t\tthis._playBtnImg = qs('#p-head-playBtn img');\r\n\t\tthis._playBtn = new RAButton(qs('#p-head-playBtn'));\r\n\t\tthis._upTempoBtn = new RAButton(qs('#p-head-tempoUpBtn'));\r\n\t\tthis._downTempoBtn = new RAButton(qs('#p-head-tempoDownBtn'));\r\n\t\tthis._songMenuBtn = new RAButton(qs('#p-head-songsBtn'));\r\n\t\tthis._settingsBtn = new RAButton(qs('#p-head-settingsBtn'));\r\n\t\t\r\n\t\tthis._fingeringsDiv = this._ui.querySelector(\"#_sp-fingeringsDiv\");\r\n\t\t\r\n\t\tthis._onAppResize();\r\n\t}\r\n\r\n\t\r\n\t\r\n\tprivate _displayScorePercentage(percentage:number):void {\r\n\t\tlet div = document.querySelector(\"#percentageDiv\") as HTMLDivElement;\r\n\t\tdiv.innerHTML = (`${percentage}%`);\r\n\t\tdiv.style.display = \"block\";\r\n\t}\r\n\t\r\n\tpublic _hideScorePercentage():void {\r\n\t\tlet div = document.querySelector(\"#percentageDiv\") as HTMLDivElement;\r\n\t\tdiv.style.display = \"none\";\r\n\t}\r\n\r\n\tprivate _onTempoUpBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._player.tempoRatio += 0.1;\r\n\t\tif (this._player.tempoRatio > 4.0){\r\n\t\t\tthis._player.tempoRatio = 4.0;\r\n\t\t}\r\n\t\tthis._updateTempoDisplay();\r\n\t}\r\n\r\n\tprivate _onTempoDownBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._player.tempoRatio -= 0.1;\r\n\t\tif (this._player.tempoRatio < 0.1){\r\n\t\t\tthis._player.tempoRatio = 0.1;\r\n\t\t}\r\n\t\tthis._updateTempoDisplay();\r\n\t}\r\n\r\n\tprivate _updateTempoDisplay():void {\r\n\t\tlet tempoDiv = this._ui.querySelector('#p-head-tempoText');\r\n\t\tlet tempo = Math.round(this._player.tempoRatio * 100)\r\n\t\ttempoDiv.innerHTML = `Tempo: ${tempo}%`;\r\n\t}\r\n\r\n\tprivate _onSettingsBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tawait new RAPlayerSettingsWindow(this._player).display();\r\n\t}\r\n\r\n\tprivate _onSongMenuBtnClick = (e:MouseEvent):void => {\r\n\t\tlet ev = new RAControlsEvent();\r\n\t\tev.type = RAControlsEventType.mainMenuRequest;\r\n\t\tthis._emitter.emit(ev);\r\n\t}\r\n\r\n\tprivate _onPlayBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tif (this._player.isPlaying){\r\n\t\t\tthis._player.stop();\r\n\t\t\tawait this._handlePlaybackStopped(false);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._setMode(ControlsMode.playing);\r\n\t\t\tawait this._player.renderMusic();\r\n\t\t\tthis._player.play();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onPlaybackComplete = async (e:RAPlayerEvent):Promise => {\r\n\t\tawait this._handlePlaybackStopped(true);\r\n\t}\r\n\t\r\n\tprivate async _handlePlaybackStopped(playbackComplete:boolean)\r\n\t\t\t:Promise {\r\n\t\tthis._setMode(ControlsMode.stopped);\r\n\t\tif (playbackComplete){\r\n\t\t\tlet results = this._player.getAssessmentResults();\r\n\t\t\tlet percentage = Math.round(results.percentage);\r\n\t\t\t\r\n\t\t\tthis._displayScorePercentage(percentage);\r\n\t\t\t\r\n\t\t\tif (percentage >= 90){\r\n\t\t\t\tSfxPlayer.playSound(\"clap3\");\r\n\t\t\t}\r\n\t\t\tlet points = results.notesCorrect * 10 - results.notesExtra * 5;\r\n\t\t\tif (StudentManager.currentStudent != null && percentage > 0 \r\n\t\t\t\t\t&& points > 0){\r\n\t\t\t\t\r\n\t\t\t\t//update student's personal best\r\n\t\t\t\tlet student = StudentManager.currentStudent;\r\n\t\t\t\tstudent.updateScore(this._player.songDO.libId, percentage);\r\n\t\t\t\tStudentManager.saveToStorage(true);\r\n\t\t\t\t\r\n\t\t\t\t//submit points for team, if it exists.\r\n\t\t\t\tif (student.team != null){\r\n\t\t\t\t\tlet team = student.team;\r\n\t\t\t\t\tlet multiplier = (team.size < 500)\r\n\t\t\t\t\t\t? Math.pow(500 / team.size, 0.4)\r\n\t\t\t\t\t\t: 1;\r\n\t\t\t\t\tpoints = Math.floor(points * multiplier);\r\n\t\t\t\t\tnew ScoreMessageBox(points);\r\n\t\t\t\t\r\n\t\t\t\t\tlet dto = new ContestEntryUpdateDTO();\r\n\t\t\t\t\tdto.dateString = ContestManager.getCompetitionId();\r\n\t\t\t\t\tdto.points = points;\r\n\t\t\t\t\tdto.teamId = team.id;\r\n\t\t\t\t\tawait Services.updateScore(dto);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis._player.scrollToTop();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _updateTitle():void {\r\n\t\tlet title = this._head.querySelector(\"#p-head-title\") as\r\n\t\t\tHTMLHeadElement;\r\n\t\ttitle.innerText = this._player.songDO.title;\r\n\t}\r\n\t\r\n\tprivate _updateAssessmentMessage():void {\r\n\t\tswitch (this._player.assessmentType){\r\n\t\t\tcase AssessmentType.pitch: {\r\n\t\t\t\tthis.displayMessage(\"Play this song with your recorder to \" +\r\n\t\t\t\t\t\"earn points.\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase AssessmentType.rhythmKeyboard: {\r\n\t\t\t\tthis.displayMessage(\"Tap keys on your keyboard to perform \" +\r\n\t\t\t\t\t\"the correct rhythms\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onAppResize = async ():Promise => {\r\n\t\tif (this._resizeTimerId != null){\r\n\t\t\twindow.clearTimeout(this._resizeTimerId)\r\n\t\t}\r\n\t\tthis._resizeTimerId = window.setTimeout(this._handleAppResize, 1000);\r\n\t}\r\n\t\r\n\tprivate _handleAppResize = async ():Promise => {\r\n\t\tif (this._player.scoreLoaded){\r\n\t\t\tif (this._player.isPlaying){\r\n\t\t\t\t//don't resize during playback since this will change the\r\n\t\t\t\t//VisualScore. We always resize just before and just after\r\n\t\t\t\t//playback.\r\n\t\t\t\treturn;\r\n\t\t\t\t// this._player.stop();\r\n\t\t\t}\r\n\t\t\tthis._player.clearAssessmentVisuals();\r\n\t\t\tawait this._player.renderMusic();\r\n\t\t}\r\n\t\t//resize fingerings div\r\n\t\tlet height:number = document.body.clientHeight;\r\n\t\tthis._fingeringsDiv.style.width = `${Math.min(height * 0.125, 80)}px`;\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._upTempoBtn.click.on(this._onTempoUpBtnClick);\r\n\t\tthis._downTempoBtn.click.on(this._onTempoDownBtnClick);\r\n\t\tthis._settingsBtn.click.on(this._onSettingsBtnClick);\r\n\t\tthis._songMenuBtn.click.on(this._onSongMenuBtnClick);\r\n\t\tthis._playBtn.click.on(this._onPlayBtnClick);\r\n\t\t\r\n\t\tthis._player.event.on(this._onPlaybackComplete);\r\n\t\t\r\n\t\tpixiAppHelper.app.renderer.addListener(\"resize\", this._onAppResize);\r\n\t}\r\n}\r\n\r\nenum ControlsMode {\r\n\tdisabled,\r\n\tstopped,\r\n\tplaying\r\n}\r\n\r\nexport class RAControlsEvent {\r\n\tpublic type:RAControlsEventType;\r\n}\r\n\r\nexport enum RAControlsEventType {\r\n\tmainMenuRequest\r\n}","import { Score } from \"score_data\";\r\nimport { Services } from \"../services/Services\";\r\nimport { AppSettings } from \"../settings/AppSettings\";\r\n\r\nexport class SongDO {\r\n\t/**unique id in the song library*/\r\n\tpublic libId:string;\r\n\t/**id of the song library category this song appears in*/\r\n\tpublic categoryId:string;\r\n\t/**title of the song*/\r\n\tpublic title:string;\r\n\t/**the [SongType], such as RhythmAssessment or RecorderAssessment*/\r\n\tpublic type:SongType;\r\n\t\r\n\tpublic path:string;\r\n\t\r\n\tpublic musicXMLString:string;\r\n\tpublic score:Score;\r\n\t/**if null, song's default tempo should be used*/\r\n\tpublic overrideTempo:number;\r\n\t\r\n\tconstructor(){\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic static fromLibrarySongJson(categoryId:string, data:any):SongDO {\r\n\t\tlet sdo = new SongDO();\r\n\t\t\r\n\t\tsdo.categoryId = categoryId;\r\n\t\tsdo.libId = data['libId'];\r\n\t\tsdo.title = data['title'];\r\n\t\tsdo.type = data['type'];\r\n\t\tsdo.path = AppSettings.resourcesPath + data['path'];\r\n\t\tsdo.overrideTempo = data['tempo']; //optional\r\n\t\t\r\n\t\treturn sdo;\r\n\t}\r\n\t\r\n}\r\n\r\nexport enum SongType {\r\n\tRhythmAssessment,\r\n\tRecorderAssessment\r\n}","import { InstrumentUtils, LyricsMode, ScoreManager, ScoreProperties }\r\n\tfrom 'score_data';\r\nimport { AssessmentResults, AssessmentType, InteractionSettings, SFPlaybackDO,\r\n\tSFScoreDriver } from 'score_performance';\r\nimport { MusicTextures } from 'score_render';\r\nimport { SongDO, SongType } from '../data/SongDO';\r\nimport { Container } from 'pixi.js';\r\nimport { MicManager, MicOptions } from 'audio_input';\r\nimport { createEmitter } from 'ts_utils';\r\nimport { BrowserUtils } from 'ts_utils';\r\nimport { LocalStorageHelper } from '../utilities/LocalStorageHelper';\r\nimport { FingeringDisplayManager } from './fingerings/FingeringDisplayManager';\r\nimport { pixiAppHelper } from '../ui/pixi_apps';\r\nimport { Services } from '../services/Services';\r\nimport { RaAssessorFactory } from './RaAssessorFactory';\r\n\r\nexport class RAPlayer {\r\n\tprivate _driver:SFScoreDriver;\r\n\tprivate _container:Container;\r\n\tprivate _songDO:SongDO;\r\n\tprivate _needsFirstRender:boolean;\r\n\t\r\n\tprivate _scoreManager:ScoreManager;\r\n\tprivate _showNoteNames:boolean;\r\n\tprivate _fingeringDM:FingeringDisplayManager;\r\n\t\r\n\tprivate _tempoRatio:number = 1.0;\r\n\tprivate _metronomeVolume:number = 0;\r\n\t\r\n\tprivate _assessmentType:AssessmentType;\r\n\tprivate _useMicForRhythmAssessment:boolean;\r\n\tprivate _assessBeats:boolean = false;\r\n\t\r\n\tprivate _micPermissionGranted:boolean = false;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(driver:SFScoreDriver, container:Container){\r\n\t\tthis._driver = driver;\r\n\t\tthis._container = container;\r\n\t\t\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tpublic async openSong(songDO:SongDO):Promise {\r\n\t\tthis._songDO = songDO;\r\n\t\t\r\n\t\tthis._songDO.musicXMLString = await Services.loadSongXml(songDO.path);\r\n\t\t\r\n\t\tlet props = ScoreProperties.getNewScoreProperties();\r\n\t\tthis._songDO.score = await this._driver.parseScore(\r\n\t\t\tsongDO.musicXMLString, true, true, props);\r\n\t\tthis._scoreManager.score = this._songDO.score;\r\n\t\t\r\n\t\tthis._needsFirstRender = true;\r\n\t\t\r\n\t\tthis.changeShowNotesAndFingerings(this._showNoteNames);\r\n\t\tawait this.renderMusic();\r\n\t\tthis._updateAssessmentSettings();\r\n\t\tthis._updateTempo();\r\n\t\tthis._updatePartPlaybackPresets();\r\n\t}\r\n\t\r\n\tpublic closeSong():void {\r\n\t\tthis._container.removeChild(this._driver.scoreViewer);\r\n\t\tthis._driver.unloadScore();\r\n\t\tthis._songDO = null;\r\n\t}\r\n\t\r\n\tpublic async renderMusic():Promise {\r\n\t\tlet pixelsPS = this._calculateClipScoreScaling(this.viewWidth);\r\n\t\tawait MusicTextures.createTextures(pixelsPS);\r\n\t\tlet score = this._songDO.score;\r\n\t\tif (this._needsFirstRender){\r\n\t\t\tthis._driver.renderNotation(score, this.viewWidth, this.viewHeight,\r\n\t\t\t\t[score.parts[0]]);\r\n\t\t\tthis._needsFirstRender = false;\r\n\t\t\tthis._container.addChild(this._driver.scoreViewer);\r\n\t\t\tlet settings = new InteractionSettings();\r\n\t\t\tsettings.enableNoteClickEvents = true;\r\n\t\t\tsettings.enableDragScroll = true;\r\n\t\t\tthis._driver.scoreViewer.setInteraction(settings);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._driver.resetNotation(this.viewWidth, this.viewHeight);\r\n\t\t}\r\n\t\t\r\n\t\tthis._driver.scoreViewer.forceScrolling = true;\r\n\t\tthis._fingeringDM.setNewScore(this._driver.scoreViewer);\r\n\t\t\r\n\t\t// pixiApp.requestRender();\r\n\t}\r\n\t\r\n\tpublic changeShowNotesAndFingerings(show:boolean):void {\r\n\t\tthis._showNoteNames = show;\r\n\t\tlet el = document.querySelector(\"#_sp-fingeringsDiv\") as HTMLDivElement;\r\n\t\tel.style.display = this._showNoteNames ? \"\" : \"none\";\r\n\t\t\r\n\t\tlet part = this._songDO.score.parts[0];\r\n\t\tif (show){\r\n\t\t\tthis._scoreManager.showNoteNames(part.staves[0]);\r\n\t\t}\r\n\t\telse if (part.staves[0].lyricsMode == LyricsMode.SHOW_LYRICS) {\r\n\t\t\tthis._scoreManager.showLyrics();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._scoreManager.hideLyrics();\r\n\t\t}\r\n\t\t\r\n\t\tpixiAppHelper.resizeToParent();\r\n\t}\r\n\t\r\n\tpublic async play():Promise {\r\n\t\tif (BrowserUtils.isSafari()){\r\n await MicManager.get().initMicMediaStream();\r\n }\r\n\t\t\r\n\t\tlet pdo = new SFPlaybackDO();\r\n\t\tpdo.tempoRatio = this._tempoRatio;\r\n\t\tpdo.metronomeVolume = this._metronomeVolume;\r\n\t\tpdo.playRepeats = false;\r\n\t\tpdo.assessmentType = this._assessmentType;\r\n\t\tpdo.countoffSeconds = 3.0;\r\n\t\tthis._driver.preparePlayback(pdo);\r\n\t\tthis._driver.clearAssessmentVisuals();\r\n\t\tthis._driver.playPrepared(pdo, this._onPlaybackComplete);\r\n\t}\r\n\t\r\n\tpublic stop():void {\r\n\t\tthis._driver.stop();\r\n\t}\r\n\t\r\n\tpublic getAssessmentResults():AssessmentResults {\r\n\t\treturn this._driver.getAssessmentResults();\r\n\t}\r\n\t\r\n\tpublic clearAssessmentVisuals():void {\r\n\t\tthis._driver.clearAssessmentVisuals();\r\n\t}\r\n\t\r\n\tpublic scrollToTop():void {\r\n\t\tthis._driver.scoreViewer.scrollToTop(1.0);\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._scoreManager = new ScoreManager();\r\n\t\tthis._fingeringDM = new FingeringDisplayManager();\r\n\t\tthis._fingeringDM.setInstrument(this.instrument, true);\r\n\t\tthis._showNoteNames = LocalStorageHelper.getShowFingerings();\r\n\t}\r\n\t\r\n\tprivate _onPlaybackComplete = () => {\r\n\t\tlet ev = new RAPlayerEvent();\r\n\t\tev.type = RAPlayerEventType.playbackComplete;\r\n\t\tthis._emitter.emit(ev);\r\n\t};\r\n\t\r\n\tprivate async _updateAssessmentSettings():Promise {\r\n\t\tif (this._songDO.type === SongType.RecorderAssessment){\r\n\t\t\tthis._assessmentType = AssessmentType.pitch;\r\n\t\t\tthis._driver.setInstrument(this.instrument);\r\n\t\t\tawait this._getMicrophonePermission();\r\n\t\t\tthis._metronomeVolume = 0;\r\n\t\t}\r\n\t\telse if (this._songDO.type === SongType.RhythmAssessment){\r\n\t\t\tthis._assessmentType = AssessmentType.rhythmKeyboard;\r\n\t\t\tthis._useMicForRhythmAssessment = false;\r\n\t\t\t(this._driver.assessorFactory as RaAssessorFactory).assessBeats =\r\n\t\t\t\tthis._assessBeats;\r\n\t\t\tthis._songDO.score.parts[0].volume = 0;\r\n\t\t\tthis._metronomeVolume = 1.0;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _updateTempo():void {\r\n\t\t//apply any tempo override\r\n\t\tif (this._songDO.overrideTempo != null){\r\n\t\t\tlet stacks = this._songDO.score.getMeasureStacks();\r\n\t\t\tlet tempoRatio = this._songDO.overrideTempo / \r\n\t\t\t\tstacks[0].tempoMarkers[0].tempo;\r\n\t\t\tstacks.forEach((s) => {\r\n\t\t\t\tif (s.tempoMarkers != null){\r\n\t\t\t\t\ts.tempoMarkers.forEach((tm) => tm.tempo *= tempoRatio);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _updatePartPlaybackPresets():void {\r\n\t\tfor (let part of this._songDO.score.parts){\r\n\t\t\tif (part.midiChannel !== 10){\r\n\t\t\t\t//guitar\r\n\t\t\t\tif (part.midiPreset >= 24 && part.midiPreset <= 31){\r\n\t\t\t\t\tpart.midiPreset = 24;\r\n\t\t\t\t}\r\n\t\t\t\t//bass\r\n\t\t\t\telse if (part.midiPreset >= 32 && part.midiPreset <= 39){\r\n\t\t\t\t\tpart.midiPreset = 33;\r\n\t\t\t\t}\r\n\t\t\t\t//piano default\r\n\t\t\t\telse {\r\n\t\t\t\t\tpart.midiPreset = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t//unpitched percussion\r\n\t\t\t\tpart.midiBank = 128;\r\n\t\t\t\tpart.midiPreset = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate async _getMicrophonePermission():Promise {\r\n\t\tif (!this._micPermissionGranted){\r\n\t\t\tlet micOptions = new MicOptions();\r\n\t\t\tawait this._driver.enableMicrophone(micOptions);\r\n\t\t\tthis._micPermissionGranted = true;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _calculateClipScoreScaling(width:number):number {\r\n\t\tif (width >= 1000) return 10;\r\n\t\telse if (width >= 800) return 9;\r\n\t\telse if (width >= 600) return 8;\r\n\t\telse return 7;\r\n\t}\r\n\t\r\n\tpublic get songDO():SongDO { return this._songDO; }\r\n\t\r\n\tpublic get viewWidth():number {\r\n\t\treturn pixiAppHelper.app.canvas.parentElement.clientWidth;\r\n\t}\r\n\t\r\n\tpublic get viewHeight():number {\r\n\t\treturn pixiAppHelper.app.canvas.parentElement.clientHeight;\r\n\t}\r\n\t\r\n\tpublic get showNoteNames():boolean {\r\n\t\treturn this._showNoteNames;\r\n\t}\r\n\t\r\n\tpublic get tempoRatio() { return this._tempoRatio; }\r\n\tpublic set tempoRatio(value:number) { this._tempoRatio = value; }\r\n\t\r\n\tpublic get assessmentType():AssessmentType { return this._assessmentType; }\r\n\t\r\n\tpublic get instrument() { return InstrumentUtils.instruments[0]; }\r\n\t\r\n\tpublic get isPlaying():boolean { return this._driver.isPlaying; }\r\n\t\r\n\tpublic get scoreLoaded():boolean {\r\n\t\treturn (this._driver.scoreViewer != null && this._songDO != null);\r\n\t}\r\n}\r\n\r\nexport class RAPlayerEvent {\r\n\tpublic type:RAPlayerEventType;\r\n}\r\n\r\nexport enum RAPlayerEventType {\r\n\tplaybackComplete\r\n}","export class RecorderFingerings {\r\n\tpublic static baroqueFingerings:Array> = [\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //C (low)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 1], //C#\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 2], //D\r\n\t\t[0, 0, 0, 0, 0, 0, 1, 2], //Eb\r\n\t\t[0, 0, 0, 0, 0, 0, 2, 2], //E\r\n\t\t[0, 0, 0, 0, 0, 2, 0, 0], //F\r\n\t\t[0, 0, 0, 0, 2, 0, 0, 2], //F#\r\n\t\t[0, 0, 0, 0, 2, 2, 2, 2], //G\r\n\t\t[0, 0, 0, 2, 0, 0, 1, 2], //Ab\r\n\t\t[0, 0, 0, 2, 2, 2, 2, 2], //A\r\n\t\t[0, 0, 2, 0, 0, 2, 2, 2], //Bb\r\n\t\t[0, 0, 2, 2, 2, 2, 2, 2], //B\r\n\t\t[0, 2, 0, 2, 2, 2, 2, 2], //C\r\n\t\t[2, 0, 0, 2, 2, 2, 2, 2], //C#\r\n\t\t[2, 2, 0, 2, 2, 2, 2, 2], //D\r\n\t\t[2, 2, 0, 0, 0, 0, 0, 2], //Eb\r\n\t\t[1, 0, 0, 0, 0, 0, 2, 2], //E\r\n\t\t[1, 0, 0, 0, 0, 2, 0, 2], //F\r\n\t\t[1, 0, 0, 0, 2, 0, 2, 2], //F#\r\n\t\t[1, 0, 0, 0, 2, 2, 2, 2], //G\r\n\t\t[1, 0, 0, 2, 0, 2, 2, 2], //Ab\r\n\t\t[1, 0, 0, 2, 2, 2, 2, 2], //A\r\n\t\t[1, 0, 0, 2, 0, 0, 0, 2], //Bb\r\n\t\t[1, 0, 0, 2, 0, 0, 2, 2], //B\r\n\t\t[1, 0, 2, 2, 0, 0, 2, 2], //C\r\n\t\t[1, 0, 1, 0, 0, 1, 0, 0], //C#\r\n\t\t[1, 0, 2, 0, 0, 2, 0, 2], //D\r\n\t\t[1, 2, 0, 0, 2, 0, 0, 2]]; //Eb\r\n\t\r\n\tpublic static germanFingerings:Array> = [\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //C (low)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 1], //C#\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 2], //D\r\n\t\t[0, 0, 0, 0, 0, 0, 1, 2], //Eb\r\n\t\t[0, 0, 0, 0, 0, 0, 2, 2], //E\r\n\t\t[0, 0, 0, 0, 0, 2, 2, 2], //F\r\n\t\t[0, 0, 0, 0, 2, 0, 0, 0], //F#\r\n\t\t[0, 0, 0, 0, 2, 2, 2, 2], //G\r\n\t\t[0, 0, 0, 2, 0, 0, 1, 2], //Ab\r\n\t\t[0, 0, 0, 2, 2, 2, 2, 2], //A\r\n\t\t[0, 0, 2, 0, 0, 2, 2, 2], //Bb\r\n\t\t[0, 0, 2, 2, 2, 2, 2, 2], //B\r\n\t\t[0, 2, 0, 2, 2, 2, 2, 2], //C\r\n\t\t[2, 0, 0, 2, 2, 2, 2, 2], //C#\r\n\t\t[2, 2, 0, 2, 2, 2, 2, 2], //D\r\n\t\t[2, 2, 0, 0, 0, 0, 0, 2], //Eb\r\n\t\t[1, 0, 0, 0, 0, 0, 2, 2], //E\r\n\t\t[1, 0, 0, 0, 0, 2, 2, 2], //F\r\n\t\t[1, 0, 0, 0, 2, 0, 2, 0], //F#\r\n\t\t[1, 0, 0, 0, 2, 2, 2, 2], //G\r\n\t\t[1, 0, 0, 0, 2, 0, 0, 0], //Ab\r\n\t\t[1, 0, 0, 2, 2, 2, 2, 2], //A\r\n\t\t[1, 0, 0, 2, 0, 0, 0, 2], //Bb\r\n\t\t[1, 0, 0, 2, 0, 0, 2, 2], //B\r\n\t\t[1, 0, 2, 2, 0, 0, 2, 2], //C\r\n\t\t[1, 0, 2, 0, 0, 2, 0, 0], //C#\r\n\t\t[1, 0, 2, 0, 0, 2, 0, 2], //D\r\n\t\t[1, 2, 0, 0, 2, 0, 0, 2]]; //Eb\r\n\t\r\n\tpublic static altoUntransposedFingerings:Array> = [\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //C (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //C# (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //D (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //Eb (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //E (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //F (low)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 1], //F#\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 2], //G\r\n\t\t[0, 0, 0, 0, 0, 0, 1, 2], //Ab\r\n\t\t[0, 0, 0, 0, 0, 0, 2, 2], //A\r\n\t\t[0, 0, 0, 0, 0, 2, 0, 0], //Bb\r\n\t\t[0, 0, 0, 0, 2, 0, 0, 2], //B\r\n\t\t[0, 0, 0, 0, 2, 2, 2, 2], //C\r\n\t\t[0, 0, 0, 2, 0, 0, 0, 2], //C#\r\n\t\t[0, 0, 0, 2, 2, 2, 2, 2], //D\r\n\t\t[0, 0, 2, 0, 0, 2, 2, 2], //Eb\r\n\t\t[0, 0, 2, 2, 2, 2, 2, 2], //E\r\n\t\t[0, 2, 0, 2, 2, 2, 2, 2], //F\r\n\t\t[2, 0, 0, 2, 2, 2, 2, 2], //F#\r\n\t\t[2, 2, 0, 2, 2, 2, 2, 2], //G\r\n\t\t[2, 2, 0, 0, 0, 0, 0, 2], //Ab\r\n\t\t[1, 0, 0, 0, 0, 0, 2, 2], //A\r\n\t\t[1, 0, 0, 0, 0, 2, 0, 2], //Bb\r\n\t\t[1, 0, 0, 0, 2, 0, 2, 2], //B\r\n\t\t[1, 0, 0, 0, 2, 2, 2, 2], //C\r\n\t\t[1, 0, 0, 2, 0, 2, 2, 2], //C#\r\n\t\t[1, 0, 0, 2, 2, 2, 2, 2], //D\r\n\t\t[1, 0, 0, 2, 0, 0, 0, 2], //Eb\r\n\t\t[1, 0, 0, 2, 0, 0, 2, 2], //E\r\n\t\t[1, 0, 2, 2, 0, 0, 2, 2], //F\r\n\t\t[1, 0, 1, 0, 0, 1, 0, 0], //F#\r\n\t\t[1, 0, 2, 0, 0, 2, 0, 2], //G\r\n\t\t[1, 2, 0, 0, 2, 0, 0, 2]]; //Ab\r\n\t\t\r\n\tpublic static altoUntransposedGermanFingerings:Array> = [\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //C (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //C# (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //D (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //Eb (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //E (not real - place holder)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 0], //F (low)\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 1], //F#\r\n\t\t[0, 0, 0, 0, 0, 0, 0, 2], //G\r\n\t\t[0, 0, 0, 0, 0, 0, 1, 2], //Ab\r\n\t\t[0, 0, 0, 0, 0, 0, 2, 2], //A\r\n\t\t[0, 0, 0, 0, 0, 2, 2, 2], //Bb\r\n\t\t[0, 0, 0, 0, 2, 0, 0, 0], //B\r\n\t\t[0, 0, 0, 0, 2, 2, 2, 2], //C\r\n\t\t[0, 0, 0, 2, 0, 0, 1, 2], //Db\r\n\t\t[0, 0, 0, 2, 2, 2, 2, 2], //D\r\n\t\t[0, 0, 2, 0, 0, 2, 2, 2], //Eb\r\n\t\t[0, 0, 2, 2, 2, 2, 2, 2], //E\r\n\t\t[0, 2, 0, 2, 2, 2, 2, 2], //F\r\n\t\t[2, 0, 0, 2, 2, 2, 2, 2], //F#\r\n\t\t[2, 2, 0, 2, 2, 2, 2, 2], //G\r\n\t\t[2, 2, 0, 0, 0, 0, 0, 2], //Ab\r\n\t\t[1, 0, 0, 0, 0, 0, 2, 2], //A\r\n\t\t[1, 0, 0, 0, 0, 2, 2, 2], //Bb\r\n\t\t[1, 0, 0, 0, 2, 0, 2, 0], //B\r\n\t\t[1, 0, 0, 0, 2, 2, 2, 2], //C\r\n\t\t[1, 0, 0, 0, 2, 0, 0, 0], //Db\r\n\t\t[1, 0, 0, 2, 2, 2, 2, 2], //D\r\n\t\t[1, 0, 0, 2, 0, 0, 0, 2], //Eb\r\n\t\t[1, 0, 0, 2, 0, 0, 2, 2], //E\r\n\t\t[1, 0, 2, 2, 0, 0, 2, 2], //F\r\n\t\t[1, 0, 2, 0, 0, 2, 0, 0], //F#\r\n\t\t[1, 0, 2, 0, 0, 2, 0, 2], //G\r\n\t\t[1, 2, 0, 0, 2, 0, 0, 2]]; //Ab\r\n}","import { InstrumentDO } from \"score_data\";\r\nimport { IFingeringVisualizer } from \"./IFingeringVisualizer\";\r\nimport { RecorderFingerings } from \"./RecorderFingerings\";\r\n\r\nexport class RecorderFingeringVisualizer implements IFingeringVisualizer {\r\n\t/** To use, create a div in your HTML with an id matching the static\r\n\t * [fingeringDivId] value (you can set this before creating this handler).*/\r\n\t\r\n\tpublic static fingeringsDivId:string = \"_sp-fingeringsDiv\";\r\n\t\r\n\tprivate _inst:InstrumentDO;\r\n\tprivate _fingeringsDiv:HTMLDivElement;\r\n\tprivate _svgElement:SVGElement;\r\n\t\r\n\t// static html.NodeValidatorBuilder _validator;\r\n\t\r\n\t/**a list of the finger holes, starting with 0 as the thumb*/\r\n\tprivate _fingerHoleSvgGroups:Array;\r\n\t\r\n\t/**matches a fingerings set from [_RecorderFingerings] class*/\r\n\tprivate _fingerings:Array>;\r\n\t\r\n\tpublic recorderSvg:string = `\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.closedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.halfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.openHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.closedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.halfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.openHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.closedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.halfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.openHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.closedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.halfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.openHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.closedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.halfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.openHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.closedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.halfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.openHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.doubleClosedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.doubleHalfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.doubleOpenHole}\r\n\t\t\t\r\n\t\t\t\t${RecorderFingeringVisualizer.doubleClosedHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.doubleHalfHole}\r\n\t\t\t\t${RecorderFingeringVisualizer.doubleOpenHole}\r\n\t\t\r\n\t`;\r\n\t\r\n\tpublic static openHole:string = `\r\n\t\t\r\n\t`;\r\n\t\r\n\tpublic static closedHole:string = `\r\n\t\t\r\n\t`;\r\n\t\r\n\tpublic static halfHole:string = `\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t`;\r\n\t\r\n\tpublic static doubleOpenHole:string = `\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t`;\r\n\t\r\n\tpublic static doubleClosedHole:string = `\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t`;\r\n\t\r\n\tpublic static doubleHalfHole:string = `\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t`;\r\n\t\r\n\tconstructor(instrument:InstrumentDO){\r\n\t\tthis._inst = instrument;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\t//pick the fingering set\r\n\t\tif (this._inst.id === 300 || this._inst.id === 303){\r\n\t\t\tthis._fingerings = (this._inst.fingeringSet === 1)\r\n\t\t\t\t? RecorderFingerings.altoUntransposedGermanFingerings\r\n\t\t\t\t: RecorderFingerings.altoUntransposedFingerings;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._fingerings = (this._inst.fingeringSet === 1)\r\n\t\t\t\t? RecorderFingerings.germanFingerings\r\n\t\t\t\t: RecorderFingerings.baroqueFingerings;\r\n\t\t}\r\n\t\t\r\n\t\tthis._draw();\r\n\t}\r\n\t\r\n\tpublic destroy():void {\r\n\t\tthis._fingeringsDiv.innerHTML = \"\";\r\n\t}\r\n\t\r\n\tpublic showFingering(displayCents:number):void {\r\n\t\t//_svgElement.remove();\r\n\t\tlet index:number = ~~(displayCents / 100) - 60;\r\n\t\tif (index >= 0 && index < this._fingerings.length) {\r\n\t\t\tlet holeSettings = this._fingerings[index];\r\n\t\t\tfor (let i = 0; i < holeSettings.length; i++){\r\n\t\t\t\tlet setting:number = holeSettings[i];\r\n\t\t\t\tlet svgGroup = this._fingerHoleSvgGroups[i];\r\n\t\t\t\t(svgGroup.children[0] as HTMLElement).style.visibility =\r\n\t\t\t\t\t(setting === 0) ? \"visible\" : \"hidden\";\r\n\t\t\t\t(svgGroup.children[1] as HTMLElement).style.visibility =\r\n\t\t\t\t\t(setting === 1) ? \"visible\" : \"hidden\";\r\n\t\t\t\t(svgGroup.children[2] as HTMLElement).style.visibility =\r\n\t\t\t\t\t(setting === 2) ? \"visible\" : \"hidden\";\r\n\t\t\t}\r\n\t\t}\r\n\t\t//_fingeringsDiv.append(_svgElement);\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\t//create the recorder bg\r\n\t\tthis._fingeringsDiv = document.querySelector(\r\n\t\t\t`#${RecorderFingeringVisualizer.fingeringsDivId}`);\r\n\t\tif (this._fingeringsDiv != null){\r\n\t\t\tlet div = document.createElement('div');\r\n\t\t\tdiv.innerHTML = this.recorderSvg;\r\n\t\t\tthis._svgElement = div.children[0] as SVGElement;\r\n\t\t\tthis._svgElement.remove();\r\n\t\t\tthis._fingeringsDiv.append(this._svgElement);\r\n\t\t}\r\n\t\t\r\n\t\t//create the graphics for the holes and get the svg groups they go in.\r\n\t\tthis._fingerHoleSvgGroups = [];\r\n\t\tfor (let i = 0; i < 8; i++){\r\n\t\t\tthis._fingerHoleSvgGroups.push(\r\n\t\t\t\tthis._svgElement.querySelector(`#_sp-recHole${i}`));\r\n\t\t}\r\n\t}\r\n}","import { InstrumentDO } from 'score_data';\r\nimport { ScoreViewer, ScoreViewerEvent, ScoreViewerEventType }\r\n\tfrom 'score_performance';\r\nimport { VisualNoteGroup } from 'score_render';\r\nimport { FingeringVisualizerFactory, IFingeringVisualizerFactory }\r\n\tfrom './FingeringVisualizerFactory';\r\nimport { IFingeringVisualizer } from './IFingeringVisualizer';\r\n\r\nexport class FingeringDisplayManager {\r\n\t/**To create custom fingering visualizers, first create a custom\r\n\t * [IFingeringVisualizerFactory] that creates your [IFingeringVisualizer]s\r\n\t * and assign it to the static visualizerFactory field before initializing\r\n\t * the [AbstractPlayer]. */\r\n \t\r\n\tprivate _scoreViewer:ScoreViewer;\r\n\tprivate _visualizer:IFingeringVisualizer;\r\n\t\r\n\t/**the [IFingeringVisualizerFactory] instance that creates the unique\r\n\t * [IFingeringVisualizer] for each instrument*/\r\n\tpublic static visualizerFactory:IFingeringVisualizerFactory = \r\n\t\tnew FingeringVisualizerFactory();\r\n\t\r\n\tconstructor(){\r\n\t\t\r\n\t}\r\n\r\n\t/**sets the fingering display (or removes it) for the new instrument\r\n\t * returns true if a change in the display occurred.*/\r\n\tpublic setInstrument(inst:InstrumentDO,\r\n\t\t\tshowFingeringsIfAvailable:boolean):void {\r\n\t\tif (this._visualizer != null){\r\n\t\t\tthis._visualizer.destroy();\r\n\t\t\tthis._visualizer = null;\r\n\t\t}\r\n\t\tif (showFingeringsIfAvailable){\r\n\t\t\tthis._visualizer =\r\n\t\t\t\tFingeringDisplayManager.visualizerFactory.create(inst);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic setNewScore(scoreViewer:ScoreViewer):void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._scoreViewer = scoreViewer;\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tprivate _onScoreViewerEvent = (e:ScoreViewerEvent):void => {\r\n\t\tswitch (e.type){\r\n\t\t\tcase ScoreViewerEventType.noteGroupClicked: {\r\n\t\t\t\tthis._displayFingering((e.visualNoteGroup));\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tcase ScoreViewerEventType.noteReached: {\r\n\t\t\t\tif (e.visualNoteGroup.noteGroup.visible){\r\n\t\t\t\t\tthis._displayFingering(e.visualNoteGroup);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _displayFingering(vng:VisualNoteGroup):void {\r\n\t\tif (this._visualizer == null) return;\r\n\t\t\r\n\t\tif (vng.noteGroup.isRest){\r\n\t\t\treturn; //no fingerings for rests\r\n\t\t}\r\n\t\t\r\n\t\tthis._visualizer.showFingering(\r\n\t\t\tvng.noteGroup.visibleNotes[0].displayCents);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._scoreViewer.event.on(this._onScoreViewerEvent);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tif (this._scoreViewer != null){\r\n\t\t\tthis._scoreViewer.event.off(this._onScoreViewerEvent);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic get showingFingerings():boolean {\r\n\t\treturn this._visualizer != null;\r\n\t}\r\n}","import { InstrumentDO } from \"score_data\";\r\nimport { IFingeringVisualizer } from \"./IFingeringVisualizer\";\r\nimport { RecorderFingeringVisualizer } from \"./RecorderFingeringVisualizer\";\r\n\r\nexport abstract class IFingeringVisualizerFactory {\r\n\t/**Creates the [IFingeringVisualizer] for the requested instrument. If\r\n\tthe instrument has no matching visualizer, must return [null].*/\r\n\tabstract create(inst:InstrumentDO):IFingeringVisualizer;\r\n}\r\n\r\nexport class FingeringVisualizerFactory implements IFingeringVisualizerFactory {\r\n\tpublic create(inst:InstrumentDO):IFingeringVisualizer {\r\n\t\tswitch(inst.id){\r\n\t\t\tcase 3: case 4:\tcase 300: case 301:\tcase 302: case 303:\r\n\t\t\t\treturn new RecorderFingeringVisualizer(inst);\r\n\t\t\tdefault:\r\n\t\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n}","import { DestinationAudioComponent, ReverbAudioComponent } from \"audio_output\";\r\nimport { AudioContextManager, SoundLoader } from \"audio_utils\";\r\nimport { Application, Container, Sprite, Ticker } from \"pixi.js\";\r\nimport { DynamicType, DynamicVolumeMap } from \"score_data\";\r\nimport { SFDriverConfig, SFScoreDriver } from \"score_performance\";\r\nimport { BitmapMusicRenderer, PixiAppHelper } from \"score_render\";\r\nimport { SoundLibManager, SoundLibType } from \"sound_lib\";\r\nimport { BrowserUtils } from \"ts_utils\";\r\nimport { AppSettings } from \"../settings/AppSettings\";\r\nimport { AppContainer } from \"../ui/AppContainer\";\r\nimport { pixiAppHelper, setMainPixiApp } from \"../ui/pixi_apps\";\r\nimport { RaAssessorFactory } from \"./RaAssessorFactory\";\r\nimport { RAControls } from \"./RAControls\";\r\nimport { RAPlayer } from \"./RAPlayer\";\r\n\r\nexport class PlayerInitializer {\r\n\tprivate _playerUi:HTMLDivElement;\r\n\tprivate _container:Container;\r\n\tprivate _driver:SFScoreDriver;\r\n\t\r\n\tpublic get raControls() { return this._raControls; }\r\n\tprivate _raControls:RAControls;\r\n\t\r\n\tpublic get raPlayer() { return this._raPlayer; }\r\n\tprivate _raPlayer:RAPlayer;\r\n\t\r\n\t//should create SFLoopDriver and pass to both NotationPlayer and \r\n\t//LoopSequencer\r\n\tconstructor(){\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic async loadApplication():Promise {\r\n\t\tthis._playerUi = AppContainer.get().playerUi;\r\n\t\tawait this._createStage();\r\n\t\tawait this._createDriver();\r\n\t\tawait this._createPlayer();\r\n\t}\r\n\t\r\n\tprivate async _createStage():Promise {\r\n\t\tlet canvasDiv = this._playerUi.querySelector('#p-score-stageDiv');\r\n\t\tlet canvas = this._playerUi.querySelector('#stageCanvas');\r\n\t\t\r\n\t\t//create the app and main container\r\n\t\tlet app = new Application();\r\n\t\tawait app.init({\r\n\t\t\tcanvas: canvas as HTMLCanvasElement,\r\n\t\t\tbackgroundColor: 0xFFFFFF,\r\n\t\t\tantialias: true,\r\n\t\t\tsharedTicker: false\r\n\t\t});\r\n\t\t\r\n\t\tTicker.shared.stop();\r\n\t\tTicker.system.stop();\r\n\t\t\r\n\t\tlet pah = new PixiAppHelper(app);\r\n\t\t\r\n\t\tpah.renderOnRequest = true;\r\n\t\tpah.setAutoResizeElement(canvasDiv as HTMLDivElement);\r\n\t\tpah.enableAutoResize();\r\n\t\t\r\n\t\tthis._container = new Container();\r\n\t\tapp.stage.addChild(this._container);\r\n\t\t\r\n\t\tsetMainPixiApp(pah);\r\n\t}\r\n\t\r\n\tprivate async _createDriver():Promise {\r\n\t\tlet r:string = AppSettings.resourcesPath;\r\n\t\tlet isSafari = BrowserUtils.isSafari();\r\n\t\tlet mapPath:string = isSafari\r\n\t\t\t? `${r}sounds/mslib_sfz/map_safari.json`\r\n\t\t\t: `${r}sounds/mslib_sfz/map.json`;\r\n\t\t\t\r\n\t\tAudioContextManager.initContext();\r\n\t\tlet ctx = AudioContextManager.context;\r\n\t\tlet destination = new DestinationAudioComponent(ctx);\r\n\t\t\r\n\t\tlet reverbComponent = new ReverbAudioComponent(ctx);\r\n\t\tlet reverbUrl = `${r}sounds/IMreverbs/Five_Columns_Long.wav`;\r\n\t\tlet impulseBuffer = await SoundLoader.getAudioBufferFromUrl(reverbUrl,\r\n\t\t\tAudioContextManager.context);\r\n\t\treverbComponent.setReverbImpulse(impulseBuffer);\r\n\t\treverbComponent.connect(destination);\r\n\t\t\r\n\t\tDynamicType.volumeMap = new DynamicVolumeMap();\r\n\t\tDynamicType.volumeMap.PPPP = 0.05;\r\n\t\tDynamicType.volumeMap.PPP = 0.1;\r\n\t\tDynamicType.volumeMap.PP = 0.15;\r\n\t\tDynamicType.volumeMap.P = 0.25;\r\n\t\tDynamicType.volumeMap.MP = 0.35;\r\n\t\tDynamicType.volumeMap.MF = 0.45;\r\n\t\tDynamicType.volumeMap.F = 0.55;\r\n\t\tDynamicType.volumeMap.FF = 0.65;\r\n\t\tDynamicType.volumeMap.FFF = 0.75;\r\n\t\tDynamicType.volumeMap.FFFF = 0.85;\r\n\t\t\r\n\t\tBitmapMusicRenderer.maxRenderers = 1;\r\n\t\t\r\n\t\tlet config = new SFDriverConfig(SoundLibType.SFZ, { \r\n\t\t\tsoundMapPath: mapPath,\r\n\t\t\tloadMapOnInit: false,\r\n\t\t\tloadPresetsOnInit: false });\r\n\t\tconfig.outputComponent = reverbComponent;\r\n\t\t\r\n\t\tthis._driver = await SFScoreDriver.create(pixiAppHelper, ctx, config);\r\n\t\tSoundLibManager.get().dbName = \"musicShareDb\";\r\n\t\tawait this._driver.loadSoundMap(mapPath);\r\n\t\tawait this._driver.loadPresets(null);\r\n\t}\r\n\t\r\n\tprivate async _createPlayer():Promise {\r\n\t\tthis._raPlayer = new RAPlayer(this._driver, this._container);\r\n\t\t\r\n\t\tlet assessFactory = new RaAssessorFactory();\r\n\t\tawait assessFactory.loadAnimations();\r\n\t\tthis._driver.assessorFactory = assessFactory;\r\n\t\t\r\n\t\tlet controlsUi = this._playerUi.querySelector('#p-headScoreFoot') as\r\n\t\t\tHTMLDivElement;\r\n\t\tthis._raControls = new RAControls(controlsUi, this._raPlayer);\r\n\t}\r\n}","import { registerVersion } from '@firebase/app';\nexport * from '@firebase/app';\n\nvar name = \"firebase\";\nvar version = \"9.6.6\";\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nregisterVersion(name, version, 'app');\n//# sourceMappingURL=index.esm.js.map\n","import { initializeApp, getApps } from 'firebase/app';\r\n\r\n/**Call static [initializeFirebase] method to initialize.*/\r\nexport class FbInit {\r\n\t\r\n\tprivate static _isInitialized:boolean = false;\r\n\t\r\n\t/**initializes Firebase with client settings*/\r\n\tpublic static async initializeFirebase(enableFirestorePersistence:boolean)\r\n\t\t\t:Promise {\r\n\t\tif (FbInit._isInitialized){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\ttry {\r\n\t\t\tif (getApps().length > 0){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\r\n\t\t\tlet fbSettings = window['firebase_settings'];\r\n\t\t\t\r\n\t\t\tinitializeApp({\r\n\t\t\t\tapiKey: fbSettings[\"apiKey\"],\r\n\t\t\t\tauthDomain: fbSettings[\"authDomain\"],\r\n\t\t\t\t// databaseURL: fbSettings[\"databaseURL\"],\r\n\t\t\t\tprojectId: fbSettings[\"projectId\"],\r\n\t\t\t\tstorageBucket: fbSettings[\"storageBucket\"],\r\n\t\t\t\t// messagingSenderId: fbSettings[\"messagingSenderId\"]\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\t// if (enableFirestorePersistence){\r\n\t\t\t// \tlet fs = getFirestore();\r\n\t\t\t// \tawait enableIndexedDbPersistence(fs);\r\n\t\t\t// }\r\n\t\t\t\r\n\t\t\tFbInit._isInitialized = true;\r\n\t\t}\r\n\t\tcatch(err){\r\n\t\t\tconsole.log(`Firebase Init Error: ${err}`);\r\n\t\t}\r\n\t}\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { Student } from \"./Student\";\r\nimport { StudentManager } from \"./StudentManager\";\r\nimport { Services } from \"../services/Services\";\r\nimport { TeamDO } from \"./TeamDO\";\r\nimport { RdtoMessage } from \"ts_utils\";\r\nimport { addStudentDg } from \"../ui/templates/addStudentTemplates\";\r\n\r\n/**Displays a dialog interface for adding a new student. Dispatches an event to\r\n * [onEvent] Stream. If a new [Student] object is created, it is passed to the\r\n * [onEvent] handler function.*/\r\nexport class AddStudentDialog {\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _nameInput:HTMLInputElement;\r\n\tprivate _yesRbtn:HTMLInputElement;\r\n\tprivate _noRbtn:HTMLInputElement;\r\n\tprivate _codeInput:HTMLInputElement;\r\n\tprivate _infoDiv:HTMLDivElement;\r\n\tprivate _saveBtn:HTMLButtonElement;\r\n\tprivate _cancelBtn:HTMLButtonElement;\r\n\t\r\n\tprivate _team:TeamDO;\r\n\t\r\n\tpublic get studentEvent() { return this._studentEmitter.event; }\r\n\tprivate _studentEmitter = createEmitter();\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._draw();\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\tthis._ui = Templates.createDiv(addStudentDg);\r\n\t\tthis._nameInput = this._ui.querySelector(\".studentdg-nameInput\");\r\n\t\tthis._codeInput = this._ui.querySelector(\".studentdg-codeInput\");\r\n\t\tthis._infoDiv = this._ui.querySelector(\".studentdg-info\");\r\n\t\tthis._saveBtn = this._ui.querySelector(\".studentdg-saveBtn\");\r\n\t\tthis._cancelBtn = this._ui.querySelector(\".studentdg-cancelBtn\");\r\n\t\t\r\n\t\tlet rbuttons = Array.from(this._ui.querySelectorAll(\r\n\t\t\t\"input[name=codeQuestion]\") as NodeListOf);\r\n\t\tthis._yesRbtn = rbuttons.find((r) => r.value === \"yes\");\r\n\t\tthis._noRbtn = rbuttons.find((r) => r.value === \"no\");\r\n\t\t\t\r\n\t\tthis._codeInput.disabled = true;\r\n\t\t\r\n\t\tdocument.body.append(this._ui);\r\n\t}\r\n\t\r\n\tprivate _setMessage(message:string):void {\r\n\t\tthis._infoDiv.innerHTML = message;\r\n\t}\r\n\t\r\n\tprivate _onCodeQuestionChange = (e:Event):void => {\r\n\t\tif (this._yesRbtn.checked){\r\n\t\t\tthis._codeInput.disabled = false;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._codeInput.disabled = true;\r\n\t\t\tthis._codeInput.value = \"\";\r\n\t\t}\t\t\r\n\t}\r\n\t\r\n\tprivate _onSaveBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tlet name:string = this._nameInput.value;\r\n\t\tlet code:string = (this._yesRbtn.checked)? this._codeInput.value : \"\";\r\n\t\tlet success = await this._validateFields(name, code);\r\n\t\tif (!success){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tlet student = StudentManager.createStudent(name, this._team);\r\n\t\tStudentManager.saveToStorage(true);\r\n\t\tthis._finish(student);\r\n\t}\r\n\t\r\n\tprivate async _validateFields(name:string, code:string):Promise {\r\n\t\tif (name.length < 1){\r\n\t\t\tthis._setMessage(\"Enter a name\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (StudentManager.students.filter((s) => s.name === name).length > 0){\r\n\t\t\tthis._setMessage(\"A user with this name already exists.\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (!this._yesRbtn.checked && !this._noRbtn.checked){\r\n\t\t\tthis._setMessage(\"Did your teacher give you a team code?\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// student can create name with no team, but if a code is provided, it\r\n\t\t// must match a team.\r\n\t\tif (this._yesRbtn.checked){\r\n\t\t\tlet rdto = await Services.getTeamByCode(code);\r\n\t\t\tif (rdto.success){\r\n\t\t\t\tthis._team = TeamDO.fromTeamDto(rdto.data);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (rdto.message === RdtoMessage.NOT_FOUND){\r\n\t\t\t\t\tthis._setMessage(\"No team with this code exists.\");\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tprivate _onCancelBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._finish(null);\r\n\t}\r\n\t\r\n\tprivate _finish(student:Student):void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._ui.remove();\r\n\t\tthis._studentEmitter.emit(student);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._yesRbtn.addEventListener(\"change\", this._onCodeQuestionChange);\r\n\t\tthis._noRbtn.addEventListener(\"change\", this._onCodeQuestionChange);\r\n\t\tthis._saveBtn.addEventListener(\"click\", this._onSaveBtnClick);\r\n\t\tthis._cancelBtn.addEventListener(\"click\", this._onCancelBtnClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._yesRbtn.removeEventListener(\"change\", this._onCodeQuestionChange);\r\n\t\tthis._noRbtn.removeEventListener(\"change\", this._onCodeQuestionChange);\r\n\t\tthis._saveBtn.removeEventListener(\"click\", this._onSaveBtnClick);\r\n\t\tthis._cancelBtn.removeEventListener(\"click\", this._onCancelBtnClick);\r\n\t}\r\n}","export const addStudentDg = `\r\n
\r\n\t
\r\n\t\t
Add Name
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\tEnter a unique name for yourself.\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\tDo you have a team code?\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n
\r\n`;","export class UserRole {\r\n\tpublic static ADMIN:number = 0;\r\n\tpublic static MODERATOR:number = 1;\r\n\tpublic static USER:number = 2;\r\n}","import { UserDTO } from \"./dtos\";\r\nimport { UserRole } from \"./UserRole\";\r\n\r\nexport class AppUser {\r\n\t/**id in db*/\r\n\tpublic userId:number;\r\n\t/**id from Firebase auth*/\r\n\tpublic fbUserId:string;\r\n\tpublic displayName:string;\r\n\tpublic role:number = UserRole.USER;\r\n\t\r\n\tpublic updateFromUserDTO(dto:UserDTO):void {\r\n\t\tthis.userId = dto.userId;\r\n\t\tthis.fbUserId = dto.fbUserId;\r\n\t\tthis.displayName = dto.displayName;\r\n\t\tthis.role = dto.role;\r\n\t}\r\n}","export function show(el:HTMLElement):void {\r\n\tel.classList.remove(\"shacc-hide\");\r\n}\r\n\r\nexport function hide(el:HTMLElement):void {\r\n\tel.classList.add(\"shacc-hide\");\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { ValidationUtils } from \"ts_utils\";\r\nimport { FbAuth } from \"../../services/firebase/FbAuth\";\r\nimport { UserManager } from \"../UserManager\";\r\nimport * as uih from \"./UiHelper\";\r\n\r\nexport class CreateAccountView {\r\n\t\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _emailInput:HTMLInputElement;\r\n\tprivate _passwordInput:HTMLInputElement;\r\n\tprivate _confirmPasswordInput:HTMLInputElement;\r\n\t\r\n\tprivate _messageDiv:HTMLDivElement;\r\n\t\r\n\tprivate _createAccountBtn:HTMLButtonElement;\r\n\tprivate _cancelBtn:HTMLButtonElement;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tuih.hide(this._ui);\r\n\t\t\r\n\t\tthis._emailInput = this._ui.querySelector(\"#cav-emailInput\");\r\n\t\tthis._passwordInput = this._ui.querySelector(\"#cav-passwordInput\");\r\n\t\tthis._confirmPasswordInput = this._ui.querySelector(\r\n\t\t\t\"#cav-confirmPasswordInput\");\r\n\t\t\r\n\t\tthis._messageDiv = this._ui.querySelector(\".shacc-message\");\r\n\t\tuih.hide(this._messageDiv);\r\n\t\t\r\n\t\tthis._createAccountBtn = this._ui.querySelector(\"#cav-createBtn\");\r\n\t\tthis._cancelBtn = this._ui.querySelector(\"#cav-cancelBtn\");\r\n\t}\r\n\t\r\n\tpublic activate():void {\r\n\t\tthis._emailInput.value = \"\";\r\n\t\tthis._passwordInput.value = \"\";\r\n\t\tthis._confirmPasswordInput.value = \"\";\r\n\t\t\r\n\t\tUserManager.get().hideLoadingOverlay();\r\n\t\tuih.hide(this._messageDiv);\r\n\t\tuih.show(this._ui);\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tpublic deactivate():void {\r\n\t\tuih.hide(this._ui);\r\n\t\tthis._removeListeners();\r\n\t}\r\n\t\r\n\tprivate _onCreateAccountBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tlet email:string = this._emailInput.value;\r\n\t\tlet password:string = this._passwordInput.value;\r\n\t\t\r\n\t\t\r\n\t\tif (password !== this._confirmPasswordInput.value){\r\n\t\t\tthis._messageDiv.innerHTML = \"Passwords don't match.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!ValidationUtils.isValidEmail(email)){\r\n\t\t\tthis._messageDiv.innerHTML = \"Please enter a valid email address.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!ValidationUtils.validatePassword(password).pass){\r\n\t\t\tthis._messageDiv.innerHTML = \"Password must contain upper and \" +\r\n\t\t\t\t\"lower case letters and at least one number\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tthis._removeListeners();\r\n\t\tUserManager.get().showLoadingOverlay();\r\n\t\tawait this._createUserViaService(email, password);\t\r\n\t}\r\n\t\r\n\tprivate _onCancelBtnClick = (e:MouseEvent):void => {\r\n\t\tlet event = new CreateAccountViewEvent();\r\n\t\tevent.type = CreateAccountViewEventType.canceled;\r\n\t\tthis._emitter.emit(event);\r\n\t}\r\n\t\r\n\tprivate async _createUserViaService(email:string, password:string)\r\n\t\t\t:Promise {\r\n\t\ttry {\r\n\t\t\tawait FbAuth.createUserWithEmailAndPassword(email, password);\r\n\t\t\tlet event = new CreateAccountViewEvent()\r\n\t\t\tevent.type = CreateAccountViewEventType.accountCreated;\r\n\t\t\tthis._emitter.emit(event);\r\n\t\t}\r\n\t\tcatch (err) {\r\n\t\t\tconsole.log(err);\r\n\t\t\tUserManager.get().hideLoadingOverlay();\r\n\t\t\tthis._addListeners();\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._createAccountBtn.addEventListener(\"click\",\r\n\t\t\tthis._onCreateAccountBtnClick);\r\n\t\tthis._cancelBtn.addEventListener(\"click\", this._onCancelBtnClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._createAccountBtn.removeEventListener(\"click\",\r\n\t\t\tthis._onCreateAccountBtnClick);\r\n\t\tthis._cancelBtn.removeEventListener(\"click\", this._onCancelBtnClick);\r\n\t}\r\n}\r\n\r\nexport class CreateAccountViewEvent {\r\n\tpublic type:CreateAccountViewEventType;\r\n}\r\n\r\nexport enum CreateAccountViewEventType {\r\n\taccountCreated,\r\n\tcanceled\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { FbAuth } from \"../../services/firebase/FbAuth\";\r\nimport { UserManager } from \"../UserManager\";\r\nimport * as uih from \"./UiHelper\";\r\n\r\nexport class EmailConfirmationView {\r\n\t\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _instructionsDiv:HTMLDivElement;\r\n\tprivate _resendLink:HTMLAnchorElement;\r\n\t\r\n\tprivate _continueBtn:HTMLButtonElement;\r\n\tprivate _signoutLink:HTMLAnchorElement;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tuih.hide(this._ui);\r\n\t\t\r\n\t\tthis._instructionsDiv = this._ui.querySelector(\"#ecv-instructions\");\r\n\t\tthis._resendLink = this._ui.querySelector(\"#ecv-resendLink\");\r\n\t\t\r\n\t\tthis._continueBtn = this._ui.querySelector(\"#ecv-continueBtn\");\r\n\t\tthis._signoutLink = this._ui.querySelector(\"#ecv-signoutLink\");\r\n\t}\r\n\t\r\n\tpublic activate():void {\r\n\t\tUserManager.get().hideLoadingOverlay();\r\n\t\tuih.show(this._ui);\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tpublic deactivate():void {\r\n\t\tuih.hide(this._ui);\r\n\t\tthis._removeListeners();\r\n\t}\r\n\t\r\n\t\r\n\tprivate _onResendLinkClick = async (e:MouseEvent):Promise => {\r\n\t\tawait this._sendEmailVerification();\r\n\t}\r\n\t\r\n\tprivate async _sendEmailVerification():Promise {\r\n\t\tthis._removeListeners();\r\n\t\tlet userManager = UserManager.get();\r\n\t\tuserManager.showLoadingOverlay();\r\n\t\tlet success:boolean = await FbAuth.sendEmailVerification();\r\n\t\tthis._addListeners();\r\n\t\tuserManager.hideLoadingOverlay();\r\n\t\t// TODO: use a message div instead of _instructionsDiv\r\n\t\t// _instructionsDiv.innerText = success\r\n\t\t// \t? \"The email has been resent to your address. After clicking to \"\r\n\t\t// \t\t\"confirm, return here and click Continue.\"\r\n\t\t// \t: \"There was a problem sending the confirmation email.\";\r\n\t\t\t\r\n\t}\r\n\t\r\n\tprivate _onContinueBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tawait FbAuth.reloadUser();\r\n\t\tif (FbAuth.emailVerified()){\r\n\t\t\tthis._emitter.emit(EmailConfirmationViewEvent.confirmed);\r\n\t\t}\t\r\n\t}\r\n\t\r\n\tprivate _onSignoutLinkClick = (e:MouseEvent):void => {\r\n\t\tthis._removeListeners();\r\n\t\tthis._emitter.emit(EmailConfirmationViewEvent.signoutRequest);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._resendLink.addEventListener(\"click\", this._onResendLinkClick);\r\n\t\tthis._continueBtn.addEventListener(\"click\", this._onContinueBtnClick);\r\n\t\tthis._signoutLink.addEventListener(\"click\", this._onSignoutLinkClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._resendLink.removeEventListener(\"click\", this._onResendLinkClick);\r\n\t\tthis._continueBtn.removeEventListener(\"click\",\r\n\t\t\tthis._onContinueBtnClick);\r\n\t\tthis._signoutLink.removeEventListener(\"click\",\r\n\t\t\tthis._onSignoutLinkClick);\r\n\t}\r\n}\r\n\r\nexport enum EmailConfirmationViewEvent {\r\n\tconfirmed,\r\n\tsignoutRequest\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { ValidationUtils } from \"ts_utils\";\r\nimport { CreateUserDTO } from \"../../data/dtos\";\r\nimport { UserRole } from \"../../data/UserRole\";\r\nimport { FbAuth } from \"../../services/firebase/FbAuth\";\r\nimport { Services } from \"../../services/Services\";\r\nimport { UserManager } from \"../UserManager\";\r\nimport * as uih from \"./UiHelper\";\r\n\r\nexport class FinishAccountView {\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _usernameInput:HTMLInputElement;\r\n\t\r\n\tprivate _finishAccountBtn:HTMLButtonElement;\r\n\tprivate _signoutLink:HTMLAnchorElement;\r\n\tprivate _messageDiv:HTMLDivElement;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tuih.hide(this._ui);\r\n\t\t\r\n\t\tthis._usernameInput = this._ui.querySelector(\"#fav-usernameInput\");\r\n\t\t\r\n\t\tthis._messageDiv = this._ui.querySelector(\".shacc-message\");\r\n\t\tuih.hide(this._messageDiv);\r\n\t\t\t\r\n\t\tthis._finishAccountBtn = \r\n\t\t\tthis._ui.querySelector(\"#fav-finishAccountBtn\");\r\n\t\tthis._signoutLink = this._ui.querySelector(\"#fav-signoutLink\");\r\n\t}\r\n\t\r\n\tpublic activate():void {\r\n\t\tuih.show(this._ui);\r\n\t\tthis._usernameInput.value = \"\";\r\n\t\tuih.hide(this._messageDiv);\r\n\t\tUserManager.get().hideLoadingOverlay();\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tpublic deactivate():void {\r\n\t\tuih.hide(this._ui);\r\n\t\tthis._removeListeners();\r\n\t}\r\n\t\r\n\tprivate _onFinishAccountBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tuih.hide(this._messageDiv);\r\n\t\tlet username:string = this._usernameInput.value.trim();\r\n\t\tif (ValidationUtils.isValidUsername(username)){\r\n\t\t\tthis._removeListeners();\r\n\t\t\tUserManager.get().showLoadingOverlay();\r\n\t\t\tawait this._createUserOnServer(username);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._messageDiv.innerHTML = \"Name must begin with a letter and \" +\r\n\t\t\t\t\"contain only letters and numbers.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onSignoutLinkClick = (e:MouseEvent):void => {\r\n\t\tthis._emitter.emit(FinishAccountViewEvent.signoutRequest);\r\n\t}\r\n\t\r\n\tprivate async _createUserOnServer(displayName:string):Promise {\r\n\t\tlet user = FbAuth.getCurrentUser();\r\n\t\tlet dto = new CreateUserDTO();\r\n\t\tdto.email = user.email\r\n\t\tdto.fbUserId = user.uid\r\n\t\tdto.displayName = displayName\r\n\t\tdto.role = UserRole.USER;\r\n\t\tlet rdto = await Services.createUser(dto);\r\n\t\tif (!rdto.success){\r\n\t\t\tthis._displayFailMessage(rdto.message);\r\n\t\t\tthis._addListeners();\r\n\t\t\tUserManager.get().hideLoadingOverlay();\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._emitter.emit(FinishAccountViewEvent.accountFinished);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _displayFailMessage(message:string):void {\r\n\t\tif (message === \"already exists\"){\r\n\t\t\tthis._messageDiv.innerHTML = \"This account already exists. Try \" +\r\n\t\t\t\t\"signing out and signing back in.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t}\r\n\t\telse if (message === \"username exists\"){\r\n\t\t\tthis._messageDiv.innerHTML = \"This display name is already \"\r\n\t\t\t\t\"taken. Try a different name, or try adding numbers to your \" +\r\n\t\t\t\t\"name to find a unique name\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._finishAccountBtn.addEventListener(\"click\",\r\n\t\t\tthis._onFinishAccountBtnClick);\r\n\t\tthis._signoutLink.addEventListener(\"click\", this._onSignoutLinkClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._finishAccountBtn.removeEventListener(\"click\",\r\n\t\t\tthis._onFinishAccountBtnClick);\r\n\t\tthis._signoutLink.removeEventListener(\"click\",\r\n\t\t\tthis._onSignoutLinkClick);\r\n\t}\r\n}\r\n\r\nexport enum FinishAccountViewEvent {\r\n\taccountFinished,\r\n\tsignoutRequest\r\n}","export class SubRemover {\r\n\tprivate _entries:SubRemoverEntry[];\r\n\t\r\n\tconstructor(){\r\n\t\tthis._entries = [];\r\n\t}\r\n\t\r\n\t/**saves the entry for removal and also calls addEventListener to create\r\n\t * the sub*/\r\n\tpublic add(context:EventTarget, eventType:string,\r\n\t\t\tcallback:EventListenerOrEventListenerObject){\r\n\t\tcontext.addEventListener(eventType, callback);\r\n\t\tthis._entries.push({ context, eventType, callback} );\r\n\t}\r\n\t\r\n\t/**saves the entry for removal without calling addEventListener */\r\n\tpublic store(context:EventTarget, eventType:string,\r\n\t\t\tcallback:EventListenerOrEventListenerObject):void {\r\n\t\tthis._entries.push({ context, eventType, callback} );\r\n\t}\r\n\t\r\n\t/**removes any entries with matching parameters and also calls\r\n\t * removeEventListener */\r\n\tpublic remove(context:EventTarget, eventType:string,\r\n\t\t\tcallback:EventListenerOrEventListenerObject):void {\r\n\t\tcontext.removeEventListener(eventType, callback);\r\n\t\tfor (let i = this._entries.length - 1; i >= 0; i--){\r\n\t\t\tlet e = this._entries[i];\r\n\t\t\tif (e.context === context && e.eventType === eventType &&\r\n\t\t\t\t\te.callback === callback){\r\n\t\t\t\tthis._entries.splice(i, 1);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**calls removeEventListener for all stored entries */\r\n\tpublic removeAllSubs():void {\r\n\t\tfor (let e of this._entries){\r\n\t\t\te.context.removeEventListener(e.eventType, e.callback);\r\n\t\t}\r\n\t\tthis._entries = [];\r\n\t}\r\n}\r\n\r\ntype SubRemoverEntry = {\r\n\tcontext:EventTarget,\r\n\teventType:string,\r\n\tcallback:EventListenerOrEventListenerObject\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { SubRemover } from \"../utilities/SubRemover\";\r\nimport { Templates } from \"./Templates\";\r\nimport { confirmationDg } from \"./templates/confirmationTemplates\";\r\n\r\nexport class ConfirmationBox {\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _resolve:(confirmed:boolean) => void;\r\n\t\r\n\tprivate _sr:SubRemover = new SubRemover();\r\n\t\r\n\tpublic get select() { return this._selectionEemitter.event; }\r\n\tprivate _selectionEemitter = createEmitter();\r\n\t\r\n\t/**displays a message for the length of time requested\r\n\t * @param message - the message to display\r\n\t * @param msDuration - the duration, in milliseconds*/\r\n\tconstructor(msg:string){\r\n\t\tthis._ui = Templates.createDiv(confirmationDg);\r\n\t\tthis._ui.querySelector(\".cfm-message\").innerHTML = msg;\r\n\t\tdocument.body.append(this._ui);\r\n\t\t\r\n\t\tlet okayBtn:HTMLButtonElement = this._ui.querySelector(\r\n\t\t\t'.cfm-confirm-ok');\r\n\t\tlet cancelBtn:HTMLButtonElement = this._ui.querySelector(\r\n\t\t\t'.cfm-confirm-cancel');\r\n\t\t\r\n\t\tthis._sr.add(okayBtn, \"click\", this._onConfirmClick);\r\n\t\tthis._sr.add(cancelBtn, \"click\", this._onCancelClick);\r\n\t}\r\n\t\r\n\tpublic awaitConfirmation():Promise {\r\n\t\treturn new Promise((resolve, reject) => {\r\n\t\t\tthis._resolve = resolve;\r\n\t\t});\r\n\t}\r\n\t\r\n\tpublic setWidth(widthStr:string){\r\n\t\tthis._ui.style.width = widthStr;\r\n\t}\r\n\t\r\n\tprivate _onConfirmClick = (e:MouseEvent):void => {\r\n\t\tthis._finish(true);\r\n\t}\r\n\t\r\n\tprivate _onCancelClick = (e:MouseEvent):void => {\r\n\t\tthis._finish(false);\r\n\t}\r\n\t\r\n\tprivate _finish(confirmed:boolean):void {\r\n\t\tthis._sr.removeAllSubs();\r\n\t\tthis._selectionEemitter.emit(confirmed);\r\n\t\tif (this._resolve != null){\r\n\t\t\tthis._resolve(confirmed);\r\n\t\t}\r\n\t\tthis._ui.remove();\r\n\t}\r\n}","export const confirmationDg = `\r\n
\r\n\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\t
\r\n
\r\n`;","import { Templates } from \"./Templates\";\r\n\r\nexport class TimedMessageBox {\r\n\tprivate static readonly uiTemplate:string =\r\n\t\t'
';\r\n\t\r\n\t/**displays a message for the length of time requested\r\n\t * @param message - the message to display\r\n\t * @param msDuration - the duration, in milliseconds*/\r\n\tconstructor(message:string,\r\n\t\t\tmsDuration:number, { \r\n\t\t\ttextAlign = \"center\"}: { \r\n\t\t\t\ttextAlign?:string}){\r\n\t\tlet div = Templates.createDiv(TimedMessageBox.uiTemplate);\r\n\t\tdiv.innerHTML = message;\r\n\t\tdiv.style.textAlign = textAlign;\r\n\t\tdocument.body.append(div);\r\n\t\tsetTimeout(() => div.remove(), msDuration);\r\n\t}\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { AppUser } from \"../../data/AppUser\";\r\nimport { Services } from \"../../services/Services\";\r\nimport { ConfirmationBox } from \"../../ui/ConfirmationBox\";\r\nimport { UserManager } from \"../UserManager\";\r\nimport * as uih from \"./UiHelper\";\r\nimport { TimedMessageBox } from \"../../ui/TimedMessageBox\";\r\n\r\nexport class ManageAccountView {\r\n\t\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _welcomeDiv:HTMLDivElement;\r\n\t\r\n\tprivate _deleteAccountLink:HTMLAnchorElement;\r\n\tprivate _closeBtn:HTMLButtonElement;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t\tuih.hide(this._ui);\r\n\t\t\r\n\t\tthis._welcomeDiv = this._ui.querySelector(\"#mav-welcome\");\r\n\t\tthis._deleteAccountLink = this._ui.querySelector(\r\n\t\t\t\"#mav-deleteAccountLink\");\r\n\t\tthis._closeBtn = this._ui.querySelector(\"#mav-closeBtn\");\r\n\t}\r\n\t\r\n\tpublic activate(user:AppUser):void {\r\n\t\tuih.show(this._ui);\r\n\t\tUserManager.get().hideLoadingOverlay();\r\n\t\tthis._welcomeDiv.innerHTML = `Welcome, ${user.displayName}!`;\r\n\t\tthis._enableUI();\r\n\t}\r\n\t\r\n\tpublic deactivate():void {\r\n\t\tuih.hide(this._ui);\r\n\t\tthis._disableUI();\r\n\t}\r\n\t\r\n\tprivate _enableUI():void {\r\n\t\tthis._closeBtn.disabled = false;\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tprivate _disableUI():void {\r\n\t\tthis._closeBtn.disabled = true;\r\n\t\tthis._removeListeners();\r\n\t}\r\n\t\r\n\tprivate _onDeleteAccountLinkClick = async (e:MouseEvent):Promise => {\r\n\t\tthis._disableUI();\r\n\t\tlet confirmationBox = new ConfirmationBox(\"Confirm that you want to \" +\r\n\t\t\t\"completely delete your account. This can not be undone.\");\r\n\t\tlet deleteAccount = await confirmationBox.awaitConfirmation();\r\n\t\tif (deleteAccount === true){\r\n\t\t\tlet result = await Services.removeUser(UserManager.get().userId);\r\n\t\t\tif (result.success){\r\n\t\t\t\twindow.location.reload();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\telse if (result.message === \"hasTeams\"){\r\n\t\t\t\tnew TimedMessageBox(\"You must remove all teams from your \" +\r\n\t\t\t\t\t\"account before removing your user account\", 4000, {});\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis._enableUI();\r\n\t}\r\n\t\r\n\tprivate _onCloseBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._emitter.emit(ManageAccountViewEvent.closeRequest);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._deleteAccountLink.addEventListener(\"click\",\r\n\t\t\tthis._onDeleteAccountLinkClick);\r\n\t\tthis._closeBtn.addEventListener(\"click\", this._onCloseBtnClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._deleteAccountLink.removeEventListener(\"click\",\r\n\t\t\tthis._onDeleteAccountLinkClick);\r\n\t\tthis._closeBtn.removeEventListener(\"click\", this._onCloseBtnClick);\r\n\t}\r\n}\r\n\r\nexport enum ManageAccountViewEvent {\r\n\tmanageSubscriptionRequest,\r\n\tdeleteAccountRequest,\r\n\tcloseRequest\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { FbAuth } from \"../../services/firebase/FbAuth\";\r\nimport { UserManager } from \"../UserManager\";\r\nimport * as uih from \"./UiHelper\";\r\n\r\nexport class SignInView {\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _emailInput:HTMLInputElement;\r\n\tprivate _passwordInput:HTMLInputElement;\r\n\tprivate _resetLink:HTMLAnchorElement;\r\n\t\r\n\tprivate _messageDiv:HTMLDivElement;\r\n\t\r\n\tprivate _signInBtn:HTMLButtonElement;\r\n\tprivate _newAccountBtn:HTMLButtonElement;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t\tthis._init();\r\n\t}\r\n\tprivate _init():void {\r\n\t\tuih.hide(this._ui);\r\n\t\t\r\n\t\tthis._emailInput = this._ui.querySelector(\"#siv-emailInput\");\r\n\t\tthis._passwordInput = this._ui.querySelector(\"#siv-passwordInput\");\r\n\t\tthis._resetLink = this._ui.querySelector(\"#siv-resetLink\");\r\n\t\t\r\n\t\tthis._messageDiv = this._ui.querySelector(\".shacc-message\");\r\n\t\tuih.hide(this._messageDiv);\r\n\t\t\r\n\t\tthis._signInBtn = this._ui.querySelector(\"#siv-signInBtn\");\r\n\t\tthis._newAccountBtn = this._ui.querySelector(\"#siv-newAccountBtn\");\r\n\t}\r\n\t\r\n\tpublic activate():void {\r\n\t\tthis._emailInput.value = \"\";\r\n\t\tthis._passwordInput.value = \"\";\r\n\t\t\r\n\t\tUserManager.get().hideLoadingOverlay();\r\n\t\tuih.hide(this._messageDiv);\r\n\t\tuih.show(this._ui);\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tpublic deactivate():void {\r\n\t\tuih.hide(this._ui);\r\n\t\tthis._removeListeners();\r\n\t}\r\n\t\r\n\tprivate _onResetLinkClick = async (e:MouseEvent):Promise => {\r\n\t\tlet email:string = this._emailInput.value;\r\n\t\tif (email.length < 1){\r\n\t\t\tthis._messageDiv.innerHTML = \"Please enter your email address to \" +\r\n\t\t\t\t\"send a reset link.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._removeListeners();\r\n\t\tUserManager.get().showLoadingOverlay();\r\n\t\t\r\n\t\ttry {\r\n\t\t\tthis._messageDiv.innerHTML = \"\";\r\n\t\t\tawait FbAuth.sendPasswordResetEmail(email);\r\n\t\t\tthis._messageDiv.innerHTML = \"Check your email and follow the \"\r\n\t\t\t\t\"instructions to reset your password.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t}\r\n\t\tcatch (err){\r\n\t\t\tthis._messageDiv.innerHTML = \"Problem resetting your password.\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\tthis._addListeners();\r\n\t\t\tUserManager.get().hideLoadingOverlay();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onSignInBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tlet email:string = this._emailInput.value;\r\n\t\tlet password:string = this._passwordInput.value;\r\n\t\t\r\n\t\tthis._removeListeners();\r\n\t\tUserManager.get().showLoadingOverlay();\r\n\t\ttry {\r\n\t\t\tlet user = await FbAuth.signInWithEmailAndPassword(email, password);\r\n\t\t\tif (user == null){\r\n\t\t\t\tthis._messageDiv.innerHTML =\r\n\t\t\t\t\t\"Unrecognized username or password\";\r\n\t\t\t\tuih.show(this._messageDiv);\r\n\t\t\t\tthis._addListeners();\r\n\t\t\t\tUserManager.get().hideLoadingOverlay();\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (err) {\r\n\t\t\tconsole.log(err);\r\n\t\t\tthis._messageDiv.innerHTML = \"Unrecognized username or password\";\r\n\t\t\tuih.show(this._messageDiv);\r\n\t\t\tthis._addListeners();\r\n\t\t\tUserManager.get().hideLoadingOverlay();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onNewAccountBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._emitter.emit(SignInViewEvent.newAccountRequest);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._resetLink.addEventListener(\"click\", this._onResetLinkClick);\r\n\t\tthis._signInBtn.addEventListener(\"click\", this._onSignInBtnClick);\r\n\t\tthis._newAccountBtn.addEventListener(\"click\",\r\n\t\t\tthis._onNewAccountBtnClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._resetLink.removeEventListener(\"click\", this._onResetLinkClick);\r\n\t\tthis._signInBtn.removeEventListener(\"click\", this._onSignInBtnClick);\r\n\t\tthis._newAccountBtn.removeEventListener(\"click\",\r\n\t\t\tthis._onNewAccountBtnClick);\r\n\t}\r\n}\r\n\r\nexport enum SignInViewEvent {\r\n\tcanceled,\r\n\tnewAccountRequest\r\n}","import { getAuth, onAuthStateChanged, User } from \"firebase/auth\";\r\nimport { createEmitter } from \"ts_utils\";\r\nimport { AppUser } from \"../data/AppUser\";\r\nimport { UserDTO } from \"../data/dtos\";\r\nimport { UserRole } from \"../data/UserRole\";\r\nimport { FbAuth } from \"../services/firebase/FbAuth\";\r\nimport { Services } from \"../services/Services\";\r\nimport { CreateAccountView, CreateAccountViewEvent, CreateAccountViewEventType }\r\n\tfrom \"./ui/CreateAccountView\";\r\nimport { EmailConfirmationView, EmailConfirmationViewEvent }\r\n\tfrom \"./ui/EmailConfirmationView\";\r\nimport { FinishAccountView, FinishAccountViewEvent }\r\n\tfrom \"./ui/FinishAccountView\";\r\nimport { ManageAccountView, ManageAccountViewEvent }\r\n\tfrom \"./ui/ManageAccountView\";\r\nimport { SignInView, SignInViewEvent } from \"./ui/SignInView\";\r\nimport * as uih from \"./ui/UiHelper\";\r\n\r\nlet _ref:UserManager;\r\n\r\nexport class UserManager {\r\n\tprivate _currentUser:AppUser;\r\n\tprivate _communityMembers:Array;\r\n\t\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _signInView:SignInView;\r\n\tprivate _createAccountView:CreateAccountView;\r\n\tprivate _emailConfirmationView:EmailConfirmationView;\r\n\tprivate _finishAccountView:FinishAccountView;\r\n\tprivate _manageAccountView:ManageAccountView;\r\n\t\r\n\tpublic get initialSignInStatusRetrieved():boolean {\r\n\t\treturn this._initialSignInStatusRetrieved;\r\n\t}\r\n\tprivate _initialSignInStatusRetrieved:boolean = false;\r\n\t\r\n\tprivate _isActive:boolean = false;\r\n\tprivate _skipManageAccountView:boolean;\r\n\t\r\n\tprivate _sessionFinishedResolve: (appUser:AppUser) => void;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tpublic static SHOW_DEBUG_MESSAGES:boolean = false;\r\n\t\r\n\tprivate constructor(ui:HTMLDivElement){\r\n\t\t_ref = this;\r\n\t\tif (ui == null){\r\n\t\t\tthrow 'You must pass the ui HTMLDivElement on the first call to ' +\r\n\t\t\t\t'UserManager.get()';\r\n\t\t}\r\n\t\tthis._ui = ui;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tpublic static get(ui?:HTMLDivElement):UserManager {\r\n\t\tif (_ref == null){\r\n\t\t\tnew UserManager(ui);\r\n\t\t}\r\n\t\treturn _ref;\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\t// FirebaseServices.setAuthPersistence(fb.Persistence.NONE);\r\n\t\tonAuthStateChanged(getAuth(), this._onAuthStateChanged);\r\n\t\t\r\n\t\tthis._signInView = new SignInView(\r\n\t\t\tthis._ui.querySelector(\"#act-signInView\"));\r\n\t\tthis._createAccountView = new CreateAccountView(\r\n\t\t\tthis._ui.querySelector(\"#act-createAccountView\"));\r\n\t\tthis._emailConfirmationView = new EmailConfirmationView(\r\n\t\t\tthis._ui.querySelector(\"#act-emailConfirmationView\"));\r\n\t\tthis._finishAccountView = new FinishAccountView(\r\n\t\t\tthis._ui.querySelector(\"#act-finishAccountView\"));\r\n\t\tthis._manageAccountView = new ManageAccountView(\r\n\t\t\tthis._ui.querySelector(\"#act-manageAccountView\"));\r\n\t\t\r\n\t\tthis.hideLoadingOverlay();\r\n\t\t\r\n\t\tthis._signInView.event.on(this._onSignInViewEvent);\r\n\t\tthis._createAccountView.event.on(this._onCreateAccountViewEvent);\r\n\t\tthis._emailConfirmationView.event.on(\r\n\t\t\tthis._onEmailConfirmationViewEvent);\r\n\t\tthis._finishAccountView.event.on(this._onFinishAccountViewEvent);\r\n\t\tthis._manageAccountView.event.on(this._onManageAccountViewEvent);\r\n\t\t\r\n\t\tthis.deactivate();\r\n\t}\r\n\t\r\n\tpublic show():void {\r\n\t\tuih.show(this._ui);\r\n\t}\r\n\t\r\n\tpublic hide():void {\r\n\t\tuih.hide(this._ui);\r\n\t}\r\n\t\r\n\t/**loads and activates the appropriate account view state. This does not\r\n\t * display the UI - use [show] for that. Returns a [Future] that completes\r\n\t * when the user closes the ManageAccountView (after fully signing in), or\r\n\t * if [skipManageAccountView] is true, completes as soon as the user fully\r\n\t * signs in. A [UserManagerEventType.sessionFinished] [UserManagerEvent] is\r\n\t * also dispatched at the same time.*/\r\n\tpublic activate(skipManageAccountView:boolean):Promise {\r\n\t\tthis._skipManageAccountView = skipManageAccountView;\r\n\t\t\r\n\t\treturn new Promise((resolve, reject) => {\r\n\t\t\tif (!this._isActive){\r\n\t\t\t\tthis._sessionFinishedResolve = resolve;\r\n\t\t\t\tthis._updateView();\r\n\t\t\t\tthis._isActive = true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tresolve(this._currentUser);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t\r\n\tpublic activateManageAccount():void {\r\n\t\tif (this._currentUser != null){\r\n\t\t\tthis._manageAccountView.activate(this._currentUser);\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**deactivates and hides each view as well as the loading overlay. The\r\n\t * container is left on the display. Use [hide] to hide it.*/\r\n\tpublic deactivate():void {\r\n\t\tif (this._isActive){\r\n\t\t\tthis._isActive = false;\r\n\t\t\r\n\t\t\tthis._signInView.deactivate();\r\n\t\t\tthis._createAccountView.deactivate();\r\n\t\t\tthis._emailConfirmationView.deactivate();\r\n\t\t\tthis._finishAccountView.deactivate();\r\n\t\t\tthis._manageAccountView.deactivate();\r\n\t\t\tthis.hideLoadingOverlay();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**logs the user out of the application and Firebase. Does not log the user\r\n\t * out of Google.*/\r\n\tpublic async logout():Promise {\r\n\t\tif (FbAuth.getCurrentUser() != null){\r\n\t\t\tawait FbAuth.logout();\r\n\t\t\tthis._log('fb logout');\r\n\t\t}\r\n\t\tthis._currentUser = null;\r\n\t\tthis._log('currentUser now null');\r\n\t}\r\n\t\r\n\tpublic async refreshUserToken():Promise {\r\n\t\tawait FbAuth.getUserToken(true);\r\n\t}\r\n\t\r\n\tpublic showLoadingOverlay():void {\r\n\t\tuih.show(_ref._ui.querySelector(\".ani-loadingOverlay\"));\r\n\t}\r\n\t\r\n\tpublic hideLoadingOverlay():void {\r\n\t\tuih.hide(_ref._ui.querySelector(\".ani-loadingOverlay\"));\r\n\t}\r\n\t\r\n\tprivate _updateView():void {\r\n\t\tthis._signInView.deactivate();\r\n\t\tthis._createAccountView.deactivate();\r\n\t\tthis._emailConfirmationView.deactivate();\r\n\t\tthis._finishAccountView.deactivate();\r\n\t\tthis._manageAccountView.deactivate();\r\n\t\t\r\n\t\tif (!this._initialSignInStatusRetrieved){\r\n\t\t\tthis.showLoadingOverlay();\r\n\t\t}\r\n\t\telse if (FbAuth.getCurrentUser() == null){\r\n\t\t\tthis._signInView.activate();\r\n\t\t}\r\n\t\telse if (!FbAuth.emailVerified()){\r\n\t\t\tthis._emailConfirmationView.activate();\r\n\t\t}\r\n\t\telse if (this._currentUser == null){\r\n\t\t\tthis._finishAccountView.activate();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (this._skipManageAccountView){\r\n\t\t\t\tthis._sendFinishedNotification();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis._manageAccountView.activate(this._currentUser);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onAuthStateChanged = async (user:User):Promise => {\r\n\t\tthis._log(`fb auth changed - fbUser = ${user}`);\r\n\t\tthis._currentUser = null;\r\n\t\tif (user != null){\r\n\t\t\tthis._log('contacting backend...');\r\n\t\t\tthis._currentUser = await this._getUserDataFromService();\r\n\t\t\tthis._log(`backend result, currentUser = ${this._currentUser}`);\r\n\t\t}\r\n\t\tthis._initialSignInStatusRetrieved = true;\r\n\t\t\r\n\t\tthis._emitter.emit(\r\n\t\t\tnew UserManagerEvent(UserManagerEventType.authStateChanged));\r\n\t\t\r\n\t\tif (this._isActive){\r\n\t\t\tthis._updateView();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onSignInViewEvent = async (e:SignInViewEvent):Promise => {\r\n\t\tif (e === SignInViewEvent.newAccountRequest){\r\n\t\t\tthis._signInView.deactivate();\r\n\t\t\tthis._createAccountView.activate();\r\n\t\t}\r\n\t\telse if (e === SignInViewEvent.canceled){\r\n\t\t\tthis._sendFinishedNotification();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onCreateAccountViewEvent = async (e:CreateAccountViewEvent)\r\n\t\t\t:Promise => {\r\n\t\tif (e.type === CreateAccountViewEventType.accountCreated){\r\n\t\t\tawait FbAuth.sendEmailVerification();\r\n\t\t}\r\n\t\telse if (e.type === CreateAccountViewEventType.canceled){\r\n\t\t\tthis._createAccountView.deactivate();\r\n\t\t\tthis._signInView.activate();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onEmailConfirmationViewEvent = async (e:EmailConfirmationViewEvent)\r\n\t\t\t:Promise => {\r\n\t\tif (e === EmailConfirmationViewEvent.confirmed){\r\n\t\t\tthis._updateView();\r\n\t\t}\r\n\t\telse if (e === EmailConfirmationViewEvent.signoutRequest){\r\n\t\t\tawait this.logout();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onFinishAccountViewEvent = async (e:FinishAccountViewEvent)\r\n\t\t\t:Promise => {\r\n\t\tif (e === FinishAccountViewEvent.accountFinished){\r\n\t\t\tthis._currentUser = await this._getUserDataFromService();\r\n\t\t\tthis.hideLoadingOverlay();\r\n\t\t\tthis._updateView();\r\n\t\t}\r\n\t\telse if (e === FinishAccountViewEvent.signoutRequest){\r\n\t\t\tawait this.logout();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onManageAccountViewEvent = async (e:ManageAccountViewEvent)\r\n\t\t\t:Promise => {\r\n\t\tswitch (e){\r\n\t\t\tcase ManageAccountViewEvent.manageSubscriptionRequest:\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase ManageAccountViewEvent.deleteAccountRequest:\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase ManageAccountViewEvent.closeRequest:\r\n\t\t\t\tthis._sendFinishedNotification();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate async _getUserDataFromService():Promise {\r\n\t\tlet rdto = await Services.getUserInfo();\r\n\t\t\r\n\t\tif (rdto.success){\r\n\t\t\tlet appUser = new AppUser();\r\n\t\t\tappUser.updateFromUserDTO(rdto.data);\r\n\t\t\treturn appUser;\r\n\t\t}\r\n\t\t\r\n\t\treturn null;\r\n\t}\r\n\t\r\n\tprivate _sendFinishedNotification():void {\r\n\t\tlet ev = new UserManagerEvent(UserManagerEventType.sessionFinished);\r\n\t\tthis._emitter.emit(ev);\r\n\t\tthis._sessionFinishedResolve(this._currentUser);\r\n\t}\r\n\t\r\n\tprivate _log(message:string):void {\r\n\t\tif (UserManager.SHOW_DEBUG_MESSAGES){\r\n\t\t\tconsole.log(message);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic get currentUser():AppUser { return this._currentUser; }\r\n\t\r\n\tpublic get userId():number { return this._currentUser?.userId; }\r\n\t\r\n\tpublic get userSignedIn():boolean { return this._currentUser != null; }\r\n\t\r\n\tget adminSignedIn():boolean { \r\n\t\treturn (this._currentUser != null &&\r\n\t\t\tthis._currentUser.role === UserRole.ADMIN);\r\n\t}\r\n\t\r\n\tpublic get communityMembers():Array {\r\n\t\treturn this._communityMembers;\r\n\t}\r\n}\r\n\r\nexport class UserManagerEvent {\r\n\tpublic type:UserManagerEventType;\r\n\t\r\n\tconstructor(type:UserManagerEventType){\r\n\t\tthis.type = type;\r\n\t}\r\n}\r\n\r\nexport enum UserManagerEventType {\r\n\t/**dispatched when user logs in/out (also at app launch)*/\r\n\tauthStateChanged,\r\n\t\r\n\t/**dispatched when operations are complete and the UI may be removed. For\r\n\t * example, the user may have clicked Cancel or Close in one of the views.\r\n\t * Check the [FbUserManager.currentUser] getter to get the [AppUser] or \r\n\t * check if its null.*/\r\n\tsessionFinished\r\n}","import { Templates } from \"../../ui/Templates\";\r\nimport { userAccountDg } from \"../../ui/templates/userAccountTemplates\";\r\nimport { UserManager, UserManagerEvent, UserManagerEventType }\r\n\tfrom \"../UserManager\";\r\n\r\nexport class UserAccountDialog {\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _accountPanel:HTMLDivElement;\r\n\t\r\n\tprivate _userManager:UserManager;\r\n\t\r\n\tprivate _finishedResolver: () => void;\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tpublic show():Promise {\r\n\t\treturn new Promise(async (resolve, reject):Promise => {\r\n\t\t\tthis._addListeners();\r\n\t\t\tthis._finishedResolver = resolve;\r\n\t\t\t\r\n\t\t\tdocument.body.append(this._ui);\r\n\t\t\tawait this._userManager.activate(true);\r\n\t\t\tthis._userManager.show();\r\n\t\t\t\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate async _init():Promise {\r\n\t\tthis._createUi();\r\n\t\tthis._userManager = UserManager.get(this._accountPanel);\r\n\t}\r\n\t\r\n\tprivate _createUi():void {\r\n\t\tthis._ui = Templates.createDiv(userAccountDg);\r\n\t\tthis._accountPanel = this._ui.querySelector(\"#stscr-account\");\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate _onUserManagerEvent = (e:UserManagerEvent):void => {\r\n\t\tswitch(e.type){\r\n\t\t\tcase UserManagerEventType.sessionFinished:\r\n\t\t\t\tthis._finish();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _finish():void {\r\n\t\tthis._userManager.deactivate();\r\n\t\t\r\n\t\tthis._removeListeners();\r\n\t\tthis._ui.remove();\r\n\t\t\r\n\t\tthis._finishedResolver();\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._removeListeners();\r\n\t\t\r\n\t\tthis._userManager.event.on(this._onUserManagerEvent);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._userManager.event.off(this._onUserManagerEvent);\r\n\t}\r\n}\r\n\r\nexport class UserAccountDialogEvent {\r\n\tpublic type:UserAccountDialogEventType;\r\n}\r\n\r\nexport enum UserAccountDialogEventType {\r\n\tfinished\r\n}","export const userAccountDg = `\r\n\r\n
\r\n\t
\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
Please wait...
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t
Sign In
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t
Name must begin with a letter and contain \r\n\t\t\t\t\tonly letters, numbers, apostrophes, hyphens or underscores.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tCreate Your Account\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
Name must begin with a letter and contain \r\n\t\t\t\t\tonly letters, numbers, apostrophes, hyphens or underscores.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t
Confirm Your Email
\r\n\t\t\t\t
\r\n\t\t\t\t\tAn email was sent to you with a link to confirm your new account.\r\n\t\t\t\t\tAfter completing that step, return here and click Continue. \r\n\t\t\t\t
\r\n\t\t\t\t
If you didn't receive the email, \r\n\t\t\t\t\tclick here to send it again.\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tSign Out\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tComplete your account.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
Name must begin with a letter and contain \r\n\t\t\t\t\tonly letters and numbers.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tSign Out\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t
My Account
\r\n\t\t\t\t
\r\n\t\t\t\t\tWelcome, Someone!\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tDelete your account\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n
\r\n`;","import { createEmitter } from \"ts_utils\";\r\nimport { TeamUpdateDTO } from \"../data/dtos\";\r\nimport { TeamDO } from \"../data/TeamDO\";\r\nimport { Services } from \"../services/Services\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { teamMenuItem } from \"../ui/templates/teamTemplates\";\r\n\r\nexport class TeamListItem {\r\n\tpublic teamDO:TeamDO;\r\n\t\r\n\tpublic ui:HTMLDivElement;\r\n\tprivate _info:HTMLInputElement;\r\n\tprivate _sizeInput:HTMLInputElement;\r\n\tprivate _saveBtn:HTMLButtonElement;\r\n\t\r\n\tprivate _isDisposed:boolean = false;\r\n\t\r\n\tprivate _emitter = createEmitter();\r\n\tpublic get event() { return this._emitter.event; }\r\n\t\r\n\tconstructor(teamDO:TeamDO){\r\n\t\tthis.teamDO = teamDO;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tpublic select():void {\r\n\t\tthis.ui.classList.add(\"selected\");\r\n\t}\r\n\t\r\n\tpublic deselect():void {\r\n\t\tthis.ui.classList.remove(\"selected\");\r\n\t}\r\n\t\r\n\tpublic prepareForRemoval():void {\r\n\t\tthis._removeListeners();\r\n\t\tthis._isDisposed = true;\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._draw();\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\tthis.ui = Templates.createDiv(teamMenuItem);\r\n\t\tthis._info = this.ui.querySelector(\".teamsdg-ti-info\");\r\n\t\tthis._sizeInput = this.ui.querySelector(\".teamsdg-ti-sizeInput\");\r\n\t\tthis._saveBtn = this.ui.querySelector(\".teamsdg-ti-saveBtn\");\r\n\t\t\r\n\t\tthis._info.innerHTML = `${this.teamDO.name} : ${this.teamDO.code}`;\r\n\t\tthis._sizeInput.value = this.teamDO.size.toString();\r\n\t}\r\n\t\r\n\tprivate _onUiClick = (e:MouseEvent):void => {\r\n\t\tlet ev = new TeamLIEvent();\r\n\t\tev.type = TeamLIEventType.selectRequest;\r\n\t\tev.target = this;\r\n\t\tthis._emitter.emit(ev);\r\n\t}\r\n\t\r\n\tprivate _onSaveBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tthis._removeListeners();\r\n\t\tlet dto = new TeamUpdateDTO();\r\n\t\tdto.id = this.teamDO.id;\r\n\t\tdto.size = this._sizeInput.valueAsNumber;\r\n\t\tlet rdto = await Services.updateTeam(dto);\r\n\t\tif (rdto.success){\r\n\t\t\tthis.teamDO.updateFromDto(rdto.data);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._sizeInput.value = this.teamDO.size.toString();\r\n\t\t}\r\n\t\t\r\n\t\tif (!this._isDisposed){\r\n\t\t\tthis._addListeners();\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis.ui.addEventListener(\"click\", this._onUiClick);\r\n\t\tthis._saveBtn.addEventListener(\"click\", this._onSaveBtnClick);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis.ui.removeEventListener(\"click\", this._onUiClick);\r\n\t\tthis._saveBtn.removeEventListener(\"click\", this._onSaveBtnClick);\r\n\t}\r\n}\r\n\r\nexport class TeamLIEvent {\r\n\tpublic type:TeamLIEventType;\r\n\tpublic target:TeamListItem;\r\n}\r\n\r\nexport enum TeamLIEventType {\r\n\tselectRequest\r\n}","export const teamsDg = `\r\n
\r\n\t
\r\n\t\t
Music Teachers
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t

\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tHow do team competitions work? \r\n\t\t\t\t\t\r\n\t\t\t\t\tTeam competitions are intended to create excitement around music\r\n\t\t\t\t\tpractice and generate positive peer encouragement among your \r\n\t\t\t\t\tstudents. Create a team for each of your music classes and challenge \r\n\t\t\t\t\tyour students to see which class can finish highest on the world \r\n\t\t\t\t\tleaderboard each week. Make up your own rewards to make it even more \r\n\t\t\t\t\texciting!\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\tWhen you create a team, you enter a unique team\tname and a team code \r\n\t\t\t\t\tthat you can share with each of your students. Your students enter \r\n\t\t\t\t\tthis code when they add their names to the application. When \r\n\t\t\t\t\tstudents play songs in RecorderAce, they earn\tpoints that are \r\n\t\t\t\t\tuploaded and combined with the points earned by\ttheir classmates. \r\n\t\t\t\t\tPoints are not averaged, so every student's contributions, no matter\r\n\t\t\t\t\thow small, only help the team. It's impossible to see how much any\r\n\t\t\t\t\tparticular student has contributed, and there is no pressure on \r\n\t\t\t\t\tindividual performance.\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tCan I use this to track my students' grades? \r\n\t\t\t\t\t\r\n\t\t\t\t\tNo, your students' scores are not retained separately, and there is \r\n\t\t\t\t\tno way to associate points earned with each student. Student names \r\n\t\t\t\t\tare not uploaded to the server. A future version of RecorderAce may \r\n\t\t\t\t\toffer separate functionality for gradebook tracking, but that will \r\n\t\t\t\t\trequire separate opt-in from both\tteachers and students/parents.\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tCan my students track their scores without entering a team code?\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\tYes. Your students can enter their names and leave the team code box \r\n\t\t\t\t\tblank. Note that students\tcan not add a team to their names \r\n\t\t\t\t\tafterwards. This is necessary to prevent students from accidentally \r\n\t\t\t\t\tediting or deleting their classmates' names. If students need to add \r\n\t\t\t\t\tthemselves to a team, they can add their name to the list again and \r\n\t\t\t\t\tinclude the team code.\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tIs student audio or video data ever uploaded?\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\tNo. RecorderAce listens to your students through the microphone in\r\n\t\t\t\t\torder to score their performances, and all of this takes place on\r\n\t\t\t\t\tthe student's computer. Audio is never uploaded. RecorderAce does\r\n\t\t\t\t\tnot use the camera.\r\n\t\t\t\t

\r\n\t\t\t\t

\r\n\t\t\t\t\tClick Sign In to set up and manage teams for \r\n\t\t\t\t\t\tyour students.\r\n\t\t\t\t\t \r\n\t\t\t\t\tNote: If you previously created an account with Google Sign-In\r\n\t\t\t\t\tand set up teams, please use your same email to create a new \r\n\t\t\t\t\taccount on the sign-in page. We're no longer using Google Sign-In,\r\n\t\t\t\t\tbut by using the same email you used previously, you will connect\r\n\t\t\t\t\tyour new account to any team data you set up. We decided that\r\n\t\t\t\t\tGoogle Sign-In presented more drawbacks than advantages for\r\n\t\t\t\t\tclassroom use. \r\n\t\t\t\t

\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\tManage your teams:\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tEnter a unique name for this team. This will appear on the team\r\n\t\t\t\t\tleaderboard.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tCreate a code for this team to share with your students. When your\r\n\t\t\t\t\tstudents create their usernames, they will enter this code to join\r\n\t\t\t\t\tthis team.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\tEnter the approximate number of students who will join this team.\r\n\t\t\t\t\tTeam size is used to help balance scoring. You can change this\r\n\t\t\t\t\tlater.\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\t\t
\r\n\t\t\tUpdate: Dear teachers, I'm seeking feedback on a new\r\n\t\t\tapplication I'm building.\r\n\t\t\tLearn more here!\r\n\t\t\tThank you!\r\n\t\t
\r\n\t
\r\n
\r\n`;\r\n\r\nexport const teamMenuItem = `\r\n
\r\n\t
\r\n\t
\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t
\r\n
\r\n`;","import { createEmitter } from \"ts_utils\";\r\nimport { ValidationUtils } from \"ts_utils\";\r\nimport { Services } from \"../services/Services\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { UserAccountDialog } from \"../user/ui/UserAccountDialog\";\r\nimport { UserManager } from \"../user/UserManager\";\r\nimport { TeamUploadDTO } from \"../data/dtos\";\r\nimport { TeamDO } from \"../data/TeamDO\";\r\nimport { TeamLIEvent, TeamListItem } from \"./TeamListItem\";\r\nimport { ConfirmationBox } from \"../ui/ConfirmationBox\";\r\nimport { teamsDg } from \"../ui/templates/teamTemplates\";\r\n\r\nexport class TeamsDialog {\t\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _page1:HTMLDivElement;\r\n\tprivate _page2:HTMLDivElement;\r\n\tprivate _page3:HTMLDivElement;\r\n\t\r\n\t//all pages\r\n\tprivate _messageDiv:HTMLDivElement;\r\n\tprivate _btn1:HTMLButtonElement;\r\n\tprivate _btn2:HTMLButtonElement;\r\n\tprivate _btn3:HTMLButtonElement;\r\n\t\r\n\t//for page 2\r\n\tprivate _teamsListDiv:HTMLDivElement;\r\n\tprivate _teams:TeamListItem[] = [];\r\n\tprivate _selectedTeam:TeamListItem;\r\n\t\r\n\t//for page 3\r\n\tprivate _teamNameInput:HTMLInputElement;\r\n\tprivate _teamCodeInput:HTMLInputElement;\r\n\tprivate _teamSizeInput:HTMLInputElement;\r\n\t\r\n\tprivate static _userAccountDialog:UserAccountDialog;\r\n\t\r\n\tprivate _teamCreated:boolean = false;\r\n\t/**true if at least one team created*/\r\n\tpublic get teamCreated():boolean { return this._teamCreated; }\r\n\t\r\n\tprivate _teamRemoved:boolean = false;\r\n\t/**true if a team is removed*/\r\n\tpublic get teamRemoved():boolean { return this._teamRemoved; }\r\n\t\r\n\tprivate _emitter = createEmitter();\r\n\tpublic get event() { return this._emitter.event; }\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._draw();\r\n\t\tif (TeamsDialog._userAccountDialog == null){\r\n\t\t\tTeamsDialog._userAccountDialog = new UserAccountDialog();\r\n\t\t}\r\n\t\t\r\n\t\tthis._setPage(1);\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\tthis._ui = Templates.createDiv(teamsDg);\r\n\t\tlet qs = this._ui.querySelector.bind(this._ui);\r\n\t\t\r\n\t\tthis._page1 = qs(\".teamsdg-page1\");\r\n\t\tthis._page2 = qs(\".teamsdg-page2\");\r\n\t\tthis._page3 = qs(\".teamsdg-page3\");\r\n\t\t\r\n\t\tthis._messageDiv = qs(\".teamsdg-message\");\r\n\t\tthis._btn1 = qs(\".teamsdg-btn1\");\r\n\t\tthis._btn2 = qs(\".teamsdg-btn2\");\r\n\t\tthis._btn3 = qs(\".teamsdg-btn3\");\r\n\t\t\r\n\t\tthis._teamsListDiv = qs(\".teamsdg-teamsListDiv\");\r\n\t\t\r\n\t\tthis._teamNameInput = qs(\".teamsdg-teamNameInput\");\r\n\t\tthis._teamCodeInput = qs(\".teamsdg-codeInput\");\r\n\t\tthis._teamSizeInput = qs(\".teamsdg-teamSizeInput\");\r\n\t\t\r\n\t\tdocument.body.append(this._ui);\r\n\t}\r\n\t\r\n\tprivate async _setPage(pageNumber:number):Promise {\r\n\t\tthis._removeListeners();\r\n\t\t\r\n\t\tthis._page1.style.display = \"none\";\r\n\t\tthis._page2.style.display = \"none\";\r\n\t\tthis._page3.style.display = \"none\";\r\n\t\t\r\n\t\tthis._btn2.style.display = \"none\";\r\n\t\t\r\n\t\tif (pageNumber === 1){\r\n\t\t\tthis._enablePage1();\r\n\t\t}\r\n\t\telse if (pageNumber === 2){\r\n\t\t\tawait this._enablePage2();\r\n\t\t}\r\n\t\telse if (pageNumber === 3){\r\n\t\t\tthis._enablePage3();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**////////////////PAGE 1//////////////////*/\r\n\tprivate _enablePage1():void {\r\n\t\tthis._page1.style.display = \"initial\";\r\n\t\tthis._btn1.innerHTML = \"Sign In\";\r\n\t\tthis._btn1.addEventListener(\"click\", this._onP1ContinueBtnClick);\r\n\t\tthis._btn3.addEventListener(\"click\", this._onCloseBtnClick);\r\n\t}\r\n\t\r\n\tprivate _onP1ContinueBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tthis._disableButtons();\r\n\t\t\r\n\t\tlet um = UserManager.get();\r\n\t\tawait um.logout();\r\n\t\tif (um.currentUser == null){\r\n\t\t\tlet display:string = this._ui.style.display;\r\n\t\t\tthis._ui.style.display = \"none\";\r\n\t\t\t\r\n\t\t\tawait TeamsDialog._userAccountDialog.show();\r\n\t\t\tthis._ui.style.display = display;\r\n\t\t}\r\n\t\t\r\n\t\tthis._enableButtons();\r\n\t\t\r\n\t\tif (um.currentUser != null){\r\n\t\t\tawait this._setPage(2);\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**////////////////PAGE 2//////////////////*/\r\n\tprivate async _enablePage2():Promise {\r\n\t\tthis._disableButtons();\r\n\t\t\r\n\t\tthis._page2.style.display = \"initial\";\r\n\t\tthis._btn2.style.display = \"initial\";\r\n\t\tthis._btn1.innerHTML = \"Add Team\";\r\n\t\tthis._btn2.innerHTML = \"Delete Team\";\r\n\t\tthis._btn3.innerHTML = \"Sign Out\";\r\n\t\tthis._btn1.addEventListener(\"click\", this._onP2AddTeamBtnClick);\r\n\t\tthis._btn2.addEventListener(\"click\", this._onP2DeleteTeamBtnClick);\r\n\t\tthis._btn3.addEventListener(\"click\", this._onCloseBtnClick);\r\n\t\t\r\n\t\tawait this._populateTeams();\r\n\t\t\r\n\t\tthis._enableButtons();\r\n\t}\r\n\t\r\n\tprivate async _populateTeams():Promise {\r\n\t\tlet um = UserManager.get();\r\n\t\tlet rdto = await Services.getTeamsForUser(um.currentUser.userId);\r\n\t\tif (!rdto.success){\r\n\t\t\tconsole.log(rdto.message);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tlet teamDOs = rdto.dataList.map(dto => TeamDO.fromTeamDto(dto));\r\n\t\t\r\n\t\t//remove old teams\r\n\t\tthis._selectedTeam = null;\r\n\t\t\r\n\t\tfor (let li of this._teams){\r\n\t\t\tli.event.offAll();\r\n\t\t\tli.prepareForRemoval();\r\n\t\t\tli.ui.remove();\r\n\t\t}\r\n\t\tthis._teams = [];\r\n\t\t\r\n\t\t//add new teams\r\n\t\t\r\n\t\tfor (let tdo of teamDOs){\r\n\t\t\tif (tdo.userId !== um.currentUser.userId){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tlet li = new TeamListItem(tdo);\r\n\t\t\tthis._teamsListDiv.append(li.ui);\r\n\t\t\tli.event.on(this._onTeamLIEvent);\r\n\t\t\tthis._teams.push(li);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onTeamLIEvent = (e:TeamLIEvent):void => {\r\n\t\tfor (let li of this._teams){\r\n\t\t\tif (li === e.target){\r\n\t\t\t\tthis._selectedTeam = li;\r\n\t\t\t\tli.select();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tli.deselect();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onP2AddTeamBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._setPage(3);\r\n\t}\r\n\t\r\n\tprivate _onP2DeleteTeamBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tif (this._selectedTeam == null){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tlet cb = new ConfirmationBox(\"Permanently delete this team?\");\r\n\t\tlet confirmed = await cb.awaitConfirmation();\r\n\t\tif (!confirmed){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tthis._disableButtons();\r\n\t\t\r\n\t\tawait Services.removeTeam(this._selectedTeam.teamDO.id);\r\n\t\tthis._teamRemoved = true;\r\n\t\t\r\n\t\tawait this._populateTeams();\r\n\t\tthis._enableButtons();\r\n\t}\r\n\t\r\n\t/**////////////////PAGE 3//////////////////*/\r\n\tprivate _enablePage3():void {\r\n\t\tthis._page3.style.display = \"initial\";\r\n\t\tthis._btn1.innerHTML = \"Create Team\";\r\n\t\tthis._btn3.innerHTML = \"Cancel\";\r\n\t\tthis._teamNameInput.value = \"\";\r\n\t\tthis._teamCodeInput.value = \"\";\r\n\t\tthis._btn1.addEventListener(\"click\", this._onP3CreateTeamBtnClick);\r\n\t\tthis._btn3.addEventListener(\"click\", this._onP3CancelBtnClick);\r\n\t}\r\n\t\r\n\tprivate _onP3CreateTeamBtnClick = async (e:MouseEvent):Promise => {\r\n\t\tif (!this._validateTeamInfo()){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._disableButtons();\r\n\t\tlet dto = new TeamUploadDTO();\r\n\t\tdto.name = this._teamNameInput.value;\r\n\t\tdto.code = this._teamCodeInput.value;\r\n\t\tdto.size = Number.parseInt(this._teamSizeInput.value);\r\n\t\tdto.userId = UserManager.get().currentUser.userId;\r\n\t\tlet rdto = await Services.addTeam(dto);\r\n\t\tthis._enableButtons();\r\n\t\tif (rdto.success){\r\n\t\t\tthis._teamCreated = true;\r\n\t\t\tthis._setPage(2);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (rdto.message === \"code taken\"){\r\n\t\t\t\tthis._messageDiv.innerHTML = (\"This code is unavailable.\");\r\n\t\t\t}\r\n\t\t\telse if (rdto.message === \"name taken\"){\r\n\t\t\t\tthis._messageDiv.innerHTML = (\"This team name is unavailable.\");\r\n\t\t\t}\r\n\t\t\tthis._messageDiv.innerHTML =\r\n\t\t\t\t(\"There was a problem creating this team.\");\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _validateTeamInfo():boolean {\r\n\t\tlet name:string = this._teamNameInput.value;\r\n\t\tif (name.length < 5){\r\n\t\t\tthis._messageDiv.innerHTML =\r\n\t\t\t\t\"Team name must be at least 5 characters\";\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (!ValidationUtils.isValidDisplayName(name)){\r\n\t\t\tthis._messageDiv.innerHTML = (\"Team name can't contain special \" +\r\n\t\t\t\t\"characters\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tlet code:string = this._teamCodeInput.value;\r\n\t\tif (code.length < 5){\r\n\t\t\tthis._messageDiv.innerHTML =\r\n\t\t\t\t\"Team code must be at least 5 characters\";\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tlet regExp = /^[a-zA-Z]+[a-zA-Z0-9]+$/;\r\n\t\tif (!regExp.test(code)){\r\n\t\t\tthis._messageDiv.innerHTML = \"Team code must begin with a letter \" +\r\n\t\t\t\t\"and contain only letters and numbers\";\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tprivate _onP3CancelBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._setPage(2);\r\n\t}\r\n\t\r\n\tprivate _disableButtons():void {\r\n\t\tthis._btn1.disabled = true;\r\n\t\tthis._btn2.disabled = true;\r\n\t\tthis._btn3.disabled = true;\r\n\t}\r\n\t\r\n\tprivate _enableButtons():void {\r\n\t\tthis._btn1.disabled = false;\r\n\t\tthis._btn2.disabled = false;\r\n\t\tthis._btn3.disabled = false;\r\n\t}\r\n\t\r\n\tprivate _onCloseBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._removeListeners();\r\n\t\tthis._ui.remove();\r\n\t\tthis._emitter.emit(TeamsDialogEvent.Finished);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._btn1.removeEventListener(\"click\", this._onP1ContinueBtnClick);\r\n\t\tthis._btn3.removeEventListener(\"click\", this._onCloseBtnClick);\r\n\t\t\r\n\t\tthis._btn1.removeEventListener(\"click\", this._onP2AddTeamBtnClick);\r\n\t\tthis._btn2.removeEventListener(\"click\", this._onP2DeleteTeamBtnClick);\r\n\t\tthis._btn3.removeEventListener(\"click\", this._onCloseBtnClick);\r\n\t\t\r\n\t\tthis._btn1.removeEventListener(\"click\", this._onP3CreateTeamBtnClick);\r\n\t\tthis._btn3.removeEventListener(\"click\", this._onP3CancelBtnClick);\r\n\t}\r\n}\r\n\r\nexport enum TeamsDialogEvent {\r\n\tFinished\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { AddStudentDialog } from \"./AddStudentDialog\";\r\nimport { StudentManager } from \"./StudentManager\";\r\nimport { TeamsDialog, TeamsDialogEvent } from \"../teams/TeamsDialog\";\r\nimport { Services } from \"../services/Services\";\r\nimport { Student } from \"./Student\";\r\nimport { RdtoMessage } from \"ts_utils\";\r\nimport { TeamDO } from \"./TeamDO\";\r\nimport { selectStudentListItem, selectStudentDg }\r\n\tfrom \"../ui/templates/studentSelectTemplates\";\r\n\r\nexport class StudentSelectionWindow {\r\n\t\r\n\tprivate _ui:HTMLDivElement;\r\n\tprivate _addStudentBtn:HTMLButtonElement;\r\n\tprivate _teachersBtn:HTMLButtonElement;\r\n\tprivate _studentList:HTMLDivElement;\r\n\t\r\n\tprivate _studentListItems:Array;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._draw();\r\n\t\tStudentManager.loadFromStorage();\r\n\t\tthis._populateStudentList();\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\tthis._ui = Templates.createDiv(selectStudentDg);\r\n\t\tthis._addStudentBtn = this._ui.querySelector('.ss-addStudentBtn');\r\n\t\tthis._teachersBtn = this._ui.querySelector('.ss-teachersBtn');\r\n\t\tthis._studentList = this._ui.querySelector('.ss-studentList');\r\n\t\t\r\n\t\tdocument.body.append(this._ui);\r\n\t}\r\n\t\r\n\tprivate _populateStudentList():void {\r\n\t\twhile (this._studentList.children.length > 0){\r\n\t\t\tthis._studentList.lastChild.remove();\r\n\t\t}\r\n\t\t\r\n\t\tthis._studentListItems = [];\r\n\t\tfor (let student of StudentManager.students){\r\n\t\t\tlet li = new StudentSelectionListItem();\r\n\t\t\tli.student = student;\r\n\t\t\tli.ui = Templates.createDiv(selectStudentListItem);\r\n\t\t\tli.nameDiv.innerHTML = student.name;\r\n\t\t\tif (student.teamCode != null){\r\n\t\t\t\tli.teamDiv.innerHTML = student.teamName?? \"On a Team\";\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tli.teamDiv.innerHTML = \"No Team\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis._studentListItems.push(li);\r\n\t\t\tthis._studentList.append(li.ui);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onStudentLiClick = async (e:MouseEvent):Promise => {\r\n\t\tthis._removeListeners();\r\n\t\t\r\n\t\tlet li = this._studentListItems.find((li) => li.ui === e.currentTarget);\r\n\t\t\r\n\t\tif (li.student.teamCode != null){\r\n\t\t\tlet rdto = await Services.getTeamByCode(li.student.teamCode);\r\n\t\t\tif (!rdto.success){\r\n\t\t\t\tif (rdto.message === RdtoMessage.NOT_FOUND){\r\n\t\t\t\t\tli.student.teamCode = null;\r\n\t\t\t\t\tli.student.teamName = null;\r\n\t\t\t\t\tStudentManager.saveToStorage(false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (li.student.teamName == null){\r\n\t\t\t\t\tli.student.teamName = rdto.data.name;\r\n\t\t\t\t\tStudentManager.saveToStorage(false);\r\n\t\t\t\t}\r\n\t\t\t\tli.student.team = TeamDO.fromTeamDto(rdto.data);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tStudentManager.setCurrentStudentByName(li.student.name);\r\n\t\t\r\n\t\tlet event = new StudentSelectionWindowEvent();\r\n\t\tevent.type = StudentSelectionWindowEvent.STUDENT_SELECTED;\r\n\t\tthis._emitter.emit(event);\r\n\t\t\r\n\t\tthis._ui.remove();\r\n\t}\r\n\t\r\n\tprivate _onAddStudentBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._ui.classList.add(\"overrideDisplayNone\");\r\n\t\tthis._removeListeners();\r\n\t\t\r\n\t\tlet dg = new AddStudentDialog();\r\n\t\tdg.studentEvent.on((student) => {\r\n\t\t\tdg.studentEvent.offAll();\r\n\t\t\tif (student != null){\r\n\t\t\t\tthis._populateStudentList();\r\n\t\t\t}\r\n\t\t\tthis._ui.classList.remove(\"overrideDisplayNone\");\r\n\t\t\tthis._addListeners();\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _onTeachersBtnClick = (e:MouseEvent):void => {\r\n\t\tthis._ui.classList.add(\"overrideDisplayNone\");\r\n\t\tthis._removeListeners();\r\n\t\t\r\n\t\tlet dg = new TeamsDialog();\r\n\t\tdg.event.on((e:TeamsDialogEvent) => {\r\n\t\t\tif (e === TeamsDialogEvent.Finished){\r\n\t\t\t\t//dialog finished\r\n\t\t\t\tdg.event.offAll();\r\n\t\t\t\tthis._populateStudentList();\r\n\t\t\t\tthis._addListeners();\r\n\t\t\t\tthis._ui.classList.remove(\"overrideDisplayNone\");\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _onMouseWheel = (e:WheelEvent):void => {\r\n\t\te.preventDefault();\r\n\t\tthis._studentList.scrollTop += Math.round(e.deltaY);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._studentListItems.forEach((li) => {\r\n\t\t\tli.ui.addEventListener(\"click\", this._onStudentLiClick);\r\n\t\t});\r\n\t\t\r\n\t\tthis._addStudentBtn.addEventListener(\"click\",\r\n\t\t\tthis._onAddStudentBtnClick);\r\n\t\tthis._teachersBtn.addEventListener(\"click\", this._onTeachersBtnClick);\r\n\t\t\r\n\t\tthis._ui.addEventListener(\"wheel\", this._onMouseWheel);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._studentListItems.forEach((li) => {\r\n\t\t\tli.ui.removeEventListener(\"click\", this._onStudentLiClick);\r\n\t\t});\r\n\t\t\r\n\t\tthis._addStudentBtn.removeEventListener(\"click\",\r\n\t\t\tthis._onAddStudentBtnClick);\r\n\t\tthis._teachersBtn.removeEventListener(\"click\",\r\n\t\t\tthis._onTeachersBtnClick);\r\n\t\t\r\n\t\tthis._ui.removeEventListener(\"wheel\", this._onMouseWheel);\r\n\t}\r\n}\r\n\r\nclass StudentSelectionListItem {\r\n\tpublic ui:HTMLDivElement;\r\n\tpublic student:Student;\r\n\t\r\n\tpublic get nameDiv():HTMLDivElement {\r\n\t\treturn this.ui.querySelector(\".ss-listItem-name\");\r\n\t}\r\n\tpublic get teamDiv():HTMLDivElement {\r\n\t\treturn this.ui.querySelector(\".ss-listItem-team\");\r\n\t}\r\n}\r\n\r\nexport class StudentSelectionWindowEvent {\r\n\tpublic type:string;\r\n\t\r\n\tpublic static readonly STUDENT_SELECTED:string = \"studentSelected\";\r\n}","export const selectStudentDg = `\r\n
\r\n\t
\r\n\t\t
Select or Add Your Name
\r\n\t\t
Add your name to save your scores on this\r\n\t\t\tcomputer. Student names are not uploaded to a server.\r\n\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n
\r\n`;\r\n\r\nexport const selectStudentListItem = `\r\n
\r\n\t
\r\n\t
\r\n
\r\n`;","import { createEmitter } from \"ts_utils\";\r\nimport { SongDO } from \"../data/SongDO\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { songItem } from \"../ui/templates/songMenuTemplates\";\r\n\r\nexport abstract class AbstractPanelItem {\r\n\t\r\n\tpublic index:number;\r\n\t\r\n\tpublic ui:HTMLDivElement;\r\n\t\r\n\tpublic static get click() { return AbstractPanelItem._clickEmitter.event; }\r\n\tprivate static _clickEmitter = createEmitter();\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._createUi();\r\n\t}\r\n\t\r\n\t/**override in sub classes to create custom PanelItem design*/\r\n\tprivate _createUi():void {\r\n\t\tthis.ui = Templates.createDiv(this.getUiTemplate());\r\n\t\tthis.ui.addEventListener(\"click\", this._onUiClick);\r\n\t}\r\n\t\r\n\tprivate _onUiClick = (e:MouseEvent) => {\r\n\t\tAbstractPanelItem._clickEmitter.emit(this);\r\n\t}\r\n\t\r\n\tabstract getUiTemplate():string;\r\n}\r\n\r\n\r\nexport class SongPanelItem extends AbstractPanelItem {\r\n\tpublic get songDO():SongDO { return this._songDO; }\r\n\tprivate _songDO:SongDO;\r\n\t\r\n\tconstructor(songDO:SongDO){\r\n\t\tsuper();\r\n\t\tthis._songDO = songDO;\r\n\t\tthis._draw();\r\n\t}\r\n\t\r\n\tpublic override getUiTemplate():string {\r\n\t\treturn songItem;\r\n\t}\r\n\t\r\n\tpublic updateAssessmentScore(score:number, studentLoggedIn:boolean):void {\r\n\t\tlet scoreContainer = this.ui.querySelector(\r\n\t\t\t\".m-songItem-scoreContainer\") as HTMLDivElement;\r\n\t\tif (!studentLoggedIn){\r\n\t\t\tscoreContainer.style.display = \"none\";\r\n\t\t}\r\n\t\telse {\r\n\t\t\tscoreContainer.style.display = \"flex\";\r\n\t\t\tlet scoreDiv = this.ui.querySelector('.m-songItem-scoreDiv') as\r\n\t\t\t\tHTMLDivElement;\r\n\t\t\tlet text = (score == null)? \"???\" : `${score}%`;\r\n\t\t\tscoreDiv.innerHTML = text;\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\t\r\n\t\tthis.updateAssessmentScore(null, false);\r\n\t\t\r\n\t\t//title\r\n\t\tlet titleDiv = this.ui.querySelector('.m-title') as HTMLDivElement;\r\n\t\tlet titleText = this._songDO.title?? '';\r\n\t\t\r\n\t\tlet a = document.createElement(\"a\");\r\n\t\ta.href = `./?id=${this._songDO.libId}`;\r\n\t\ta.innerHTML = titleText;\r\n\t\ttitleDiv.append(a);\r\n\t\ta.addEventListener(\"click\", (e) => {\r\n\t\t\te.preventDefault();\r\n\t\t});\r\n\t}\r\n}","import { ContestManager } from \"../data/ContestManager\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { leaderboardItem } from \"../ui/templates/songMenuTemplates\";\r\n\r\nexport class _LeadersSection {\r\n\tprivate _container:HTMLDivElement;\r\n\tprivate _leadersListDiv:HTMLDivElement;\r\n\t\r\n\tprivate _thisWeekDescription:HTMLDivElement;\r\n\tprivate _lastWeekDescription:HTMLDivElement;\r\n\t\r\n\tconstructor(container:HTMLDivElement){\r\n\t\tthis._container = container;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._thisWeekDescription = this._container.querySelector(\r\n\t\t\t\".m-leaders-description-this-week\");\r\n\t\tthis._lastWeekDescription = this._container.querySelector(\r\n\t\t\t\".m-leaders-description-last-week\");\r\n\t\t\r\n\t\tthis._thisWeekDescription.querySelector(\"a\").addEventListener(\"click\",\r\n\t\t\tthis._toggleWeek);\r\n\t\tthis._lastWeekDescription.querySelector(\"a\").addEventListener(\"click\",\r\n\t\t\tthis._toggleWeek);\r\n\t\t\t\r\n\t\tthis._leadersListDiv = this._container.querySelector(\".m-leaders-list\");\r\n\t}\r\n\t\r\n\tpublic async update(weekIndex:number = 0):Promise {\r\n\t\t//get the latest contest data\r\n\t\tlet dateId:string = ContestManager.getCompetitionId(null, weekIndex);\r\n\t\tawait ContestManager.getEntries(dateId);\r\n\t\t\r\n\t\tthis._populateLeaders();\r\n\t}\r\n\t\r\n\tprivate _populateLeaders():void {\r\n\t\t//sort by highest score\r\n\t\tContestManager.entries.sort((e1, e2) => {\r\n\t\t\treturn (e1.points >= e2.points)? -1 : 1;\r\n\t\t});\r\n\t\t\r\n\t\t//populate leaderboard\r\n\t\twhile (this._leadersListDiv.children.length > 0){\r\n\t\t\tthis._leadersListDiv.children[0].remove();\r\n\t\t}\r\n\t\tContestManager.entries.forEach((e) => {\r\n\t\t\tlet li = Templates.createDiv(leaderboardItem);\r\n\t\t\tli.innerHTML = `${e.points} pts - ${e.team.name}`;\r\n\t\t\tthis._leadersListDiv.append(li);\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _toggleWeek = (e:MouseEvent):void => {\r\n\t\tif (this._lastWeekDescription.classList.contains(\"hide\")){\r\n\t\t\tthis._lastWeekDescription.classList.remove(\"hide\");\r\n\t\t\tthis._thisWeekDescription.classList.add(\"hide\");\r\n\t\t\tthis.update(1);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._thisWeekDescription.classList.remove(\"hide\");\r\n\t\t\tthis._lastWeekDescription.classList.add(\"hide\");\r\n\t\t\tthis.update(0);\r\n\t\t}\r\n\t}\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { BrowserUtils } from \"ts_utils\";\r\nimport { AbstractPanelItem } from \"./panel_items\";\r\n\r\nexport class SongPanel {\r\n\tprivate _panelDiv:HTMLDivElement;\r\n\tprivate _navDiv:HTMLDivElement;\r\n\t\r\n\t/**map of panel indexes to PanelItems*/\r\n\tprivate _panelItems = new Map();\r\n\tprivate _minItemIndex:number = 0;\r\n\tprivate _maxItemIndex:number = null;\r\n\t\r\n\t/**index of the item that should currently appear first in the panel*/\r\n\tprivate _currentIndex:number;\r\n\tprivate _currentlyDisplayedItems:Array = [];\r\n\t\r\n\tprivate _prevLink:HTMLAnchorElement;\r\n\tprivate _nextLink:HTMLAnchorElement;\r\n\t\r\n\tprivate _navQueryPrefix:string;\r\n\t\r\n\tprivate _lastIndexRequest:number;\r\n\t\r\n\tprivate _maxDisplayedItems:number = 10;\r\n\t\r\n\tprivate _itemsPerRequestCall:number;\r\n\t\r\n\t/**Gets a stream of integers representing the first index number of the*/\r\n\tpublic get itemsRequest() { return this._itemsRequestEmitter.event; }\r\n\tprivate _itemsRequestEmitter = createEmitter();\r\n\t\r\n\t/**Gets a stream of events that occur each time the panel's contents are\r\n\t * updated.*/\r\n\tpublic get displayUpdate() { return this._displayUpdateEmitter.event; }\r\n\tprivate _displayUpdateEmitter = createEmitter();\r\n\t\r\n\tconstructor(panelDiv:HTMLDivElement, navDiv:HTMLDivElement,\r\n\t\t\t{ navQueryPrefix = \"index\", currentIndex = 0 } :\r\n\t\t\t{ navQueryPrefix?:string, currentIndex?:number }){\r\n\t\tthis._panelDiv = panelDiv;\r\n\t\tthis._navDiv = navDiv;\r\n\t\tthis._navQueryPrefix = navQueryPrefix;\r\n\t\tthis._currentIndex = currentIndex;\r\n\t\t\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void {\r\n\t\tthis._prevLink = this._navDiv.querySelector(\".m-previousResults\");\r\n\t\tthis._nextLink = this._navDiv.querySelector(\".m-nextResults\");\r\n\t\t\r\n\t\tthis._prevLink.addEventListener(\"click\", this._onPrevLinkClick);\r\n\t\tthis._nextLink.addEventListener(\"click\", this._onNextLinkClick);\r\n\t\t\r\n\t\tthis._updateNavDisplay();\r\n\t}\r\n\t\r\n\tpublic resetPanel():void {\r\n\t\tthis._minItemIndex = 0;\r\n\t\tthis._maxItemIndex = null;\r\n\t\tthis._removePanelItemsFromDisplay();\r\n\t\tthis._panelItems = new Map();\r\n\t\tthis._updateNavDisplay();\r\n\t\tthis._currentIndex = 0;\r\n\t\tthis._lastIndexRequest = null;\r\n\t}\r\n\t\r\n\t/**adds a list of MSPanelItem objects that may be displayed in the panel.\r\n\t * [items] the list of MSPanelItem objects to add*/\r\n\tpublic addPanelItems(items:AbstractPanelItem[]):void {\r\n\t\titems.forEach((item) => this._panelItems.set(item.index, item));\r\n\t\tthis.displayFromIndex(this._currentIndex);\r\n\t}\r\n\t\r\n\t/**displays panel items from the requested [index]. If [index] is null,\r\n\t * the [_currentIndex] is used.*/\r\n\tpublic displayFromIndex(index:number):void {\r\n\t\t//make sure we're on the display, as otherwise the width calculation is\r\n\t\t//useless.\r\n\t\tif (!this._isAttachedToBody()){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tlet scrollY:number = window.scrollY;\r\n\t\t\r\n\t\tif (index == null){\r\n\t\t\tindex = this._currentIndex;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._currentIndex = index;\r\n\t\t}\r\n\t\t\r\n\t\tthis._removePanelItemsFromDisplay();\r\n\t\t\r\n\t\tlet panelRect = this._panelDiv.getBoundingClientRect();\r\n\t\twhile (this._currentlyDisplayedItems.length < this._maxDisplayedItems){\r\n\t\t\t//the maxDisplayedItems is a guarantee against browsers which might\r\n\t\t\t//not support flexbox and thus our bounds checking - we don't want\r\n\t\t\t//to display thousands of items and generate tons of requests\r\n\t\t\tif (this._panelItems.has(index)){\r\n\t\t\t\tlet item = this._panelItems.get(index);\r\n\t\t\t\tthis._panelDiv.append(item.ui);\r\n\t\t\t\tlet itemRect = item.ui.getBoundingClientRect();\r\n\t\t\t\tif (itemRect.right > panelRect.right &&\r\n\t\t\t\t\t\tthis._panelDiv.children.length > 1){\r\n\t\t\t\t\titem.ui.remove();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tthis._currentlyDisplayedItems.push(item);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t//this._requestItems(index);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tindex++;\r\n\t\t}\r\n\t\t\r\n\t\tthis._updateNavDisplay();\r\n\t\tthis._checkForNeededItems();\r\n\t\t\r\n\t\t//removing the panel items and nav causes scrolling to jump, so we store\r\n\t\t//it and reset after finishing these operations.\r\n\t\twindow.scrollTo(0, scrollY);\r\n\t\t\r\n\t\tthis._displayUpdateEmitter.emit(this);\r\n\t}\r\n\t\r\n\tpublic reportItemRequestFail():void {\r\n\t\t//reset this so we can try this index again.\r\n\t\tthis._lastIndexRequest = null;\r\n\t}\r\n\t\r\n\tpublic getAllPanelItems():Array{\r\n\t\tlet items:Array = [];\r\n\t\tlet keys = Array.from(this._panelItems.keys());\r\n\t\tkeys = keys.sort((i1, i2) => i1 <= i2 ? -1 : 1);\r\n\t\tfor (let key of keys){\r\n\t\t\titems.push(this._panelItems.get(key));\r\n\t\t}\r\n\t\treturn items;\r\n\t}\r\n\t\r\n\tprivate _updateNavDisplay():void {\r\n\t\tif (this._panelItems.size === 0){\r\n\t\t\tthis._navDiv.style.display = \"none\";\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._navDiv.style.display = \"\";\r\n\t\tthis._nextLink.removeAttribute('href');\r\n\t\tthis._nextLink.removeAttribute('rel');\r\n\t\tlet nextDiv = this._nextLink.querySelector('div');\r\n\t\tif (!nextDiv.classList.contains('disabled')) \r\n\t\t\tnextDiv.classList.add('disabled');\r\n\t\t\r\n\t\tthis._prevLink.removeAttribute('href');\r\n\t\tthis._prevLink.removeAttribute('rel');\r\n\t\tlet prevDiv = this._prevLink.querySelector('div');\r\n\t\tif (!prevDiv.classList.contains('disabled'))\r\n\t\t\tprevDiv.classList.add('disabled');\r\n\t\t\r\n\t\tlet numVisible:number = this._panelDiv.children.length;\r\n\t\tif (this._maxItemIndex == null || this._maxItemIndex > numVisible + \r\n\t\t\t\tthis._currentIndex - 1){\r\n\t\t\tlet index:number = this._currentIndex + numVisible;\r\n\t\t\t//make sure we have an item for this index\r\n\t\t\tif (this._panelItems.get(index) != null){\r\n\t\t\t\tthis._nextLink.href =`./?${this._navQueryPrefix}=${index}`;\r\n\t\t\t\tthis._nextLink.rel = \"next\";\r\n\t\t\t\tnextDiv.classList.remove('disabled');\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (this._minItemIndex < this._currentIndex){\r\n\t\t\tlet index:number = Math.max(this._currentIndex -\r\n\t\t\t\tthis._maxDisplayedItems, this._minItemIndex);\r\n\t\t\t//guard against the situation where we have previous items but not\r\n\t\t\t//enough to match numVisible\r\n\t\t\tindex = Math.max(index, this._getSortedPanelItemIndexes()[0]);\r\n\t\t\t//make sure we have an item for this index\r\n\t\t\tif (this._panelItems.get(index) != null){\r\n\t\t\t\tthis._prevLink.href = `./?${this._navQueryPrefix}=${index}`;\r\n\t\t\t\tthis._prevLink.rel = \"prev\";\r\n\t\t\t\tprevDiv.classList.remove('disabled');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _checkForNeededItems():void {\r\n\t\tif (this._currentlyDisplayedItems.length === 0) return;\r\n\t\t\r\n\t\tlet indexes:number[] = this._getSortedPanelItemIndexes();\r\n\t\t\r\n\t\tlet firstDisplayed:number = this._currentlyDisplayedItems[0].index;\r\n\t\tlet lastDisplayed:number = this._currentlyDisplayedItems[\r\n\t\t\tthis._currentlyDisplayedItems.length - 1].index;\r\n\t\t\r\n\t\tif (firstDisplayed === indexes[0] &&\r\n\t\t\t\tfirstDisplayed > this._minItemIndex){\r\n\t\t\tlet targetIndex:number = (this._itemsPerRequestCall != null)\r\n\t\t\t\t? firstDisplayed - this._itemsPerRequestCall\r\n\t\t\t\t: firstDisplayed - this._currentlyDisplayedItems.length;\r\n\t\t\tthis._requestItems(Math.max(this._minItemIndex, targetIndex));\r\n\t\t}\r\n\t\telse if (lastDisplayed === indexes[indexes.length - 1] &&\r\n\t\t\t\t(this._maxItemIndex == null ||\r\n\t\t\t\tlastDisplayed < this._maxItemIndex)){\r\n\t\t\tthis._requestItems(lastDisplayed + 1);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _requestItems(index:number):void {\r\n\t\tif (this._lastIndexRequest === index) return; //avoid duplicates\r\n\t\tif (index >= this._minItemIndex && \r\n\t\t\t\t(this._maxItemIndex == null || index <= this._maxItemIndex)){\r\n\t\t\tthis._lastIndexRequest = index;\r\n\t\t\tthis._itemsRequestEmitter.emit(index);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onPrevLinkClick = (e:MouseEvent):void => {\r\n\t\te.preventDefault();\r\n\t\tif (this._prevLink.href === \"\") return;\r\n\t\t\r\n\t\tlet index = BrowserUtils.getQueryParam(this._navQueryPrefix,\r\n\t\t\tthis._prevLink.href);\r\n\t\tthis.displayFromIndex(Number.parseInt(index));\r\n\t}\r\n\t\r\n\tprivate _onNextLinkClick = (e:MouseEvent):void => {\r\n\t\te.preventDefault();\r\n\t\tif (this._nextLink.href === \"\") return;\r\n\t\t\r\n\t\tlet index = BrowserUtils.getQueryParam(this._navQueryPrefix,\r\n\t\t\tthis._nextLink.href);\r\n\t\tthis.displayFromIndex(Number.parseInt(index));\r\n\t}\r\n\t\r\n\tprivate _removePanelItemsFromDisplay():void {\r\n\t\tfor (let i = this._panelDiv.children.length - 1; i >= 0; i--){\r\n\t\t\tthis._panelDiv.children[i].remove();\r\n\t\t}\r\n\t\tthis._currentlyDisplayedItems = [];\r\n\t}\r\n\t\r\n\t/**gets a sorted [List] of indexes of all _panelItems available (not\r\n\t * just displayed)*/\r\n\tprivate _getSortedPanelItemIndexes():Array {\r\n\t\tlet indexes = Array.from(this._panelItems.keys());\r\n\t\tindexes.sort((i1, i2) => (i1 <= i2)? -1 : 1);\r\n\t\treturn indexes;\r\n\t}\r\n\t\r\n\tprivate _isAttachedToBody():boolean {\r\n\t\treturn (document.contains(this._panelDiv) &&\r\n\t\t\tthis._panelDiv.getBoundingClientRect().right > 0);\r\n\t}\r\n\t\r\n\t/**index of the first panel item that can be displayed - used for\r\n\t * determining whether to show prev/next links. Defaults to 0.*/\r\n\tpublic get minItemIndex():number { return this._minItemIndex; }\r\n\tpublic set minItemIndex(value:number) {\r\n\t\tthis._minItemIndex = value;\r\n\t\tthis._updateNavDisplay();\r\n\t}\r\n\t\r\n\t/**index of the last panel item that can be displayed - used for determining\r\n\t * whether to show prev/next links. If this value is null (default), it \r\n\t * means the max is still unknown.*/\r\n\tpublic get maxItemIndex():number { return this._maxItemIndex; }\r\n\tpublic set maxItemIndex(value:number) {\r\n\t\tthis._maxItemIndex = value;\r\n\t\tthis._updateNavDisplay();\r\n\t}\r\n\t\r\n\t/**returns the number of items currently displayed.*/\r\n\tpublic get numItemsDisplayed():number {\r\n\t\treturn this._currentlyDisplayedItems.length;\r\n\t}\r\n\t\r\n\t/**the number of new results we expect to receive upon fulfillment of a \r\n\t * request for new items. This is null by default, meaning it won't be used.\r\n\t * Setting this gives optimized handling when clicking previous, since we\r\n\t * know how far to go back.*/\r\n\tpublic get itemsPerRequestCall():number {\r\n\t\treturn this._itemsPerRequestCall;\r\n\t}\r\n\tpublic set itemsPerRequestCall(value:number) { \r\n\t\tthis._itemsPerRequestCall = value;\r\n\t}\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { sidebarItem } from \"../ui/templates/songMenuTemplates\";\r\n\r\nexport class _SongsSidebar {\r\n\tprivate _ui:HTMLDivElement;\r\n\t\r\n\tprivate _categories:Array<_CategoryItem> = [];\r\n\t\r\n\tprivate _selectedCategory:_CategoryItem;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter<_SongSidebarEvent>();\r\n\t\r\n\tconstructor(ui:HTMLDivElement){\r\n\t\tthis._ui = ui;\r\n\t}\r\n\t\r\n\tpublic init():void {\r\n\t\tthis._draw();\r\n\t\t\r\n\t\tthis._selectedCategory = this._categories[0];\r\n\t\tthis._updateSelection();\r\n\t\tthis._dispatchRequest();\r\n\t\t\r\n\t\tthis._addListeners();\r\n\t}\r\n\t\r\n\t/**call to dispatch an event that will request the songs reflecting the\r\n\t * currently selected song category filter. In turn this will fire the\r\n\t * [_SongSection]'s code to redisplay the songs.*/\r\n\tpublic dispatchSongDisplayRequest():void {\r\n\t\tthis._dispatchRequest();\r\n\t}\r\n\t\r\n\tprivate _draw():void {\r\n\t\tlet categoriesDiv = this._ui.querySelector(\".m-sidebar-genresDiv\");\r\n\t\tlet categoriesJson = window['libraryCategories'] as any[];\r\n\t\tfor (let c of categoriesJson){\r\n\t\t\tlet item = new _CategoryItem(c['title'], c['catId']);\r\n\t\t\titem.ui = Templates.createDiv(sidebarItem);\r\n\t\t\titem.ui.innerHTML = c['title'];\r\n\t\t\tcategoriesDiv.append(item.ui);\r\n\t\t\tthis._categories.push(item);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onCategoryClick = (e:MouseEvent):void => {\r\n\t\tthis._selectedCategory = this._categories.find(c => c.ui === e.target);\r\n\t\tthis._updateSelection();\r\n\t\tthis._dispatchRequest();\r\n\t}\r\n\t\r\n\tprivate _updateSelection():void {\r\n\t\tthis._categories.forEach((g) => {\r\n\t\t\tg.ui.classList.remove(\"m-selected\");\r\n\t\t\tif (g === this._selectedCategory){\r\n\t\t\t\tg.ui.classList.add(\"m-selected\");\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _dispatchRequest():void {\r\n\t\tlet event = new _SongSidebarEvent();\r\n\t\tevent.type = _SongSidebarEvent.CategoryRequest;\r\n\t\tevent.categoryId = this._selectedCategory.categoryId;\r\n\t\tthis._emitter.emit(event);\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tthis._categories.forEach((g) => {\r\n\t\t\tg.ui.addEventListener(\"click\", this._onCategoryClick);\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tthis._categories.forEach((g) => {\r\n\t\t\tg.ui.removeEventListener(\"click\", this._onCategoryClick);\r\n\t\t});\r\n\t}\r\n}\r\n\r\nclass _CategoryItem {\r\n\tpublic name:string;\r\n\tpublic categoryId:string;\r\n\tpublic ui:HTMLDivElement;\r\n\t\r\n\tconstructor(name:string, categoryId:string){\r\n\t\tthis.name = name;\r\n\t\tthis.categoryId = categoryId;\r\n\t}\r\n}\r\n\r\nexport class _SongSidebarEvent {\r\n\tpublic type:string;\r\n\tpublic categoryId:string;\r\n\t\r\n\tpublic static readonly CategoryRequest:string = \"categoryRequest\";\r\n}","import { SongDO } from \"../data/SongDO\";\r\nimport { StudentManager } from \"../data/StudentManager\";\r\nimport { AbstractPanelItem, SongPanelItem } from \"./panel_items\";\r\nimport { SongPanel } from \"./SongPanel\";\r\nimport { _SongSidebarEvent, _SongsSidebar } from \"./_SongsSidebar\";\r\n\r\nexport class _SongSection {\r\n\tprivate _container:HTMLDivElement;\r\n\t\r\n\tprivate _sidebar:_SongsSidebar;\r\n\tprivate _panel:SongPanel;\r\n\tprivate _librarySongs:Array = [];\r\n\t\r\n\tconstructor(container:HTMLDivElement){\r\n\t\tthis._container = container;\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate async _init():Promise {\r\n\t\tthis._initializeSidebar();\r\n\t\tthis._initializePanel();\r\n\t\tawait this._getLibrarySongs();\r\n\t\t\r\n\t\tthis._sidebar.event.on(this._onSidebarEvent);\r\n\t\t\r\n\t\t//call init here so we can respond to the sidebar's content request\r\n\t\tthis._sidebar.init();\r\n\t}\r\n\t\r\n\tpublic updateAssessmentScores():void {\r\n\t\tthis._updateAssessmentScores();\r\n\t}\r\n\t\r\n\tprivate _initializeSidebar():void {\r\n\t\tlet sidebarDiv = this._container.querySelector(\".m-panel-sidebar\") as\r\n\t\t\tHTMLDivElement;\r\n\t\tthis._sidebar = new _SongsSidebar(sidebarDiv);\r\n\t}\r\n\t\r\n\tprivate _initializePanel():void {\r\n\t\tlet sectionDiv = this._container.querySelector(\".m-panel-section\");\r\n\t\tlet panelDiv = sectionDiv.querySelector(\".m-hpanel\") as HTMLDivElement;\r\n\t\tlet navDiv = sectionDiv.querySelector(\".m-hpanelnav\") as HTMLDivElement;\r\n\t\tthis._panel = new SongPanel(panelDiv, navDiv,\r\n\t\t\t{ navQueryPrefix: \"lib\" });\r\n\t}\r\n\t\r\n\tprivate async _getLibrarySongs():Promise {\r\n\t\tthis._librarySongs = [];\r\n\t\tlet librarySongsJson:any[] = window['librarySongs'];\r\n\t\tfor (let songJson of librarySongsJson){\r\n\t\t\tlet catId:string = songJson['catId'];\r\n\t\t\tlet sdo = SongDO.fromLibrarySongJson(catId, songJson);\r\n\t\t\tthis._librarySongs.push(sdo);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onSidebarEvent = (e:_SongSidebarEvent):void => {\r\n\t\tlet sdoList:Array;\r\n\t\t\r\n\t\tif (e.type === _SongSidebarEvent.CategoryRequest){\r\n\t\t\tsdoList = this._librarySongs.filter((ls) => {\r\n\t\t\t\treturn (ls.categoryId === e.categoryId);\r\n\t\t\t});\r\n\t\t}\r\n\t\tthis._displaySongs(sdoList, 0);\r\n\t\tthis._updateAssessmentScores();\r\n\t}\r\n\t\r\n\tprivate _displaySongs(songDOList:SongDO[], displayIndex:number):void {\r\n\t\tthis._panel.resetPanel();\r\n\t\tthis._panel.maxItemIndex = songDOList.length;\r\n\t\t\r\n\t\tlet items:AbstractPanelItem[] = [];\r\n\t\tlet index:number = 0;\r\n\t\tfor (let sdo of songDOList){\r\n\t\t\tlet item = new SongPanelItem(sdo);\r\n\t\t\titem.index = index;\r\n\t\t\titems.push(item);\r\n\t\t\tindex++;\r\n\t\t}\r\n\t\t\r\n\t\tthis._panel.addPanelItems(items);\r\n\t\tthis._panel.displayFromIndex(displayIndex);\r\n\t}\r\n\t\r\n\tprivate _updateAssessmentScores():void {\r\n\t\tlet student = StudentManager.currentStudent;\r\n\t\tlet items = this._panel.getAllPanelItems();\r\n\t\tfor (let item of items){\r\n\t\t\tlet msItem = item as SongPanelItem;\r\n\t\t\tlet score:number = (student != null)\r\n\t\t\t\t? student.scores.get(msItem.songDO.libId)\r\n\t\t\t\t: null;\r\n\t\t\tmsItem.updateAssessmentScore(score, student != null);\r\n\t\t}\r\n\t}\r\n}","import { createEmitter } from \"ts_utils\";\r\nimport { SongDO } from \"../data/SongDO\";\r\nimport { StudentManager } from \"../data/StudentManager\";\r\nimport { StudentSelectionWindow, StudentSelectionWindowEvent }\r\n\tfrom \"../data/StudentSelectionWindow\";\r\nimport { AppContainer } from \"../ui/AppContainer\";\r\nimport { Templates } from \"../ui/Templates\";\r\nimport { AbstractPanelItem, SongPanelItem } from \"./panel_items\";\r\nimport { _LeadersSection } from \"./_LeadersSection\";\r\nimport { _SongSection } from \"./_SongSection\";\r\nimport { songMenuOverlay } from \"../ui/templates/songMenuTemplates\";\r\n\r\nexport class MainMenu {\r\n\t\r\n\t/**the most recent SongDO selected to be opened (from MuseScore or file)*/\r\n\tprivate _currentSongDO:SongDO;\r\n\t\r\n\tprivate _container:HTMLDivElement;\r\n\tprivate _overlay:HTMLDivElement;\r\n\tprivate _welcomeDiv:HTMLDivElement;\r\n\tprivate _switchUserLink:HTMLAnchorElement;\r\n\tprivate _songSection:_SongSection;\r\n\tprivate _leadersSection:_LeadersSection;\r\n\tprivate _initialized:boolean = false;\r\n\t\r\n\tprivate _resizeTimerId:number;\r\n\t\r\n\tpublic get event() { return this._emitter.event; }\r\n\tprivate _emitter = createEmitter();\r\n\t\r\n\tconstructor(){\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate async _init():Promise {\r\n\t\tthis._container = AppContainer.get().songMenuUi;\r\n\t\t\r\n\t\tthis._overlay = Templates.createDiv(songMenuOverlay);\r\n\t\tdocument.querySelector('body').append(this._overlay);\r\n\t\t\r\n\t\tthis._welcomeDiv = this._container.querySelector(\r\n\t\t\t\"#m-currentStudent-welcome\");\r\n\t\tthis._switchUserLink = this._container.querySelector(\r\n\t\t\t\"#m-switchUserLink\");\r\n\t\t\r\n\t\tthis._songSection = new _SongSection(this._container);\r\n\t\t\r\n\t\tthis._leadersSection = new _LeadersSection(this._container);\r\n\t\t\r\n\t\tthis._showStudentSelectionWindow(null);\r\n\t\t\r\n\t\tthis._initialized = true;\r\n\t}\r\n\t\r\n\tpublic async activate():Promise {\r\n\t\tif (!this._initialized) { await this._init(); }\r\n\t\telse { document.querySelector('body').append(this._overlay); }\r\n\t\t\r\n\t\tawait this._updateDisplay();\r\n\t\tthis._addListeners();\r\n\t\t\r\n\t\tthis._overlay.remove();\r\n\t}\r\n\t\r\n\tpublic deactivate():void {\r\n\t\tthis._removeListeners();\r\n\t}\r\n\t\r\n\tprivate _handleSongItemClick = (panelItem:AbstractPanelItem):void => {\r\n\t\tif (panelItem instanceof SongPanelItem){\r\n\t\t\tthis._requestSongLoad(panelItem.songDO);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _requestSongLoad(songDO:SongDO):void {\r\n\t\t//load the song\r\n\t\tconsole.log(songDO.title);\r\n\t\tthis._currentSongDO = songDO;\r\n\t\t//dispatch ready event\r\n\t\tlet ev = new MainMenuEvent(MainMenuEventType.loadSongRequest);\r\n\t\tev.songDO = songDO;\r\n\t\tthis._emitter.emit(ev);\r\n\t}\r\n\t\r\n\tprivate _showStudentSelectionWindow = (e:MouseEvent):void => {\r\n\t\tlet ssWindow = new StudentSelectionWindow();\r\n\t\tssWindow.event.on(async (e:StudentSelectionWindowEvent) => {\r\n\t\t\tssWindow.event.offAll();\r\n\t\t\tlet name = StudentManager.currentStudent.name;\r\n\t\t\tthis._welcomeDiv.innerHTML = `Welcome, ${name}!`;\r\n\t\t\tthis._songSection.updateAssessmentScores();\r\n\t\t\tawait this._leadersSection.update();\r\n\t\t});\r\n\t}\r\n\t\r\n\tprivate _onWindowResize = (e:Event):void => {\r\n\t\tif (this._resizeTimerId != null){\r\n\t\t\twindow.clearTimeout(this._resizeTimerId);\r\n\t\t\tthis._resizeTimerId = null;\r\n\t\t}\r\n\t\t\r\n\t\tthis._resizeTimerId = window.setTimeout(this._updateDisplay, 500);\r\n\t}\r\n\t\r\n\tprivate _updateDisplay = async ():Promise => {\r\n\t\tthis._songSection.updateAssessmentScores();\r\n\t\tawait this._leadersSection.update();\r\n\t}\r\n\t\r\n\tprivate _addListeners():void {\r\n\t\tAbstractPanelItem.click.on(this._handleSongItemClick);\r\n\t\t\t\r\n\t\twindow.addEventListener(\"resize\", this._onWindowResize);\r\n\t\tthis._switchUserLink.addEventListener(\"click\",\r\n\t\t\tthis._showStudentSelectionWindow);\r\n\t}\r\n\t\r\n\tprivate _removeListeners():void {\r\n\t\tAbstractPanelItem.click.offAll();\r\n\t\t//for some reason this is not working consistently.\r\n\t\t// AbstractPanelItem.click.off(this._handleSongItemClick);\r\n\t\t\t\r\n\t\twindow.removeEventListener(\"resize\", this._onWindowResize);\r\n\t\tthis._switchUserLink.removeEventListener(\"click\",\r\n\t\t\tthis._showStudentSelectionWindow);\r\n\t}\r\n\t\r\n\t/**the most recent SongDO selected to be opened (from MuseScore or file)*/\r\n\tpublic get currentSongDO():SongDO { return this._currentSongDO; }\r\n\t\r\n\t/**true if the [MainMenu] is currently displayed*/\r\n\tpublic get isActive():boolean { return this._container.parentNode != null; }\r\n}\r\n\r\nexport class MainMenuEvent {\r\n\tpublic type:MainMenuEventType;\r\n\tpublic songDO:SongDO;\r\n\t\r\n\tconstructor(type:MainMenuEventType){\r\n\t\tthis.type = type;\r\n\t}\r\n}\r\n\r\nexport enum MainMenuEventType {\r\n\tloadSongRequest\r\n}","import { BrowserUtils } from \"ts_utils\";\r\nimport { SongDO } from \"./data/SongDO\";\r\nimport { PlayerInitializer } from \"./player/PlayerInitializer\";\r\nimport { RAControls, RAControlsEvent, RAControlsEventType }\r\n\tfrom \"./player/RAControls\";\r\nimport { FbInit } from \"./services/firebase/FbInit\";\r\nimport { AppSettings } from \"./settings/AppSettings\";\r\nimport { MainMenu, MainMenuEvent, MainMenuEventType }\r\n\tfrom \"./songSelection/MainMenu\";\r\nimport { AppContainer, AppScreen } from \"./ui/AppContainer\";\r\nimport * as analytics from \"./utilities/analytics\";\r\n\r\nexport class RecorderAce {\r\n\tprivate _mainMenu:MainMenu;\r\n\tprivate _raControls:RAControls;\r\n\t\r\n\tprivate _state:AppState;\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate async _init():Promise {\r\n\t\t//init Firestore to enable persistent storage\r\n\t\tawait FbInit.initializeFirebase(true);\r\n\t\t\r\n\t\t//clear query params and set start page history to song menu\r\n\t\tthis._setStartPageHistory();\r\n\t\t\r\n\t\t//init app container\r\n\t\tAppContainer.get();\r\n\t\t\r\n\t\t//create the MainMenu\r\n\t\tthis._state = AppState.initializingMainMenu;\r\n\t\tthis._mainMenu = new MainMenu();\r\n\t\tthis._mainMenu.event.on(this._onMainMenuEvent);\r\n\t\t\r\n\t\t//create PlayerWindow\r\n\t\tthis._state = AppState.initializingPlayer;\r\n\t\tlet initializer = new PlayerInitializer();\r\n\t\tawait initializer.loadApplication();\r\n\t\tthis._raControls = initializer.raControls;\r\n\t\t\r\n\t\tthis._raControls.event.on(this._onRaControlsEvent);\r\n\r\n\t\t//MainMenu loading completes complete asynchronously, so the remaining \r\n\t\t//lines in this method will execute before the MainMenu completes\r\n\t\tAppContainer.get().setActiveScreen(AppScreen.menu); \r\n\t\tawait this._showSongMenu(false);\r\n\t\t\r\n\t\t//listen for back/forward buttons\r\n\t\twindow.addEventListener(\"popstate\", this._onPopState);\r\n\t}\r\n\t\r\n\tprivate _onMainMenuEvent = (e:MainMenuEvent):void => {\r\n\t\tif (e.type === MainMenuEventType.loadSongRequest){\r\n\t\t\t//update the url\r\n\t\t\tlet query:string = this._buildSongQuery(e.songDO);\r\n\t\t\twindow.history.pushState({'page':'play'}, \"\",\r\n\t\t\t\t`${AppSettings.pageUrl}${query}`);\r\n\t\t\t\r\n\t\t\t//update page title to the new song\r\n\t\t\tdocument.title = e.songDO.title?? \"Custom Song\";\r\n\t\t\t\r\n\t\t\tanalytics.updateAnalyticsPage(query, document.title);\r\n\t\t\t\r\n\t\t\t//call onPopState\r\n\t\t\tthis._onPopState(null);\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _buildSongQuery(sdo:SongDO):string {\r\n\t\treturn BrowserUtils.buildQueryString(new Map([\r\n\t\t\t[\"id\", sdo.libId]\r\n\t\t]));\r\n\t}\r\n\t\r\n\tprivate _onPopState = async (e:PopStateEvent):Promise => {\r\n\t\tif (window.history.state[\"page\"] === \"menu\"){\r\n\t\t\tthis._raControls.closeSong();\r\n\t\t\tAppContainer.get().setActiveScreen(AppScreen.menu);\r\n\t\t\tawait this._showSongMenu();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis._mainMenu.deactivate();\r\n\t\t\tthis._state = AppState.playerSongLoading;\r\n\t\t\tAppContainer.get().setActiveScreen(AppScreen.player);\r\n\t\t\tawait this._raControls.openSong(this._mainMenu.currentSongDO);\r\n\t\t\tthis._state = AppState.playerActive;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate _onRaControlsEvent = (e:RAControlsEvent):void => {\r\n\t\tswitch (e.type){\r\n\t\t\tcase RAControlsEventType.mainMenuRequest:\r\n\t\t\t\twindow.history.back();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate async _showSongMenu(updateAnalytics:boolean = true):Promise {\r\n\t\tthis._state = AppState.songMenuLoading;\r\n\t\tdocument.title = \"RecorderAce\";\r\n\t\tif (updateAnalytics){\r\n\t\t\tanalytics.updateAnalyticsPage(\"\", \"RecorderAce\");\r\n\t\t}\r\n\r\n\t\t//this completes asynchronously, but it shouldn't be a problem.\r\n\t\tawait this._mainMenu.activate();\r\n\t\tthis._state = AppState.songMenuActive;\r\n\t}\r\n\t\r\n\tprivate _setStartPageHistory():void {\r\n\t\t//update the query string to remove song ids and pop indexes.\r\n\t\tlet query:string = BrowserUtils.getUpdatedQueryString(['id']);\r\n\t\t\r\n\t\t//we'll always start history on the menu page, regardless\r\n\t\tdocument.title = \"RecorderAce\";\r\n\t\twindow.history.replaceState({\"page\":\"menu\"}, \"\", \r\n\t\t\t`${AppSettings.pageUrl}${query}`);\r\n\t}\r\n}\r\n\r\nenum AppState {\r\n\tstartScreen,\r\n\tinitializingMainMenu,\r\n\tinitializingPlayer,\r\n\tsongMenuLoading,\r\n\tsongMenuActive,\r\n\tplayerSongLoading,\r\n\tplayerActive\r\n}","export function updateAnalyticsPage(query:string, pageTitle:string):void {\r\n\ttry {\r\n\t\t// if (window[\"sendPagePath\"]){\r\n\t\t// \twindow[\"sendPagePath\"](`/RecorderAce/${page}`);\r\n\t\t// }\r\n\t\tif (window[\"gtag\"]){\r\n\t\t\twindow[\"gtag\"]('event', 'page_view', {\r\n\t\t\t\tpage_title: pageTitle,\r\n\t\t\t\tpage_location: `/RecorderAce/${query}`\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tcatch(e){\r\n\r\n\t}\r\n}","import { RecorderAce } from \"./src/RecorderAce\";\r\nimport { Services } from \"./src/services/Services\";\r\nimport { AppSettings } from \"./src/settings/AppSettings\";\r\n\r\nexport class Main {\r\n\tprivate _app:RecorderAce;\r\n\t\r\n\tconstructor(){\r\n\t\tthis._init();\r\n\t}\r\n\t\r\n\tprivate _init():void{\r\n\t\tAppSettings.init();\r\n\t\t\r\n\t\tlet apiUrl = AppSettings.getJSParam(\"apiUrl\") as string;\r\n\t\tServices.rootApiPath = apiUrl;\r\n\t\tServices.recorderAceApiPath = (apiUrl + \"RecorderAce/\");\r\n\t\t\r\n\t\tthis._cleanUrl();\r\n\t\t\r\n\t\t//launch app\r\n\t\tthis._app = new RecorderAce();\r\n\t}\r\n\t\r\n\tprivate _cleanUrl():void {\r\n\t\tlet url = window.location.toString();\r\n\t\t//first check for song ID with old URL string with just #id\r\n\t\tlet songNum:string;\r\n\t\tlet regEx = /#\\d+/;\r\n\t\tlet matches = url.match(regEx);\r\n\t\tif (matches != null){\r\n\t\t\tsongNum = matches[0].substring(1);\r\n\t\t}\r\n\r\n\t\t//now check for song ID with new URL string with #!id\r\n\t\tregEx = /#!\\d+/;\r\n\t\tmatches = url.match(regEx);\r\n\t\tif (matches != null){\r\n\t\t\tsongNum = matches[0].substring(2);\r\n\t\t}\r\n\t\t\r\n\t\tif (songNum != null){\r\n\t\t\twindow.history.replaceState({'url': ''}, \"menuView\", \r\n\t\t\t\t`./?id=${songNum}`);\r\n\t\t}\r\n\t\telse if (url.endsWith(\"#\")){\r\n\t\t\twindow.history.replaceState({'url': ''}, \"menuView\", \"./\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\nnew Main();","import { extensions } from '../extensions/Extensions.mjs';\nimport { Container } from '../scene/container/Container.mjs';\nimport { AccessibilitySystem } from './AccessibilitySystem.mjs';\nimport { accessibilityTarget } from './accessibilityTarget.mjs';\n\n\"use strict\";\nextensions.add(AccessibilitySystem);\nContainer.mixin(accessibilityTarget);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../extensions/Extensions.mjs';\nimport { ResizePlugin } from './ResizePlugin.mjs';\nimport { TickerPlugin } from './TickerPlugin.mjs';\n\n\"use strict\";\nextensions.add(ResizePlugin);\nextensions.add(TickerPlugin);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../extensions/Extensions.mjs';\nimport { Container } from '../scene/container/Container.mjs';\nimport { EventSystem } from './EventSystem.mjs';\nimport { FederatedContainer } from './FederatedEventTarget.mjs';\n\n\"use strict\";\nextensions.add(EventSystem);\nContainer.mixin(FederatedContainer);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { GraphicsContextSystem } from './shared/GraphicsContextSystem.mjs';\nimport { GraphicsPipe } from './shared/GraphicsPipe.mjs';\n\n\"use strict\";\nextensions.add(GraphicsPipe);\nextensions.add(GraphicsContextSystem);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { MeshPipe } from './shared/MeshPipe.mjs';\n\n\"use strict\";\nextensions.add(MeshPipe);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { CanvasTextPipe } from './canvas/CanvasTextPipe.mjs';\nimport { CanvasTextSystem } from './canvas/CanvasTextSystem.mjs';\n\n\"use strict\";\nextensions.add(CanvasTextSystem);\nextensions.add(CanvasTextPipe);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { BitmapTextPipe } from './BitmapTextPipe.mjs';\n\n\"use strict\";\nextensions.add(BitmapTextPipe);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { HTMLTextPipe } from './HTMLTextPipe.mjs';\nimport { HTMLTextSystem } from './HTMLTextSystem.mjs';\n\n\"use strict\";\nextensions.add(HTMLTextSystem);\nextensions.add(HTMLTextPipe);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { TilingSpritePipe } from './TilingSpritePipe.mjs';\n\n\"use strict\";\nextensions.add(TilingSpritePipe);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../../extensions/Extensions.mjs';\nimport { NineSliceSpritePipe } from './NineSliceSpritePipe.mjs';\n\n\"use strict\";\nextensions.add(NineSliceSpritePipe);\n//# sourceMappingURL=init.mjs.map\n","import { extensions } from '../extensions/Extensions.mjs';\nimport { FilterPipe } from './FilterPipe.mjs';\nimport { FilterSystem } from './FilterSystem.mjs';\n\n\"use strict\";\nextensions.add(FilterSystem);\nextensions.add(FilterPipe);\n//# sourceMappingURL=init.mjs.map\n"],"names":["MAX_BITS","LITERALS","HEAP_SIZE","END_BLOCK","Z_STREAM_ERROR","Z_BUF_ERROR","extractArray","array","flatArray","map","length","value","Array","fill","reduce","a","b","concat","isArray","_dist_code","Tree","that","this","bi_reverse","code","len","res","build_tree","s","tree","dyn_tree","stree","stat_desc","static_tree","elems","n","m","node","max_code","heap_len","heap_max","heap","depth","opt_len","static_len","Math","floor","pqdownheap","max","extra","extra_bits","base","extra_base","max_length","h","bits","xbits","f","overflow","bl_count","gen_bitlen","next_code","gen_codes","StaticTree","_length_code","base_length","base_dist","d_code","dist","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","static_l_desc","static_d_desc","static_bl_desc","Config","good_length","max_lazy","nice_length","max_chain","func","config_table","z_errmsg","BUSY_STATE","FINISH_STATE","MAX_MATCH","MIN_LOOKAHEAD","smaller","tn2","tm2","Deflate","strm","status","pending_buf_size","last_flush","w_size","w_bits","w_mask","window","window_size","prev","head","ins_h","hash_size","hash_bits","hash_mask","hash_shift","block_start","match_length","prev_match","match_available","strstart","match_start","lookahead","prev_length","max_chain_length","max_lazy_match","level","strategy","good_match","nice_match","dyn_ltree","dyn_dtree","bl_tree","l_desc","d_desc","bl_desc","l_buf","lit_bufsize","last_lit","d_buf","matches","last_eob_len","bi_buf","bi_valid","init_block","i","scan_tree","curlen","prevlen","nextlen","count","max_count","min_count","REP_3_6","REPZ_3_10","REPZ_11_138","put_byte","p","pending_buf","pending","put_short","w","send_bits","val","send_code","c","c2","send_tree","bi_flush","_tr_tally","lc","out_length","in_length","dcode","compress_block","ltree","dtree","lx","bi_windup","_tr_stored_block","buf","stored_len","eof","header","set","subarray","copy_block","_tr_flush_block","opt_lenb","static_lenb","max_blindex","BL_CODES","build_bl_tree","lcodes","dcodes","blcodes","rank","send_all_trees","flush_block_only","flush_pending","fill_window","more","avail_in","read_buf","longest_match","cur_match","match","chain_length","scan","best_len","limit","_nice_match","wmask","strend","scan_end1","scan_end","deflateReset","total_in","total_out","msg","pending_out","MIN_MATCH","lm_init","k","v","j","deflateInit","_level","_method","memLevel","_strategy","dstate","Uint8Array","deflateEnd","deflateParams","err","deflate","deflateSetDictionary","dictionary","dictLength","index","_strm","flush","level_flags","old_flush","bstate","next_out","next_in","Z_NEED_DICT","avail_out","putShortMSB","max_start","max_block_size","deflate_stored","bflush","hash_head","deflate_fast","max_insert","deflate_slow","STATIC_TREES","ZStream","next_in_index","next_out_index","ZStream$1","prototype","ret","start","size","Z_OK","Z_STREAM_END","Z_DATA_ERROR","Z_MEM_ERROR","inflate_mask","MANY","fixed_tl","fixed_td","cplens","cplext","cpdist","cpdext","BMAX","InfTree","hn","r","u","x","huft_build","bindex","d","e","t","hp","g","l","mask","q","xp","y","z","initWorkArea","vsize","Int32Array","inflate_trees_bits","bb","tb","result","inflate_trees_dynamic","nl","nd","bl","bd","tl","td","inflate_trees_fixed","START","LEN","LENEXT","DIST","DISTEXT","COPY","LIT","WASH","END","BADCODE","InfCodes","mode","tree_index","need","lit","get","lbits","dbits","ltree_index","dtree_index","inflate_fast","tl_index","td_index","tp","tp_index","ml","md","tp_index_t_3","bitb","bitk","write","read","end","read_byte","init","proc","tindex","inflate_flush","free","border","TYPE","LENS","STORED","TABLE","BTREE","DTREE","CODES","DRY","DONELOCKS","BADBLOCKS","InfBlocks","blens","left","table","codes","last","hufts","inftree","reset","bl_","bd_","tl_","td_","set_dictionary","sync_point","BAD","mark","Inflate","inflateReset","istate","blocks","method","was","marker","wbits","inflateEnd","inflateInit","inflate","inflateSetDictionary","inflateSync","inflateSyncPoint","DEFAULT_CONFIGURATION","chunkSize","maxWorkers","navigator","hardwareConcurrency","terminateWorkerTimeout","useWebWorkers","workerScripts","undefined","config","Object","assign","getConfiguration","configure","configuration","baseURL","Error","application","annodex","bbolin","cap","dsptype","ecmascript","futuresplash","hta","javascript","m3g","mathematica","msaccess","msword","mxf","oda","ogg","pdf","postscript","rar","rtf","smil","xml","zip","applixware","exi","gxf","hyperstudio","ipfix","json","marc","mbox","mp21","mp4","onenote","oxps","pkcs10","pkcs8","pkixcmp","sdp","srgs","widget","winhlp","yang","envoy","fractals","olescript","audio","amr","basic","flac","midi","mpeg","mpegurl","adpcm","s3m","silk","webm","xm","mid","chemical","image","gif","ief","jpeg","pcx","png","tiff","bmp","cgm","g3fax","ktx","sgi","webp","pipeg","message","rfc822","model","iges","mesh","vrml","text","calendar","css","csv","h323","html","iuls","mathml","plain","richtext","scriptlet","texmacs","n3","sgml","troff","turtle","vcard","webviewhtml","video","avif","dl","dv","fli","gl","quicktime","h261","h263","h264","jpm","mj2","mimeTypes","type","hasOwnProperty","subtype","indexMimeType","Crc32","constructor","crc","append","data","offset","encodeText","TextEncoder","unescape","encodeURIComponent","charCodeAt","encode","bitArray","a1","a2","shift","getPartial","_shiftRight","slice","bitLength","clamp","ceil","partial","_end","round","carry","out","push","last2","shift2","pop","codec","bytes","fromBits","arr","byteLength","tmp","toBits","hash","_h","_buffer","_length","sha1","blockSize","_init","update","utf8String","ol","Uint32Array","_block","splice","finalize","_key","_f","_S","words","cipher","key","aes","_tables","_precompute","sbox","decTable","keyLen","encKey","decKey","rcon","encrypt","_crypt","decrypt","encTable","sboxInv","th","xInv","x2","x4","x8","tDec","tEnc","input","dir","nInnerRounds","t0","t1","t2","t3","b2","kIndex","prf","iv","_prf","_initIv","_iv","calculate","incWord","word","b1","b3","incCounter","counter","misc","hmac","Hash","_hash","exKey","bs","_baseHash","_resultHash","_updated","digest","ERR_INVALID_PASSWORD","BLOCK_LENGTH","RAW_FORMAT","PBKDF2_ALGORITHM","name","BASE_KEY_ALGORITHM","DERIVED_BITS_ALGORITHM","iterations","DERIVED_BITS_USAGE","SALT_LENGTH","KEY_LENGTH","SIGNATURE_LENGTH","COUNTER_DEFAULT_VALUE","codecBytes","Aes","CtrGladman","ctrGladman","HmacSha1","hmacSha1","AESDecrypt","password","signed","strength","pendingInput","aesCrypto","preamble","async","preambleArray","createKeys","passwordVerification","passwordVerificationKey","keys","createDecryptionKeys","aesCtrGladman","from","authentication","chunkToDecrypt","originalSignature","decryptedChunkArray","encryptedChunk","decryptedChunk","valid","signature","indexSignature","AESEncrypt","salt","crypto","getRandomValues","createEncryptionKeys","output","encryptedChunkArray","paddingStart","paddingEnd","verifySignature","inputLength","inputArray","expand","inputChunk","outputChunk","target","encodedPassword","basekey","subtle","importKey","derivedBits","deriveBits","compositeKey","leftArray","rightArray","begin","HEADER_LENGTH","ZipCryptoDecrypt","zipCrypto","decryptedHeader","ZipCryptoEncrypt","getByte","updateKeys","crcKey0","crcKey2","byte","getInt32","getInt8","imul","temp","number","CODEC_DEFLATE","CODEC_INFLATE","ERR_INVALID_SIGNATURE","codecConstructor","compressed","encryptionStrength","encrypted","Boolean","crc32","dataViewSignature","DataView","buffer","setUint32","getUint32","inputData","newData","MESSAGE_INIT","MESSAGE_APPEND","MESSAGE_FLUSH","MESSAGE_EVENT_TYPE","classicWorkersSupported","getWorker","workerData","options","onTaskFinished","webWorker","scripts","busy","terminate","worker","interface","messageTask","workerOptions","error","addEventListener","onMessage","initAndSendMessage","url","URL","Worker","sendMessage","Promise","resolve","reject","postMessage","event","reponseError","stack","createWebWorkerInterface","interfaceCodec","codecType","startsWith","createCodec","createWorkerInterface","pool","pendingRequests","find","clearTerminateTimeout","Number","isFinite","terminateTimeout","setTimeout","filter","clearTimeout","CONTENT_TYPE_TEXT_PLAIN","Stream","initialized","Reader","Writer","writeUint8Array","TextReader","super","blobReader","BlobReader","Blob","readUint8Array","TextWriter","encoding","blob","getData","reader","FileReader","onload","onerror","readAsText","arrayBuffer","readAsArrayBuffer","BlobWriter","contentType","arrayBuffers","Uint8ArrayReader","MAX_32_BITS","MAX_16_BITS","COMPRESSION_METHOD_DEFLATE","COMPRESSION_METHOD_STORE","COMPRESSION_METHOD_AES","LOCAL_FILE_HEADER_SIGNATURE","DATA_DESCRIPTOR_RECORD_SIGNATURE","CENTRAL_FILE_HEADER_SIGNATURE","END_OF_CENTRAL_DIR_SIGNATURE","ZIP64_END_OF_CENTRAL_DIR_SIGNATURE","ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE","EXTRAFIELD_TYPE_ZIP64","EXTRAFIELD_TYPE_AES","EXTRAFIELD_TYPE_NTFS","EXTRAFIELD_TYPE_NTFS_TAG1","EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP","BITFLAG_ENCRYPTED","BITFLAG_DATA_DESCRIPTOR","BITFLAG_LANG_ENCODING_FLAG","VERSION_DEFLATE","VERSION_ZIP64","VERSION_AES","DIRECTORY_SIGNATURE","MAX_DATE","Date","MIN_DATE","CP437","split","decodeCP437","stringValue","indexCharacter","decodeText","trim","toLowerCase","TextDecoder","fileReader","decode","MINIMUM_CHUNK_SIZE","ERR_ABORT","processData","writer","processChunk","chunkOffset","outputLength","signal","testAborted","min","chunkLength","writeData","onprogress","aborted","PROPERTY_NAMES","Entry","forEach","ERR_BAD_FORMAT","ERR_EXTRAFIELD_ZIP64_NOT_FOUND","ERR_UNSUPPORTED_COMPRESSION","CHARSET_UTF8","CHARSET_CP437","ZIP64_PROPERTIES","ZipReader","getEntries","zipReader","endOfDirectoryInfo","startOffset","minimumBytes","maximumLength","signatureArray","view","getDataView","maximumBytes","seek","indexByte","seekSignature","endOfDirectoryView","directoryDataLength","directoryDataOffset","filesLength","getUint16","prependedDataLength","endOfDirectoryLocatorView","getBigUint64","endOfDirectoryArray","expectedDirectoryDataOffset","originalDirectoryDataOffset","directoryArray","directoryView","entries","indexFile","fileEntry","ZipEntry","readCommonHeader","languageEncodingFlag","bitFlag","filenameOffset","extraFieldOffset","filenameLength","commentOffset","extraFieldLength","versionMadeBy","msDosCompatible","compressedSize","uncompressedSize","commentLength","directory","getUint8","internalFileAttribute","externalFileAttribute","rawFilename","filenameUTF8","commentUTF8","rawExtraField","endOffset","rawComment","filenameEncoding","getOptionValue","commentEncoding","filename","comment","all","endsWith","readCommonFooter","entry","close","zipEntry","extraFieldAES","compressionMethod","rawLastModDate","localDirectory","dataArray","dataView","originalCompressionMethod","lastAccessDate","creationDate","dataDescriptor","dataOffset","rawBitFlag","version","lastModDate","getDate","extraField","Map","rawExtraFieldView","offsetExtraField","extraFieldZip64","zip64","extraFieldView","values","indexValue","missingProperties","propertyName","indexMissingProperty","readExtraFieldZip64","extraFieldUnicodePath","readExtraFieldUnicode","extraFieldUnicodeComment","vendorVersion","vendorId","readExtraFieldAES","extraFieldNTFS","tag1Data","tagValue","attributeSize","tag1View","rawLastAccessDate","rawCreationDate","getDateNTFS","extraFieldData","readExtraFieldNTFS","extraFieldExtendedTimestamp","flags","timeProperties","timeRawProperties","indexProperty","time","rawPropertyName","readExtraFieldExtendedTimestamp","extraFieldUnicode","timeRaw","date","BigInt","ERR_DUPLICATED_NAME","ERR_INVALID_COMMENT","ERR_INVALID_ENTRY_COMMENT","ERR_INVALID_ENTRY_NAME","ERR_INVALID_VERSION","ERR_INVALID_ENCRYPTION_STRENGTH","ERR_INVALID_EXTRAFIELD_TYPE","ERR_INVALID_EXTRAFIELD_DATA","ERR_UNSUPPORTED_FORMAT","EXTRAFIELD_DATA_AES","EXTRAFIELD_LENGTH_ZIP64","workers","ZipWriter","files","pendingCompressedSize","pendingEntries","add","zipWriter","has","extraFieldSize","arraySet","Uint16Array","extendedTimestamp","maximumCompressedSize","keepOrder","getMaximumCompressedSize","bufferedWrite","dataDescriptorSignature","previousFileEntry","resolveLockUnbufferedWrite","resolveLockCurrentFileEntry","lockPreviousFileEntry","fileWriter","lockCurrentFileEntry","lock","lockWrite","rawExtraFieldAES","rawExtraFieldNTFS","rawExtraFieldExtendedTimestamp","extraFieldAESView","setUint16","setUint8","extraFieldExtendedTimestampView","getTime","extraFieldNTFSView","lastModTimeNTFS","getTimeNTFS","setBigUint64","rawExtraFieldZip64","headerArray","headerView","dateArray","dateView","getHours","getMinutes","getSeconds","getFullYear","getMonth","localHeaderArray","dataWritten","dataDescriptorView","dataDescriptorArray","dataDescriptorOffset","rawExtraFieldZip64View","createFileEntry","indexWrittenData","pendingFileEntry","writingBufferedData","headerLength","sliceAsArrayBuffer","arrayBufferView","writeSlice","writeBlob","corruptedEntry","hasCorruptedEntries","delete","getFileEntry","addFile","pendingEntry","then","catch","directoryOffset","END_OF_CENTRAL_DIR_LENGTH","indexFileEntry","closeFile","typedArray","_documentCurrentScript","src","document","baseURI","href","createObjectURL","configureWebWorker","bufsize","lastIndex","bufferIndex","bufferSize","buffers","chunk","nomoreinput","ArrayUtils","lastWhere","items","condition","thisObj","call","lastIndexWhere","removeWhere","remove","item","idx","indexOf","BrowserUtils","isSafari","uagent","userAgent","isMobile","includes","isiOS","isAndroid","getQueryParams","URLSearchParams","location","search","getQueryParam","paramName","getQueryParamInt","params","param","parseInt","getUpdatedQueryString","paramsToRemove","paramsToAdd","qstring","buildQueryString","getFolderPathToFile","fileUrl","lastIndexOf","substring","ConversionUtils","_ConversionUtils","getUint8ArrayFromArrayBuffer","getBlobFromArrayBuffer","getUint8ArrayFromBlob","getArrayBufferFromBinaryBlob","getNumberArrayFromUint8Array","uint8Array","getStringFromUint8Array","getUint8ArrayFromString","getStringFromTextBlob","_","ev","toString","CompressionUtils","zipBlobs","compression","blobWriter","fileName","textReader","console","log","unzip","file","ArrayBuffer","unzipToUint8Array","getStringFromEntry","getBlobFromEntry","createZipFileFromString","uncompressedName","getStringFromZipBlob","zipBlob","JsonUtils","source","JSON","parse","decodeAsList","decodeAsMapOfStringKeys","stringify","jsArrayToArray","list","el","StringUtils","isString","obj","String","generateRandomString","characters","trunc","random","isNull","str","isEmpty","isNullOrEmpty","isNotNull","isNotEmpty","IDTO","RdtoMessage","ALREADY_EXISTS","NOT_FOUND","SERVER_ERROR","UNAUTHORIZED","RDTO","generator","success","_jsonParsed","_generator","jsonMap","_parse","dataValue","dataList","dto","EmptyDTO","HttpUtils","_HttpUtils","userToken","responseType","request","XMLHttpRequest","open","setRequestHeader","send","getString","responseText","getArrayBuffer","response","post","formData","encodedJson","parseQueryString","queryString","searchParams","IdxDbManager","_IdxDbManager","_dbState","_initializeDatabase","db","deleteOld","_config","os","objectStoreNames","contains","deleteObjectStore","autoIncrement","store","createObjectStore","keyPath","createIndex","unique","indexedDB","webkitIndexedDB","mozIndexedDB","IDBTransaction","webkitIDBTransaction","msIDBTransaction","IDBKeyRange","webkitIDBKeyRange","msIDBKeyRange","IdxDbManagerResponse","isSupported","openRequest","onsuccess","_db","_loadFromDb","addRecord","objectStoreName","record","transaction","objectStore","_awaitTransactionResult","addedKey","updateRecord","put","deleteRecord","deleteAllRecords","clear","getRecord","getAllRecords","getAll","records","closeDatabase","deleteDatabase","dbName","finish","onblocked","transactionComplete","addSuccessful","checkFinished","oncomplete","BaseEvent","listeners","on","callback","once","promise","off","listener","originalLength","offAll","SealedEvent","createEmitter","publicListenersEvent","emit","emitting","hadListeners","createEmitterWithBaseEvent","ValidationUtils","helloWorld","isValidEmail","email","raw","RegExp","test","isValidDisplayName","isValidUsername","validatePassword","minLength","requireUpperAndLower","requireNumbers","requireNonAlphas","PasswordValidationResult","pass","removeAllHtmlTags","htmlText","replace","defineProperty","baseEvent","attach","_attach","boundTo","handler","_this","detach","_listeners","deleted","args","_i","arguments","_detach","apply","listenerCount","_call","extendStatics","__extends","setPrototypeOf","__proto__","__","create","syncEvent","ErrorSyncEvent","VoidSyncEvent","SyncEvent","_super","_recursion","_listenersChanged","enumerable","configurable","MAX_RECURSION_DEPTH","isInteger","_a","_b","_c","_d","evtListenersChanged","require$$0","EventQueue_1","sync_event_1","EventQueue","evtFilled","evtDrained","_queue","_flushing","global","_instance","resetGlobal","empty","flushOnce","flushing","queue","maxRounds","EventQueue$1","default","queuedEvent","ErrorQueuedEvent","VoidQueuedEvent","require$$1","require$$2","QueuedEvent","opts","_queued","condensed","_condensed","_queuedData","_queuedListeners","listeners_1","asyncEvent","ErrorAsyncEvent","VoidAsyncEvent","AsyncEvent","defaultScheduler","setImmediate","setScheduler","scheduler","_scheduler","_postDirect","objects","shallowEquals","namesA","namesB","name_1","name_2","sort","join","exports","ErrorAnyEvent","VoidAnyEvent","AnyEvent","EventType","objects_1","async_event_1","queued_event_1","require$$3","_events","monitorAttach","evtFirstAttached","evtLastDetached","Sync","postable","detacher","prevCount","evt","Async","Queued","_e","attachSync","unshift","onceSync","attachAsync","onceAsync","attachQueued","onceQueued","events","__createBinding","o","k2","__exportStar","require$$4","require$$5","EventQueue_2","definition","sections","doInherit","newClass","baseClass","WebmBase","WebmUint","padHex","hex","WebmFloat","WebmContainer","WebmFile","setSource","fixWebmDuration","duration","onloadend","fixDuration","toBlob","ex","updateBySource","updateByData","setData","substr","getValue","setValue","getFloatArrayType","Float32Array","Float64Array","byteArray","reverse","floatArray","readByte","readUint","firstByte","id","info","ctr","section","idHex","writeUint","draft","flag","writeSections","content","contentLength","getSectionById","logger","segmentSection","infoSection","timeScaleSection","durationSection","mimeType","module","ysFixWebmDuration","AudioComponent","_connectedComponents","connect","component","outputNode","inputNode","disconnect","disconnectAll","DestinationAudioComponent","context","_context","destination","ReverbAudioComponent","setReverbImpulse","_convolver","_setupAudioGraph","_preVerbMix","createGain","createConvolver","_dryMix","_wetMix","_masterMix","gain","wetToDryRatio","masterVolume","setValueAtTime","AudioContextManager","_AudioContextManager","initContext","AudioContext","AudioProcessor","_AudioProcessor","generateReverbImpulse","seconds","decay","rate","sampleRate","impulse","createBuffer","impulseL","getChannelData","impulseR","pow","trimBuffer","leftChannel","rightChannel","startTrimSample","newLength","newLeftChannel","newRightChannel","returnBuffer","copyToChannel","normalizeWithBreaks","audioBuffer","maxSamplesBetweenBreaks","convertToMono","normalizationValue","minThreshold","fadeOutTime","fadeSamples","numberOfChannels","_normalizeMonoBuffer","_normalizeMultiChannelBuffer","samples","peak","_getPeak","factor","_multiplyValues","highestPeak","nonZeroSampleSets","newBuffer","targetSamples","_mergeToMono","sample","_waitForNextFrame","numSamples","sampleSets","targetSet","_SoundLoader","downloadProgress","_downloadProgressEmitter","getAudioBufferFromFileInput","fileInputId","getElementById","getAudioBufferFromBlob","audioBlob","ab","decodeAudioData","getAudioBufferFromUrl","getArrayBufferFromUrl","byteBuffer","getDownloadLinkForArrayBuffer","createElement","style","display","download","click","revokeObjectURL","createEmitter2","SoundLoader","ExtensionType","ExtensionType2","normalizeExtension","ext","extension","ref","normalizeExtensionPriority","defaultPriority","priority","extensions","_addHandlers","_removeHandlers","extensions2","handlers","handle","onAdd","onRemove","addHandlers","removeHandlers","handleByMap","handleByNamedList","findIndex","handleByList","browserExt","Environment","load","webworkerExt","self","WorkerGlobalScope","ObservablePoint","observer","_x","_y","_observer","clone","_onUpdate","copyFrom","copyTo","equals","prefix","Events","EE","fn","addListener","emitter","TypeError","_eventsCount","clearEvent","EventEmitter","eventNames","names","getOwnPropertySymbols","ee","a3","a4","a5","removeListener","removeAllListeners","prefixed","PI_2","PI","RAD_TO_DEG","DEG_TO_RAD","Point","shared","tempPoint","Matrix","tx","ty","fromArray","toArray","transpose","pos","newPos","applyInverse","translate","scale","rotate","angle","cos","sin","c1","tx1","matrix","d1","appendFrom","d2","setTransform","pivotX","pivotY","scaleX","scaleY","rotation","skewX","skewY","prepend","decompose","transform","pivot","atan2","delta","abs","skew","sqrt","position","invert","isIdentity","identity","IDENTITY","identityMatrix","tempMatrix","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","sign","row","_ux","_uy","_vx","_vy","mat","groupD8","E","SE","S","SW","W","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","dx","dy","matrixAppendRotationInv","tempPoints","Rectangle","width","height","right","top","bottom","EMPTY","copyFromBounds","bounds","minX","minY","maxX","maxY","rectangle","strokeContains","strokeWidth","intersects","other","x02","y02","x0","x1","y0","y1","lt","lb","rt","rb","nx","ny","n00","n10","n01","n11","mx","my","m00","m10","m01","m11","pad","paddingX","paddingY","fit","y2","resolution","eps","enlarge","getBounds","uidCache","uid","warnings","v8_0_0","deprecation","ignoreDepth","warn","groupCollapsed","groupEnd","NOOP","nextPow2","isPow2","idHash","_TextureStyle","_resourceType","_touched","_maxAnisotropy","destroyed","defaultOptions","addressMode","addressModeU","addressModeV","addressModeW","scaleMode","magFilter","minFilter","mipmapFilter","lodMinClamp","lodMaxClamp","compare","maxAnisotropy","wrapMode","_resourceId","_sharedResourceId","_generateResourceId","bigKey","createResourceIdFromString","destroy","TextureStyle","_TextureSource","uploadMethodId","_resolution","pixelWidth","pixelHeight","sampleCount","mipLevelCount","autoGenerateMipmaps","format","dimension","antialias","_batchTick","_textureBindLocation","label","resource","autoGarbageCollect","resourceWidth","resourceHeight","dimensions","alphaMode","definedProps","_refreshPOT","_style","_onStyleChange","repeatMode","resize","unload","naturalWidth","videoWidth","displayWidth","naturalHeight","videoHeight","displayHeight","newPixelWidth","newPixelHeight","updateMipmaps","isPowerOfTwo","_resource","TextureSource","BufferImageSource","Int16Array","Int8Array","Uint8ClampedArray","tempMat","TextureMatrix","texture","clampMargin","mapCoord","uClampFrame","uClampOffset","_textureID","_updateID","clampOffset","isSimple","_texture","multiplyUvs","uvs","tex","x3","y3","orig","texBase","frame","margin","Texture","defaultAnchor","defaultBorders","dynamic","noFrame","isTexture","_source","updateUvs","textureMatrix","_textureMatrix","nX","nY","nW","nH","w2","h2","cX","cY","destroySource","baseTexture","updateQuadBounds","anchor","padding","sourceWidth","sourceHeight","WHITE","grad","turn","rad","string","exec","object","M","H","$","parsed","rgba","isValid","brightness","isDark","isLight","toHex","toRgb","toRgbString","toHsl","toHslString","toHsv","saturate","desaturate","grayscale","lighten","darken","hue","alpha","isEqual","extend","white","bisque","blue","cadetblue","chartreuse","chocolate","coral","antiquewhite","aqua","azure","whitesmoke","papayawhip","plum","blanchedalmond","black","gold","goldenrod","gainsboro","cornsilk","cornflowerblue","burlywood","aquamarine","beige","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkkhaki","darkgray","darkgreen","darkgrey","peachpuff","darkmagenta","darkred","darkorchid","darkorange","darkslateblue","gray","darkslategray","darkslategrey","deeppink","deepskyblue","wheat","firebrick","floralwhite","ghostwhite","darkviolet","magenta","green","dodgerblue","grey","honeydew","hotpink","blueviolet","forestgreen","lawngreen","indianred","indigo","fuchsia","brown","maroon","mediumblue","lightcoral","darkturquoise","lightcyan","ivory","lightyellow","lightsalmon","lightseagreen","linen","mediumaquamarine","lemonchiffon","lime","khaki","mediumseagreen","limegreen","mediumspringgreen","lightskyblue","lightblue","midnightblue","lightpink","mistyrose","moccasin","mintcream","lightslategray","lightslategrey","navajowhite","navy","mediumvioletred","powderblue","palegoldenrod","oldlace","paleturquoise","mediumturquoise","mediumorchid","rebeccapurple","lightsteelblue","mediumslateblue","thistle","tan","orchid","mediumpurple","purple","pink","skyblue","springgreen","palegreen","red","yellow","slateblue","lavenderblush","peru","palevioletred","violet","teal","slategray","slategrey","aliceblue","darkseagreen","darkolivegreen","greenyellow","seagreen","seashell","tomato","silver","sienna","lavender","lightgreen","orange","orangered","steelblue","royalblue","turquoise","yellowgreen","salmon","saddlebrown","sandybrown","rosybrown","darksalmon","lightgoldenrodyellow","snow","lightgrey","lightgray","dimgray","dimgrey","olivedrab","olive","toName","closest","_Color","_value","_components","_int","_cloneSource","_isSourceEqual","_normalize","isView","value1","value2","type1","every","keys1","keys2","toRgba","toRgbaString","toUint8RgbArray","_arrayRgb","_arrayRgba","toRgbArray","toNumber","toBgrNumber","toLittleEndianNumber","multiply","_temp","_refreshInt","premultiply","applyToRGB","toPremultiplied","hexString","toHexa","alphaString","setAlpha","_clamp","HEX_PATTERN","color","colord","isColorLike","Color","Pool","ClassType","initialSize","_pool","_count","_index","_classType","prepopulate","total","totalSize","totalFree","totalUsed","BigPool","_poolsByClass","Class","getPool","return","stats","ID","used","removeItems","startIdx","removeCount","childrenHelperMixin","allowChildren","removeChildren","beginIndex","endIndex","children","range","removed","child","parent","renderGroup","parentRenderGroup","RangeError","removeChildAt","getChildAt","removeChild","setChildIndex","getChildIndex","addChildAt","currentIndex","didChange","didViewUpdate","_updateFlags","addChild","sortableChildren","sortDirty","swapChildren","child2","index1","index2","structureDidChange","_didChangeId","removeFromParent","reparentChild","reparentChildAt","childMat","worldTransform","newMatrix","setFromMatrix","FilterEffect","pipe","filters","filterArea","MaskEffectManager","_effectClasses","_tests","_initialized","maskClass","getMaskEffect","returnMaskEffect","effect","MaskEffect","effectsMixin","_maskEffect","_filterEffect","effects","addEffect","_updateIsSimple","removeEffect","hasFilters","freeze","findMixin","getChildByName","deep","getChildByLabel","found","getChildrenByLabel","defaultMatrix","Bounds","Infinity","_rectangle","addFrame","addRect","rect","addBounds","addBoundsMask","applyMatrix","fitBounds","isPositive","addVertexData","vertexData","beginOffset","localX","localY","containsPoint","matrixPool","boundsPool","getGlobalBounds","skipUpdateTransform","parentTransform","pooledMatrix","updateTransformBackwards","_getGlobalBounds","visible","measurable","updateLocalTransform","localTransform","parentBounds","preserveBounds","boundsArea","warnCount","maxWarnings","getLocalBounds","relativeMatrix","_getLocalBounds","rootContainer","isRoot","relativeTransform","renderPipeId","addLocalBounds","checkChildrenDidChange","container","previousData","changeId","measureMixin","_localBoundsCacheId","_localBoundsCacheData","_setWidth","localWidth","_setHeight","localHeight","localBounds","localBoundsCacheData","skipUpdate","onRenderMixin","_onRender","onRender","removeOnRender","addOnRender","sortMixin","_zIndex","zIndex","depthOfChildModified","sortChildren","toLocalGlobalMixin","getGlobalPosition","point","toGlobal","_position","globalMatrix","toLocal","InstructionSet","instructions","instructionSize","instruction","RenderGroup","root","canBundle","renderGroupParent","renderGroupChildren","worldColorAlpha","worldColor","worldAlpha","childrenToUpdate","updateTick","childrenRenderablesToUpdate","instructionSet","_onRenderContainers","childrenAtDepth","addRenderGroupChild","renderGroupChild","_removeRenderGroupChild","relativeRenderGroupDepth","onChildUpdate","updateRenderable","globalDisplayStatus","renderPipes","onChildViewUpdate","isRenderable","localDisplayStatus","runOnRender","getChildren","_getChildren","defaultSkew","defaultPivot","defaultScale","UPDATE_COLOR","UPDATE_BLEND","UPDATE_VISIBLE","Container","parentRenderGroupIndex","includeInBuild","relativeGroupTransform","groupTransform","_scale","_pivot","_skew","_cx","_sx","_cy","_sy","_rotation","localColor","localAlpha","groupAlpha","groupColor","groupColorAlpha","localBlendMode","groupBlendMode","_didLocalTransformChangeId","ignore","assignWithIgnore","mixin","defineProperties","getOwnPropertyDescriptors","_updateSkew","isRenderGroup","enableRenderGroup","disableRenderGroup","_worldTransform","getSize","setSize","convertedWidth","convertedHeight","updateTransform","localTransformChangeId","sx","sy","px","py","tint","bgr","blendMode","valueNumber","culled","renderable","oldChildren","cullArea","cullable","cullableChildren","Sprite","roundPixels","rest","batched","_didSpriteUpdate","_bounds","_sourceBounds","_boundsDirty","_sourceBoundsDirty","_roundPixels","_anchor","onViewUpdate","skipCache","currentTexture","_width","_height","_updateBounds","sourceBounds","_updateSourceBounds","destroyTextureSource","textureSource","tempBounds","addMaskBounds","boundsToMask","addMaskLocalBounds","localRoot","getMatrixRelativeToParent","AlphaMask","renderMaskToTexture","hitTestFn","ColorMask","StencilMask","currentAdapter","createCanvas","canvas","getCanvasRenderingContext2D","CanvasRenderingContext2D","getWebGLRenderingContext","WebGLRenderingContext","getNavigator","getBaseUrl","getFontFaceSet","fonts","fetch","parseXML","DOMParser","parseFromString","DOMAdapter","adapter","CanvasSource","autoDensity","resizeCanvas","transparent","didResize","globalThis","HTMLCanvasElement","OffscreenCanvas","ImageSource","HTMLImageElement","getContext","drawImage","ImageBitmap","UPDATE_PRIORITY","UPDATE_PRIORITY2","TickerListener","next","previous","_destroyed","_fn","_once","ticker","redirect","hard","_Ticker","autoStart","deltaTime","lastTime","speed","started","_requestId","_maxElapsedMS","_minElapsedMS","_protected","_lastFrame","_head","deltaMS","targetFPMS","elapsedMS","_tick","requestAnimationFrame","_requestIfNeeded","performance","now","_cancelIfNeeded","cancelAnimationFrame","_startIfPossible","NORMAL","_addListener","addOnce","current","stop","currentTime","FPS","minFPS","fps","maxFPS","minFPMS","_shared","system","_system","Ticker","detectVideoAlphaMode","video2","onloadeddata","autoplay","crossOrigin","preload","createTexture","bindTexture","TEXTURE_2D","framebuffer","createFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK_COLORSPACE_CONVERSION_WEBGL","NONE","texImage2D","RGBA","UNSIGNED_BYTE","pixel","readPixels","deleteFramebuffer","deleteTexture","getExtension","loseContext","_VideoSource","isReady","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_videoFrameRequestCallback","bind","_videoFrameRequestCallbackHandle","_load","_resolve","_reject","_onCanPlay","_onCanPlayThrough","_onError","_onPlayStart","_onPlayStop","_onSeeked","autoLoad","updateFrame","playbackRate","requestVideoFrameCallback","readyState","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","complete","_isSourceReady","_mediaReady","preloadTimeoutMs","_preloadTimeout","ErrorEvent","removeEventListener","_isSourcePlaying","paused","ended","_configureAutoUpdate","play","pause","autoUpdate","cancelVideoFrameCallback","HTMLVideoElement","VideoFrame","crossorigin","loop","muted","playsinline","MIME_TYPES","ogv","mov","m4v","VideoSource","convertToList","forceTransform","Cache","_parsers","_cache","_cacheMap","cacheableAssets","parsers","parser","getCacheableAssets","cacheableMap","key2","cacheKeys","cachedAssets","cacheMap","sources","textureSourceFrom","hasResource","Source","resourceToTexture","LoaderParserPriority","LoaderParserPriority2","assertPath","path2","removeUrlParams","path","toPosix","isUrl","isDataUrl","isBlobUrl","hasProtocol","getProtocol","matchFile","matchProtocol","toAbsolute","customBaseUrl","customRootUrl","baseUrl","rootUrl","rootname","isAbsolute","normalize","protocol","trailingSeparator","allowAboveRoot","lastSegmentLength","lastSlash","dots","lastSlashIndex","normalizeStringPosix","segments","joined","arg","prevArg","joinExtensions","extname","dirname","hasRoot","matchedSlash","proto","origpath","basename","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","sep","delimiter","processX","ids","tags","createStringVariations","vars","isSingleItem","Resolver","_defaultBundleIdentifierOptions","connector","createBundleAssetId","bundleId","assetId","_bundleIdConnector","extractAssetIdFromBundle","assetBundleId","_createBundleAssetId","_extractAssetIdFromBundle","_assetMap","_preferredOrder","_resolverHash","_bundles","setBundleIdentifier","bundleIdentifier","prefer","preferOrders","basePath","_basePath","rootPath","_rootPath","_manifest","_defaultSearchParams","setDefaultSearchParams","queryValues","getAlias","asset","alias","aliasesToUse","addManifest","manifest","bundles","bundle","addBundle","assets","assetNames","convertedAssets","srcs","aliases","bundleAssetId","bundleIds","keyCheck","hasKey","loadParser","srcsToUse","src2","resolvedAssets","formattedAsset","_buildResolvedAsset","resolveBundle","singleAsset","results","resolveUrl","preferredOrder","_getPreferredOrder","priorityKey","filteredAssets","hasBundle","preferred","preference","_appendDefaultSearchParams","assetData","RETINA_PREFIX","copySearchParams","targetUrl","sourceUrl","_Spritesheet","linkedSheets","textures","animations","metaResolution","parseFloat","meta","_frames","frames","_frameKeys","_batchIndex","_callback","BATCH_SIZE","_processFrames","_processAnimations","_parseComplete","_nextBatch","initialFrameIndex","frameIndex","maxFrames","sourceSize","trimmed","rotated","spriteSourceSize","borders","animName","frameName","destroyBase","Spritesheet","validImages","ignoreMultiPack","out2","related_multi_packs","spritesheetAsset","Asset","cache","resolver","ResolveParser","loader","LoadParser","Normal","imageTexture","imageFilename","imagePath","spritesheet","multiPacks","promises","itemUrl","sp","_resolvedAsset","_sourceOrigin","FederatedEvent","manager","bubbles","cancelBubble","cancelable","composed","defaultPrevented","eventPhase","propagationStopped","propagationImmediatelyStopped","layer","page","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","layerX","layerY","pageX","pageY","composedPath","propagationPath","initEvent","_type","_bubbles","_cancelable","initUIEvent","_typeArg","_bubblesArg","_cancelableArg","_viewArg","_detailArg","preventDefault","nativeEvent","Event","stopImmediatePropagation","stopPropagation","appleIphone","appleIpod","appleTablet","appleUniversal","androidPhone","androidTablet","amazonPhone","amazonTablet","windowsPhone","windowsTablet","otherBlackBerry","otherBlackBerry10","otherOpera","otherChrome","otherFirefox","isAppleTabletOnIos13","platform","maxTouchPoints","MSStream","nav","regex","createMatch","apple","phone","ipod","tablet","universal","device","amazon","android","windows","blackberry","blackberry10","opera","firefox","chrome","any","isMobileJs","AccessibilitySystem","renderer","_mobileInfo","debug","_isActive","_isMobileAccessibility","_renderId","_children","_androidUpdateCount","_androidUpdateFrequency","_hookDiv","_createTouchHook","div","_div","_renderer","_onKeyDown","_onMouseMove","isActive","isMobileAccessibility","hookDiv","backgroundColor","title","_activate","_destroyTouchHook","body","appendChild","runners","postrender","parentNode","_deactivate","_updateAccessibleObjects","accessibleChildren","accessible","isInteractive","_accessibleActive","_addChild","renderingToScreen","lastObjectRendered","getBoundingClientRect","viewWidth","viewHeight","_accessibleDiv","hitArea","wt","_capHitArea","accessibleTitle","getAttribute","accessibleHint","setAttribute","tabIndex","_updateDebugHTML","innerHTML","borderStyle","_onClick","_onFocus","_onFocusOut","pointerEvents","accessiblePointerEvents","accessibleType","_dispatchEvent","boundary","rootBoundary","rootTarget","type2","dispatchEvent","keyCode","movementX","movementY","WebGLSystem","WebGPUSystem","idCounts","createIdFromString","groupId","maxFragmentPrecision","getTestContext","isContextLost","getMaxFragmentPrecision","getShaderPrecisionFormat","shaderFragment","FRAGMENT_SHADER","HIGH_FLOAT","precision","fragmentNameCache","VertexNameCache","processes","stripVersion","isES300","ensurePrecision","isFragment","maxSupportedPrecision","maxSupportedFragmentPrecision","maxSupportedVertexPrecision","requestedFragmentPrecision","requestedVertexPrecision","addProgramDefines","setProgramName","nameCache","insertVersion","programCache","_GlProgram","fragment","preprocessorOptions","preferredFragmentPrecision","preferredVertexPrecision","vertex","processKey","processOptions","_attributeData","_uniformData","_uniformBlockData","transformFeedbackVaryings","GlProgram","attributeFormatData","uint8x2","stride","normalised","uint8x4","sint8x2","sint8x4","unorm8x2","unorm8x4","snorm8x2","snorm8x4","uint16x2","uint16x4","sint16x2","sint16x4","unorm16x2","unorm16x4","snorm16x2","snorm16x4","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","getAttributeInfoFromFormat","WGSL_TO_VERTEX_TYPES","f32","vec2f","vec3f","vec4f","i32","u32","bool","extractStructAndGroups","wgsl","groupPattern","bindingPattern","namePattern","typePattern","structMemberPattern","structName","groups","group","binding","isUniform","structs","struct","members","acc","member","name2","some","ShaderStage","ShaderStage2","GpuProgram","_layoutKey","layout","gpuLayout","structsAndGroups","vertexStructsAndGroups","fragmentStructsAndGroups","structNameSet","Set","dupeGroupKeySet","removeStructAndGroupDuplicates","generateLayoutHash","visibility","VERTEX","FRAGMENT","sampler","sampleType","viewDimension","multisampled","generateGpuLayoutGroups","autoAssignGlobalUniforms","globalUniforms","autoAssignLocalUniforms","localUniforms","_generateProgramKey","entryPoint","attributeData","mainVertStart","arrowFunctionStart","functionArgsSubstring","inputsRegex","instance","extractAttributesFromGpuProgram","UNIFORM_TYPES_VALUES","UNIFORM_TYPES_MAP","getDefaultUniformValue","_UniformGroup","uniformStructures","isUniformGroup","_dirtyId","uniforms","uniformData","ubo","isStatic","_signature","UniformGroup","BindGroup","resources","_dirty","setResource","_updateKey","keyParts","currentResource","onResourceChange","getResource","_touch","tick","RendererType","RendererType2","Shader","_uniformBindMap","_ownedBindGroups","gpuProgram","glProgram","compatibleRenderers","groupMap","WEBGPU","WEBGL","nameHash","uniformName","groupData","bindTick","_buildResourceAccessor","addResource","groupIndex","bindIndex","uniformsOut","destroyPrograms","bindGroup","gpu","blendModeIds","normal","screen","overlay","erase","_State","polygonOffset","blend","depthMask","offsets","cullMode","culling","clockwiseFrontFace","depthTest","_blendMode","_blendModeId","_polygonOffset","for2d","state","default2d","State","_Filter","enabled","_state","blendRequired","filterManager","clearMode","applyFilter","Filter","environments","unsafeEval","unsafeEvalSupported","Function","earcut","holeIndices","dim","invSize","hasHoles","outerLen","outerNode","linkedList","triangles","steiner","getLeftmost","compareX","eliminateHole","eliminateHoles","earcutLinked","clockwise","signedArea","insertNode","removeNode","filterPoints","again","area","ear","zOrder","prevZ","nextZ","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","ax","bx","cx","ay","by","cy","pointInTriangle","minZ","maxZ","locallyInside","isValidDiagonal","splitPolygon","hole","bridge","hx","hy","qx","tanMin","sectorContainsSector","findHoleBridge","bridgeReverse","leftmost","intersectsPolygon","inside","middleInside","p1","p2","q1","q2","o1","o2","o3","o4","onSegment","num","Node","an","bp","sum","earcutModule","deviation","polygonArea","trianglesArea","flatten","vertices","holes","holeIndex","CLEAR","CLEAR2","SystemRunner","_name","a0","a6","a7","removeAll","defaultRunners","_AbstractRenderer","_initOptions","_systemsHash","combinedRunners","_addRunners","_unsafeEvalCheck","skip","skipExtensionImports","manageImports","env","loadEnvironmentExtensions","_addSystems","systems","_addPipes","renderPipeAdaptors","systemName","render","deprecated","renderTexture","renderTarget","_lastObjectRendered","clearColor","background","colorRgba","isRGBAArray","prerender","renderStart","renderEnd","desiredScreenWidth","desiredScreenHeight","ALL","resolutionChange","runnerIds","runnerId","_addSystem","ClassRef","pipes","pipeAdaptors","adaptors","adaptor","PipeClass","Adaptor","runner","generateTexture","textureGenerator","failIfMajorPerformanceCaveat","_isWebGLSupported","_isWebGPUSupported","AbstractRenderer","isWebGPUSupported","requestAdapter","requestDevice","renderPriority","ApplicationInitHook","__PIXI_APP_INIT__","Application","RendererInitHook","__PIXI_RENDERER_INIT__","_Application","stage","RendererClass","finalOptions","rendererType","WebGPURenderer","webgpu","contextOptions","stencil","getContextAttributes","WebGLRenderer","webgl","autoDetectRenderer","_plugins","plugin","rendererDestroyOptions","plugins","ResizePlugin","dom","queueResize","_resizeTo","_cancelResize","_resizeId","innerWidth","innerHeight","clientWidth","clientHeight","resizeTo","TickerPlugin","sharedTicker","_ticker","LOW","oldTicker","AbstractBitmapFont","chars","lineHeight","fontFamily","fontMetrics","fontSize","ascent","descent","baseLineOffset","distanceField","pages","applyFillAsTint","baseMeasurementFontSize","baseRenderedFontSize","font","pageTextures","distanceFieldRange","distanceFieldType","destroyTextures","_FillGradient","gradientStops","_styleKey","addColorStop","buildLinearGradient","defaultSize","defaultTextureSize","ctx","gradient","createLinearGradient","fillStyle","fillRect","styleKey","stops","FillGradient","repetitionMap","repeat","FillPattern","repetition","parseSvgPath","segment","command","numbers","parseValues","Circle","radius","r2","distance","circle","Ellipse","halfWidth","halfHeight","normx","normy","halfStrokeWidth","innerA","innerB","outerA","outerB","normalizedX","normalizedY","ellipse","squaredDistanceToLineSegment","lenSq","xx","yy","Polygon","points","flat","il","closePath","polygon","xi","yi","xj","yj","halfStrokeWidthSqrd","iterationLength","pointsDesc","currentPoint","lastX","lastY","isCornerWithinStroke","pX","pY","cornerX","cornerY","RoundedRectangle","radius2","innerX","innerY","rightBound","bottomBound","fragTemplate","generateIfTestSrc","maxIfs","maxTexturesPerBatchCache","getMaxTexturesPerBatch","getParameter","MAX_TEXTURE_IMAGE_UNITS","shader","createShader","fragmentSrc","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","checkMaxIfStatementsInShader","cachedGroups","getTextureBatchBindGroup","bindGroupResources","maxTextures","generateTextureBatchBindGroup","ViewableBuffer","sizeOrBuffer","rawBinaryData","uint32View","float32View","int8View","_int8View","uint8View","_uint8View","int16View","_int16View","int32View","_int32View","float64View","_float64Array","bigUint64View","_bigUint64Array","BigUint64Array","uint16View","sizeOf","fastCopy","sourceBuffer","destinationBuffer","lengthDouble","sourceFloat64View","remainingBytes","sourceUint8View","BLEND_TO_NPM","STENCIL_MODES","STENCIL_MODES2","getAdjustedBlendModeBlend","BatchTextureArray","Batch","action","gpuBindGroup","batcher","batchPool","batchPoolIndex","getBatchFromPool","returnBatchToPool","batch","BATCH_TICK","_Batcher","dirty","batchIndex","batches","_vertexSize","_elements","vertexSize","indexSize","attributeBuffer","indexBuffer","_maxTextures","elementSize","elementStart","_batchIndexStart","_batchIndexSize","batchableObject","indexStart","checkAndUpdateTexture","textureId","updateElement","packAttributes","elements","textureBatch","firstElement","_resizeAttributeBuffer","_resizeIndexBuffer","iBuffer","element","adjustedBlendMode","blendModeChange","_finishBatch","packIndex","break","ensureAttributeBuffer","ensureIndexBuffer","newSize","newArrayBuffer","newIndexBuffer","BYTES_PER_ELEMENT","Batcher","BufferUsage","BufferUsage2","Buffer","usage","shrinkToFit","_data","mappedAtCreation","descriptor","setDataWithSize","static","STATIC","syncGPU","_updateSize","oldData","sizeInBytes","ensureIsBuffer","INDEX","COPY_DST","ensureIsAttribute","attribute","Geometry","attributes","topology","instanceCount","onBufferUpdate","getIndex","getBuffer","geometry","attributeId","byteSize","getGeometryBounds","destroyBuffers","placeHolderBufferData","placeHolderIndexData","BatchGeometry","aPosition","aUV","aColor","aTextureIdAndRound","transformVertices","BatchableGraphics","applyTransform","indicesOffset","indices","geometryData","indexOffset","vertexOffset","graphics","positions","vertSize","rgb","argb","color1","color2","textureIdAndRound","gpuBuffer","buildCircle","ShapeBuilder","build","shape","rx","ry","roundedRect","j1","j2","j3","j4","y22","x12","x22","y12","triangulate","verticesStride","verticesOffset","centerX","centerY","centerIndex","buildEllipse","buildRoundedRectangle","closePointEps","curveEps","square","innerWeight","outerWeight","verts","exx","eyy","eix","eiy","eox","eoy","ey","cx2p0x","cy2p0y","angle0","angle1","startAngle","angleDiff","absAngleDiff","segCount","angleInc","triangulateWithHoles","emptyArray","buildPolygon","buildRectangle","rectData","verticesIndex","buildTriangle","shapeBuilders","tempRect","addTextureToGeometryData","vertOffset","dw","dh","textureUvs","graphicsBatch","addShapePathToGeometryData","shapePath","isStroke","shapePrimitives","lineStyle","flipAlignment","closed","_verticesStride","_verticesOffset","_indicesOffset","alignment","orientation","getOrientationOfPoints","firstPoint","lastPoint","closedShape","closedPath","midPointX","midPointY","indexCount","widthSquared","miterLimitSquared","miterLimit","perpX","perpY","perp1x","perp1y","dx0","dy0","dx1","dy1","dot","cross","pDist","imx","imy","omx","omy","insideWeight","eps2","buildLine","otherPoints","holeArrays","holePrimitives","holePrimitive","holePoints","getHoleArrays","uvsOffset","uvsStride","buildUvs","buildSimpleUvs","GpuGraphicsContext","GraphicsContextRenderData","_GraphicsContextSystem","_gpuContextHash","_graphicsDataContextHash","bezierSmoothness","getContextRenderData","_initContextRenderData","updateGpuContext","gpuContext","_initContext","_cleanGraphicsContextData","buildContextBatches","batchMode","customShader","isBatchable","getGpuContext","graphicsData","drawBatches","onGraphicsContextDestroy","CanvasSystem","GraphicsContextSystem","RECURSION_LIMIT","FLT_EPSILON","PATH_DISTANCE_EPSILON","buildAdaptiveBezier","sX","sY","cp1x","cp1y","cp2x","cp2y","eX","eY","smoothness","smoothing","distanceTolerance","recursive","y4","x23","y23","x34","y34","x123","y123","x234","y234","x1234","y1234","d3","buildAdaptiveQuadratic","buildArc","steps","TAU","ang1","ang2","mapToEllipse","cosPhi","sinPhi","yp","approxUnitArc","vectorAngle","acos","buildArcToSvg","xAxisRotation","largeArcFlag","sweepFlag","pxp","pyp","lambda","rxSq","rySq","pxpSq","pypSq","radicant","centerXp","centerYp","vx1","vy1","vx2","vy2","getArcCenter","ratio","outCurvePoint","curve","tempRectangle","ShapePath","graphicsPath2D","_currentPoly","_graphicsPath2D","moveTo","startPoly","lineTo","_ensurePoly","fromX","fromY","arc","endAngle","counterclockwise","arcTo","mm","dd","cc","tt","k1","qy","buildArcTo","arcToSvg","bezierCurveTo","currentPoly","quadraticCurveTo","endPoly","addPath","drawShape","poly","regularPoly","sides","roundPoly","corner","sideLength","internalAngle","roundShape","useQuadratic","pointLerp","numPoints","thisPoint","pRadius","nextPoint","lastEdgeLength","nextEdgeLength","roundedShapeQuadraticCurve","vecFrom","pp","sharpCorner","p3","v1","v2","asin","radDirection","drawDirection","halfAngle","cRadius","lenOut","roundedShapeArc","filletRect","fillet","maxFillet","inset","chamferRect","chamfer","radiusX","radiusY","roundRect","lastShape","ly","tempX","buildPath","shapePrimitive","boundsRect","GraphicsPath","svgPath","commands","subpaths","currentSubPath","bezierCurveToShort","quadraticCurveToShort","startX","startY","SVGToGraphicsPath","_shapePath","getLastPoint","currentX","currentY","cpx1","cpy1","star","innerRadius","newGraphicsPath2D","cpx2","cpy2","adjustTransform","lastInstruction","currentMatrix","SVGParser","svg","graphicsContext","querySelector","renderChildren","session","strokeStyle","f1","s1","useFill","useStroke","styleParts","stylePart","stroke","parseFloatAttribute","parseStyle","pointsString","graphicsPath","nodeName","beginPath","defaultValue","isFillPattern","isFillGradient","handleFillPattern","defaultStyle","handleFillGradient","toFillStyle","objectStyle","handleColorLike","sourceStyle","handleFillObject","toStrokeStyle","tmpPoint","_GraphicsContext","_activePath","_transform","_fillStyle","defaultFillStyle","_strokeStyle","defaultStrokeStyle","_stateStack","setFillStyle","setStrokeStyle","onUpdate","_initNextPathLocation","cut","holePath","transformedX","transformedY","cpx","cpy","restore","save","getTransform","resetTransform","hasHit","shapes","transformedPoint","holeShapes","GraphicsContext","valuesToIterateForKeys","generateTextStyleKey","prop","addFillStyleKey","_fill","addStokeStyleKey","_stroke","dropShadow","blur","addDropShadowKey","_TextStyle","oldStyle","defaults","TextStyle","defaultDropShadow","dropShadowAlpha","dropShadowAngle","dropShadowBlur","dropShadowColor","dropShadowDistance","strokeThickness","fillGradientStops","defaultTextStyle","gradientFill","fills","convertV7Tov8Style","fullStyle","align","_align","breakWords","_breakWords","_dropShadow","_createProxy","_fontFamily","_fontSize","fontStyle","_fontStyle","fontVariant","_fontVariant","fontWeight","_fontWeight","leading","_leading","letterSpacing","_letterSpacing","_lineHeight","_padding","_trim","textBaseline","_textBaseline","whiteSpace","_whiteSpace","wordWrap","_wordWrap","wordWrapWidth","_wordWrapWidth","_originalFill","_isFillStyle","_originalStroke","_generateKey","cb","Proxy","property","newValue","CanvasPool","canvasOptions","_canvasPool","enableFullScreen","_createCanvasAndContext","getOptimalCanvasAndContext","minWidth","minHeight","canvasAndContext","returnCanvasAndContext","genericFontFamilies","fontStringFromTextStyle","fontSizeString","fontFamilies","contextSettings","willReadFrequently","_CanvasTextMetrics","experimentalLetterSpacingSupported","_experimentalLetterSpacingSupported","lines","lineWidths","maxLineWidth","fontProperties","measureText","_canvas","textKey","_measurementCache","measureFont","__context","lineWidth","_measureText","useExperimentalLetterSpacing","experimentalLetterSpacing","textLetterSpacing","graphemeSegmenter","line","collapseSpaces","_collapseSpaces","collapseNewlines","_collapseNewlines","canPrependSpaces","tokens","_tokenize","token","_isNewline","_addLine","currIsBreakingSpace","isBreakingSpace","lastIsBreakingSpace","tokenWidth","_getFromCache","canBreakWords","wordWrapSplit","char","lastChar","nextChar","canBreakChars","characterWidth","isLastToken","newLine","_trimRight","_newlines","_nextChar","_breakingSpaces","_token","_char","_fonts","metrics","METRICS_STRING","BASELINE_SYMBOL","properties","actualBoundingBoxAscent","actualBoundingBoxDescent","clearMetrics","__canvas","BASELINE_MULTIPLIER","HEIGHT_MULTIPLIER","Intl","Segmenter","segmenter","CanvasTextMetrics","getCanvasFillStyle","pattern","createPattern","fillPattern","fillGradient","resolveCharacters","startCode","endCode","i2","fromCharCode","_DynamicBitmapFont","_measureCache","_currentChars","_currentX","_currentY","_currentPageIndex","_skipKerning","dynamicOptions","_textureSize","textureSize","_mipmap","mipmap","overrideFill","requestedFontSize","overrideSize","skipKerning","ensureCharacters","charList","pageData","_nextPage","fontScale","widthScale","maxCharHeight","skipTexture","paddedWidth","paddedHeight","pageData2","xAdvance","codePointAt","xOffset","yOffset","kerning","_drawGlyph","_applyKerning","newChars","measureCache","first","second","amount","textureResolution","_setupContext","lineJoin","shadowOptions","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","strokeText","fillText","DynamicBitmapFont","getBitmapTextLayout","layoutData","offsetY","charPositions","spaceWidth","spacesIndex","currentLine","previousChar","firstWord","currentWord","spaceWord","nextWord","nextLine","adjustedLetterSpacing","adjustedWordWrapWidth","isEnd","charData","nextCharWidth","measurementData","alignCenter","alignRight","indy","spaceIndex","totalSpaces","alignJustify","fontCount","BitmapFontManager","ALPHA","NUMERIC","ALPHANUMERIC","ASCII","getFont","fontFamilyKey","fnt","dynamicFont","getLayout","bitmapFont","install","textStyle","flatChars","uninstall","cacheKey","BitmapFont","textureFrame","frameReal","bitmapFontTextParser","txt","rawData","common","kernings","attributeList","itemData","strValue","floatValue","isNaN","distanceRange","fieldType","face","charNode","letter","xoffset","yoffset","xadvance","bitmapFontXMLParser","getElementsByTagName","bitmapFontXMLStringParser","validExtensions","bitmapFontCachePlugin","CacheParser","loadBitmapFont","bitmapFontData","textureUrls","textureOptions","pageFile","loadedTextures","_options","BackgroundLoader","verbose","_loader","_assetList","_isLoading","_maxConcurrent","assetUrls","_next","toLoad","toLoadAmount","active","cacheTextureArray","testImageFormat","imageData","Image","createImageBitmap","detectAvif","DetectionParser","formats","imageFormats","detectDefaults","inWorker","testVideoFormat","canPlayType","detectMp4","detectOgv","detectWebm","detectWebp","Loader","_parsersValidated","promiseCache","_getLoadPromiseAndParser","_parserHash","parserX","parser2","testParse","assetsToLoadIn","onProgress","_validateParsers","assetsToLoad","assetsToUnloadIn","loadPromise","loadedAsset","checkDataUrl","mimes","mime","checkExtension","tempURL","loadJson","Low","loadTxt","validWeights","validFontExtensions","validFontMIMEs","CSS_IDENT_TOKEN_REGEX","validURICharactersRegex","loadWebFont","fontFaces","family","nameTokens","charAt","toUpperCase","fontFamilyName","getFontFamilyName","weights","weight","FontFace","uri","encodeURI","getResolutionOfUrl","loadSvg","parseAsGraphicsContext","svgSource","loadAsGraphics","blobUrl","_p","loadAsTexture","WORKER_URL","WorkerInstance$1","WorkerInstance","MAX_WORKERS","UUID","WorkerManager","_createdWorkers","_workerPool","_resolveHash","isImageBitmapSupported","_isImageBitmapSupported","loadImageBitmap","_run","_initWorkers","_getWorker","_complete","_returnWorker","uuid","toDo","validImageExtensions","validImageMIMEs","loadTextures","High","preferWorkers","preferCreateImageBitmap","ok","statusText","imageBlob","validVideoExtensions","validVideoMIMEs","loc","parsedUrl","hostname","port","determineCrossOrigin","loadVideoTextures","isValidDataUrl","isValidExtension","videoElement","attributeMap","sourceElement","onCanPlay","loaded","cleanup","resolveTextureUrl","resolveJsonUrl","Assets","_detections","_backgroundLoader","defaultSearchParams","resolutionPref","texturePreference","_detectFormats","preferredFormats","skipDetections","detections","preferences","setPreferences","urls","urlArray","resolveResults","_mapLoadToResolve","loadBundle","_onProgress","resolveResult","resolveResult2","backgroundLoad","backgroundLoadBundle","resolveArray","loadedAssets","_unloadFromResolved","unloadBundle","detection","assetKeyMap","EventsTicker","interactionFrequency","_deltaTime","_didMove","_tickerAdded","_pauseUpdate","removeTickerListener","pauseUpdate","addTickerListener","domElement","_tickerUpdate","INTERACTION","pointerMoved","_update","rootPointerEvent","supportsTouchEvents","pointerType","PointerEvent","clientX","clientY","pointerId","FederatedMouseEvent","client","movement","offsetX","globalX","globalY","screenX","screenY","getLocalPosition","globalPos","getModifierState","initMouseEvent","_canBubbleArg","_screenXArg","_screenYArg","_clientXArg","_clientYArg","_ctrlKeyArg","_altKeyArg","_shiftKeyArg","_metaKeyArg","_buttonArg","_relatedTargetArg","FederatedPointerEvent","isPrimary","getCoalescedEvents","getPredictedEvents","FederatedWheelEvent","DOM_DELTA_PIXEL","DOM_DELTA_LINE","DOM_DELTA_PAGE","tempHitLocation","tempLocalMapping","EventBoundary","dispatch","moveOnAll","enableGlobalMoveEvents","mappingState","trackingData","eventPool","_allInteractiveElements","_hitElements","_isPointerMoveEvent","hitPruneFn","mapPointerDown","mapPointerMove","mapPointerOut","mapPointerOver","mapPointerUp","mapPointerUpOutside","mapWheel","mappingTable","addEventMapping","propagate","mapEvent","mappers","hitTest","invertedPath","eventMode","currentTarget","notifyTarget","targets","hitTestMoveRecursive","testFn","pruneFn","shouldReturn","_interactivePrune","interactiveChildren","nestedHit","_isInteractive","isInteractiveMode","isInteractiveTarget","hitTestRecursive","relativeLocation","int","handlerKey","_notifyListeners","createPointerEvent","isRightButton","button","pressTargetsByButton","freeEvent","isMouse","outTarget","findMountedTarget","overTargets","outType","outEvent","leaveEvent","overType","overEvent","clonePointerEvent","overTargetAncestor","enterEvent","allMethods","allowGlobalPointerEvents","cursor","pressTarget","clickTarget","clickEvent","clicksByButton","clickCount","timeStamp","clickHistory","detail","wheelEvent","createWheelEvent","allocateEvent","copyPointerData","copyMouseData","copyData","originalEvent","copyWheelData","to","deltaMode","deltaX","deltaY","deltaZ","pressure","tangentialPressure","tiltX","tiltY","twist","altKey","buttons","ctrlKey","metaKey","shiftKey","isTrusted","srcElement","which","overTarget","TOUCH_TO_POINTER","touchstart","touchend","touchendoutside","touchmove","touchcancel","_EventSystem","supportsPointerEvents","autoPreventDefault","_eventsAdded","_rootPointerEvent","_rootWheelEvent","cursorStyles","pointer","features","defaultEventFeatures","_onPointerDown","_onPointerMove","_onPointerUp","_onPointerOverOut","onWheel","defaultEventMode","_defaultEventMode","setTargetElement","eventFeatures","globalMove","_currentCursor","setCursor","applyStyles","_normalizeToPointerData","isNormalized","nativeEvent2","federatedEvent","_bootstrapEvent","move","normalizedEvents","outside","wheel","normalizeWheelEvent","_removeEvents","_addEvents","msPointerEnabled","msContentZooming","msTouchAction","touchAction","passive","capture","mapPositionToPoint","isConnected","resolutionMultiplier","TouchEvent","li","changedTouches","touch","touches","identifier","force","MouseEvent","tempEvent","_transferMouseData","relatedTarget","EventSystem","FederatedContainer","onclick","onmousedown","onmouseenter","onmouseleave","onmousemove","onglobalmousemove","onmouseout","onmouseover","onmouseup","onmouseupoutside","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onglobalpointermove","onpointerout","onpointerover","onpointertap","onpointerup","onpointerupoutside","onrightclick","onrightdown","onrightup","onrightupoutside","ontap","ontouchcancel","ontouchend","ontouchendoutside","ontouchmove","onglobaltouchmove","ontouchstart","onwheel","interactive","_internalEventMode","listenerFn","handleEvent","TexturePool","_poolKeyHash","_texturePool","getOptimalTexture","frameWidth","frameHeight","po2Width","po2Height","getSameSizeTexture","returnTexture","FilterPipe","filterEffect","_container","execute","WebGLPipes","WebGPUPipes","CanvasPipes","getFastGlobalBounds","_getGlobalBoundsRecursive","manageEffects","viewBounds","advanced","quadGeometry","FilterSystem","_filterStackIndex","_filterStack","_filterGlobalUniforms","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture","_globalFilterBindGroup","activeBackTexture","_activeFilterData","backTexture","_getFilterData","filterData","renderables","getGlobalRenderableBounds","colorTextureSource","colorTexture","backBuffer","useBackBuffer","viewPort","rootViewPort","previousRenderSurface","renderSurface","inputTexture","finishRenderPass","previousBounds","getRenderTarget","getBackTexture","flip","flop","lastRenderSurface","backgroundResolution","copyToTexture","isFinalTarget","rootRenderTarget","filterUniforms","outputFrame","inputSize","inputPixel","inputClamp","globalFrame","outputTexture","filterData2","rootTexture","uniformBatch","batchUniforms","getUboResource","encoder","draw","calculateSpriteMatrix","outputMatrix","sprite","mappedMatrix","MaskFilter","uFilterMatrix","uMaskClamp","uAlpha","uMaskTexture","Graphics","_ownedContext","_didGraphicsUpdate","_callContextMethod","rotateTransform","scaleTransform","translateTransform","beginFill","endFill","drawCircle","drawEllipse","drawPolygon","drawRect","drawRoundedRect","drawStar","_MeshGeometry","shrinkBuffersToFit","MeshGeometry","AnimatedSprite","_textures","_durations","animationSpeed","updateAnchor","onComplete","onFrameChange","onLoop","_currentTime","_playing","_previousFrame","HIGH","gotoAndStop","frameNumber","currentFrame","gotoAndPlay","elapsed","previousFrame","lag","_updateTexture","fromFrames","fromImages","images","totalFrames","playing","AbstractText","styleClass","_autoResolution","_didTextUpdate","_styleClass","_text","_getKey","owner","Text","ensureOptions","canvasMeasurement","textStyleToCSS","cssStyles","strokeToCSS","dropShadowToCSS","cssOverrides","tagStyles","tagStyle","cssTagStyle","templates","tagStyleToCSS","dropShadowStyle","HTMLTextStyle","_cssOverrides","_cssStyle","cssStyle","addOverride","toAdd","removeOverride","toRemove","nssvg","nsxhtml","HTMLTextRenderData","svgRoot","createElementNS","foreignObject","styleElement","tempHTMLTextRenderData","addBits","srcParts","parts","part","toLocaleLowerCase","sanitisedPart","findHooksRx","compileHooks","programSrc","hook","extractInputs","fragmentSource","compileInputs","fragments","template","mainInput","finalString","inValue","cleanedString","extractOutputs","injectBits","templateSrc","fragmentParts","bitCacheMap","CACHE_UID","compileHighShader","cacheId","generateCacheId","vertexFragments","shaderBit","fragmentFragments","compiledVertex","mainStruct","mainStart","mainEnd","extractVariableName","compiledCode","compileOutputs","compiledFragment","compileInputsAndOutputs","compileBits","compileHighShaderGl","highFragment","vertexParts","globalUniformsBit","globalUniformsBitGl","compileHighShaderGpuProgram","compileHighShaderGlProgram","colorBit","main","colorBitGl","textureBatchBitGpuCache","generateBindingSrc","bindingIndex","generateSampleSrc","generateTextureBatchBit","textureBatchBitGlCache","generateSampleGlSrc","generateTextureBatchBitGl","roundPixelsBit","roundPixelsBitGl","batchSamplersUniformGroupHash","getBatchSamplersUniformGroup","batchSamplersUniformGroup","sampleValues","uTextures","GlBatchAdaptor","_didUpload","_tempState","batcherPipe","_shader","batchSamplers","contextChange","batchPipe","updateUniformGroup","uniformGroup","WebGLPipesAdaptor","tempState","GpuBatchAdaptor","program","_geometry","setGeometry","pipeline","getPipeline","globalUniformsBindGroup","resetBindGroup","setBindGroup","getBindGroup","textureGC","setPipeline","renderPassEncoder","drawIndexed","WebGPUPipesAdaptor","BatcherPipe","_batches","_geometries","_adaptor","buildStart","_activeBatch","_activeGeometry","addToBatch","buildEnd","activeBatch","upload","localUniformBit","localUniformBitGroup2","localUniformBitGl","textureBit","textureBitGl","buildInstructions","colorMask","collectAllRenderablesAdvanced","collectAllRenderables","rendererPipes","setBlendMode","addRenderable","collectAllRenderablesSimple","addRenderGroup","AlphaMaskEffect","AlphaMaskPipe","_activeMaskStage","maskedContainer","maskContainer","_maskedContainer","renderMask","filterTexture","maskData","ColorMaskPipe","_colorStack","_colorStackIndex","_currentColor","colorStack","currentColor","_mask","setMask","StencilMaskPipe","_maskStackHash","_maskHash","WeakMap","instructionsStart","instructionsLength","renderTargetUid","maskStackIndex","ensureDepthStencil","setStencilMode","RENDERING_MASK_ADD","MASK_ACTIVE","RENDERING_MASK_REMOVE","STENCIL","DISABLED","BUFFER_TYPE","BUFFER_TYPE2","GlBuffer","updateID","GlBufferSystem","_gpuBuffers","_boundBufferBases","_gl","getGlBuffer","createGLBuffer","glBuffer","bindBuffer","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","updateBuffer","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","destroyAll","deleteBuffer","onBufferDestroy","contextLost","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","UNIFORM","_GlContextSystem","supports","uint32Indices","uniformBufferObject","vertexArrayObject","srgbTextures","nonPowOf2wrapping","msaa","nonPowOf2mipmaps","handleContextLost","handleContextRestored","isLost","initFromContext","premultipliedAlpha","createContext","preferWebGLVersion","preserveDrawingBuffer","powerPreference","webGLVersion","getExtensions","validateContext","anisotropicFiltering","floatTextureLinear","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc","rgtc","drawBuffers","depthTexture","uint32ElementIndex","floatTexture","textureHalfFloat","textureHalfFloatLinear","vertexAttribDivisorANGLE","srgb","colorBufferFloat","provokeExt","provokingVertexWEBGL","FIRST_VERTEX_CONVENTION_WEBGL","_contextLossForced","restoreContext","useProgram","forceContextLoss","isWebGl2","GlContextSystem","ensureAttributes","extractedData","tempStride","tempStart","ensureStartAndStride","GL_FORMATS","GL_FORMATS2","GL_TARGETS","GL_TARGETS2","GL_TYPES","GL_TYPES2","infoMap","BYTE","UNSIGNED_SHORT","SHORT","HALF_FLOAT","FLOAT","UNSIGNED_INT","INT","topologyToGlMap","GlGeometrySystem","_geometryVaoHash","_activeVao","hasVao","hasInstance","nativeVaoExtension","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","nativeInstancedExtension","drawArraysInstanced","drawArraysInstancedANGLE","drawElementsInstanced","drawElementsInstancedANGLE","vertexAttribDivisor","getVao","updateBuffers","unbind","bufferSystem","checkCompatibility","geometryAttributes","shaderAttributes","getSignature","attribs","strings","initGeometryVao","_incRefCount","_getProgramData","onGeometryDestroy","vaoObjectHash","activateVao","lastBuffer","programAttrib","enableVertexAttribArray","attributeInfo","vertexAttribIPointer","vertexAttribPointer","divisor","glTopology","glType","drawElements","drawArrays","bigTriangleGeometry","_GlBackBufferSystem","_useBackBufferThisRender","_antialias","bigTriangleProgram","_bigTriangleShader","uTexture","renderTarget2","_targetTexture","_getBackBufferTexture","_presentBackBuffer","_backBufferTexture","targetSourceTexture","GlBackBufferSystem","GlColorMaskSystem","_colorMaskCache","GlEncoderSystem","commandFinished","skipSync","_activeProgram","GlRenderTarget","msaaRenderBuffer","GpuStencilModesToPixi","stencilWriteMask","stencilReadMask","stencilFront","passOp","stencilBack","GlStencilSystem","_stencilCache","stencilReference","stencilMode","_renderTargetStencilState","onRenderTargetChange","_comparisonFuncMapping","always","ALWAYS","never","NEVER","equal","EQUAL","NOTEQUAL","less","LESS","LEQUAL","greater","GREATER","GEQUAL","_stencilOpsMapping","keep","KEEP","zero","ZERO","REPLACE","INVERT","INCR","DECR","INCR_WRAP","DECR_WRAP","_activeRenderTarget","stencilState","enable","STENCIL_TEST","stencilFunc","stencilOp","disable","UboSystem","_syncFunctionHash","_systemCheck","ensureUniformGroup","getUniformGroupData","_initUniformGroup","uniformGroupSignature","createUboElements","syncFunction","_generateUboSync","uboElements","generateUboSync","syncUniformGroup","uniformGroupData","synced","WGSL_TO_STD40_SIZE","createUboElementsSTD40","uboElement","lineUpValue","uniformParsers","uniform","createUboSyncFunction","parserCode","arrayGenerationFunction","singleSettersMap","funcFragments","loopMatrix","col","uboSyncFunctionsSTD40","uboSyncFunctionsWGSL","generateArraySyncSTD40","offsetToAdd","rowSize","remainder","createUboSyncFunctionSTD40","GlUboSystem","GlRenderTargetAdaptor","_clearColorCache","_viewPortCache","renderTargetSystem","_renderTargetSystem","sourceRenderSurfaceTexture","destinationTexture","originSrc","originDest","glRenderTarget","getGpuRenderTarget","resolveTargetFramebuffer","copyTexSubImage2D","startRenderPass","viewport","gpuRenderTarget","viewPortY","colorTextures","viewPortCache","depthStencilRenderBuffer","_initStencil","READ_FRAMEBUFFER","blitFramebuffer","COLOR_BUFFER_BIT","NEAREST","initGpuRenderTarget","_initColor","destroyGpuRenderTarget","deleteRenderbuffer","renderBuffer","_renderTarget","COLOR","defaultClearColor","clearColorCache","clearColorArray","resizeGpuRenderTarget","_resizeColor","_resizeStencil","bindSource","glTexture","getGlSource","viewFramebuffer","createRenderbuffer","source2","glInternalFormat","internalFormat","bindRenderbuffer","RENDERBUFFER","renderbufferStorageMultisample","framebufferRenderbuffer","DEPTH_STENCIL_ATTACHMENT","DEPTH24_STENCIL8","renderbufferStorage","DEPTH_STENCIL","canvasCache","getCanvasTexture","onDestroy","_RenderTarget","dirtyId","_size","_managedColorTextures","colorSource","onSourceResize","depthStencilTexture","ensureDepthStencilTexture","skipColorTexture","RenderTarget","RenderTargetSystem","projectionMatrix","_renderSurfaceToRenderTargetHash","_gpuRenderTargetHash","_renderTargetStack","isRenderingToScreen","pm","flipY","calculateProjection","currentRenderTargetData","_initRenderTarget","GlRenderTargetSystem","BufferResource","_bufferResource","onBufferChange","destroyBuffer","GlProgramData","uniformGroups","uniformDirtyGroups","uniformBlockBindings","booleanArray","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT_VEC2","INT_VEC3","INT_VEC4","UNSIGNED_INT_VEC2","UNSIGNED_INT_VEC3","UNSIGNED_INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","GLSL_TO_VERTEX_TYPES","float","vec2","vec3","vec4","ivec2","ivec3","ivec4","uint","uvec2","uvec3","uvec4","bvec2","bvec3","bvec4","mapType","typeNames","tn","mapGlToVertexFormat","typeValue","logPrettyShaderError","shaderSrc","getShaderSource","shaderLog","getShaderInfoLog","splitShader","dedupe","lineNumbers","logArgs","fragmentSourceToLog","generateProgram","glVertShader","VERTEX_SHADER","glFragShader","webGLProgram","createProgram","attachShader","bufferMode","SEPARATE_ATTRIBS","INTERLEAVED_ATTRIBS","linkProgram","getProgramParameter","LINK_STATUS","vertexShader","fragmentShader","getProgramInfoLog","logProgramError","sortAttributes","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","bindAttribLocation","getAttribLocation","extractAttributesFromGlProgram","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","getUniformData","ACTIVE_UNIFORM_BLOCKS","uniformBlocks","totalUniformsBlocks","getActiveUniformBlockName","uniformBlockIndex","getUniformBlockIndex","getActiveUniformBlockParameter","UNIFORM_BLOCK_DATA_SIZE","getUboData","deleteShader","getUniformLocation","defaultSyncData","textureCount","blockIndex","GlShaderSystem","_programDataHash","_nextIndex","_boundUniformsIdsToIndexHash","_boundIndexToUniformsHash","_shaderSyncFunctions","_maxBindings","MAX_UNIFORM_BUFFER_BINDINGS","_setProgram","_generateShaderSync","bindUniformBlock","programData","isBufferResource","boundIndex","nextIndex","currentBoundUniformGroup","uniformBlockBinding","_createProgramData","shaderSystem","headerFragments","addedTextreSystem","uniform1i","functionSource","generateShaderSyncCode","UNIFORM_TO_SINGLE_SETTERS","UNIFORM_TO_ARRAY_SETTERS","GlUniformGroupSystem","_uniformGroupSyncHash","syncData","_getUniformSyncFunction","syncFunc","_createUniformSyncFunction","uniformGroupSyncHash","_getSignature","_generateUniformsSync","generateUniformsSync","preFix","_GlStateSystem","stateId","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","setDepthMask","checks","defaultState","blendModesMap","blendMap","ONE","ONE_MINUS_SRC_ALPHA","DST_COLOR","ONE_MINUS_SRC_COLOR","none","SRC_ALPHA","mapWebGLBlendModesToPixi","diff","forceState","_updateCheck","_checkBlendMode","BLEND","_checkPolygonOffset","POLYGON_OFFSET_FILL","DEPTH_TEST","CULL_FACE","frontFace","blendFunc","blendFuncSeparate","blendEquationSeparate","FUNC_ADD","setPolygonOffset","UNPACK_FLIP_Y_WEBGL","GlStateSystem","GlTexture","samplerType","glUploadBufferImageResource","texSubImage2D","compressedFormatMap","glUploadCompressedTextureResource","UNPACK_ALIGNMENT","mipWidth","mipHeight","levelBuffer","compressedTexImage2D","glUploadImageResource","glWidth","glHeight","textureWidth","textureHeight","glUploadVideoResource","scaleModeToGlFilter","linear","nearest","mipmapScaleModeToGlFilter","wrapModeToGlAddress","compareModeToGlCompare","applyStyleParams","mipmaps","anisotropicExt","glFunctionName","firstParam","forceClamp","firstCreation","castParam","wrapModeS","wrapModeT","wrapModeR","TEXTURE_WRAP_S","TEXTURE_WRAP_T","TEXTURE_WRAP_R","TEXTURE_MAG_FILTER","glFilterMode","TEXTURE_MIN_FILTER","MAX_TEXTURE_MAX_ANISOTROPY_EXT","TEXTURE_MAX_ANISOTROPY_EXT","TEXTURE_COMPARE_FUNC","GlTextureSystem","managedTextures","_glTextures","_glSamplers","_boundTextures","_activeTextureLocation","_boundSamplers","_uploads","_useSeparateSamplers","_mapFormatToInternalFormat","bgra8unorm","SRGB8_ALPHA8_EXT","SRGB8_ALPHA8","RGBA8","r8unorm","R8","r8snorm","R8_SNORM","r8uint","R8UI","r8sint","R8I","r16uint","R16UI","r16sint","R16I","r16float","R16F","rg8unorm","RG8","rg8snorm","RG8_SNORM","rg8uint","RG8UI","rg8sint","RG8I","r32uint","R32UI","r32sint","R32I","r32float","R32F","rg16uint","RG16UI","rg16sint","RG16I","rg16float","RG16F","rgba8unorm","rgba8snorm","RGBA8_SNORM","rgba8uint","RGBA8UI","rgba8sint","RGBA8I","rgb9e5ufloat","RGB9_E5","rgb10a2unorm","RGB10_A2","rg11b10ufloat","R11F_G11F_B10F","rg32uint","RG32UI","rg32sint","RG32I","rg32float","RG32F","rgba16uint","RGBA16UI","rgba16sint","RGBA16I","rgba16float","RGBA16F","rgba32uint","RGBA32UI","rgba32sint","RGBA32I","rgba32float","RGBA32F","stencil8","STENCIL_INDEX8","depth16unorm","DEPTH_COMPONENT16","depth24plus","DEPTH_COMPONENT24","depth32float","DEPTH_COMPONENT32F","DEPTH32F_STENCIL8","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT","COMPRESSED_RED_RGTC1_EXT","COMPRESSED_SIGNED_RED_RGTC1_EXT","COMPRESSED_RED_GREEN_RGTC2_EXT","COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT","COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT","COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT","COMPRESSED_RGBA_BPTC_UNORM_EXT","COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT","COMPRESSED_RGB8_ETC2","COMPRESSED_SRGB8_ETC2","COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2","COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2","COMPRESSED_RGBA8_ETC2_EAC","COMPRESSED_SRGB8_ALPHA8_ETC2_EAC","COMPRESSED_R11_EAC","COMPRESSED_SIGNED_RG11_EAC","COMPRESSED_RGBA_ASTC_4x4_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR","COMPRESSED_RGBA_ASTC_5x4_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR","COMPRESSED_RGBA_ASTC_5x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR","COMPRESSED_RGBA_ASTC_6x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR","COMPRESSED_RGBA_ASTC_6x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR","COMPRESSED_RGBA_ASTC_8x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR","COMPRESSED_RGBA_ASTC_8x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR","COMPRESSED_RGBA_ASTC_8x8_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR","COMPRESSED_RGBA_ASTC_10x5_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR","COMPRESSED_RGBA_ASTC_10x6_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR","COMPRESSED_RGBA_ASTC_10x8_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR","COMPRESSED_RGBA_ASTC_10x10_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR","COMPRESSED_RGBA_ASTC_12x10_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR","COMPRESSED_RGBA_ASTC_12x12_KHR","COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR","mapFormatToGlInternalFormat","_mapFormatToType","UNSIGNED_INT_5_9_9_9_REV","UNSIGNED_INT_2_10_10_10_REV","UNSIGNED_INT_10F_11F_11F_REV","UNSIGNED_INT_24_8","FLOAT_32_UNSIGNED_INT_24_8_REV","mapFormatToGlType","_mapFormatToFormat","RED","RG","RGB","DEPTH_COMPONENT","mapFormatToGlFormat","initSource","_bindSampler","_activateLocation","bindSampler","_getGlSampler","boundTextures","activeTexture","TEXTURE0","_initSource","biggestDimension","log2","onSourceUpdate","onStyleChange","onSourceDestroy","onSourceUnload","onUpdateMipmaps","updateStyle","generateMipmap","_initSampler","glSampler","createSampler","generateCanvas","pixels","getPixels","createImageData","putImageData","glRenterTarget","GlGraphicsAdaptor","uColor","uTransformMatrix","uRound","graphicsPipe","contextSystem","GlMeshAdaptor","textureUniforms","uTextureMatrix","meshPipe","uSampler","localUniformsBindGroup","CustomRenderPipe","executeInstructions","RenderGroupPipe","worldTransformMatrix","clearList","collectRenderGroups","WHITE_BGR","mixColors","localBGRColor","parentBGRColor","r1","g1","mixHexColors","tempContainer","UPDATE_BLEND_COLOR_VISIBLE","updateRenderGroupTransforms","updateChildRenderGroups","updateRenderGroupTransform","renderGroupDepth","updateTransformAndChildren","updateFlags","updateColorBlendVisibility","validateRenderables","rebuildRequired","validateRenderable","RenderGroupSystem","renderGroups","originalLocalTransform","updateRenderables","BatchableSprite","w0","w1","h0","h1","SpritePipe","_gpuSpriteHash","_instructionSet","gpuSprite","_getGpuSprite","_updateBatchableSprite","destroyRenderable","batchableSprite","_initGPUSprite","_BackgroundSystem","clearBeforeRender","_backgroundColor","backgroundAlpha","BackgroundSystem","BLEND_MODE_FILTERS","BlendMode","BlendModePipe","_isAdvanced","_filterHash","_activeBlendMode","_endAdvancedBlendMode","_beginAdvancedBlendMode","_renderableList","imageTypes","jpg","_ExtractSystem","_normalizeOptions","base64","defaultImageOptions","quality","readAsDataURL","toDataURL","convertToBlob","pixelInfo","link","ExtractSystem","RenderTexture","noColor","GenerateTextureSystem","textureSourceOptions","region","color32BitToUniform","abgr","GlobalUniformSystem","_stackIndex","_globalUniformDataStack","_uniformsPool","_activeUniforms","_bindGroupPool","_activeBindGroups","currentGlobalUniformData","projectionData","globalUniformData","_createUniforms","uProjectionMatrix","uResolution","uWorldTransformMatrix","uWorldColorAlpha","getUniformBindGroup","_currentGlobalUniformData","saidHello","VERSION","HelloSystem","hello","sayHello","_TextureGCSystem","checkCount","checkCountMax","textureGCCheckCountMax","maxIdle","textureGCAMaxIdle","textureGCActive","run","TextureGCSystem","_ViewSystem","multiView","removeView","SharedSystems","SharedRenderPipes","DefaultWebGLSystems","DefaultWebGLPipes","DefaultWebGLAdapters","BindGroupSystem","_gpu","_createBindGroup","groupLayout","gpuResource","getGPUBuffer","bufferResource","getGpuSampler","getGpuSource","createView","getProgramData","bindGroups","createBindGroup","GpuBufferSystem","_managedBuffers","createGPUBuffer","writeBuffer","getMappedRange","unmap","_destroyBuffer","UboBatch","minUniformOffsetAlignment","_minUniformOffsetAlignment","byteIndex","addEmptyGroup","addGroup","GpuColorMaskSystem","setColorMask","GpuDeviceSystem","_initPromise","_createDeviceAndAdaptor","forceFallbackAdapter","requiredFeatures","feature","GpuEncoderSystem","_boundBindGroup","_boundVertexBuffer","_resolveCommandFinished","commandEncoder","createCommandEncoder","beginRenderPass","endRenderPass","_clearCache","setViewport","setPipelineFromGeometryProgramAndState","_boundPipeline","_setVertexBuffer","setVertexBuffer","_setIndexBuffer","_boundIndexBuffer","indexFormat","setIndexBuffer","_setShaderBindGroups","_syncBindGroup","submit","restoreRenderPass","getDescriptor","boundPipeline","boundVertexBuffer","boundIndexBuffer","boundBindGroup","GpuStencilSystem","setStencilReference","WGSL_ALIGN_SIZE_DATA","f16","createUboElementsWGSL","generateArraySyncWGSL","createUboSyncFunctionWGSL","GpuUboSystem","GpuUniformBatchPipe","_bindGroupHash","_buffers","_bindGroups","_bufferResources","_batchBuffer","COPY_SRC","_uploadBindGroups","_resetBindGroups","duplicate","_getBindGroup","_getBufferResource","getArrayBindGroup","getArrayBufferResource","firstBuffer","copyBufferToBuffer","topologyStringToId","PipelineSystem","_moduleCache","_bufferLayoutsCache","_pipeCache","_pipeStateCaches","_colorMask","_multisampleCount","_updatePipeHash","setMultisampleCount","multisampleCount","setRenderTarget","msaaSamples","_depthStencilAttachment","depthStencilAttachment","_stencilMode","_stencilState","passEncoder","_generateBufferKey","geometryLayout","shaderKey","getGraphicsStateKey","_createPipeline","_createVertexBufferLayouts","blendModes","getColorTargets","writeMask","_getModule","primitive","multisample","depthStencil","depthWriteEnabled","depthCompare","createRenderPipeline","_createModule","createShaderModule","keyGen","attributeKeys","stringKey","vertexBuffersLayout","bufferEntry","arrayStride","stepMode","bufferEntryAttributes","shaderLocation","stencilStateId","multiSampleCount","GpuRenderTarget","contexts","msaaTextures","GpuRenderTargetAdaptor","baseGpuTexture","_getGpuColorTexture","backGpuTexture","copyTextureToTexture","origin","getCurrentTexture","clearValue","colorAttachments","resolveTarget","getTextureView","loadOp","storeOp","stencilLoadOp","depthLoadOp","DEPTH","stencilStoreOp","depthClearValue","depthStoreOp","renderPassDescriptor","gpuCommands","GPUTextureUsage","TEXTURE_BINDING","RENDER_ATTACHMENT","msaaTexture","unconfigure","GpuRenderTargetSystem","GpuShaderSystem","_gpuProgramData","_createGPUProgramData","createBindGroupLayout","pipelineLayoutDesc","bindGroupLayouts","createPipelineLayout","GpuBlendModesToPixi","srcFactor","dstFactor","operation","GpuStateSystem","gpuUploadBufferImageResource","gpuTexture","bytesPerPixel","writeTexture","rowsPerImage","bytesPerRow","depthOrArrayLayers","blockDataMap","blockBytes","blockWidth","blockHeight","defaultBlockData","gpuUploadCompressedTextureResource","blockData","mipLevel","gpuUploadImageResource","copyExternalImageToTexture","gpuUploadVideoResource","GpuMipmapGenerator","pipelines","_getMipmapPipeline","mipmapShaderModule","mipTexture","arrayLayerCount","renderToSource","mipTextureDescriptor","bindGroupLayout","getBindGroupLayout","arrayLayer","srcView","baseMipLevel","baseArrayLayer","dstMipLevel","dstView","mipLevelSize","GpuTextureSystem","_gpuSources","_gpuSamplers","_textureViewHash","textureDescriptor","_mipmapGenerator","getTextureBindGroup","_createTextureBindGroup","bindGroupId","_createTextureView","getPreferredCanvasFormat","webGPUCanvas","getImageData","GpuGraphicsAdaptor","localBindGroup","GpuMeshAdapter","DefaultWebGPUSystems","DefaultWebGPUPipes","DefaultWebGPUAdapters","MSAA_QUALITY","MSAA_QUALITY2","DEPRECATED_WRAP_MODES","DEPRECATED_WRAP_MODES2","DEPRECATED_SCALE_MODES","DEPRECATED_SCALE_MODES2","GraphicsPipe","_graphicsBatchesHash","wasBatched","_rebuild","_addToBatcher","_removeBatchForRenderable","_initBatchesForRenderable","_getBatchesForRenderable","batchClone","graphicsUid","_PlaneGeometry","verticesX","verticesY","sizeX","sizeY","totalSub","xpos","ypos","value3","value4","PlaneGeometry","BatchableMesh","_uvUpdateId","_textureMatrixUpdateId","uvBuffer","transformedUvs","_transformedUvs","MeshPipe","_meshDataHash","_gpuBatchableMeshHash","meshData","_getMeshData","isBatched","batchableMesh","_getBatchableMesh","gpuBatchableMesh","gpuMesh","_initMeshData","_initBatchableMesh","_NineSliceGeometry","_originalWidth","originalWidth","_originalHeight","originalHeight","_leftWidth","leftWidth","_rightWidth","rightWidth","_topHeight","topHeight","_bottomHeight","bottomHeight","updatePositions","scaleW","scaleH","_uvw","_uvh","NineSliceGeometry","NineSliceSpritePipe","tilingBit","tilingBitGl","TilingSpriteShader","tilingUniforms","uMapCoord","uTextureTransform","uSizeAnchor","updateUniforms","anchorX","anchorY","sharedQuad","TilingSpritePipe","_tilingSpriteDataHash","tilingSpriteData","_getTilingSpriteData","couldBatch","canBatch","_updateCanBatch","tilingSprite","_didTilingSpriteUpdate","_updateBatchableMesh","_tileTransform","_initTilingSpriteData","renderableData","_applyAnchorToTexture","setUvs","setPositions","_nonPowOf2wrapping","localUniformMSDFBit","localUniformMSDFBitGl","mSDFBit","mSDFBitGl","SdfShader","uDistance","BitmapTextPipe","_gpuBitmapText","bitmapText","graphicsRenderable","_getGpuBitmapText","_updateContext","syncWithProxy","_updateDistanceField","_destroyRenderableByUid","renderableUid","proxyGraphics","bitmapTextLayout","initGpuText","proxyRenderable","worldScale","proxy","HTMLTextPipe","_gpuText","gpuText","_getGpuText","newKey","textureNeedsUploading","currentKey","_updateText","_destroyRenderableById","htmlTextUid","decreaseReferenceCount","_updateGpuText","generatingTexture","getManagedTexture","gpuTextData","getPo2TextureFromSource","loadFontCSS","dataSrc","loadFontAsBase64","FontStylePromiseCache","HTMLTextSystem","_activeTextures","_createCanvas","getTexture","_buildTexturePromise","_increaseReferenceCount","usageCount","htmlTextData","addFontFamily","fontFamily2","extractFontFamilies","fontCSS","fontPromises","getFontCss","measured","fontStyleCSS","htmlTextRenderData","textContent","contentBounds","descenderPadding","doublePadding","measureHtmlText","svgURL","XMLSerializer","serializeToString","getSVGUrl","delay","resolve2","loadSVGImage","clearRect","getTemporaryCanvasFromImage","_cleanUp","getReferenceCount","defaultFontOptions","CanvasTextPipe","canvasText","getTextureSize","textUid","checkRow","checkColumn","CanvasTextSystem","_textKey","createTextureAndCanvas","renderTextToCanvas","getCanvasBoundingBox","lineCap","linePositionX","linePositionY","passesCount","isShadowPass","dsOffsetText","dsOffsetShadow","globalAlpha","linePositionYShift","_drawLetterSpacing","currentPosition","stringArray","previousWidth","currentWidth","currentChar","textStr","rnds8","rng","msCrypto","REGEX","byteToHex","validate","v4","rnds","_ClefType","getClefType","TREBLE","BASS","TENOR","ALTO","ClefType","TranspositionDO","diatonic","chromatic","_PitchUtils","getStepValueOfNote","pitchName","getStepsFromTopStaffLine","clefType","stepValue","topStaffLineStepValue","getPitchNameFromStaffLinePosition","stepsFromTopStaffLine","topStaffLineNoteIndex","topStaffLineNoteOctave","noteIndex","noteOctave","pitchNames","getCommonPitchNameFromCents","cents","centPitchNames","getNumberOfLegerLines","legerLines","getCommonDiatonicTranspositionFromChromaticSteps","chromaticSteps","numOctaves","diatonicSteps","transpositions","getPitchStringFromMidiPitch","midiPitch","accidentalPreference","octave","getKeySigAlterationForNote","pitchLetterName","keySig","keySigAlteration","pitchIndex","sharps","flats","getAlterationForCents","displayCents","naturalCents","pitchNameToDiatonicCents","pitchNameCentVals","transposePitchName","alteration","newCents","newPitchName","newAlteration","getDisplayKeyForConcertKey","concertKey","chromaticTransposition","diatonicTransposition","getKeySigAlterationForTransposition","getConcertKeyForDisplayKey","displayKey","getKeySignature","diatonicStepsFromC","chromaticStepsFromC","major","getTranspositionForKeyChange","oldKey","oldKeyIsMajor","newKeyIsMajor","transposeUp","keyDelta","chromDelta","diatDelta","getNearestTranspositionDirection","getTotalKeySize","outgoingKey","getAccidentalsForNewKeySignature","numNaturals","numFlats","numSharps","numDoubleFlats","numDoubleSharps","cancelStartIndex","cancelSharps","accidentals","_PitchUtils$1","C","D","F","G","A","B","PitchUtils","_BaseDataObject","_dataID","resetIDCounter","_nextID","dataID","uniqueID","_uniqueID","uuidv4","BaseDataObject","_ScoreProperties","_pixelsPerSpace","DEFAULT_PIXELS_PER_SPACE","ScoreProperties","scoreProps","rights","_rights","pageHeight","_pageHeight","pageWidth","_pageWidth","leftPageMargin","_leftPageMargin","rightPageMargin","_rightPageMargin","topPageMargin","_topPageMargin","bottomPageMargin","_bottomPageMargin","firstPageVerticalOffset","_firstPageVerticalOffset","systemSpacing","_systemSpacing","topSystemDistance","_topSystemDistance","leftSystemMargin","_leftSystemMargin","rightSystemMargin","_rightSystemMargin","staffSpacing","_staffSpacing","stemWidth","_stemWidth","beamWidth","_beamWidth","staffLineWidth","_staffLineWidth","lightBarlineWidth","_lightBarlineWidth","heavyBarlineWidth","_heavyBarlineWidth","legerLineWidth","_legerLineWidth","repeatEndingWidth","_repeatEndingWidth","hairpinLineWidth","_hairpinLineWidth","enclosureWidth","_enclosureWidth","tupletBracketWidth","_tupletBracketWidth","graceNoteSize","_graceNoteSize","cueNoteSize","_cueNoteSize","noteheadWidth","_noteheadWidth","clefDistanceFromBarline","_clefDistanceFromBarline","chordSymbolFontHeight","_chordSymbolFontHeight","staffGroupingStyle","_staffGroupingStyle","getNewScoreProperties","DEFAULT_PAGE_WIDTH","qNoteWidth","keySigWidth","timeSigWidth","clefWidth","measureLeadIn","minMeasureWidth","pixelsPerSpace","software","_software","_qNoteWidth","_keySigWidth","_timeSigWidth","_clefWidth","_measureLeadIn","_minMeasureWidth","DEFAULT_TEMPO","_AccidentalType","getAccidentalType","NATURAL","SHARP","DOUBLE_SHARP","TRIPLE_SHARP","FLAT","DOUBLE_FLAT","TRIPLE_FLAT","getAccidentalFromString","AccidentalType","_ArticulationType","getTypeFromName","STACCATO","ACCENT","LEGATO","UNKNOWN","ArticulationType","_BarlineLocation","getLocation","RIGHT","LEFT","MIDDLE","BarlineLocation","_BarlineStyle","getStyle","REGULAR","DOTTED","DASHED","HEAVY","LIGHT_LIGHT","LIGHT_HEAVY","HEAVY_LIGHT","HEAVY_HEAVY","TICK","BarlineStyle","BeamState","BEGIN","CONTINUE","FORWARD_HOOK","BACKWARD_HOOK","_DurationType","getDurationValue","durationType","numDots","dotVal","getDurationType","durationName","WHOLE","HALF","QUARTER","EIGHTH","SIXTEENTH","THIRTY_SECOND","SIXTY_FOURTH","BREVE","LONG","MAXIMA","ONE_TWO_EIGHTH","TWO_FIVE_SIXTH","FIVE_TWELFTH","ONE_ZERO_TWO_FOURTH","UNSUPPORTED","calculateDotDuration","dotTotal","getBaseDurationAndDots","totalDuration","baseDuration","combinedDuration","dotValue","DurationType","DynamicVolumeMap","FFFF","FFF","FF","MF","MP","P","PP","PPP","PPPP","DEFAULT","_DynamicType","getVolumeByType","volumeMap","DynamicType","_EndingType","getType","STOP","DISCONTINUE","EndingType","LyricsMode","LyricsMode2","_OrnamentType","INVERTED_MORDENT","MORDENT","TRILL_MARK","getTypeFromMusicXmlName","OrnamentType","_RepeatDirection","getDirection","direction","FORWARD","BACKWARD","RepeatDirection","StemDirection","UP","DOWN","NO_STEM","SyllablePosition","TieState","MeasureData","VoiceData","Voice","_noteGroups","_number","toVoiceData","noteGroups","ng","toNoteGroupData","addNoteGroup","noteGroup","voice","tuplets","removeNoteGroupContainer","ngc","removeParentIfEmpty","removedNoteGroups","ngcList","parentNGC","parentNGCList","_noteGroupContainers","noteGroupContainers","measure","_measure","isEmptyOrSingleRest","isRest","Measure","_voices","_diatonicTransposition","_chromaticTransposition","_concertKey","_displayKey","_outgoingKey","_isMajorKey","_showKey","_numBeats","_beatType","_beatGroups","_subBeatGroups","_showTime","_clefs","_attachments","_notesNeedRendering","toMeasureData","voices","isMajorKey","showKey","numBeats","beatType","displayNumBeats","_displayNumBeats","displayBeatType","_displayBeatType","beatGroups","subBeatGroups","showTime","clefs","toClefData","attachments","toMeasureAttachmentData","getVoiceByNumber","voiceNumber","newVoice","beatQnoteDuration","subBeatQnoteDuration","_stack","staff","_staff","totalNoteDuration","lastNG","qNoteTime","qNoteDuration","notesNeedRendering","needsRendering","measures","numMeasures","below","above","MeasureStackData","MeasureStack","_measures","_startTime","_endTime","_qNoteLength","_newSystem","_indent","_indentAsSystemLeader","_startPosition","_idealWidth","_maxKeySize","_newKey","_newClef","_isPickup","_needsRendering","toMeasureStackData","startTime","endTime","qNoteLength","newClef","tempoMarkers","_tempoMarkers","tm","toTempoMarkerData","barline","toBarlineData","repeatDOs","toRepeatDOData","isPickup","numNotes","cNoteGroup","addMeasure","addNoteGroupsFromMeasure","removeNoteGroup","numNoteGroups","clearNoteGroups","clearMeasures","getInheritedTempoMarker","cStack","_previous","getMeasureAttachments","sortByQNoteTime","beatQNotePositions","_beatQNotePositions","newSystem","indent","indentAsSystemLeader","startPosition","idealWidth","maxKeySize","systemRef","_systemRef","NoteGroupData","NoteGroup","_notes","_hPos","_stemDirection","_stemEndPos","_stemHPos","_duration","_qNoteDuration","_qNoteTime","_durationType","_numDots","_isGrace","_beamStates","_maxBeams","_numAccidentalLevels","_isRest","_restVPos","_clipStart","_clipEnd","_idealHPos","_playbackStartTime","_visible","_prevVisible","notes","toNoteData","stemDirection","isGrace","beamStates","_tuplets","toTupletData","slurs","_slurs","toSlurData","clefUniqueID","_clef","lyric","_lyric","toLyricData","clipStart","clipEnd","articulations","_articulations","toArticulationData","ornaments","_ornaments","toOrnamentData","trackId","_trackId","addNote","note","insertNote","sortNotes","n1","n2","removeNote","sortNotesByPitch","clearNextPrevNGCaches","_cachedNextNG","_cachedPrevNG","clearVisibleNotesCache","_visibleNotesCache","revertVisibility","visibleNotes","restVPos","stem","_stem","stemStartPos","_stemStartPos","stemEndPos","stemHPos","maxBeams","numAccidentalLevels","hPos","clef","idealHPos","_voice","ngcRef","_ngcRef","voiceNum","nextMeasure","nextVoice","prevMeasure","prevVoice","playbackStartTime","playbackTempo","_playbackTempo","NoteGroupContainer","_durUnitStartTime","_durUnitEndTime","qNoteStartTime","_qNoteStartTime","durUnitStartTime","durUnitEndTime","_parentNGC","_noteGroup","_ngcList","tuplet","_tuplet","Page","_systems","addSystem","prevSystem","pageRef","removeSystem","measureStacks","PartData","fromJsonString","jsonString","Part","partID","abbreviation","_staves","_midiBank","_midiPreset","_midiChannel","_muted","_volume","_pan","_assessmentInstruments","_preventTransposition","_playbackOctaveDelta","_partID","_abbreviation","toPartData","staves","toStaffData","midiBank","midiPreset","midiChannel","percussionMap","_percussionMap","addStaff","partRef","getMeasuresByTime","qNoteEndTime","allMeasures","numStaves","getNoteGroupsByTime","measures2","allNoteGroups","getNoteGroupsWithoutRests","staffIndex","voiceIndex","ngList","getNoteGroupsWithoutRestsOrTieIntos","tieState","getFirstNote","setTransposition","updateMeasures","noteGroupsExcludingRests","volume","pan","assessmentInstruments","preventTransposition","playbackOctaveDelta","ScoreData","PlaybackRegionDataType","PlaybackRegionDataType2","TempoTimeStampDO","msTime","tempo","PlaybackRegion","_PlaybackRegion","createTempoTimeStamps","timeStamps","startTempo","tdatas","tdata","nextSampleTimeStampDO","startQNT","endQNT","reg","dList","stackDataWithStartQNT","repeatPass","stackRepeatPass","stackDataWithEndQNT","PlaybackRegionData","_PlaybackRegionManager","score","stacks","repeatAnalyzer","_score","_stacks","_repeatAnalyzer","getPlaybackRegions","startRepeatPass","endRepeatPass","includeRepeats","_regions","_createRegions","playbackPath","_regionNoRepeats","regions","stackData","firstSourceRegion","lastSourceRegion","clones","allTimeStamps","regionStamps","lastStack","lastTM","stamp","convertQNoteTimeToSeconds","targetQNoteTime","passNum","lastRegion","toFixed","cTempo","_stackNoteGroupsMap","_createStackMaps","refTempoTime","refQNoteTime","stackPassMap","regionStacks","stackQNT","cStackData","qNoteDelta2","eventFound","tms","_stackAttachmentsMap","beats","subBeats","beatQnoteDur","subBeatQnoteDur","ngs","nextTmIndex","nextAttIndex","nextBeatIndex","nextSubBeatIndex","nextNgIndex","testVals","MAX_SAFE_INTEGER","prData","resultIndex","_getIndexOfMinValue","qNoteDelta3","measureAttachment","qNoteDelta","minIndex","minValue","attList","ng1","ng2","_RepeatAnalyzer","_measureStacks","updatePlaybackPath","passMap","_playbackPath","_createPlaybackPathPair","startIndex","lastForwardRepeatIndex","rdo","repeatDirection","repeatTimes","_findPrecedingForwardRepeat","endingType","endingNumber","endingTargetIndex","_chooseEnding","lastEndingCloseIndex","endingTargetNum","ScorePlaybackInfo","getMeasureStacks","_regionManager","Score","_parts","_pages","_graceNotesNeedFixing","toScoreData","graceNotesNeedFixing","addPart","addPage","prevPage","getSystems","getBeatQNotePositions","allBeatQNotePositions","removePage","setPixelsPerSpace","preservePageSize","_scoreProperties","sys","getSettingsFromScoreProperties","setPageSize","valuesArePixels","markAllMeasuresNeedRendering","playbackInfo","_playbackInfo","scoreProperties","StaffData","Staff","_lyricsMode","removeMeasureAt","insertMeasure","insertionIndex","getFirstNonRest","_partRef","originalLyrics","_originalLyrics","lyricsMode","atLeastOneStaffVisible","System","_staffVPosOffsets","_newPage","_scoreProps","_systemWidth","addMeasureStack","linkStacksBetweenSystems","prevStack","linkStacksInSurroundingSystems","addMeasureStacks","insertStack","nextStack","insertMeasureStacks","removeStacksFromBeginning","removedStacks","removeStacksFromEnd","addStackAfterExistingStack","newStack","stackToFollow","numStacks","removeStack","attemptStackDonation","clearAllStacks","firstStack","nextSystem","_createPartStaffGroupings","groupings","measureIndex","numVisibleStaves","_visibleParts","_createScoreStaffGroupings","totalStaves","requestedStackWidth","totalWidth","systemWidth","staffVPosOffsets","staffGroupings","visibleParts","_pageRef","newPage","slurSegments","_slurSegments","RepeatDOData","RepeatDO","endingVPos","NotationObjectData","NoteAttachmentData","ArticulationData","NotationObject","addNotationObjectData","vPos","_vPos","NoteAttachment","_isAbove","_outsideStaff","addNoteAttachmentData","noteGroupUniqueID","isAbove","outsideStaff","Articulation","getWidthHeight","BarlineData","Barline","MeasureAttachmentData","ChordSymbolData","MeasureAttachment","addMeasureAttachmentData","baseline","_baseline","measureAttachmentType","ChordSymbol","degrees","rootName","rootAlteration","bassName","bassAlteration","displayType","toChordSymbolDegreeData","calculateHeight","textHeight","ChordSymbolDegreeData","ChordSymbolDegree","displayText","ClefData","Clef","_isNew","_show","_smallSize","isNew","show","smallSize","DynamicData","Dynamic","LyricData","Lyric","syllablePosition","verse","_verse","_syllablePosition","MeasureInstructionData","MeasureInstruction","NoteData","Note","_pitchName","_alteration","_displayCents","_playbackCents","_accidental","_showAccidental","_tieState","_legerLines","_stepsFromTopStaffLine","playbackCents","accidental","showAccidental","isTieTarget","accidentalPos","_accidentalPos","pitchLetter","_pitchLetter","pitchOctave","_pitchOctave","OrnamentData","Ornament","SlurData","Slur","_slurID","_above","sd","firstNoteUniqueID","_firstNote","endNoteUniqueID","_endNote","slurID","firstNote","endNote","_segments","TempoMarkerData","TempoMarker","_tempo","TupletData","Tuplet","_tupletID","_numerator","_denominator","_numeratorDuration","_denominatorDuration","_showBracket","tupletID","firstNoteUniqueId","endNoteUniqueId","numerator","denominator","numeratorDuration","denominatorDuration","showBracket","SlurSegment","_points","slur","_slur","ngCoordinates","_ngCoordinates","NoteManager","changeNoteOctave","octaveDelta","oldOctave","updateAccidentals","changeNoteGroupOctave","changeDuration","newDuration","parentList","tupletNGC","tupletRatio","ngToRemove","removeSlur","fillMeasure","addTuplet","originalDurUnitDuration","childNGC","toggleTie","updateTies","fixNotesForClefs","noteIdx","addPitch","newNote","_setPercussionPlaybackCents","newDurationInfo","repitch","removePitch","ngcToRemove","pitchHistory","ngLists","numVoices","nextNGIndex","numLists","nextNG","nextNote","_getMatchingNoteInNextNoteGroup","nextNoteGroup","nextNotes","nxNote","createNoteGroupContainers","topContainer","addNotesToContainer","changeNoteGroupTimeStamps","measureEndTime","voiceRef","checkEndTimes","measureDuration","beatPositions","maxRestSize","checkLevelForGaps","prevNG","addSlur","parentNGCQNoteTime","fillGapWithRests","subTupletBeatPositions","subTupletMaxRestSize","subTupletRatio","unadjustedEndtime","startPoint","endPoint","ngcListIndex","currentPos","beatIndex","beatPos","beatSize","restSize","goalPos","goalRestSize","getRestBySize","superNGC","goalSize","dotsValue","tupletIndex","cTime","subTupletNGList","subTupletNGC","PitchNameManager","showLyrics","lyricIndex","showNoteNames","storeLyrics","_getAccidentalText","updateNoteNames","isStaffShowingNoteNames","hideLyrics","MeasureRegion","startMeasure","endMeasure","startMeasureIndex","endMeasureIndex","TranspositionRecord","TranspositionManager","noteManager","_history","_noteManager","preventPercussionTransposition","repitchNotes","repitchDOs","storeOldSettings","adjustOctavesOfNotes","octaveShiftValues","ngsNoTieIntosOrRests","transposition","ngOctaveDeltas","changeOctaveOfPart","setPartTransposition","chromaticTrans","diatonicTrans","chromaticShift","diatonicShift","_getKeyMeasureRegions","_updateDisplayKeyOfRegion","_transposeRegion","savePartTranspositions","_partTranspositions","restorePartTranspositions","tdo","transposeSong","preventInitialKeyOptimization","isMajor","_optimizeKeyEnharmonically","adjustedChromaticShift","adjustedDiatonicShift","adjustedUp","_setConcertKeyForRegion","setConcertKeyOfSong","newConcertKey","transposeDirection","transDO","revertTranspositions","cutoffIndex","inverse","_revertRepitchNotes","transposeByChromaticSteps","oldLetter","oldAlteration","mr","updateDisplayedAccidentals","cMeasure","clefList","attachmentNG","att","pitch","_setKeysForPartMeasureRegion","_updateKeySizeForStacks","totalKeySize","displayedKey","ScoreManager","_transpositionManager","_pitchNameManager","removeLyrics","setLyricsVerticalPosition","createScore","scoreSettings","abbr","positionIndex","firstStaff","numExistingMeasures","newMeasure","keySize","deleteMeasures","firstMeasure","lastMeasure","cVoice","cNoteGroups","cng","nextMeas","prevMeas","totalTime","changeTime","firstMeasureStack","lastMeasureStack","showTime2","timeOffsets","ngContainers","saveClefs","_clefsMap","restoreClefs","changeClef","followingMeasure","PointXY","_AttachmentFormatter","formatAttachments","_formatMeasureAttachments","_formatNoteAttachments","formatLines","measuresPerStack","repeatEndingHeightSet","vStaffPos","_processSlursForNoteGroup","_processTupletsForNoteGroup","_setRepeatEndingHeight","ngIndex","_buildSlurSegments","_formatTuplet","stackWidth","attachment","_processMeasureAttachment","stackIsSystemLeader","stackIndent","defaultAbovePos","defaultBelowPos","attachmentTime","closestPrevNG","closestNextNG","matchingNG","ngTime","collisionNG","artic","_formatArticulation","orn","_formatOrnament","articulation","_formatAttachment","ornament","vOffset","attSteps","topNote","highestNoteSteps","bottomNote","lowestNoteSteps","needBracket","stemUpTally","stemDownTally","highPoint","lowPoint","lastNote","cSystem","multipleVoices","coordPos","endNoteFound","slope","cpXOffset","cp1","cp2","yShift","yIntercept","perpSlope","intersectX","intersectY","breakOuterLoop","measureHPos","cngNotes","ng2TopNote","ng2BottomNote","ep","defaultCPHeight","numValues","firstStackIndex","highestVPos","underEndingBracket","endingRDOs","endingFinished","noteVPos","AttachmentFormatter","MusicBeamer","successCount","getSystemBeamGroupings","getMeasureBeamGroupings","currentBeamStartTimes","numBeatGroups","ng1EndTime","beatGroupIndex","getBeamletDirection","beamStartTime","noteTime","noteDuration","previousBeamLevelState","isEvenMultiple","NoteGroupFormatter","getSystemStemDirections","getMeasureStemDirections","numVisibleVoices","currentUpScore","currentDownScore","highestUpScore","highestDownScore","numUpVotes","numDownVotes","beamGroup","visNotes","setStemDirectionsForBeamedNotes","beamedNotes","beamedNG","getSystemNoteheadOffsets","getMeasureNoteheadOffsets","getNoteheadOffsets","placeOnLeft","cNote","lastPosition","rightNotePos","clusterFound","levelClaimsList","numPositions","lowerBound","upperBound","cLevel","getSystemStemEndPositions","getMeasureStemEndPositions","firstNoteRP","lastNoteRP","interiorHighestRP","interiorLowestRP","beamedNoteCount","requestedStemPos","getRequestedStemEndPosition","totalHDistance","totalRise","cIntNote","decidingNote","bonusDurationLength","penaltyLength","_MusicSpacer","initializeScoreSettings","sProps","_standardSystemWidth","computeIdealSpacingValues","measureStack","computeIdealSpacingForStack","groupMeasuresIntoSystems","measuresPerSystem","originalStackGroupings","firstSystem","firstSystemsStacks","cPage","changeMade","qStack","leadStack","numNewSystems","numOriginalSystems","newSystemStacks","oldSystemStacks","currentSystem","computeActualSpacingValues","sysWidth","totalIndentSpace","totalNoteIdealSpace","stackIdealWidth","newWidth","cPosition","clefDFB","repeatSpaceAtEnd","NORMAL_MIN_WHITE_SPACE","LYRIC_LETTER_SPACE","minWhiteSpace","newTimePositionDelta","firstNoteTime","notesAtCurrentPos","largestLeftExtension","largestRightExtension","prevRightExtension","ngLeftExtension","ngRightExtension","halfLyricWidth","previousNG","SPACING_FACTOR","endSpace","MusicSpacer","ScoreFormatter","_musicSpacer","_beamer","_ngFormatter","_attachmentFormatter","correctGraceNoteStartTimes","setPartList","updateMeasureStackNoteGroupsAndMeasures","formatScore2","reflowMeasuresAcrossSystems","_processUpdateRequests","_getActualSpacingAndPositioning","consecutiveGraceNotes","stack2","formatScore","formatSystem","MusicXmlParser2","_getMusicXMLObject","_musicXML","_musicXMLString","_rejectCompleter","_parseXML","_lastPauseMsTime","_midiInstrumentsXMLList","_currentTuplets","_currentSlurs","_currentPage","_currentSystem","_currentStack","defaultsEl","getScoreProperties","rightsEl","_overrideScoreProps","_requestedScoreProps","softwareEl","_getMusicData","_processNextMeasure","_measureIndex","_measureXMLList","_checkPartForErrors","_cPart","_processNextPart","measureXML","_createNewMeasure","_passedTimeDPQ","_cPartDPQ","midMeasureClef","dpqPositionBeforeBackup","childNodes","Element","noteXML","elemName","tagName","_eint","_estr","clefXML","querySelectorAll","staffMsrs","targetMeasure","noteHasBeenAdded","targetStack","_createTempoMarker","dyn","metronomeEl","styleEl","repeatEl","endingEl","repeatDO","repeatTimesStr","cMeasure2","_processHarmonyEl","staffNum","cStaff","_createNoteGroup","_createNote","_updateMeasureBeatGroups","_enum","selector","zeroIfNull","emptyStringIfNull","_aint","_anum","_s2n","musicXMLString","computeMaxKeySizeForRendering","overrideScoreProps","_resolveCompleter","_computeMaxKeySizeForRendering","defEl","tenths","_buildInstrumentsXMLList","_calculatePartVolumes","_cPartIndex","_partXMLList","_partVol","_computeMaxKeySizes","_adjustMeasureLengthsToFitNotes","_checkScoreForErrors","_partXML","_removeIncompleteSlurs","_createPartObj","_createStavesForPart","moreMeasures","_runTimeout","staffName","abbrName","scorePartEl","channel","partId","cPart","measuresXML","transXml","rootEl","symbol","bassEl","kindEl","degreeEl","degree","previousMeasure","reParentedMidMeasureClef","prevClef","attXML","keyXML","timeXML","stackQNoteDuration","beatDur","qNotePos","beat","tupletsToRemove","notationsXML","tupletsXML","tupletXML","tupletDurType","tupActualXML","tupNormalXML","durString","tup","tupletToRemove","slursXML","slurXML","slurIndex","notationsElements","articulationElements","articXML","ornamentElements","ornamentEl","lyricXML","beamsXML","beamXML","instID","miXML","tieXMLs","tempoMarker","matchFound","markers","currentQNoteOffset","stackStartTime","latestNoteEndTime","tupletQNoteEndTime","newNumerator","newDenominator","stackNewQNoteDur","qNoteRemainder","mult","musicXML","FINISHED_PARSING","MusicXmlUtils","_MusicXmlUtils","getFileType","fileNamePath","getMusicXmlStringFromUrl","MusicXmlError","INVALID_FILE_TYPE","xmlString","cleanString","_verifyAndCleanMusicXmlString","INVALID_FORMAT","decompressMusicXml","cleanXml","getMusicXmlStringFromFile","fname","Range","_Range","comfort","getRangeString","InstrumentDO","minKey","maxKey","easyRange","mediumRange","advancedRange","offRange","fingeringMode","fingeringSet","getRangeByType","_InstrumentUtils","getInstrumentByID","inst","instruments","isRecorder","InstrumentUtils","_Symbol","_svg","scaledX","coordinateScale","scaledY","scaledWidth","scaledHeight","Symbol","_MusicSymbolsSvg","setScale","_currentScale","_DEFAULT_PIXELS_PER_SPACE","DEFAULT_COORDINATE_SCALE","_scaledAtlases","atlasCanvas","symbols","_createSymbolsSvg","img","_getSvgHeader","_DEFAULT_SVG_WIDTH","_DEFAULT_SVG_HEIGHT","symbolsMap","TrebleClef","BassClef","CClef","Sharp","Natural","DoubleSharp","QuarterNoteHead","HalfNoteHead","WholeNoteHead","DoubleWholeNoteHead","DoubleWholeRest","WholeRest","HalfRest","QuarterRest","EighthRest","SixteenthRest","ThirtySecondRest","SixtyFourthRest","EighthFlagUp","SixteenthFlagUp","ThirtySecondFlagUp","SixtyFourthFlagUp","EighthFlagDown","SixteenthFlagDown","ThirtySecondFlagDown","SixtyFourthFlagDown","DoubleFlat","Flat","Accent","Tenuto","Staccato","Trill","Mordent","MordentInverted","MusicSymbolsSvg","NoteheadType","NoteheadType2","TextureSet","createTextures","symbolsBD","wholeRest","halfRest","quarterRest","eighthRest","sixteenthRest","thirtySecondRest","sixtyFourthRest","wholeNoteHead","halfNoteHead","quarterNoteHead","sharp","natural","doubleSharp","doubleFlat","eighthFlagUp","eighthFlagDown","sixteenthFlagUp","sixteenthFlagDown","thirtySecondFlagUp","thirtySecondFlagDown","sixtyFourthFlagUp","sixtyFourthFlagDown","trebleClef","bassClef","altoClef","tenorClef","ff","fff","ppp","mf","mp","augmentationDot","accent","staccato","legato","mordent","mordentInverted","trill","sym","getColoredNotehead","noteheadType","_disposeOfTextures","MusicTextures","_textureSets","textureSet","getTextureSet","VisualMeasure","scoreX","vSystemRef","scoreY","measureRef","vNoteGroups","VNGContent","VisualNoteGroup","_content","_vSystemRef","setColor","_noteheadList","nh","_visualAttachments","_draw","_g","_drawRest","_drawNotes","_drawStem","_addAttachments","restShape","verticalOffset","Sprite2","noteShape","_noteheadType","doubSharp","doubFlat","legerWidth","flagShape","lyricTF","articBmp","ornBmp","visualAttachments","noteheadList","originalPosition","_originalPosition","VisualSystem","Container2","visualScore","_visualMeasures","_visualSystemStaves","_visualScore","_visNoteGroups","Graphics2","_textureSprite","Sprite3","getVisualMeasureUnderPoint","vStaff","vMeas","vMeasures","getVisualNoteGroupUnderPoint","vng","getTextureSprite","_renderTexture","_generateTexture","_graphicsBounds","createOrRefreshTexture","wasDisplayed","displayTexture","displayGraphics","addExtraNotehead","xPos","yPos","removeExtraNoteheads","Rectangle2","pixiAppHelper","app","visNoteGroups","visualMeasures","visualSystemStaves","graphicsBounds","renderTextureQuality","VisualSystemStaff","vSystem","_SystemRenderer","_legacyVNGIndex","renderSystem","addedObjects","removedObjects","visualSystem","systemIndent","horizMeasPos","_drawStaff","vMeasuresOnStaff","vngLists","vNoteGroupsInMeasure","_addClefKeyTime","clefOffset","vMeasure","vSystemStaff","_drawBeams","_drawTuplets","_drawTies","_renderVerticalBarlines","_drawRepeats","_drawSlurs","spx","spy","Point3","_legacyVNoteGroups","numLegacyVNGs","loopedOnce","Graphics3","currentBeams","vngList","stackPos","BeamState2","StemDirection2","startingPoint","bracketWidth","tupletTF","Text2","endX","hookEndVPos","hInsertPos","_drawClef","breakMiddle","numVNGs","sharpPositions","TC_SHARP_POSITIONS","flatPositions","TC_FLAT_POSITIONS","BC_SHARP_POSITIONS","BC_FLAT_POSITIONS","TENOR_SHARP_POSITIONS","TENOR_FLAT_POSITIONS","ALTO_SHARP_POSITIONS","ALTO_FLAT_POSITIONS","accidentalList","numAccidentals","_drawAccidental","timeTF","clefShape","Sprite4","accidentalBD","accidentalShape","hOffset","numAttachments","visualAttachment","_drawChordSymbol","fontHeight","dividerWidth","Container3","rootTf","containerWidth","typeTf","bassTf","vertStartPos","stavesInGroup","vertEndPos","horizPos","heavyPos","lightPos","dotsPos","leftPos","rightPos","textPos","tf","nextVNG","tieStartOffset","tieEndOffset","cVNG","_drawTie","x1Val","x2Val","yVal","vPosInStaff","curveDown","tieShape","yControl","legacyVNoteGroups","SystemRenderer","_VisualPage","Container4","_currentVSystemPos","_visualSystems","ScoreProperties3","DISTANCE_BETWEEN_SYSTEMS","_removeAllSystems","_replaceSystem","originalVSystem","newVSystem","visualSystems","VisualPage","ClickRegion","_VisualScore","Container5","_clickRegions","debugShowClicks","_pah","_visualPages","_currentVPagePos","Graphics4","deleteSystemTextures","vSystems","getVisualSystems","vsys","addWidthHeightMarkers","createMeasureToVisualMeasureMap","_visualMeasuresMap","vm","getVisualMeasureForMeasure","getVisualNoteGroups","_visualNoteGroupsCache","vsystems","vsystem","vnoteGroups","clearVisualNoteGroupCache","getNgToVngMap","getVisualSystemUnderPoint","visualPages","scoreWidth","visSystem","sysPoint","Point4","vSys","addClickRegion","invalidateGrid","_grid","removeClickRegion","gridSearch","details","_createSearchGrid","scorePoint","cellRow","_Cell","cellHeight","cellCol","cellWidth","cell","matchMeasure","visualMeasure","matchNoteGroup","visualNoteGroup","matchClickRegions","clickRegion","_addPage","ScoreProperties4","DISTANCE_BETWEEN_PAGES","_removeAllPages","prepareForRemoval","numCols","numRows","scoreHeight","rowOfCells","_setCellMatches","isVNG","isVMeas","isVSys","isReg","grid","startCellRow","startCellCol","VisualScore","_BitmapMusicRenderer","_renderersInUse","maxRenderers","renderScore","_addedObjects","_removedObjects","_systemRenderer","vPages","cVPage","reRender","vPage","numSystems","pageIndex","vSystemFound","BitmapMusicRenderer","PointDetails","PixiAppHelper","pixiApp","_renderOnRequest","_needsRender","_autoResizeEnabled","_app","_onAppTick","renderOnRequest","resizeToParent","parentElement","resizeToAutoResizeElement","_autoResizeElement","setAutoResizeElement","enableAutoResize","disableAutoResize","startTicker","stopTicker","requestRender","AssessmentInstrumentDO","assessmentType","minFreq","maxFreq","yinQuality","windowWidth","pRecMethod","pRecQuality","overSampTimes","requiredPitchesPerSecond","tuningWindow","ignoreOctave","checkNoteStartTimes","timeBucketLeft","timeBucketRight","minAmplPerc","psMinPitchStabilityThresh","psPitchesToConsider","psMinStablePitches","psMinTotalPitchJump","asMinAmplPercRise","asMaxAmplRiseTime","spMinTimeBetweenSplits","minTimeBetweenClaps","minAmplRatioToFloor","minConsecutiveQuietPeaks","minAmplSlopeScore","qNoteNudge","qNoteBucket","_AssessmentInstrumentUtils","AssessmentInstrumentUtils","_MicDataNode","AudioWorkletNode","_micDataEmitter","_onProcessorMessage","workletRegistered","micData","registerWorklet","micDataWorklet","audioWorklet","addModule","setWindowSize","windowSize","onmessage","MicDataNode","MicOptions","channelCount","autoGainControl","echoCancellation","latency","noiseSuppression","toMap","deviceId","settings","VideoOptions","idealFrameRate","maxFrameRate","bitRate","recordingBlobSize","mimeCodecsString","ideal","frameRate","Device","MediaDeviceManagerEvent","MediaDeviceManager","_MediaDeviceManager","_micPermissionGranted","_cameraPermissionGranted","_isInitialized","_eventEmitter","_onDeviceChange","getDevices","micChanged","_currentMic","deviceAvailable","cameraChanged","_currentCamera","_dispatchDeviceChangeEvent","devices","_devices","currentMic","currentCamera","micPermissionGranted","cameraPermissionGranted","isMicReady","isCameraReady","isInitialized","_ref","_checkIfPermissionGranted","mediaDevices","initWithDefaultDevices","initMic","initCamera","getPermissions","micSuccess","setMic","cameraSuccess","setCamera","mic","camera","_createStreams","deviceObjects","enumerateDevices","dev","kind","isDefault","clearMic","clearCamera","stream","getUserMedia","tracks","getTracks","track","removeTrack","permissions","query","AudioOptions","_MicManager","createEmitter3","_recordingBufferSize","_isCapturing","_micOptions","_onMicData","_onMediaDeviceManagerEvent","includesVideo","killStream","_audioOptions","initMicMediaStream","micOptions","videoOptions","deviceManager","_setupWorklets","_videoOptions","_stream","MicManagerEvent","addFiltering","wasCapturing","startCapture","removeFiltering","stopCapture","_inputNode","createMediaStreamSource","_micDataNode","_micMonitorOutput","getNumAudioChannels","getAudioTracks","getSettings","audioContext","recordingBufferSize","audioOptions","isCapturing","micMonitorOutput","isStreamActive","micAudioTrack","useOldChromeSettings","MicManager","AudioRecorder2","_AudioRecorder2","micManager","_isRecording","_fixWebmDuration","_onDataAvailable","_recordingBlobs","_mediaRecorder","_recordingComplete","_completeBlobReturn","_onMicManagerEvent","_killMediaRecorder","_createMediaRecorder","_micManager","_recordStartTime","_recordStopTime","getAudioBlob","_returnBlobCompleter","getAudioElement","audioEl","_audioStreamIsReady","vidOptions","recordingVideo","audioBitsPerSecond","videoBitsPerSecond","MediaRecorder","audioStreams","fixedBlob","isRecording","recordStartTime","recordStopTime","_isSupported","HitRecognizer","createEmitter4","HitType","HitType2","HitEvent","KeyHitRecognizer","_KeyHitRecognizer","_sendStartEndEvents","_sendBeatEvents","_beatKey","_keyStates","hEvent","hitType","keycode","_onKeyUp","startHitRec","_removeListeners","stopHitRec","generateHit","sendBeatEvents","sendStartEndEvents","beatKey","MicHitRecognizer","_MicHitRecognizer","_windowSize","msLengthOfData","_micSampleRate","_recordDelay","_recordTimeStamp","dataStartTime","_processAudioData","_instDO","_lastHitTime","_currentSampleIndex","_samples","_averagePeakAmpl","_recentPeaks","_floorPeakAmpl","_numPeakReadings","_consecutiveQuietPeaks","setInstrument","instDO","samplesBA","startSampleIndex","windowSamples","highestAmpl","lowestAmpl","maxPeak","MIN_VALUE","highestRecentPeak","amplSlopeScore","_detectHitByAmplSlope","peakFloorScore","samplesList","_detectHitByJerkiness","prevAmpl","cAmpl","nextAmpl","biggestJerk","midPointAmpl","PitchRecognizer","_isRunning","createEmitter5","durOfData","_processData","pitchRecMethod","_pitchRecMethod","isRunning","pitchRecEvent","startPRec","startMicCapture","_prEvents","_leftOverMicData","stopPRec","stopMicCapture","_minFreq","_maxFreq","_windowWidth","_resampleDivisor","_quality","_overSampTimes","pitchesToRead","secondsPerPitch","secondsPerOverSampIteration","dataPos","overSampIteration","curData","peakAmpl","frequency","rms","adjustedStartTime","_autoCorrelateProductDifferenceMethod","_notifyOfPitch","samplesVector","validIValues","_getValidIntervals","bestSinglePeriodInterval","_findPeriodViaProductSums","bestMultiPeriodInterval","_findAveragePeriodViaAverageDifferenceSums","_correlationScore","_getCorrelationScore","firstPeakIndex","readyForPeak","lastValue","frequencyToCheck","greatestSum","greatestSumsInterval","interval","totalPeriods","currentAverage","bestAverage","bestIntervalIndex","improvedCorrelation","minIValueToCheck","maxIValue","PitchRecEvent","midiUnrounded","roundedCents","tuningDelta","tuning","correlationScore","pitchSplit","amplSplit","totalEvents","_PRec2Node","_pitchRecEmitter","createEmitter7","instrument","_instrument","pitchRec","pRec2Worklet","resetPRec","msReadingInterval","msAnalysisDuration","AudioRecorder","_encodeLive","_encoder","_audioChunks","cancel","_initOggEncoder","getAudioBuffer","stereo","resampleRate","deleteRecordedAudio","encodeLive","numChannels","resampleLength","oac","OfflineAudioContext","bsn","createBufferSource","renderedBuffer","startRendering","getOggAudioBlob","recording","OggVorbisEncoder","_Sf2Instrument","zones","_BasicPreset","_Sf2Preset","_Sf2Sample","_Sf2Zone","__Sf2Zone","startLoopAddrsOffset","endLoopAddrsOffset","bottomVel","topVel","fineTune","courseTune","overridingRootKey","initialAttenuation","initialFilterFc","delayVolEnvTime","attackVolEnvTime","holdVolEnvTime","decayVolEnvTime","sustainVolReduction","releaseVolEnvTime","modEnvToFilterFc","isGlobal","createForInstrument","zone","_zoneType","createForPreset","_Sf2Parser","sfdata","audioIsCompressed","_sfData","_audioIsCompressed","_createReaders","_createSamples","_createInstruments","_createPresets","getPreset","bank","preset","_presets","numPresets","presetNumber","bankNumber","dataRdr","_BinaryListReader","readString","getRangeAsNewReader","sdtaLength","startOfSdtaSection","_samplesSectionByteIndex","_phdrRdr","_pbagRdr","_pmodRdr","_pgenRdr","_instRdr","_ibagRdr","_imodRdr","_igenRdr","_shdrRdr","cSample","loopStart","loopEnd","originalPitch","pitchCorrection","readInt","sampleLink","_addSF3AudioDataToSample","_addSF2AudioDataToSample","oggsIndex","oggEndIndex","sampleRateConv","sByteStartPosition","adjSampleStart","sdata","cInstrument","_instruments","nextInstrumentsBagStartIndex","cZone","nextZonesGenStartIndex","nextZonesModStartIndex","sampleMode","cPreset","bytesRead","presetBagIndex","library","genre","morphology","nextPresetBagStartIndex","__BinaryListReader","offsetInBytes","_arrayBuffer","_startIndex","_byteDataView","_uint8List","_textDecoder","numBytes","getInt16","newReaderStartIndex","_SfzPreset","samplesLoaded","_SfzRegion","__SfzRegion","lokey","hikey","lovel","hivel","lochan","hichan","loopMode","pitchKeycenter","pitchKeytrack","tune","dbVolume","ampegDelay","ampegStart","ampegAttack","ampegHold","ampegDecay","ampegSustain","ampegRelease","filType","resonance","filegDelay","filegStart","filegAttack","filegHold","filegDecay","filegSustain","filegRelease","filegDepth","cutoff","setLoopModeFromSfzValue","sfzLoopValue","setFilterTypeFromSfzValue","_SfzSample","loadAudio","_zipEntry","_getSampleRate","_path","_sampleRate","_SfzParser","initSfz","sfzZip","CompressionUtils2","_getPresetsAndSamplesFromEntries","parseAndLoadAllPresets","parseAndLoadPreset","_parsePreset","_loadSamples","e1","e2","localeCompare","currentBank","sfz","_currentPreset","_processHeader","_processOpcode","_global","_group","_region","equalsIndex","opcode","filePath","SoundLibManager","SoundLibEvent","SoundLibEventType","SoundLibEventType2","SoundLibType","SoundLibType2","_SoundMapFileEntry","_loaded","_SoundMapPresetEntry","_SoundMap","mapUrl","_fileEntries","_mapUrl","_id","libType","_isValid","fileJson","_version","presetJson","_bank","_preset","_getFileMatchingPreset","presetEntry","_SoundLibLoader","_idbConfig","deleteOldVersionStores","objectStores","keypath","indexes","_slm","loadSoundMap","_dispatch","_soundMap","_libType","loadLibrary","loadSfzPresets","fileVersion","_checkType","_getSfxFile","_parser","loadPresets","bankPresetPairs","mapDir","bankNum","presetNum","loadAllPresets","presets","hasPreset","progressCallback","progress","_dbName","_downloadArrayBuffer","libPath","_idbManager","_createRecord","_updateRecord","ConversionUtils2","PerformanceNoteDO","_PerformanceNoteDO","sfAudioStartPos","sfAudioEndPos","pitchStretchRatio","sampleDebt","loopStartPos","loopEndPos","leftVolume","rightVolume","fadeInSamples","fadeOutSamples","totalTimePlayed","attackStartTime","holdStartTime","decayStartTime","decayEndTime","preReleaseVol","releaseStartTime","amplitude","createPerformanceNote","ndo","midiVel","pZone","midiNote","iZone","_getNoteFromZones","pz","iz","pNoteDO","durationRequested","sampleRootPitch","lowpassFreq","filterMap","dbPeakAmplitude","peakAmplitude","fullDecayDur","dbSustainLevel","releaseTime","_createTimeValueMap","pdo","createNotesSfz","vel","srRatio","sfzPreset","rootNote","noteDelta","regVolAsPerc","preDelayVal","startVal","attack","peakVal","hold","sustainVal","release","finalVal","envTime","prevTime","prevVal","tratio","finalEnvTime","_NoteBuilder","clearSequence","_sequence","createPerformanceNotes","ndoList","pNotes","_createPerformanceNotes","addNoteToSequence","setPreset","sequence","pn1","pn2","NoteInfoDO","_NoteInfoDO","fromLiveNote","ldo","_StringNoteParser","_hold","_time","createNotes","_reset","cmdString","cmd","_readNum","_readPreset","_readNote","_readRest","advanceTime","_convertNoteTypeToTime","_SoundLibPlayer","_noteSets","_playStartTime","_timerInterval","_window","_phTimeSubs","_isPlaying","_trackGains","_trackPanners","_masterGainValue","_noteNodes","_lastNoteEndTime","_onTimer","phTime","currentPlayTime","phTriggerTime","removePhTimeSub","_getNotesInWindow","MIN_SAFE_INTEGER","_removeFinishedNodes","activePNotes","windowCutoff","origNote","noteStartTime","setEndTime","iterationCanceled","enableRescheduling","schedule","ms","noteSetId","_checkAllNotesFinished","_firstSoundTime","newNodes","_processNotes","playNotes","resetStartTime","_masterGain","cancelScheduledValues","addPhTimeSub","_timerId","setInterval","_playSilentNote","clearInterval","_playbackCompleteIntervalId","linearRampToValueAtTime","_clearAllNoteSetSchedules","noteNodesCopy","noteNode","disconnectNodes","prepareAudio","performanceTime","_NoteSet","clearNotes","removeNoteSet","stopNoteSetPlayback","ns","scheduleNoteSet","clearNoteSetSchedule","noteSet","setTrackVolume","_getOrCreateTrackGain","setTrackPan","_isSafari","_getOrCreateTrackPanner","setMasterVolume","shiftPlayerTime","timeDelta","ctxTime","gainNode","pts","_PhTimeSub","BrowserUtils2","nodeGroup","endContextTime","elapsedTime","finished","msUntilPlaybackComplete","pNoteDOs","playStartTime","noteNodes","noteContextTime","_NoteNodes","gainNodesPool","minPoolSize","lastTimeKey","timeKey","vol","exponentialRampToValueAtTime","filterNode","trackNode","filterNodesPool","createBiquadFilter","frq","trackGain","trackPan","createStereoPanner","isPlaying","firstSoundTime","__NoteNodes","bufferSourceNode","__NoteSet","enableScheduling","_originalStartTime","idCounter","_LiveNotePlayer","AudioComponent2","noteBuilder","_isEnabled","_notesMap","_onCleanupTime","ldoList","_noteBuilder","isEnabled","_cleanupIntervalId","stopAllLiveNotes","startLiveNote","_playNote","stopLiveNote","fadeDuration","stopBufferSource","BrowserUtils3","_LiveNoteNodes","__LiveNoteNodes","_bufferSourceNodeStopped","stopTime","_SoundLibManager","soundLibType","outputTarget","_phTimeEmitter","setOutputTarget","soundLibEvent","phTimeEvent","_player","_outputTarget","_sequenceBuilder","noteDO","getPerformanceNotes","createNotesFromString","_stringNoteMaker","enableLiveNotePlayer","_liveNotePlayer","disableLiveNotePlayer","prepareSequencedPlayback","notesetId","addPerformanceNotes","soundMapLoaded","LiveNoteInfoDO","Easing","Linear","None","Quadratic","In","Out","InOut","Cubic","Quartic","Quintic","Sinusoidal","Exponential","Circular","Elastic","Back","Bounce","now$1","process","hrtime","Group","_tweens","_tweensAddedDuringUpdate","tweenId","tween","getId","preserve","tweenIds","Interpolation","Utils","Bezier","pw","bn","Bernstein","CatmullRom","p0","fc","Factorial","v0","Sequence","nextId","_nextId","mainGroup","Tween","_object","_isPaused","_pauseStart","_valuesStart","_valuesEnd","_valuesStartRepeat","_initialRepeat","_repeat","_yoyo","_reversed","_delayTime","_easingFunction","_interpolationFunction","_chainedTweens","_onStartCallbackFired","_isChainStopped","_goToEnd","isPaused","_swapEndStartRepeatValues","_setupProperties","startValue","startValueIsArray","propType","isInterpolationList","endValues","_handleRelativeValue","stopChainedTweens","_onStopCallback","resume","numChainedTweens","times","repeatDelay","_repeatDelayTime","yoyo","easing","easingFunction","interpolation","interpolationFunction","chain","tweens","onStart","_onStartCallback","_onUpdateCallback","onRepeat","_onRepeatCallback","_onCompleteCallback","onStop","_updateProperties","startIsArray","endIsArray","endValue","TWEEN","AudioSequencer","_soundsList","_nodeCollections","preEffectsMix","masterMix","wetMix","dryMix","fxNode","removeSound","ss","addSound","zeroTime","createNodeCollections","collection","sequencerSound","sounds","overrideOutput","collections","sound","nodeCollection","NodeCollection","addNode","mapGain","volStartTime","soundMasterGainNode","panNode","soundMasterPanNode","connectNodes","renderAudio","highestFrameEndTime","frameEndTime","OfflineAudioCompletionEvent","removeAllNodes","getGainNodeForSequencerSound","getPanNodeForSequencerSound","returnNode","nodes","StereoPannerNode","AudioBufferSourceNode","Assessor","scoreViewer","visualizer","_totalCorrect","_totalIncorrect","_totalExtra","_totalBeatsCorrect","_totalBeatsIncorrect","_totalBeatsExtra","history","_scoreViewer","_visualizer","setVisualizer","NewAssessmentVisualizer","_createAssessmentNotes","_createAssessmentBeats","assessor","_noteList","_ngToAssessNoteMap","_vngToAssessNoteMap","_ngToVngMap","_beatList","clearAssessmentVisuals","getScore","extraPenalty","getBeatScore","getResults","AssessmentResults","notesCorrect","notesIncorrect","notesExtra","percentage","beatsCorrect","beatsIncorrect","beatsExtra","beatsPercentage","getAssessNoteFromNg","getAssessNoteFromVNG","getVngFromNg","vScore","AssessmentNote","qnTime","AssessmentBeat","_markNoteCorrect","matched","markNoteCorrect","_markNoteIncorrect","markNoteIncorrect","_addExtraNote","addExtraNote","_markBeatCorrect","markBeatCorrect","_markBeatIncorrect","markBeatIncorrect","_addExtraBeat","requiresMicrophone","getLongestStreak","AssessmentVisualizerBase","_assessor","_AssessmentVisualizer","GREEN","targetSystem","xVal","noteBefore","noteAfter","posRatio","BLACK","_NewAssessmentVisualizer","autoMarkTiedNotes","setNoteColor","markTiedNotes","props","assessmentOverlay","nextNg","AssessmentType","AssessmentType2","InteractionSettings","enableScrollWheel","enableDragScroll","enableMeasureClickEvents","enableNoteClickEvents","enableRegionClickEvents","enableMeasureOverEvents","enableNoteOverEvents","enableRegionOverEvents","scoreViewerIsStationary","_requiresMouseUpDown","_requiresMouseMove","_requiresWheel","ScoreViewerInteractionManager","viewManager","_enabled","_mouseDownPotentialClick","_minDeltaForDragScroll","_maxDeltaForClick","_lastScrollWheelTime","_spaceAboveScore","_spaceBelowScore","_onMouseDown","_getMousePositionDetails","_mouseDetails","mouseOutsideViewer","_mouseDownStartPos","clientMousePos","_settings","_onTick","_mouseDownLastPos","_getPointDetailsInScore","_pointDetails","_lastMeasureOver","ScoreViewerEvent","_dispatchClientEvent","_lastNoteGroupOver","_lastRegionOver","origY","nowY","inc","dec","_fixVerticalScorePosition","_vm","updateVisibleSystems","_onMouseUp","isClick","_cancelMouseDownWatch","_onWheel","_MouseEventDetails","setNewScore","enableInteraction","_viewerGlobalPos","disableInteraction","setInteraction","notifyPlaybackStateChange","setScrollBuffers","aboveScore","belowScore","_viewerHeight","canvasMousePos","viewerMousePos","scoreMousePos","mouseOutsideCanvas","viewerGlobalPos","_viewerWidth","scoreGlobalPos","ScoreViewerPlaybackManager","interactionManager","_vngIndex","_forceScrolling","_audioStartDelay","_onEnterFrame","_getCurrentTime","_getQNoteTime","_updateCursorAndScrollPos","_updateCountoffDisplay","_displayRepeatPreview","lastVng","_vngList","_nextTimeStamp","_stopPlayback","_im","_vScore","_cursor","drawCursor","beatList","countoffBeatList","audioStartDelaySeconds","startNG","endQNoteTime","_prepareTracking","_prepareScrolling","_contextStartTime","_timeStamps","_lastTimeStamp","_currentQNoteToSecondsRatio","_sortAndRemoveDuplicates","_countoffBeatList","_beatIndex","_countoffBeatIndex","_firstNoteReached","_initializeCursorAndView","_lastReachedVNG","_lastVNGInRegion","_useScrolling","isNoteInView","ts","_lastSystem","scrollToSystem","_moveCursorToNotePosition","qNoteTime2","newStampQNoteTime","removeSystemPreview","mostRecentVNG","skipNote","contextTime","mostRecentBeat","_isMeasureWholeRest","startHPos","prevNoteXPos","sysPageOffset","updateVisualCountoff","_systemPreview","showSystemPreview","num1","num2","lastNum","newList","newNum","forceScrolling","_ScoreViewerViewManager","_systemScrollEmitter","_onUpdateTweens","runAgain","_scrollTween","_countoffFadeTween","_systemPreviewScrollTween","systemScrollEvent","_assessmentOverlay","viewerWidth","viewerHeight","_vSystems","setWidthAndHeight","_viewerMask","EDGE_BUFFER","stopCurrentScrollTween","getFirstVisibleSystem","getVisibleSystems","targetY","nextScrollDelta","cacheAlreadyVisibleSystems","countoffBeat","_countoffDisplay","targetSys","currentSys","targetVng","preview","fadeIntoPosition","tempSys","ScoreViewerViewManager","ScoreViewer3","_emitter","_pm","setScore","vng1","vng2","startBeatTrackPlayback","countoffBeats","scrollToTop","draw1pxFrame","_frame","playbackManager","ScoreViewerEventType","ScoreViewerEventType2","NoteSplitter","_pitchHistory","_currentEventIndex","_osMinStablePitches","_osPitchesToConsider","_osMinTotalPitchJump","_osMinPitchStabilityThreshold","_osLastStablePitch","_osStablePitchEventsCount","_osMinAmplPercRise","_osAmplMaxRiseTime","_osLastSplitTime","_minTimeBetweenSplits","_minAmplPerc","_highestAmpl","addEvent","prEvent","cprEvent","cPitch","firstPitchIndex","firstSamePitchIndex","stableCount","stableTotal","pitchStable","newAverage","splitCents","prevEventIndex","PitchAssessor","_assess_Delay","_debugPRecString","_debugNotesString","_debug","_onScoreViewerEvent","_notationNotesQue","_debugNREvents","_onPitchRec","_inst","_noteSplitter","_debugPREvents","_checkForNotesToAssess","_initialize","SoundLibManager2","_pitchRecognizer","_debugMatchedNotes","_hitMissHistory","_prEventWindowStartIndex","_lastNotationPitch","_maxAmplitudeEncountered","isFinalFrame","nrEvent","assessNote4","assessNote","noteReachedEvent","durationInSeconds","requiredMatches","matchedPitches","notationCents","timeWindow","allowMultipleGuesses","pitchMatch","guesses","centsGuessList","numGuesses","pRecCents","difference","twLeft","twRight","haveSplitPointInTimeWindow","prEventTime","prEventInTimeWindow","debugPRecString","debugNotesString","debugPREvents","debugNREvents","debugMatchedNotes","_RhythmAssessor","_keyMap","_defaultWindowSize","_onHit","rhythm_hit_start","_handleRhythmHitStart","rhythm_hit_end","_handleRhythmHitEnd","beat_hit","assessBeats","_handleBeatHit","rhythm_hit","_firstNotePlayed","_notesReachedQue","_notesReachedIndex","aNote","_rhythmHits","_beatHits","_noteIndex","usesKeyboard","_keyHitRecognizer","usesLiveNotes","usesMicHit","_micHitRecognizer","setHitMode","_hitMode","KeyHitRecognizer2","MediaDeviceManager2","isClapHitRec","AssessmentInstrumentUtils2","MicManager2","SoundLibManager3","_findNoteMatchForHit","_findClosestNoteForHit","_findBeatMatchForHit","_playBeat","TieState2","closestNote","closestDistance","increment","NoteInfoDO2","isVoiceHitRec","RhythmAssessor","RhythmAssessorHitMode","RhythmAssessorHitMode2","_SFPerformanceNoteMaker","soundLibManager","addNotesInParts","tempoRatio","playSoundFontNotes","metronomeVolume","numCountoffBeats","playRepeats","_tempoRatio","startQNoteTime","_getNoteOrStackTime","realStartQNoteTime","_calculateQNoteStartTime","_createTempoTimeStamps","_createPlaybackNotes","_createMetronomeBeats","_createCountoffClicks","stackTime","actualCountoffTempo","COMPOUND_METER_TEMPO_CUTOFF","_qNotesPerCountoffBeat","_countoffDuration","distToNearestBeat","adjustedCountoffBeats","_tempoTimeStamps","countoffTimeStamp","TempoTimeStampDO2","playAllParts","partDynamics","NOTE_GROUP","partIndex","ngQnDur","tieDuration","TieState3","tieEndFound","nextNgData","noteVolume","art","NoteInfoDO3","_beats","useSubBeat","BEAT","SUB_BEAT","metronomeNote","actualMetVolume","beatTime","startNGMarkerTempo","remainingClicks","clickPos","cSecondsPerQNote","clickDuration","_countoffBeats","sampleTimeStamps","countoffBeatQNotePositions","countoffDuration","SFPerformanceNoteMaker","SFPlaybackDO","_SFPlaybackDO","countoffSeconds","playAudio","fromPDO","_startNoteTimeOffset","_countoffBeatQNotePositions","requiresMic","SFDriverDrawManager","driver","_scoreViewerWidth","_scoreViewerHeight","defaultPageWidth","_driver","renderNotation","clearSystemIndents","_clearSystemIndents","_scoreFormatter","_renderMusic","resetNotation","_displayedParts","resizeScoreViewer","_markMeasuresForRendering","_formatMusic","ScoreFormatter2","IAssessorFactory","BasicAssessorFactory","getAssessor","assessType","SFDriverStatusEvent","SFScoreDriver","_SFScoreDriver","_useAudioRecorder2","_assessorFactory","_leaveMicCaptureEnabled","_statusEmitter","_onSoundLibEvent","loadProgress","parsing","libraryReady","noteSetComplete","playbackFinished","_onPlaybackComplete","_playbackCompleteCallback","statusEvent","sfd","hasAudio","throwErrorOnNoAudioContext","_drawManager","_outputComponent","outputComponent","DestinationAudioComponent2","SoundLibManager6","MusicTextures3","initialPixelsPerSpace","BitmapMusicRenderer2","MediaDeviceManager4","MicManager4","_audioRecorder","_audioRecorder2","AudioRecorder22","useAudioRecorder2","initialInstrument","soundMapPath","loadMapOnInit","loadPresetsOnInit","enableMicrophone","useCamera","unloadScore","destroyParser","parseScore","musicXmlString","keepParserObject","MusicXmlParser22","addSequencerSounds","audioSupported","_audioSequencer","preparePlayback","_prepareSFAudio","_prepareAssessment","playbackCompleteCallback","playPrepared","_performanceNoteMaker","getAssessmentScore","getAssessmentResults","getRecording","getRecordingAsOggAudioBlob","getRecordingBlobAR2","getAudioElementAR2","_getCountoffBeatsForSeconds","tmList","qNotesPerCountoffBeat","actualTempo","secondsPerMeasure","leaveMicCaptureEnabled","audioSequencer","assessorFactory","SFDriverConfig","ScoreProperties6","InstrumentUtils2","AppSettings","_jsParams","_isBot","getJSParam","isBot","resourcesPath","pageUrl","Templates","htmlString","firstElementChild","createDiv","AppContainer","songMenuUi","_songMenuUi","playerUi","_playerUi","_appContainer","qs","setActiveScreen","_activeScreen","_updateDisplay","className","classList","AppScreen","menu","player","SfxPlayer","loadSounds","_sfx","clap1","clap2","clap3","playSound","soundId","RaAssessmentVisualizer","explosion","_rewardTextStyle","_streak","_tweenWrappers","_animationWrappers","_handleAnimationFrame","wrapper","_onSpriteFrameChange","_explosion","addExplosion","completionHandler","notehead","_AnimationWrapper","_TweenWrapper","RaAssessorFactory","loadAnimations","_spriteSheet","rhythmKeyboard","keyboardAndBeat","keyboard","UserDTO","userId","fbUserId","displayName","role","CreateUserDTO","toForm","fd","FormData","TeamDTO","TeamUploadDTO","TeamUpdateDTO","ContestEntryDTO","dateString","teamId","teamDto","ContestEntryUpdateDTO","byteToCharMap_","charToByteMap_","byteToCharMapWebSafe_","charToByteMapWebSafe_","ENCODED_VALS_BASE","ENCODED_VALS","ENCODED_VALS_WEBSAFE","HAS_NATIVE_SUPPORT","atob","encodeByteArray","webSafe","init_","byteToCharMap","byte1","haveByte2","byte2","haveByte3","byte3","outByte1","outByte2","outByte3","outByte4","encodeString","btoa","stringToByteArray$1","decodeString","c3","byteArrayToString","decodeStringToByteArray","charToByteMap","byte4","base64Decode","Deferred","wrapCallback","getUA","FirebaseError","customData","captureStackTrace","ErrorFactory","service","serviceName","errors","fullCode","PATTERN","replaceTemplate","fullMessage","deepEqual","aKeys","bKeys","aProp","bProp","isObject","thing","querystring","querystringParams","arrayVal","querystringDecode","decodeURIComponent","extractQuerystring","queryStart","fragmentStart","ObserverProxy","executor","onNoObservers","observers","unsubscribes","observerCount","task","finalized","forEachObserver","subscribe","nextOrObserver","methods","implementsAnyMethods","noop","unsub","unsubscribeOne","finalError","sendOne","getModularInstance","_delegate","Component","instanceFactory","multipleInstances","serviceProps","instantiationMode","onInstanceCreated","setInstantiationMode","setMultipleInstances","setServiceProps","setInstanceCreatedCallback","DEFAULT_ENTRY_NAME","Provider","instances","instancesDeferred","instancesOptions","onInitCallbacks","normalizedIdentifier","normalizeInstanceIdentifier","deferred","shouldAutoInitialize","getOrInitializeService","instanceIdentifier","getImmediate","optional","getComponent","setComponent","isComponentEager","instanceDeferred","clearInstance","services","INTERNAL","_delete","isComponentSet","getOptions","initialize","onInit","existingCallbacks","existingInstance","invokeOnInitCallbacks","callbacks","ComponentContainer","providers","addComponent","provider","getProvider","addOrOverwriteComponent","getProviders","LogLevel","levelStringToEnum","DEBUG","VERBOSE","INFO","WARN","ERROR","silent","SILENT","defaultLogLevel","ConsoleMethod","defaultLogHandler","logType","logLevel","toISOString","Logger","_logLevel","_logHandler","_userLogHandler","setLogLevel","logHandler","userLogHandler","PlatformLoggerServiceImpl","getPlatformInfoString","isVersionServiceProvider","logString","name$o","version$1","name$n","name$m","name$l","name$k","name$j","name$i","name$h","name$g","name$f","name$e","name$d","name$c","name$b","name$a","name$9","name$8","name$7","name$6","name$5","name$4","name$3","name$2","name$1","PLATFORM_LOG_STRING","name$1$1","name$p","_apps","_addComponent","_registerComponent","componentName","_getProvider","ERROR_FACTORY","FirebaseAppImpl","_isDeleted","_automaticDataCollectionEnabled","automaticDataCollectionEnabled","checkDestroyed","isDeleted","appName","SDK_VERSION","registerVersion","libraryKeyOrName","variant","libraryMismatch","versionMismatch","warning","__rest","propertyIsEnumerable","_prodErrorMap","SuppressedError","prodErrorMap","_DEFAULT_AUTH_ERROR_FACTORY","logClient","_logError","_fail","authOrCode","createErrorInternal","_createError","_errorWithCustomMessage","auth","errorMap","fullParams","_errorFactory","_assert","assertion","debugFail","failure","debugAssert","instanceCache","_getInstance","cls","_getCurrentUrl","_getCurrentScheme","_isOnline","onLine","runtime","browser","isBrowserExtension","Delay","shortDelay","longDelay","_emulatorUrl","emulator","FetchProvider","fetchImpl","headersImpl","responseImpl","headers","Headers","Response","SERVER_ERROR_MAP","CREDENTIAL_MISMATCH","MISSING_CUSTOM_TOKEN","INVALID_IDENTIFIER","MISSING_CONTINUE_URI","INVALID_PASSWORD","MISSING_PASSWORD","EMAIL_EXISTS","PASSWORD_LOGIN_DISABLED","INVALID_IDP_RESPONSE","INVALID_PENDING_TOKEN","FEDERATED_USER_ID_ALREADY_LINKED","MISSING_REQ_TYPE","EMAIL_NOT_FOUND","RESET_PASSWORD_EXCEED_LIMIT","EXPIRED_OOB_CODE","INVALID_OOB_CODE","MISSING_OOB_CODE","CREDENTIAL_TOO_OLD_LOGIN_AGAIN","INVALID_ID_TOKEN","TOKEN_EXPIRED","USER_NOT_FOUND","TOO_MANY_ATTEMPTS_TRY_LATER","INVALID_CODE","INVALID_SESSION_INFO","INVALID_TEMPORARY_PROOF","MISSING_SESSION_INFO","SESSION_EXPIRED","MISSING_ANDROID_PACKAGE_NAME","UNAUTHORIZED_DOMAIN","INVALID_OAUTH_CLIENT_ID","ADMIN_ONLY_OPERATION","INVALID_MFA_PENDING_CREDENTIAL","MFA_ENROLLMENT_NOT_FOUND","MISSING_MFA_ENROLLMENT_ID","MISSING_MFA_PENDING_CREDENTIAL","SECOND_FACTOR_EXISTS","SECOND_FACTOR_LIMIT_EXCEEDED","BLOCKING_FUNCTION_ERROR_RESPONSE","DEFAULT_API_TIMEOUT_MS","_addTidIfNecessary","tenantId","_performApiRequest","customErrorMap","_performFetchWithErrorHandling","apiKey","_getAdditionalHeaders","languageCode","_getFinalTarget","apiHost","referrerPolicy","fetchFn","_canInitEmulator","networkTimeout","NetworkTimeout","race","clearNetworkTimeout","_makeTaggedError","errorMessage","serverErrorCode","serverErrorMessage","authError","_performSignInRequest","serverResponse","_serverResponse","host","apiScheme","timer","errorParams","phoneNumber","_tokenResponse","utcTimestampToDateString","utcTimestamp","toUTCString","secondsStringToMilliseconds","_parseToken","algorithm","payload","decoded","_logoutIfInvalidated","user","bypassAuthState","isUserInvalidated","currentUser","signOut","ProactiveRefresh","timerId","errorBackoff","_start","_stop","getInterval","wasError","stsTokenManager","expirationTime","iteration","getIdToken","UserMetadata","createdAt","lastLoginAt","_initializeTime","lastSignInTime","creationTime","_copy","metadata","toJSON","_reloadWithoutSaving","idToken","getAccountInfo","users","coreAccount","_notifyReloadListener","newProviderData","providerUserInfo","providerId","rawId","photoURL","photoUrl","providerData","original","deduped","mergeProviderData","oldIsAnonymous","isAnonymous","newIsAnonymous","passwordHash","updates","localId","emailVerified","StsTokenManager","refreshToken","accessToken","isExpired","updateFromServerResponse","expiresIn","parsedToken","exp","iat","_tokenExpiresIn","updateTokensAndExpiration","getToken","forceRefresh","refresh","clearRefreshToken","oldToken","grant_type","refresh_token","tokenApiHost","access_token","expires_in","requestStsToken","expiresInSec","fromJSON","_assign","_clone","_performRefresh","assertStringOrUndefined","UserImpl","opt","proactiveRefresh","reloadUserInfo","reloadListener","_persistUserIfCurrent","_notifyListenersIfCurrent","getIdTokenResult","userInternal","claims","auth_time","firebase","signInProvider","authTime","issuedAtTime","signInSecondFactor","reload","userInfo","_onReload","_startProactiveRefresh","_stopProactiveRefresh","_updateTokensIfNecessary","tokensRefreshed","deleteAccount","_redirectEventId","_fromJSON","plainObjectTokenManager","_fromIdTokenResponse","idTokenResponse","InMemoryPersistence","storage","_isAvailable","_set","_get","_remove","_listener","_removeListener","inMemoryPersistence","_persistenceKeyName","PersistenceUserManager","persistence","userKey","fullUserKey","fullPersistenceKey","boundEventHandler","_onStorageEvent","setCurrentUser","getCurrentUser","removeCurrentUser","savePersistenceForRedirect","setPersistence","newPersistence","persistenceHierarchy","availablePersistences","selectedPersistence","userToMigrate","migrationHierarchy","_shouldAllowMigration","_getBrowserName","ua","_isIEMobile","_isFirefox","_isBlackBerry","_isWebOS","_isChromeIOS","_isAndroid","re","_isIOS","_isIE10","isIE","documentMode","_isMobileBrowser","_getClientVersion","clientPlatform","frameworks","reportedPlatform","reportedFrameworks","AuthImpl","emulatorConfig","operations","authStateSubscription","Subscription","idTokenSubscription","redirectUser","isProactiveRefreshEnabled","_deleted","_initializationPromise","_popupRedirectResolver","lastNotifiedUid","appVerificationDisabledForTesting","clientVersion","sdkClientVersion","_initializeWithPersistence","popupRedirectResolver","persistenceManager","_shouldInitProactively","initializeCurrentUser","assertedPersistence","_currentUser","_updateCurrentUser","storedUser","authDomain","getOrInitRedirectPersistenceManager","redirectUserEventId","storedUserEventId","tryRedirectSignIn","directlySetCurrentUser","reloadAndSetCurrentUserOrClear","redirectResolver","_completeRedirectFn","_setRedirectUser","useDeviceLanguage","navigatorLanguage","languages","language","_getUserLanguage","updateCurrentUser","userExtern","notifyAuthListeners","redirectPersistenceManager","_getPersistence","_updateErrorMap","onAuthStateChanged","completed","registerStateListener","onIdTokenChanged","redirectManager","_redirectPersistence","_redirectUserForId","currentUid","subscription","addObserver","_logFramework","framework","_getFrameworks","appId","_castAuth","createSubscribe","AuthCredential","signInMethod","_getIdTokenResponse","_auth","_linkToIdToken","_idToken","_getReauthenticationResolver","sendOobCode","EmailAuthCredential","_email","_password","_tenantId","_fromEmailAndPassword","_fromEmailAndCode","oobCode","signInWithPassword","returnSecureToken","signInWithEmailLink$1","updateEmailPassword","signInWithEmailLinkForLinking","signInWithIdp","OAuthCredential","pendingToken","_fromParams","cred","nonce","oauthToken","oauthTokenSecret","secret","buildRequest","autoCreate","requestUri","postBody","ActionCodeURL","actionLink","parseMode","continueUrl","parseLink","doubleDeepLink","iOSDeepLink","parseDeepLink","EmailAuthProvider","PROVIDER_ID","credential","credentialWithLink","emailLink","actionCodeUrl","EMAIL_PASSWORD_SIGN_IN_METHOD","EMAIL_LINK_SIGN_IN_METHOD","FederatedAuthProvider","defaultLanguageCode","customParameters","setDefaultLanguage","setCustomParameters","customOAuthParameters","getCustomParameters","BaseOAuthProvider","scopes","addScope","scope","getScopes","FacebookAuthProvider","FACEBOOK_SIGN_IN_METHOD","credentialFromResult","userCredential","credentialFromTaggedObject","credentialFromError","tokenResponse","oauthAccessToken","GoogleAuthProvider","GOOGLE_SIGN_IN_METHOD","oauthIdToken","GithubAuthProvider","GITHUB_SIGN_IN_METHOD","TwitterAuthProvider","TWITTER_SIGN_IN_METHOD","UserCredentialImpl","operationType","providerIdForResponse","_forOperation","MultiFactorError","_fromErrorAndOperation","_processCredentialSavingMfaContextIfNecessary","_signInWithCredential","sendPasswordResetEmail","actionCodeSettings","authModular","requestType","sendPasswordResetEmail$1","createUserWithEmailAndPassword","authInternal","signUp","signInWithEmailAndPassword","signInWithCredential","sendEmailVerification","sendEmailVerification$1","STORAGE_AVAILABLE_KEY","BrowserPersistenceClass","storageRetriever","setItem","removeItem","getItem","BrowserLocalPersistence","localStorage","poll","onStorageEvent","localCache","pollTimer","safariLocalStorageNotSynced","_iframeCannotSyncWebStorage","_isIframe","fallbackToPolling","forAllChangedKeys","oldValue","_oldValue","notifyListeners","detachListener","stopPolling","storedValue","triggerListeners","startPolling","StorageEvent","attachListener","browserLocalPersistence","BrowserSessionPersistence","sessionStorage","browserSessionPersistence","Receiver","eventTarget","handlersMap","receivers","receiver","isListeningto","newInstance","messageEvent","eventId","eventType","ports","fulfilled","reason","_allSettled","_subscribe","eventHandler","_unsubscribe","_generateEventId","digits","Sender","removeMessageHandler","messageChannel","port1","_send","timeout","MessageChannel","completionTimer","ackTimer","port2","finally","_isWorker","DB_NAME","DB_OBJECTSTORE_NAME","DB_DATA_KEYPATH","DBPromise","toPromise","getObjectStore","isReadWrite","_openDatabase","_deleteDatabase","_putObject","_deleteObject","IndexedDBLocalPersistence","pendingWrites","sender","serviceWorkerReceiverAvailable","activeServiceWorker","_workerInitializationPromise","initializeServiceWorkerMessaging","_openDb","_withRetries","op","numAttempts","initializeReceiver","initializeSender","_origin","keyProcessed","_poll","serviceWorker","ready","_getActiveServiceWorker","notifyServiceWorker","controller","_withPendingWrite","getObject","getAllRequest","keysInResult","fbase_key","localKey","indexedDBLocalPersistence","_loadJS","charset","_withDefaultResolver","resolverOverride","IdpCredential","_buildIdpRequest","sessionId","returnIdpCredential","_signIn","_reauth","_reauthenticate","_link","_link$1","AbstractPopupRedirectOperation","pendingPromise","eventManager","onExecution","registerConsumer","onAuthEvent","urlResponse","getIdpTask","onError","unregisterAndCleanUp","unregisterConsumer","cleanUp","_POLL_WINDOW_CLOSE_TIMEOUT","signInWithPopup","_assertInstanceOf","resolverInternal","PopupOperation","executeNotNull","authWindow","pollId","currentPopupAction","_openPopup","associatedEvent","_originValidation","_isIframeWebStorageSupported","pollUserCancellation","PENDING_REDIRECT_KEY","redirectOutcomeMap","RedirectAction","readyOutcome","pendingRedirectKey","resolverPersistence","hasPendingRedirect","_getAndClearPendingRedirectStatus","_getRedirectResult","resolverExtern","AuthEventManager","cachedEventUids","consumers","queuedRedirectEvent","hasHandledPotentialRedirect","lastProcessedEventTime","authEventConsumer","isEventForConsumer","sendToConsumer","saveEventToCache","onEvent","hasEventBeenHandled","handled","consumer","isNullRedirectEvent","isRedirectEvent","eventIdMatches","eventUid","IP_ADDRESS_REGEX","HTTP_REGEX","_validateOrigin","authorizedDomains","_getProjectConfig","domain","matchDomain","expected","currentUrl","ceUrl","escapedDomainPattern","NETWORK_TIMEOUT","resetUnloadedGapiModules","beacon","___jsl","hint","L","CP","loadGapi","loadGapiIframe","gapi","iframes","ontimeout","Iframe","cbName","cachedGApiLoader","PING_TIMEOUT","IFRAME_PATH","EMULATED_IFRAME_PATH","IFRAME_ATTRIBUTES","tabindex","EID_FROM_APIHOST","getIframeUrl","eid","fw","_openIframe","_loadGapi","where","messageHandlersFilter","CROSS_ORIGIN_IFRAMES_FILTER","dontclear","iframe","restyle","setHideOnLeave","networkError","networkErrorTimer","clearTimerAndResolve","ping","BASE_POPUP_OPTIONS","resizable","statusbar","toolbar","AuthPopup","_open","availHeight","availWidth","scrollbars","optionsString","accum","standalone","_isIOSStandalone","createEvent","openAsNewWindowIOS","newWin","focus","WIDGET_PATH","EMULATOR_WIDGET_PATH","_getRedirectUrl","authType","redirectUrl","additionalParams","tid","paramsDict","getHandlerBase","WEB_STORAGE_SUPPORT_KEY","browserPopupRedirectResolver","eventManagers","originValidationPromises","_openRedirect","initAndGetManager","register","iframeEvent","authEvent","AuthInterop","internalListeners","getUid","assertAuthConfigured","addAuthTokenListener","unsubscribe","updateProactiveRefresh","removeAuthTokenListener","getAuth","getApp","deps","initializeAuth","authInstance","hierarchy","_initializeAuthInstance","_instanceIdentifier","getVersionForPlatform","FbAuth","showLogin","prompt","logout","setAuthPersistence","reloadUser","getUserToken","Services","getUserInfo","U","req","rdto","exception","createUser","removeUser","loadSongXml","getTeamByCode","getTeamsForUser","addTeam","updateTeam","removeTeam","updateScore","getContestData","dateId","usersApiVersion","raApiVersion","withTime","rootApiPath","recorderAceApiPath","TeamDO","fromTeamDto","updateFromDto","ContestEntryDO","fromContestDto","cdo","team","LuxonError","InvalidDateTimeError","toMessage","InvalidIntervalError","InvalidDurationError","ConflictingSpecificationError","InvalidUnitError","unit","InvalidArgumentError","ZoneIsAbstractError","DATE_SHORT","year","month","day","DATE_MED","DATE_MED_WITH_WEEKDAY","weekday","DATE_FULL","DATE_HUGE","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hourCycle","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","isUndefined","isNumber","hasRelative","RelativeTimeFormat","bestBy","best","pair","integerBetween","padStart","padded","parseInteger","parseFloating","parseMillis","fraction","roundTo","towardZero","isLeapYear","daysInYear","daysInMonth","modMonth","floorMod","objToLocalTS","UTC","millisecond","setUTCFullYear","getUTCFullYear","weeksInWeekYear","weekYear","untruncateYear","parseZoneInfo","offsetFormat","locale","timeZone","intlOpts","modified","DateTimeFormat","formatToParts","signedOffset","offHourStr","offMinuteStr","offHour","offMin","is","asNumber","numericValue","normalizeObject","normalizer","normalized","formatOffset","hours","minutes","timeObject","pick","ianaRegex","monthsLong","monthsShort","monthsNarrow","months","weekdaysLong","weekdaysShort","weekdaysNarrow","weekdays","meridiems","erasLong","erasShort","erasNarrow","eras","stringifyTokens","splits","tokenToString","literal","macroTokenToFormatOpts","Formats.DATE_SHORT","DD","Formats.DATE_MED","DDD","Formats.DATE_FULL","DDDD","Formats.DATE_HUGE","Formats.TIME_SIMPLE","Formats.TIME_WITH_SECONDS","ttt","Formats.TIME_WITH_SHORT_OFFSET","tttt","Formats.TIME_WITH_LONG_OFFSET","T","Formats.TIME_24_SIMPLE","TT","Formats.TIME_24_WITH_SECONDS","TTT","Formats.TIME_24_WITH_SHORT_OFFSET","TTTT","Formats.TIME_24_WITH_LONG_OFFSET","Formats.DATETIME_SHORT","Formats.DATETIME_MED","Formats.DATETIME_FULL","ffff","Formats.DATETIME_HUGE","Formats.DATETIME_SHORT_WITH_SECONDS","Formats.DATETIME_MED_WITH_SECONDS","Formats.DATETIME_FULL_WITH_SECONDS","Formats.DATETIME_HUGE_WITH_SECONDS","Formatter","parseFormat","fmt","currentFull","bracketed","formatOpts","systemLoc","formatWithSystemDefault","dt","redefaultToSystem","dtFormatter","formatDateTime","formatDateTimeParts","resolvedOptions","forceSimple","padTo","numberFormatter","formatDateTimeFromString","knownEnglish","listingMode","useDateTimeFormatter","outputCalendar","extract","isOffsetFixed","allowZ","meridiem","English.meridiemForDateTime","English.monthForDateTime","English.weekdayForDateTime","maybeMacro","era","English.eraForDateTime","offsetName","zoneName","weekNumber","ordinal","quarter","formatDurationFromString","dur","tokenToField","realTokens","collapsed","shiftTo","lildur","mapped","Invalid","explanation","Zone","isUniversal","otherZone","singleton","SystemZone","getTimezoneOffset","matchingRegex","dtfCache","typeToPos","ianaZoneCache","IANAZone","resetCache","isValidSpecifier","isValidZone","NaN","dtf","hour12","formatted","filled","partsOffset","fMonth","fDay","fYear","fHour","fMinute","fSecond","hackyOffset","asTS","over","FixedOffsetZone","utcInstance","parseSpecifier","fixed","InvalidZone","normalizeZone","defaultZone","lowered","throwOnInvalid","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","Settings","numberingSystem","resetCaches","Locale","intlLFCache","intlDTCache","getCachedDTF","locString","intlNumCache","intlRelCache","sysLocaleCache","listStuff","defaultOK","englishFn","intlFn","PolyNumberFormatter","intl","otherOpts","useGrouping","minimumIntegerDigits","inf","NumberFormat","getCachedINF","PolyDateFormatter","gmtOffset","offsetZ","DateTime","fromMillis","toJSDate","PolyRelFormatter","isEnglish","cacheKeyOpts","getCachedRTF","numeric","narrow","units","years","quarters","weeks","days","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","English.formatRelativeTime","fromOpts","defaultToEN","specifiedLocale","localeR","numberingSystemR","outputCalendarR","fromObject","numbering","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","localeStr","uIndex","parseLocaleString","intlConfigString","weekdaysCache","monthsCache","meridiemCache","eraCache","fastNumbersCached","fastNumbers","isActuallyEn","hasNoWeirdness","alts","getOwnPropertyNames","redefaultToEN","English.months","formatStr","utc","mapMonths","English.weekdays","mapWeekdays","English.meridiems","English.eras","field","matching","relFormatter","listFormatter","ListFormat","getCachedLF","combineRegexes","regexes","full","combineExtractors","extractors","mergedVals","mergedZone","patterns","extractor","simpleParse","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","extractISOWeekData","extractISOOrdinalData","sqlTimeRegex","sqlTimeExtensionRegex","fallback","extractISOYmd","extractISOTime","milliseconds","extractISOOffset","local","fullOffset","extractIANAZone","isoTimeOnly","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","hasNegativePrefix","negativeSeconds","maybeNegate","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","English.monthsShort","English.weekdaysLong","English.weekdaysShort","rfc2822","extractRFC2822","obsOffset","milOffset","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDateAndTime","extractISOTimeAndOffset","extractISOTimeOnly","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOYmdTimeOffsetAndIANAZone","extractISOTimeOffsetAndIANAZone","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","conf","conversionAccuracy","Duration","convert","fromMap","fromUnit","toUnit","conv","added","antiTrunc","accurate","invalid","isLuxonDuration","normalizeUnit","fromDurationLike","durationLike","isDuration","fromISO","parseISODuration","fromISOTime","parseISOTimeOnly","week","toFormat","fmtOpts","toHuman","unitDisplay","listStyle","toObject","toISO","toISOTime","millis","toMillis","suppressMilliseconds","suppressSeconds","includePrefix","as","valueOf","plus","minus","negate","mapUnits","reconfigure","vals","normalizeValues","built","accumulated","lastUnit","own","ak","down","negated","invalidReason","invalidExplanation","INVALID","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","validateStartEnd","after","before","startIsValid","endIsValid","isInterval","toDuration","startOf","hasSame","isAfter","dateTime","isBefore","splitAt","dateTimes","sorted","splitBy","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","final","sofar","xor","currentCount","ends","toISODate","dateFormat","separator","mapEndpoints","mapFn","Info","hasDST","setZone","isValidIANAZone","locObj","monthsFormat","weekdaysFormat","relative","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highWater","lowestOrder","differs","differ","highOrderDiffs","remainingMillis","lowerOrderUnits","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","digitRegex","MISSING_FTP","intUnit","deser","parseDigits","spaceOrNBSP","spaceOrNBSPRegExp","fixListRegex","stripInsensitivities","oneOf","simple","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","dummyDateTimeCache","maybeExpandMacroToken","tokenForPart","explainFromTokens","expandMacroTokens","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","unitForToken","disqualifyingUnit","regexString","buildRegex","rawMatches","matchIndex","specificOffset","Z","toField","dateTimeFromMatches","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","js","getUTCDay","computeOrdinal","uncomputeOrdinal","month0","gregorianToWeek","gregObj","weekToGregorian","weekData","weekdayOfJan4","yearInDays","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","hasInvalidGregorianData","validYear","validMonth","validDay","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","unsupportedZone","possiblyCachedWeekData","old","fixOffset","localTS","tz","utcGuess","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","extended","longFormat","includeOffset","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","quickDT","tsNow","offsetProvis","diffRelative","calendary","lastOpts","argList","ot","_zone","isLuxonDateTime","fromJSDate","isDate","zoneToUse","fromSeconds","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","higherOrderInvalid","validWeek","validWeekday","hasInvalidWeekData","validOrdinal","hasInvalidOrdinalData","gregorian","tsFinal","offsetFinal","parseISODate","fromRFC2822","preprocessRFC2822","parseRFC2822Date","fromHTTP","parseHTTPDate","fromFormat","localeToUse","parseFromTokens","fromString","fromSQL","parseSQL","isDateTime","monthShort","monthLong","weekdayShort","weekdayLong","offsetNameShort","offsetNameLong","isInDST","isInLeapYear","resolvedLocaleOptions","keepCalendarTime","newTS","offsetGuess","asObj","setLocale","settingWeekStuff","mixed","normalizedUnit","endOf","toLocaleString","toLocaleParts","toISOWeekDate","toRFC2822","toHTTP","toSQLDate","toSQLTime","includeZone","toSQL","toSeconds","toBSON","includeConfig","otherDateTime","durOpts","otherIsLater","diffed","diffNow","until","inputMs","adjustedToZone","toRelative","toRelativeCalendar","fromFormatExplain","fromStringExplain","Formats.DATE_MED_WITH_WEEKDAY","Formats.DATETIME_MED_WITH_WEEKDAY","dateTimeish","ContestManager","_entries","getCompetitionId","startDate","weekIndex","getCompetitionStartDate","weekDelta","daysDelta","LocalStorageHelper","clearAllStoredSettings","getStudentData","saveStudentData","studentsJson","getShowFingerings","setShowFingerings","getMicId","setMicId","getRecordDelay","setRecordDelay","_isNewUser","Student","songLibId","scores","parseScores","scoresJson","getScoresMapAsObject","StudentManager","loadFromStorage","students","studentsJsonString","studentJson","student","teamCode","teamName","currentStudent","saveToStorage","moveCurrentStudentToTop","_createStudentsJson","createStudent","insertAtTop","hasStudentWithName","setCurrentStudentByName","RAButton","_clickEmitter","ui","_ui","addCssClass","removeCssClass","ScoreMessageBox","_displayScore","msgBox","RAPlayerSettingsWindow","_onNoteNamesCbChange","changeShowNotesAndFingerings","_noteNamesCb","checked","renderMusic","_onCloseBtnClick","_close","_sessionResolver","_addListeners","_closeBtn","RAControls","_isFirstSongLoad","_onTempoUpBtnClick","_updateTempoDisplay","_onTempoDownBtnClick","_onSettingsBtnClick","_onSongMenuBtnClick","RAControlsEvent","RAControlsEventType","mainMenuRequest","_onPlayBtnClick","_handlePlaybackStopped","_setMode","ControlsMode","_onAppResize","_resizeTimerId","_handleAppResize","scoreLoaded","_fingeringsDiv","openSong","songDO","_updateTitle","_updateAssessmentMessage","stopped","closeSong","disabled","_hideScorePercentage","displayMessage","msgRow","innerText","hideMessage","_settingsBtn","_songMenuBtn","_playBtn","_upTempoBtn","_downTempoBtn","_playBtnImg","_displayScorePercentage","tempoDiv","playbackComplete","libId","multiplier","SongType","RAPlayerEventType","SongDO","fromLibrarySongJson","categoryId","sdo","overrideTempo","RecorderFingerings","baroqueFingerings","germanFingerings","altoUntransposedFingerings","altoUntransposedGermanFingerings","RecorderFingeringVisualizer","recorderSvg","closedHole","halfHole","openHole","doubleClosedHole","doubleHalfHole","doubleOpenHole","_fingerings","showFingering","holeSettings","setting","svgGroup","_fingerHoleSvgGroups","fingeringsDivId","_svgElement","FingeringDisplayManager","noteGroupClicked","_displayFingering","noteReached","showFingeringsIfAvailable","visualizerFactory","showingFingerings","RAPlayer","_metronomeVolume","_assessBeats","RAPlayerEvent","_songDO","_scoreManager","_needsFirstRender","_showNoteNames","_updateAssessmentSettings","_updateTempo","_updatePartPlaybackPresets","pixelsPS","_calculateClipScoreScaling","_fingeringDM","SHOW_LYRICS","_assessmentType","RecorderAssessment","_getMicrophonePermission","RhythmAssessment","_useMicForRhythmAssessment","PlayerInitializer","raControls","_raControls","raPlayer","_raPlayer","loadApplication","_createStage","_createDriver","_createPlayer","canvasDiv","pah","setPixiAppHelper","mapPath","reverbComponent","reverbUrl","impulseBuffer","SFZ","assessFactory","controlsUi","FbInit","initializeFirebase","enableFirestorePersistence","fbSettings","rawConfig","existingApp","newApp","initializeApp","projectId","storageBucket","AddStudentDialog","studentEvent","_studentEmitter","_onCodeQuestionChange","_yesRbtn","_codeInput","_onSaveBtnClick","_nameInput","_validateFields","_team","_finish","_onCancelBtnClick","_infoDiv","_saveBtn","_cancelBtn","rbuttons","_noRbtn","_setMessage","UserRole","ADMIN","MODERATOR","USER","AppUser","updateFromUserDTO","hide","CreateAccountView","_onCreateAccountBtnClick","_emailInput","_passwordInput","_confirmPasswordInput","_messageDiv","uih.show","UserManager","showLoadingOverlay","_createUserViaService","CreateAccountViewEvent","CreateAccountViewEventType","canceled","uih.hide","_createAccountBtn","activate","hideLoadingOverlay","deactivate","accountCreated","EmailConfirmationViewEvent","FinishAccountViewEvent","EmailConfirmationView","_onResendLinkClick","_sendEmailVerification","_onContinueBtnClick","confirmed","_onSignoutLinkClick","signoutRequest","_instructionsDiv","_resendLink","_continueBtn","_signoutLink","userManager","FinishAccountView","_onFinishAccountBtnClick","username","_usernameInput","_createUserOnServer","_finishAccountBtn","_displayFailMessage","accountFinished","SubRemover","removeAllSubs","ConfirmationBox","select","_selectionEemitter","_sr","_onConfirmClick","_onCancelClick","okayBtn","cancelBtn","awaitConfirmation","setWidth","widthStr","TimedMessageBox","msDuration","textAlign","uiTemplate","ManageAccountView","_onDeleteAccountLinkClick","_disableUI","confirmationBox","_enableUI","ManageAccountViewEvent","closeRequest","_welcomeDiv","_deleteAccountLink","SignInViewEvent","SignInView","_onResetLinkClick","_onSignInBtnClick","_onNewAccountBtnClick","newAccountRequest","_resetLink","_signInBtn","_newAccountBtn","initialSignInStatusRetrieved","_initialSignInStatusRetrieved","_onAuthStateChanged","_log","_getUserDataFromService","UserManagerEvent","UserManagerEventType","authStateChanged","_updateView","_onSignInViewEvent","_signInView","_createAccountView","_sendFinishedNotification","_onCreateAccountViewEvent","_onEmailConfirmationViewEvent","_onFinishAccountViewEvent","_onManageAccountViewEvent","manageSubscriptionRequest","deleteAccountRequest","_emailConfirmationView","_finishAccountView","_manageAccountView","skipManageAccountView","_skipManageAccountView","_sessionFinishedResolve","activateManageAccount","refreshUserToken","appUser","sessionFinished","SHOW_DEBUG_MESSAGES","userSignedIn","adminSignedIn","communityMembers","_communityMembers","UserAccountDialogEventType","UserAccountDialog","_onUserManagerEvent","_finishedResolver","_userManager","_createUi","_accountPanel","TeamListItem","teamDO","_isDisposed","_onUiClick","TeamLIEvent","TeamLIEventType","selectRequest","_sizeInput","valueAsNumber","deselect","_info","TeamsDialogEvent","TeamsDialog","teamCreated","_teamCreated","teamRemoved","_teamRemoved","_teams","_onP1ContinueBtnClick","_disableButtons","um","_userAccountDialog","_enableButtons","_setPage","_onTeamLIEvent","_selectedTeam","_onP2AddTeamBtnClick","_onP2DeleteTeamBtnClick","_populateTeams","_onP3CreateTeamBtnClick","_validateTeamInfo","_teamNameInput","_teamCodeInput","_teamSizeInput","_onP3CancelBtnClick","Finished","_page1","_page2","_page3","_btn1","_btn2","_btn3","_teamsListDiv","pageNumber","_enablePage1","_enablePage2","_enablePage3","teamDOs","StudentSelectionWindow","_onStudentLiClick","_studentListItems","StudentSelectionWindowEvent","STUDENT_SELECTED","_onAddStudentBtnClick","dg","_populateStudentList","_onTeachersBtnClick","_onMouseWheel","_studentList","scrollTop","_addStudentBtn","_teachersBtn","lastChild","StudentSelectionListItem","nameDiv","teamDiv","AbstractPanelItem","getUiTemplate","SongPanelItem","updateAssessmentScore","studentLoggedIn","scoreContainer","titleDiv","titleText","_LeadersSection","_toggleWeek","_lastWeekDescription","_thisWeekDescription","_leadersListDiv","_populateLeaders","SongPanel","itemsRequest","_itemsRequestEmitter","displayUpdate","_displayUpdateEmitter","panelDiv","navDiv","navQueryPrefix","_panelItems","_minItemIndex","_maxItemIndex","_currentlyDisplayedItems","_maxDisplayedItems","_onPrevLinkClick","_prevLink","_navQueryPrefix","displayFromIndex","_onNextLinkClick","_nextLink","_panelDiv","_navDiv","_currentIndex","_updateNavDisplay","resetPanel","_removePanelItemsFromDisplay","_lastIndexRequest","addPanelItems","_isAttachedToBody","scrollY","panelRect","_checkForNeededItems","scrollTo","reportItemRequestFail","getAllPanelItems","i1","removeAttribute","nextDiv","prevDiv","numVisible","rel","_getSortedPanelItemIndexes","firstDisplayed","lastDisplayed","targetIndex","_itemsPerRequestCall","_requestItems","minItemIndex","maxItemIndex","numItemsDisplayed","itemsPerRequestCall","_SongsSidebar","_categories","_onCategoryClick","_selectedCategory","_updateSelection","_dispatchRequest","dispatchSongDisplayRequest","categoriesDiv","categoriesJson","_CategoryItem","_SongSidebarEvent","CategoryRequest","_SongSection","_librarySongs","_onSidebarEvent","sdoList","ls","_displaySongs","_updateAssessmentScores","_initializeSidebar","_initializePanel","_getLibrarySongs","_sidebar","updateAssessmentScores","sidebarDiv","sectionDiv","_panel","librarySongsJson","songJson","catId","songDOList","displayIndex","msItem","MainMenu","_handleSongItemClick","panelItem","_requestSongLoad","_showStudentSelectionWindow","ssWindow","_songSection","_leadersSection","_onWindowResize","_overlay","_switchUserLink","_currentSongDO","MainMenuEvent","MainMenuEventType","loadSongRequest","currentSongDO","AppState","updateAnalyticsPage","pageTitle","page_title","page_location","RecorderAce","_onMainMenuEvent","_buildSongQuery","pushState","analytics.updateAnalyticsPage","_onPopState","_showSongMenu","_mainMenu","playerSongLoading","playerActive","_onRaControlsEvent","back","_setStartPageHistory","initializingMainMenu","initializingPlayer","initializer","updateAnalytics","songMenuLoading","songMenuActive","replaceState","Main","apiUrl","_cleanUrl","songNum","regEx"],"mappings":"yFAuCA,MAAMA,EAAW,GAKXC,EAAW,IAEXC,MAEAC,EAAY,IAoCZC,GAAkB,EAElBC,GAAe,EAIrB,SAASC,EAAaC,GACrB,OAAOC,EAAUD,EAAME,KAAI,EAAEC,EAAQC,KAAW,IAAKC,MAAMF,GAASG,KAAKF,EAAO,EAAGD,KACpF,CAEA,SAASF,EAAUD,GAClB,OAAOA,EAAMO,QAAO,CAACC,EAAGC,IAAMD,EAAEE,OAAOL,MAAMM,QAAQF,GAAKR,EAAUQ,GAAKA,IAAI,GAC9E,CAGA,MAAMG,EAAa,CAAC,EAAG,EAAG,EAAG,GAAGF,UAAUX,EAAa,CACtD,CAAC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50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,446,460,461,462,463,464,465,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,510,543,544,545,546,547,548,549,550,551,552,553]}