shop-components 0.0.26 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{stories/device-viewer/roller.d.ts → device-viewer/belt.d.ts} +1 -4
- package/dist/device-viewer/index.d.ts +3 -1
- package/dist/shop-components.mjs +62270 -0
- package/dist/shop-components.umd.js +9644 -0
- package/package.json +4 -2
- package/dist/assets/Color-RQJUDNI5-leAiB7jg.js +0 -1
- package/dist/assets/Configure-OUhXg2g0.js +0 -173
- package/dist/assets/DRACOLoader-FOpiHRUS.js +0 -2
- package/dist/assets/DocsRenderer-K4EAMTCU-wTc0yUaa.js +0 -7
- package/dist/assets/Header-Yyx952jD.css +0 -1
- package/dist/assets/Header.stories-8tnkOwSt.js +0 -31
- package/dist/assets/Page-fZ7a-HXz.css +0 -1
- package/dist/assets/Page.stories-53Crpe03.js +0 -61
- package/dist/assets/RGBELoader-re-MEsjP.js +0 -5
- package/dist/assets/SFL-CDD14-9UY62fbR.glb +0 -0
- package/dist/assets/WithTooltip-Y7J54OF7-e8Yh5ASp.js +0 -1
- package/dist/assets/_commonjsHelpers-4gQjN7DL.js +0 -1
- package/dist/assets/accessibility-Fv4dmnDm.png +0 -0
- package/dist/assets/addon-library-VlAgJsjc.png +0 -0
- package/dist/assets/bg-circle-d8WfpvaX.png +0 -0
- package/dist/assets/context-tKiKnkuP.png +0 -0
- package/dist/assets/docs-Pvr7BWzI.png +0 -0
- package/dist/assets/entry-preview-TptA_luc.js +0 -8
- package/dist/assets/entry-preview-docs-AhrJ3R4Z.js +0 -2
- package/dist/assets/figma-plugin-h9oRC4jr.png +0 -0
- package/dist/assets/formatter-B5HCVTEV-DKi3GmSv.js +0 -58
- package/dist/assets/iframe-tlQuLR4E.js +0 -7
- package/dist/assets/img-radar-kufDNNXQ.png +0 -0
- package/dist/assets/img-radar2-1cPZO_cj.png +0 -0
- package/dist/assets/index-CXFn8OGe.js +0 -513
- package/dist/assets/index-C_uo8BdM.js +0 -1
- package/dist/assets/index-PPLHz8o0.js +0 -6
- package/dist/assets/index-jFdhmKfM.js +0 -3
- package/dist/assets/index-jtEywAqJ.js +0 -1
- package/dist/assets/index-ogXoivrg.js +0 -1
- package/dist/assets/index.stories-TVZrSYZv.js +0 -20
- package/dist/assets/index.stories-Uq0Yg-kp.js +0 -896
- package/dist/assets/index.stories-VJP6Jo4U.js +0 -22
- package/dist/assets/index.stories-VoNcNCFd.js +0 -27
- package/dist/assets/index.stories-YIFSciWI.js +0 -1174
- package/dist/assets/index.stories-iMKoZNyH.js +0 -46
- package/dist/assets/lightroom_14b-MJkJLVlP.hdr +0 -0
- package/dist/assets/lightroom_14b_512-e_XJNpR6.js +0 -3981
- package/dist/assets/lightroom_14b_512-nMVn659Q.hdr +0 -0
- package/dist/assets/lit-element-P_wTzRvl.js +0 -19
- package/dist/assets/preview-1q4RDNOi.js +0 -1
- package/dist/assets/preview-6iG64ELu.js +0 -20
- package/dist/assets/preview-7nNmfNVr.js +0 -7
- package/dist/assets/preview-9bpQVOkQ.js +0 -1
- package/dist/assets/preview-FnnPJHgu.js +0 -1
- package/dist/assets/preview-VI2eoWmp.js +0 -1
- package/dist/assets/preview-bEa2SesL.js +0 -7
- package/dist/assets/preview-u8M_OEO2.js +0 -396
- package/dist/assets/preview-zZA4w0lH.js +0 -1
- package/dist/assets/property-EQZXZ3dt.js +0 -5
- package/dist/assets/query-7eORIRsG.js +0 -13
- package/dist/assets/roller-8Vy8W3X_.glb +0 -0
- package/dist/assets/roller-hopper-Heae_wy5.glb +0 -0
- package/dist/assets/share-xgPlHEHy.png +0 -0
- package/dist/assets/styling-ZOs40c1G.png +0 -0
- package/dist/assets/syntaxhighlighter-JOJW2KGS-uBo08tOF.js +0 -1
- package/dist/assets/testing-HG80fZfa.png +0 -0
- package/dist/assets/theming--liSzaFj.png +0 -0
- package/dist/assets/three.module-9MfFqitO.js +0 -3825
- package/dist/assets/tiny-invariant-VyoA2Os1.js +0 -1
- package/dist/assets/worker-h5IcTUxB.js +0 -1
- package/dist/favicon.svg +0 -7
- package/dist/iframe.html +0 -495
- package/dist/index.html +0 -155
- package/dist/index.json +0 -1
- package/dist/package.json +0 -60
- package/dist/project.json +0 -1
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js +0 -12
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js +0 -60
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -18
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/links-1/manager-bundle.js +0 -3
- package/dist/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -3
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/fonts.css +0 -31
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/WithTooltip-Y7J54OF7-3AIPQNGM.js +0 -1
- package/dist/sb-manager/chunk-I53COLQ6.js +0 -183
- package/dist/sb-manager/chunk-L35575BZ.js +0 -234
- package/dist/sb-manager/chunk-TZAR34JC.js +0 -6
- package/dist/sb-manager/chunk-UOBNU442.js +0 -347
- package/dist/sb-manager/chunk-VMGB76WP.js +0 -9
- package/dist/sb-manager/chunk-XP3HGWTR.js +0 -1
- package/dist/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +0 -58
- package/dist/sb-manager/globals-module-info.js +0 -1
- package/dist/sb-manager/globals-runtime.js +0 -1
- package/dist/sb-manager/globals.js +0 -1
- package/dist/sb-manager/index.js +0 -1
- package/dist/sb-manager/runtime.js +0 -1
- package/dist/sb-manager/syntaxhighlighter-JOJW2KGS-7BF26SBB.js +0 -1
- package/dist/sb-preview/globals.js +0 -1
- package/dist/sb-preview/runtime.js +0 -128
- package/dist/stories/cropper/index.d.ts +0 -18
- package/dist/stories/cropper/index.js +0 -118
- package/dist/stories/cropper/index.js.map +0 -1
- package/dist/stories/cropper/index.stories.d.ts +0 -11
- package/dist/stories/cropper/index.stories.js +0 -14
- package/dist/stories/cropper/index.stories.js.map +0 -1
- package/dist/stories/device-viewer/amr.d.ts +0 -75
- package/dist/stories/device-viewer/amr.js +0 -554
- package/dist/stories/device-viewer/amr.js.map +0 -1
- package/dist/stories/device-viewer/assembly.d.ts +0 -11
- package/dist/stories/device-viewer/assembly.js +0 -47
- package/dist/stories/device-viewer/assembly.js.map +0 -1
- package/dist/stories/device-viewer/asserts/fonts/type.json +0 -1281
- package/dist/stories/device-viewer/dimension/index.d.ts +0 -31
- package/dist/stories/device-viewer/dimension/index.js +0 -131
- package/dist/stories/device-viewer/dimension/index.js.map +0 -1
- package/dist/stories/device-viewer/dimension/line3.d.ts +0 -21
- package/dist/stories/device-viewer/dimension/line3.js +0 -98
- package/dist/stories/device-viewer/dimension/line3.js.map +0 -1
- package/dist/stories/device-viewer/dimension/size-box.d.ts +0 -39
- package/dist/stories/device-viewer/dimension/size-box.js +0 -176
- package/dist/stories/device-viewer/dimension/size-box.js.map +0 -1
- package/dist/stories/device-viewer/group-roller.d.ts +0 -20
- package/dist/stories/device-viewer/group-roller.js +0 -65
- package/dist/stories/device-viewer/group-roller.js.map +0 -1
- package/dist/stories/device-viewer/index.d.ts +0 -47
- package/dist/stories/device-viewer/index.js +0 -530
- package/dist/stories/device-viewer/index.js.map +0 -1
- package/dist/stories/device-viewer/index.stories.d.ts +0 -27
- package/dist/stories/device-viewer/index.stories.js +0 -37
- package/dist/stories/device-viewer/index.stories.js.map +0 -1
- package/dist/stories/device-viewer/lines.d.ts +0 -36
- package/dist/stories/device-viewer/lines.js +0 -171
- package/dist/stories/device-viewer/lines.js.map +0 -1
- package/dist/stories/device-viewer/main.d.ts +0 -1
- package/dist/stories/device-viewer/main.js +0 -2
- package/dist/stories/device-viewer/main.js.map +0 -1
- package/dist/stories/device-viewer/mechanism/mechanism.d.ts +0 -29
- package/dist/stories/device-viewer/mechanism/mechanism.js +0 -164
- package/dist/stories/device-viewer/mechanism/mechanism.js.map +0 -1
- package/dist/stories/device-viewer/outerline.d.ts +0 -16
- package/dist/stories/device-viewer/outerline.js +0 -63
- package/dist/stories/device-viewer/outerline.js.map +0 -1
- package/dist/stories/device-viewer/roller.js +0 -121
- package/dist/stories/device-viewer/roller.js.map +0 -1
- package/dist/stories/device-viewer/row.d.ts +0 -18
- package/dist/stories/device-viewer/row.js +0 -58
- package/dist/stories/device-viewer/row.js.map +0 -1
- package/dist/stories/device-viewer/scene.d.ts +0 -101
- package/dist/stories/device-viewer/scene.js +0 -535
- package/dist/stories/device-viewer/scene.js.map +0 -1
- package/dist/stories/device-viewer/slot/slot-item.d.ts +0 -20
- package/dist/stories/device-viewer/slot/slot-item.js +0 -82
- package/dist/stories/device-viewer/slot/slot-item.js.map +0 -1
- package/dist/stories/device-viewer/slot.d.ts +0 -71
- package/dist/stories/device-viewer/slot.js +0 -272
- package/dist/stories/device-viewer/slot.js.map +0 -1
- package/dist/stories/device-viewer/sound.d.ts +0 -5
- package/dist/stories/device-viewer/sound.js +0 -13
- package/dist/stories/device-viewer/sound.js.map +0 -1
- package/dist/stories/device-viewer/text2.d.ts +0 -4
- package/dist/stories/device-viewer/text2.js +0 -12
- package/dist/stories/device-viewer/text2.js.map +0 -1
- package/dist/stories/device-viewer/text3.d.ts +0 -4
- package/dist/stories/device-viewer/text3.js +0 -14
- package/dist/stories/device-viewer/text3.js.map +0 -1
- package/dist/stories/device-viewer/utils/index.d.ts +0 -36
- package/dist/stories/device-viewer/utils/index.js +0 -166
- package/dist/stories/device-viewer/utils/index.js.map +0 -1
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.d.ts +0 -8
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js +0 -88
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js.map +0 -1
- package/dist/stories/device-viewer/worker/generateAsync.worker.d.ts +0 -1
- package/dist/stories/device-viewer/worker/generateAsync.worker.js +0 -57
- package/dist/stories/device-viewer/worker/generateAsync.worker.js.map +0 -1
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.d.ts +0 -16
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js +0 -29
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js.map +0 -1
- package/dist/stories/main/index.d.ts +0 -1
- package/dist/stories/main/index.js +0 -2
- package/dist/stories/main/index.js.map +0 -1
- package/dist/stories/main.d.ts +0 -4
- package/dist/stories/main.js +0 -5
- package/dist/stories/main.js.map +0 -1
- package/dist/stories/plugin.d.ts +0 -5
- package/dist/stories/plugin.js +0 -6
- package/dist/stories/plugin.js.map +0 -1
- package/dist/stories/plugins/change-slot/index.d.ts +0 -0
- package/dist/stories/plugins/change-slot/index.js +0 -2
- package/dist/stories/plugins/change-slot/index.js.map +0 -1
- package/dist/stories/sglb/index.d.ts +0 -27
- package/dist/stories/sglb/index.js +0 -151
- package/dist/stories/sglb/index.js.map +0 -1
- package/dist/stories/smap-viewer/index.d.ts +0 -14
- package/dist/stories/smap-viewer/index.js +0 -59
- package/dist/stories/smap-viewer/index.js.map +0 -1
- package/dist/stories/smap-viewer/index.stories.d.ts +0 -22
- package/dist/stories/smap-viewer/index.stories.js +0 -27
- package/dist/stories/smap-viewer/index.stories.js.map +0 -1
- package/dist/stories/step-viewer/index.d.ts +0 -17
- package/dist/stories/step-viewer/index.js +0 -109
- package/dist/stories/step-viewer/index.js.map +0 -1
- package/dist/stories/step-viewer/index.stories.d.ts +0 -20
- package/dist/stories/step-viewer/index.stories.js +0 -24
- package/dist/stories/step-viewer/index.stories.js.map +0 -1
- package/dist/stories/test/index.d.ts +0 -25
- package/dist/stories/test/index.js +0 -99
- package/dist/stories/test/index.js.map +0 -1
- package/dist/stories/test/index.stories.d.ts +0 -14
- package/dist/stories/test/index.stories.js +0 -16
- package/dist/stories/test/index.stories.js.map +0 -1
- package/dist/stories/test/scene.d.ts +0 -20
- package/dist/stories/test/scene.js +0 -86
- package/dist/stories/test/scene.js.map +0 -1
- package/dist/stories/utils/index.d.ts +0 -4
- package/dist/stories/utils/index.js +0 -28
- package/dist/stories/utils/index.js.map +0 -1
|
@@ -1,1174 +0,0 @@
|
|
|
1
|
-
import{s as Vl,x as jl,i as Yl,r as ql}from"./lit-element-P_wTzRvl.js";import{e as Kl,t as Zl}from"./query-7eORIRsG.js";import{g as Ja,c as Ss,a as Ql}from"./_commonjsHelpers-4gQjN7DL.js";import{aB as Jl}from"./three.module-9MfFqitO.js";var je=(s=>(s[s.WEBGL_LEGACY=0]="WEBGL_LEGACY",s[s.WEBGL=1]="WEBGL",s[s.WEBGL2=2]="WEBGL2",s))(je||{}),th=(s=>(s[s.UNKNOWN=0]="UNKNOWN",s[s.WEBGL=1]="WEBGL",s[s.CANVAS=2]="CANVAS",s))(th||{}),Kr=(s=>(s[s.COLOR=16384]="COLOR",s[s.DEPTH=256]="DEPTH",s[s.STENCIL=1024]="STENCIL",s))(Kr||{}),$=(s=>(s[s.NORMAL=0]="NORMAL",s[s.ADD=1]="ADD",s[s.MULTIPLY=2]="MULTIPLY",s[s.SCREEN=3]="SCREEN",s[s.OVERLAY=4]="OVERLAY",s[s.DARKEN=5]="DARKEN",s[s.LIGHTEN=6]="LIGHTEN",s[s.COLOR_DODGE=7]="COLOR_DODGE",s[s.COLOR_BURN=8]="COLOR_BURN",s[s.HARD_LIGHT=9]="HARD_LIGHT",s[s.SOFT_LIGHT=10]="SOFT_LIGHT",s[s.DIFFERENCE=11]="DIFFERENCE",s[s.EXCLUSION=12]="EXCLUSION",s[s.HUE=13]="HUE",s[s.SATURATION=14]="SATURATION",s[s.COLOR=15]="COLOR",s[s.LUMINOSITY=16]="LUMINOSITY",s[s.NORMAL_NPM=17]="NORMAL_NPM",s[s.ADD_NPM=18]="ADD_NPM",s[s.SCREEN_NPM=19]="SCREEN_NPM",s[s.NONE=20]="NONE",s[s.SRC_OVER=0]="SRC_OVER",s[s.SRC_IN=21]="SRC_IN",s[s.SRC_OUT=22]="SRC_OUT",s[s.SRC_ATOP=23]="SRC_ATOP",s[s.DST_OVER=24]="DST_OVER",s[s.DST_IN=25]="DST_IN",s[s.DST_OUT=26]="DST_OUT",s[s.DST_ATOP=27]="DST_ATOP",s[s.ERASE=26]="ERASE",s[s.SUBTRACT=28]="SUBTRACT",s[s.XOR=29]="XOR",s))($||{}),te=(s=>(s[s.POINTS=0]="POINTS",s[s.LINES=1]="LINES",s[s.LINE_LOOP=2]="LINE_LOOP",s[s.LINE_STRIP=3]="LINE_STRIP",s[s.TRIANGLES=4]="TRIANGLES",s[s.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",s[s.TRIANGLE_FAN=6]="TRIANGLE_FAN",s))(te||{}),S=(s=>(s[s.RGBA=6408]="RGBA",s[s.RGB=6407]="RGB",s[s.RG=33319]="RG",s[s.RED=6403]="RED",s[s.RGBA_INTEGER=36249]="RGBA_INTEGER",s[s.RGB_INTEGER=36248]="RGB_INTEGER",s[s.RG_INTEGER=33320]="RG_INTEGER",s[s.RED_INTEGER=36244]="RED_INTEGER",s[s.ALPHA=6406]="ALPHA",s[s.LUMINANCE=6409]="LUMINANCE",s[s.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",s[s.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",s[s.DEPTH_STENCIL=34041]="DEPTH_STENCIL",s))(S||{}),ui=(s=>(s[s.TEXTURE_2D=3553]="TEXTURE_2D",s[s.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",s[s.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",s[s.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",s[s.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",s[s.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",s[s.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",s))(ui||{}),G=(s=>(s[s.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",s[s.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",s[s.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",s[s.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",s[s.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",s[s.UNSIGNED_INT=5125]="UNSIGNED_INT",s[s.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",s[s.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",s[s.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",s[s.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",s[s.BYTE=5120]="BYTE",s[s.SHORT=5122]="SHORT",s[s.INT=5124]="INT",s[s.FLOAT=5126]="FLOAT",s[s.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",s[s.HALF_FLOAT=36193]="HALF_FLOAT",s))(G||{}),F=(s=>(s[s.FLOAT=0]="FLOAT",s[s.INT=1]="INT",s[s.UINT=2]="UINT",s))(F||{}),he=(s=>(s[s.NEAREST=0]="NEAREST",s[s.LINEAR=1]="LINEAR",s))(he||{}),Te=(s=>(s[s.CLAMP=33071]="CLAMP",s[s.REPEAT=10497]="REPEAT",s[s.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",s))(Te||{}),se=(s=>(s[s.OFF=0]="OFF",s[s.POW2=1]="POW2",s[s.ON=2]="ON",s[s.ON_MANUAL=3]="ON_MANUAL",s))(se||{}),Ct=(s=>(s[s.NPM=0]="NPM",s[s.UNPACK=1]="UNPACK",s[s.PMA=2]="PMA",s[s.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",s[s.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",s[s.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",s))(Ct||{}),Qt=(s=>(s[s.NO=0]="NO",s[s.YES=1]="YES",s[s.AUTO=2]="AUTO",s[s.BLEND=0]="BLEND",s[s.CLEAR=1]="CLEAR",s[s.BLIT=2]="BLIT",s))(Qt||{}),Yn=(s=>(s[s.AUTO=0]="AUTO",s[s.MANUAL=1]="MANUAL",s))(Yn||{}),Bt=(s=>(s.LOW="lowp",s.MEDIUM="mediump",s.HIGH="highp",s))(Bt||{}),pt=(s=>(s[s.NONE=0]="NONE",s[s.SCISSOR=1]="SCISSOR",s[s.STENCIL=2]="STENCIL",s[s.SPRITE=3]="SPRITE",s[s.COLOR=4]="COLOR",s))(pt||{}),ut=(s=>(s[s.NONE=0]="NONE",s[s.LOW=2]="LOW",s[s.MEDIUM=4]="MEDIUM",s[s.HIGH=8]="HIGH",s))(ut||{}),ee=(s=>(s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",s))(ee||{});const tc={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")},O={ADAPTER:tc,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var pr=/iPhone/i,uo=/iPod/i,po=/iPad/i,fo=/\biOS-universal(?:.+)Mac\b/i,fr=/\bAndroid(?:.+)Mobile\b/i,mo=/Android/i,Ze=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ts=/Silk/i,ne=/Windows Phone/i,go=/\bWindows(?:.+)ARM\b/i,yo=/BlackBerry/i,_o=/BB10/i,vo=/Opera Mini/i,xo=/\b(CriOS|Chrome)(?:.+)Mobile/i,bo=/Mobile(?:.+)Firefox\b/i,wo=function(s){return typeof s<"u"&&s.platform==="MacIntel"&&typeof s.maxTouchPoints=="number"&&s.maxTouchPoints>1&&typeof MSStream>"u"};function ec(s){return function(t){return t.test(s)}}function Ao(s){var t={userAgent:"",platform:"",maxTouchPoints:0};!s&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof s=="string"?t.userAgent=s:s&&s.userAgent&&(t={userAgent:s.userAgent,platform:s.platform,maxTouchPoints:s.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var r=ec(e),n={apple:{phone:r(pr)&&!r(ne),ipod:r(uo),tablet:!r(pr)&&(r(po)||wo(t))&&!r(ne),universal:r(fo),device:(r(pr)||r(uo)||r(po)||r(fo)||wo(t))&&!r(ne)},amazon:{phone:r(Ze),tablet:!r(Ze)&&r(ts),device:r(Ze)||r(ts)},android:{phone:!r(ne)&&r(Ze)||!r(ne)&&r(fr),tablet:!r(ne)&&!r(Ze)&&!r(fr)&&(r(ts)||r(mo)),device:!r(ne)&&(r(Ze)||r(ts)||r(fr)||r(mo))||r(/\bokhttp\b/i)},windows:{phone:r(ne),tablet:r(go),device:r(ne)||r(go)},other:{blackberry:r(yo),blackberry10:r(_o),opera:r(vo),firefox:r(bo),chrome:r(xo),device:r(yo)||r(_o)||r(vo)||r(bo)||r(xo)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const ic=Ao.default??Ao,le=ic(globalThis.navigator);O.RETINA_PREFIX=/@([0-9\.]+)x/;O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var eh={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var p=new r(c,u||h,d),f=e?e+l:l;return h._events[f]?h._events[f].fn?h._events[f]=[h._events[f],p]:h._events[f].push(p):(h._events[f]=p,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,p=u.length,f=new Array(p);d<p;d++)f[d]=u[d].fn;return f},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,d,p,f){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],_=arguments.length,x,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),_){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,u),!0;case 4:return g.fn.call(g.context,c,u,d),!0;case 5:return g.fn.call(g.context,c,u,d,p),!0;case 6:return g.fn.call(g.context,c,u,d,p,f),!0}for(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];g.fn.apply(g.context,x)}else{var v=g.length,A;for(y=0;y<v;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),_){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,c);break;case 3:g[y].fn.call(g[y].context,c,u);break;case 4:g[y].fn.call(g[y].context,c,u,d);break;default:if(!x)for(A=1,x=new Array(_-1);A<_;A++)x[A-1]=arguments[A];g[y].fn.apply(g[y].context,x)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,d){var p=e?e+l:l;if(!this._events[p])return this;if(!c)return o(this,p),this;var f=this._events[p];if(f.fn)f.fn===c&&(!d||f.once)&&(!u||f.context===u)&&o(this,p);else{for(var m=0,g=[],_=f.length;m<_;m++)(f[m].fn!==c||d&&!f[m].once||u&&f[m].context!==u)&&g.push(f[m]);g.length?this._events[p]=g.length===1?g[0]:g:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,s.exports=a})(eh);var sc=eh.exports;const qi=Ja(sc);var qn={exports:{}};qn.exports=ir;qn.exports.default=ir;function ir(s,t,e){e=e||2;var i=t&&t.length,r=i?t[0]*e:s.length,n=ih(s,0,r,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,c,u,d,p;if(i&&(n=hc(s,t,n,e)),s.length>80*e){a=l=s[0],h=c=s[1];for(var f=e;f<r;f+=e)u=s[f],d=s[f+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);p=Math.max(l-a,c-h),p=p!==0?32767/p:0}return $i(n,o,e,a,h,p,0),o}function ih(s,t,e,i,r){var n,o;if(r===Jr(s,t,e,i)>0)for(n=t;n<e;n+=i)o=Eo(n,s[n],s[n+1],o);else for(n=e-i;n>=t;n-=i)o=Eo(n,s[n],s[n+1],o);return o&&sr(o,o.next)&&(Vi(o),o=o.next),o}function $e(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(sr(e,e.next)||nt(e.prev,e,e.next)===0)){if(Vi(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function $i(s,t,e,i,r,n,o){if(s){!o&&n&&pc(s,i,r,n);for(var a=s,h,l;s.prev!==s.next;){if(h=s.prev,l=s.next,n?nc(s,i,r,n):rc(s)){t.push(h.i/e|0),t.push(s.i/e|0),t.push(l.i/e|0),Vi(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=oc($e(s),t,e),$i(s,t,e,i,r,n,2)):o===2&&ac(s,t,e,i,r,n):$i($e(s),t,e,i,r,n,1);break}}}}function rc(s){var t=s.prev,e=s,i=s.next;if(nt(t,e,i)>=0)return!1;for(var r=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,c=r<n?r<o?r:o:n<o?n:o,u=a<h?a<l?a:l:h<l?h:l,d=r>n?r>o?r:o:n>o?n:o,p=a>h?a>l?a:l:h>l?h:l,f=i.next;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=p&&li(r,a,n,h,o,l,f.x,f.y)&&nt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function nc(s,t,e,i){var r=s.prev,n=s,o=s.next;if(nt(r,n,o)>=0)return!1;for(var a=r.x,h=n.x,l=o.x,c=r.y,u=n.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,f=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,_=Zr(p,f,t,e,i),x=Zr(m,g,t,e,i),y=s.prevZ,v=s.nextZ;y&&y.z>=_&&v&&v.z<=x;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==o&&li(a,c,h,u,l,d,y.x,y.y)&&nt(y.prev,y,y.next)>=0||(y=y.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==r&&v!==o&&li(a,c,h,u,l,d,v.x,v.y)&&nt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==o&&li(a,c,h,u,l,d,y.x,y.y)&&nt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=x;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==r&&v!==o&&li(a,c,h,u,l,d,v.x,v.y)&&nt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function oc(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!sr(r,n)&&sh(r,i,i.next,n)&&zi(r,n)&&zi(n,r)&&(t.push(r.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Vi(i),Vi(i.next),i=s=n),i=i.next}while(i!==s);return $e(i)}function ac(s,t,e,i,r,n){var o=s;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&gc(o,a)){var h=rh(o,a);o=$e(o,o.next),h=$e(h,h.next),$i(o,t,e,i,r,n,0),$i(h,t,e,i,r,n,0);return}a=a.next}o=o.next}while(o!==s)}function hc(s,t,e,i){var r=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:s.length,l=ih(s,a,h,i,!1),l===l.next&&(l.steiner=!0),r.push(mc(l));for(r.sort(lc),n=0;n<r.length;n++)e=cc(r[n],e);return e}function lc(s,t){return s.x-t.x}function cc(s,t){var e=uc(s,t);if(!e)return t;var i=rh(e,s);return $e(i,i.next),$e(e,e.next)}function uc(s,t){var e=t,i=s.x,r=s.y,n=-1/0,o;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){var a=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,c=o.y,u=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&li(r<c?i:n,r,l,c,r<c?n:i,r,e.x,e.y)&&(d=Math.abs(r-e.y)/(i-e.x),zi(e,s)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&dc(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function dc(s,t){return nt(s.prev,s,t.prev)<0&&nt(t.next,s,s.next)<0}function pc(s,t,e,i){var r=s;do r.z===0&&(r.z=Zr(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,fc(r)}function fc(s){var t,e,i,r,n,o,a,h,l=1;do{for(e=s,s=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(r=e,e=e.nextZ,a--):(r=i,i=i.nextZ,h--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;e=i}n.nextZ=null,l*=2}while(o>1);return s}function Zr(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function mc(s){var t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function li(s,t,e,i,r,n,o,a){return(r-o)*(t-a)>=(s-o)*(n-a)&&(s-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(i-a)}function gc(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!yc(s,t)&&(zi(s,t)&&zi(t,s)&&_c(s,t)&&(nt(s.prev,s,t.prev)||nt(s,t.prev,t))||sr(s,t)&&nt(s.prev,s,s.next)>0&&nt(t.prev,t,t.next)>0)}function nt(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function sr(s,t){return s.x===t.x&&s.y===t.y}function sh(s,t,e,i){var r=is(nt(s,t,e)),n=is(nt(s,t,i)),o=is(nt(e,i,s)),a=is(nt(e,i,t));return!!(r!==n&&o!==a||r===0&&es(s,e,t)||n===0&&es(s,i,t)||o===0&&es(e,s,i)||a===0&&es(e,t,i))}function es(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function is(s){return s>0?1:s<0?-1:0}function yc(s,t){var e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&sh(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function zi(s,t){return nt(s.prev,s,s.next)<0?nt(s,t,s.next)>=0&&nt(s,s.prev,t)>=0:nt(s,t,s.prev)<0||nt(s,s.next,t)<0}function _c(s,t){var e=s,i=!1,r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function rh(s,t){var e=new Qr(s.i,s.x,s.y),i=new Qr(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Eo(s,t,e,i){var r=new Qr(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Vi(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Qr(s,t,e){this.i=s,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ir.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,o=Math.abs(Jr(s,0,n,e));if(r)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:s.length;o-=Math.abs(Jr(s,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,p=i[a+1]*e,f=i[a+2]*e;u+=Math.abs((s[d]-s[f])*(s[p+1]-s[d+1])-(s[d]-s[p])*(s[f+1]-s[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Jr(s,t,e,i){for(var r=0,n=t,o=e-i;n<e;n+=i)r+=(s[o]-s[n])*(s[n+1]+s[o+1]),o=n;return r}ir.flatten=function(s){for(var t=s[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,r=0;r<s.length;r++){for(var n=0;n<s[r].length;n++)for(var o=0;o<t;o++)e.vertices.push(s[r][n][o]);r>0&&(i+=s[r-1].length,e.holes.push(i))}return e};var vc=qn.exports;const xc=Ja(vc);var Ns={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ns.exports;(function(s,t){(function(e){var i=t&&!t.nodeType&&t,r=s&&!s.nodeType&&s,n=typeof Ss=="object"&&Ss;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,c=26,u=38,d=700,p=72,f=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,A=Math.floor,B=String.fromCharCode,T;function E(P){throw new RangeError(y[P])}function D(P,I){for(var Q=P.length,J=[];Q--;)J[Q]=I(P[Q]);return J}function k(P,I){var Q=P.split("@"),J="";Q.length>1&&(J=Q[0]+"@",P=Q[1]),P=P.replace(x,".");var tt=P.split("."),mt=D(tt,I).join(".");return J+mt}function q(P){for(var I=[],Q=0,J=P.length,tt,mt;Q<J;)tt=P.charCodeAt(Q++),tt>=55296&&tt<=56319&&Q<J?(mt=P.charCodeAt(Q++),(mt&64512)==56320?I.push(((tt&1023)<<10)+(mt&1023)+65536):(I.push(tt),Q--)):I.push(tt);return I}function M(P){return D(P,function(I){var Q="";return I>65535&&(I-=65536,Q+=B(I>>>10&1023|55296),I=56320|I&1023),Q+=B(I),Q}).join("")}function b(P){return P-48<10?P-22:P-65<26?P-65:P-97<26?P-97:h}function C(P,I){return P+22+75*(P<26)-((I!=0)<<5)}function H(P,I,Q){var J=0;for(P=Q?A(P/d):P>>1,P+=A(P/I);P>v*c>>1;J+=h)P=A(P/v);return A(J+(v+1)*P/(P+u))}function V(P){var I=[],Q=P.length,J,tt=0,mt=f,lt=p,gt,At,Pt,xt,st,ct,dt,$t,zt;for(gt=P.lastIndexOf(m),gt<0&&(gt=0),At=0;At<gt;++At)P.charCodeAt(At)>=128&&E("not-basic"),I.push(P.charCodeAt(At));for(Pt=gt>0?gt+1:0;Pt<Q;){for(xt=tt,st=1,ct=h;Pt>=Q&&E("invalid-input"),dt=b(P.charCodeAt(Pt++)),(dt>=h||dt>A((a-tt)/st))&&E("overflow"),tt+=dt*st,$t=ct<=lt?l:ct>=lt+c?c:ct-lt,!(dt<$t);ct+=h)zt=h-$t,st>A(a/zt)&&E("overflow"),st*=zt;J=I.length+1,lt=H(tt-xt,J,xt==0),A(tt/J)>a-mt&&E("overflow"),mt+=A(tt/J),tt%=J,I.splice(tt++,0,mt)}return M(I)}function W(P){var I,Q,J,tt,mt,lt,gt,At,Pt,xt,st,ct=[],dt,$t,zt,Ti;for(P=q(P),dt=P.length,I=f,Q=0,mt=p,lt=0;lt<dt;++lt)st=P[lt],st<128&&ct.push(B(st));for(J=tt=ct.length,tt&&ct.push(m);J<dt;){for(gt=a,lt=0;lt<dt;++lt)st=P[lt],st>=I&&st<gt&&(gt=st);for($t=J+1,gt-I>A((a-Q)/$t)&&E("overflow"),Q+=(gt-I)*$t,I=gt,lt=0;lt<dt;++lt)if(st=P[lt],st<I&&++Q>a&&E("overflow"),st==I){for(At=Q,Pt=h;xt=Pt<=mt?l:Pt>=mt+c?c:Pt-mt,!(At<xt);Pt+=h)Ti=At-xt,zt=h-xt,ct.push(B(C(xt+Ti%zt,0))),At=A(Ti/zt);ct.push(B(C(At,0))),mt=H(Q,$t,J==tt),Q=0,++J}++Q,++I}return ct.join("")}function Y(P){return k(P,function(I){return g.test(I)?V(I.slice(4).toLowerCase()):I})}function at(P){return k(P,function(I){return _.test(I)?"xn--"+W(I):I})}if(o={version:"1.4.1",ucs2:{decode:q,encode:M},decode:V,encode:W,toASCII:at,toUnicode:Y},i&&r)if(s.exports==i)r.exports=o;else for(T in o)o.hasOwnProperty(T)&&(i[T]=o[T]);else e.punycode=o})(Ss)})(Ns,Ns.exports);var bc=Ns.exports,wc=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var r=42;t[e]=r;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==r||o.enumerable!==!0)return!1}return!0},To=typeof Symbol<"u"&&Symbol,Ac=wc,Ec=function(){return typeof To!="function"||typeof Symbol!="function"||typeof To("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ac()},So={foo:{}},Tc=Object,Sc=function(){return{__proto__:So}.foo===So.foo&&!({__proto__:null}instanceof Tc)},Cc="Function.prototype.bind called on incompatible ",Ic=Object.prototype.toString,Pc=Math.max,Rc="[object Function]",Co=function(t,e){for(var i=[],r=0;r<t.length;r+=1)i[r]=t[r];for(var n=0;n<e.length;n+=1)i[n+t.length]=e[n];return i},Mc=function(t,e){for(var i=[],r=e||0,n=0;r<t.length;r+=1,n+=1)i[n]=t[r];return i},Bc=function(s,t){for(var e="",i=0;i<s.length;i+=1)e+=s[i],i+1<s.length&&(e+=t);return e},Dc=function(t){var e=this;if(typeof e!="function"||Ic.apply(e)!==Rc)throw new TypeError(Cc+e);for(var i=Mc(arguments,1),r,n=function(){if(this instanceof r){var c=e.apply(this,Co(i,arguments));return Object(c)===c?c:this}return e.apply(t,Co(i,arguments))},o=Pc(0,e.length-i.length),a=[],h=0;h<o;h++)a[h]="$"+h;if(r=Function("binder","return function ("+Bc(a,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,r.prototype=new l,l.prototype=null}return r},Fc=Dc,Kn=Function.prototype.bind||Fc,Oc=Function.prototype.call,Lc=Object.prototype.hasOwnProperty,Nc=Kn,Uc=Nc.call(Oc,Lc),Z,vi=SyntaxError,nh=Function,di=TypeError,mr=function(s){try{return nh('"use strict"; return ('+s+").constructor;")()}catch{}},Ge=Object.getOwnPropertyDescriptor;if(Ge)try{Ge({},"")}catch{Ge=null}var gr=function(){throw new di},kc=Ge?function(){try{return arguments.callee,gr}catch{try{return Ge(arguments,"callee").get}catch{return gr}}}():gr,Qe=Ec(),Gc=Sc(),_t=Object.getPrototypeOf||(Gc?function(s){return s.__proto__}:null),ii={},Hc=typeof Uint8Array>"u"||!_t?Z:_t(Uint8Array),He={"%AggregateError%":typeof AggregateError>"u"?Z:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Z:ArrayBuffer,"%ArrayIteratorPrototype%":Qe&&_t?_t([][Symbol.iterator]()):Z,"%AsyncFromSyncIteratorPrototype%":Z,"%AsyncFunction%":ii,"%AsyncGenerator%":ii,"%AsyncGeneratorFunction%":ii,"%AsyncIteratorPrototype%":ii,"%Atomics%":typeof Atomics>"u"?Z:Atomics,"%BigInt%":typeof BigInt>"u"?Z:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Z:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Z:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Z:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Z:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Z:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Z:FinalizationRegistry,"%Function%":nh,"%GeneratorFunction%":ii,"%Int8Array%":typeof Int8Array>"u"?Z:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Z:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Z:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qe&&_t?_t(_t([][Symbol.iterator]())):Z,"%JSON%":typeof JSON=="object"?JSON:Z,"%Map%":typeof Map>"u"?Z:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qe||!_t?Z:_t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Z:Promise,"%Proxy%":typeof Proxy>"u"?Z:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Z:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Z:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qe||!_t?Z:_t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Z:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qe&&_t?_t(""[Symbol.iterator]()):Z,"%Symbol%":Qe?Symbol:Z,"%SyntaxError%":vi,"%ThrowTypeError%":kc,"%TypedArray%":Hc,"%TypeError%":di,"%Uint8Array%":typeof Uint8Array>"u"?Z:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Z:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Z:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Z:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Z:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Z:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Z:WeakSet};if(_t)try{null.error}catch(s){var Wc=_t(_t(s));He["%Error.prototype%"]=Wc}var Xc=function s(t){var e;if(t==="%AsyncFunction%")e=mr("async function () {}");else if(t==="%GeneratorFunction%")e=mr("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=mr("async function* () {}");else if(t==="%AsyncGenerator%"){var i=s("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=s("%AsyncGenerator%");r&&_t&&(e=_t(r.prototype))}return He[t]=e,e},Io={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ki=Kn,Us=Uc,$c=Ki.call(Function.call,Array.prototype.concat),zc=Ki.call(Function.apply,Array.prototype.splice),Po=Ki.call(Function.call,String.prototype.replace),ks=Ki.call(Function.call,String.prototype.slice),Vc=Ki.call(Function.call,RegExp.prototype.exec),jc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Yc=/\\(\\)?/g,qc=function(t){var e=ks(t,0,1),i=ks(t,-1);if(e==="%"&&i!=="%")throw new vi("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new vi("invalid intrinsic syntax, expected opening `%`");var r=[];return Po(t,jc,function(n,o,a,h){r[r.length]=a?Po(h,Yc,"$1"):o||n}),r},Kc=function(t,e){var i=t,r;if(Us(Io,i)&&(r=Io[i],i="%"+r[0]+"%"),Us(He,i)){var n=He[i];if(n===ii&&(n=Xc(i)),typeof n>"u"&&!e)throw new di("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new vi("intrinsic "+t+" does not exist!")},Ye=function(t,e){if(typeof t!="string"||t.length===0)throw new di("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new di('"allowMissing" argument must be a boolean');if(Vc(/^%?[^%]*%?$/,t)===null)throw new vi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=qc(t),r=i.length>0?i[0]:"",n=Kc("%"+r+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(r=l[0],zc(i,$c([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],p=ks(d,0,1),f=ks(d,-1);if((p==='"'||p==="'"||p==="`"||f==='"'||f==="'"||f==="`")&&p!==f)throw new vi("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),r+="."+d,o="%"+r+"%",Us(He,o))a=He[o];else if(a!=null){if(!(d in a)){if(!e)throw new di("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ge&&c+1>=i.length){var m=Ge(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=Us(a,d),a=a[d];u&&!h&&(He[o]=a)}}return a},oh={exports:{}},Zc=Ye,tn=Zc("%Object.defineProperty%",!0),en=function(){if(tn)try{return tn({},"a",{value:1}),!0}catch{return!1}return!1};en.hasArrayLengthDefineBug=function(){if(!en())return null;try{return tn([],"length",{value:1}).length!==1}catch{return!0}};var ah=en,Qc=Ye,Cs=Qc("%Object.getOwnPropertyDescriptor%",!0);if(Cs)try{Cs([],"length")}catch{Cs=null}var hh=Cs,Jc=ah(),Zn=Ye,ki=Jc&&Zn("%Object.defineProperty%",!0);if(ki)try{ki({},"a",{value:1})}catch{ki=!1}var tu=Zn("%SyntaxError%"),Je=Zn("%TypeError%"),Ro=hh,eu=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Je("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Je("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Je("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Je("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Je("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Je("`loose`, if provided, must be a boolean");var r=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,h=!!Ro&&Ro(t,e);if(ki)ki(t,e,{configurable:o===null&&h?h.configurable:!o,enumerable:r===null&&h?h.enumerable:!r,value:i,writable:n===null&&h?h.writable:!n});else if(a||!r&&!n&&!o)t[e]=i;else throw new tu("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},lh=Ye,Mo=eu,iu=ah(),Bo=hh,Do=lh("%TypeError%"),su=lh("%Math.floor%"),ru=function(t,e){if(typeof t!="function")throw new Do("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||su(e)!==e)throw new Do("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],r=!0,n=!0;if("length"in t&&Bo){var o=Bo(t,"length");o&&!o.configurable&&(r=!1),o&&!o.writable&&(n=!1)}return(r||n||!i)&&(iu?Mo(t,"length",e,!0,!0):Mo(t,"length",e)),t};(function(s){var t=Kn,e=Ye,i=ru,r=e("%TypeError%"),n=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,n),h=e("%Object.defineProperty%",!0),l=e("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}s.exports=function(d){if(typeof d!="function")throw new r("a function is required");var p=a(t,o,arguments);return i(p,1+l(0,d.length-(arguments.length-1)),!0)};var c=function(){return a(t,n,arguments)};h?h(s.exports,"apply",{value:c}):s.exports.apply=c})(oh);var nu=oh.exports,ch=Ye,uh=nu,ou=uh(ch("String.prototype.indexOf")),au=function(t,e){var i=ch(t,!!e);return typeof i=="function"&&ou(t,".prototype.")>-1?uh(i):i};const hu={},lu=Object.freeze(Object.defineProperty({__proto__:null,default:hu},Symbol.toStringTag,{value:"Module"})),cu=Ql(lu);var Qn=typeof Map=="function"&&Map.prototype,yr=Object.getOwnPropertyDescriptor&&Qn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gs=Qn&&yr&&typeof yr.get=="function"?yr.get:null,Fo=Qn&&Map.prototype.forEach,Jn=typeof Set=="function"&&Set.prototype,_r=Object.getOwnPropertyDescriptor&&Jn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Hs=Jn&&_r&&typeof _r.get=="function"?_r.get:null,Oo=Jn&&Set.prototype.forEach,uu=typeof WeakMap=="function"&&WeakMap.prototype,Gi=uu?WeakMap.prototype.has:null,du=typeof WeakSet=="function"&&WeakSet.prototype,Hi=du?WeakSet.prototype.has:null,pu=typeof WeakRef=="function"&&WeakRef.prototype,Lo=pu?WeakRef.prototype.deref:null,fu=Boolean.prototype.valueOf,mu=Object.prototype.toString,gu=Function.prototype.toString,yu=String.prototype.match,to=String.prototype.slice,we=String.prototype.replace,_u=String.prototype.toUpperCase,No=String.prototype.toLowerCase,dh=RegExp.prototype.test,Uo=Array.prototype.concat,Jt=Array.prototype.join,vu=Array.prototype.slice,ko=Math.floor,sn=typeof BigInt=="function"?BigInt.prototype.valueOf:null,vr=Object.getOwnPropertySymbols,rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Tt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xi||!0)?Symbol.toStringTag:null,ph=Object.prototype.propertyIsEnumerable,Go=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function Ho(s,t){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||dh.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var i=s<0?-ko(-s):ko(s);if(i!==s){var r=String(i),n=to.call(t,r.length+1);return we.call(r,e,"$&_")+"."+we.call(we.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return we.call(t,e,"$&_")}var nn=cu,Wo=nn.custom,Xo=mh(Wo)?Wo:null,xu=function s(t,e,i,r){var n=e||{};if(ve(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ve(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=ve(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ve(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ve(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return yh(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?Ho(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?Ho(t,l):l}var c=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return on(t)?"[Array]":"[Object]";var u=Uu(n,i);if(typeof r>"u")r=[];else if(gh(r,t)>=0)return"[Circular]";function d(b,C,H){if(C&&(r=vu.call(r),r.push(C)),H){var V={depth:n.depth};return ve(n,"quoteStyle")&&(V.quoteStyle=n.quoteStyle),s(b,V,i+1,r)}return s(b,n,i+1,r)}if(typeof t=="function"&&!$o(t)){var p=Pu(t),f=ss(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(f.length>0?" { "+Jt.call(f,", ")+" }":"")}if(mh(t)){var m=xi?we.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):rn.call(t);return typeof t=="object"&&!xi?Si(m):m}if(Ou(t)){for(var g="<"+No.call(String(t.nodeName)),_=t.attributes||[],x=0;x<_.length;x++)g+=" "+_[x].name+"="+fh(bu(_[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+No.call(String(t.nodeName))+">",g}if(on(t)){if(t.length===0)return"[]";var y=ss(t,d);return u&&!Nu(y)?"["+an(y,u)+"]":"[ "+Jt.call(y,", ")+" ]"}if(Au(t)){var v=ss(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!ph.call(t,"cause")?"{ ["+String(t)+"] "+Jt.call(Uo.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Jt.call(v,", ")+" }"}if(typeof t=="object"&&o){if(Xo&&typeof t[Xo]=="function"&&nn)return nn(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Ru(t)){var A=[];return Fo&&Fo.call(t,function(b,C){A.push(d(C,t,!0)+" => "+d(b,t))}),zo("Map",Gs.call(t),A,u)}if(Du(t)){var B=[];return Oo&&Oo.call(t,function(b){B.push(d(b,t))}),zo("Set",Hs.call(t),B,u)}if(Mu(t))return xr("WeakMap");if(Fu(t))return xr("WeakSet");if(Bu(t))return xr("WeakRef");if(Tu(t))return Si(d(Number(t)));if(Cu(t))return Si(d(sn.call(t)));if(Su(t))return Si(fu.call(t));if(Eu(t))return Si(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Ss)return"{ [object globalThis] }";if(!wu(t)&&!$o(t)){var T=ss(t,d),E=Go?Go(t)===Object.prototype:t instanceof Object||t.constructor===Object,D=t instanceof Object?"":"null prototype",k=!E&&Tt&&Object(t)===t&&Tt in t?to.call(Ie(t),8,-1):D?"Object":"",q=E||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=q+(k||D?"["+Jt.call(Uo.call([],k||[],D||[]),": ")+"] ":"");return T.length===0?M+"{}":u?M+"{"+an(T,u)+"}":M+"{ "+Jt.call(T,", ")+" }"}return String(t)};function fh(s,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+s+i}function bu(s){return we.call(String(s),/"/g,""")}function on(s){return Ie(s)==="[object Array]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function wu(s){return Ie(s)==="[object Date]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function $o(s){return Ie(s)==="[object RegExp]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function Au(s){return Ie(s)==="[object Error]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function Eu(s){return Ie(s)==="[object String]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function Tu(s){return Ie(s)==="[object Number]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function Su(s){return Ie(s)==="[object Boolean]"&&(!Tt||!(typeof s=="object"&&Tt in s))}function mh(s){if(xi)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!rn)return!1;try{return rn.call(s),!0}catch{}return!1}function Cu(s){if(!s||typeof s!="object"||!sn)return!1;try{return sn.call(s),!0}catch{}return!1}var Iu=Object.prototype.hasOwnProperty||function(s){return s in this};function ve(s,t){return Iu.call(s,t)}function Ie(s){return mu.call(s)}function Pu(s){if(s.name)return s.name;var t=yu.call(gu.call(s),/^function\s*([\w$]+)/);return t?t[1]:null}function gh(s,t){if(s.indexOf)return s.indexOf(t);for(var e=0,i=s.length;e<i;e++)if(s[e]===t)return e;return-1}function Ru(s){if(!Gs||!s||typeof s!="object")return!1;try{Gs.call(s);try{Hs.call(s)}catch{return!0}return s instanceof Map}catch{}return!1}function Mu(s){if(!Gi||!s||typeof s!="object")return!1;try{Gi.call(s,Gi);try{Hi.call(s,Hi)}catch{return!0}return s instanceof WeakMap}catch{}return!1}function Bu(s){if(!Lo||!s||typeof s!="object")return!1;try{return Lo.call(s),!0}catch{}return!1}function Du(s){if(!Hs||!s||typeof s!="object")return!1;try{Hs.call(s);try{Gs.call(s)}catch{return!0}return s instanceof Set}catch{}return!1}function Fu(s){if(!Hi||!s||typeof s!="object")return!1;try{Hi.call(s,Hi);try{Gi.call(s,Gi)}catch{return!0}return s instanceof WeakSet}catch{}return!1}function Ou(s){return!s||typeof s!="object"?!1:typeof HTMLElement<"u"&&s instanceof HTMLElement?!0:typeof s.nodeName=="string"&&typeof s.getAttribute=="function"}function yh(s,t){if(s.length>t.maxStringLength){var e=s.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return yh(to.call(s,0,t.maxStringLength),t)+i}var r=we.call(we.call(s,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Lu);return fh(r,"single",t)}function Lu(s){var t=s.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+_u.call(t.toString(16))}function Si(s){return"Object("+s+")"}function xr(s){return s+" { ? }"}function zo(s,t,e,i){var r=i?an(e,i):Jt.call(e,", ");return s+" ("+t+") {"+r+"}"}function Nu(s){for(var t=0;t<s.length;t++)if(gh(s[t],`
|
|
2
|
-
`)>=0)return!1;return!0}function Uu(s,t){var e;if(s.indent===" ")e=" ";else if(typeof s.indent=="number"&&s.indent>0)e=Jt.call(Array(s.indent+1)," ");else return null;return{base:e,prev:Jt.call(Array(t+1),e)}}function an(s,t){if(s.length===0)return"";var e=`
|
|
3
|
-
`+t.prev+t.base;return e+Jt.call(s,","+e)+`
|
|
4
|
-
`+t.prev}function ss(s,t){var e=on(s),i=[];if(e){i.length=s.length;for(var r=0;r<s.length;r++)i[r]=ve(s,r)?t(s[r],s):""}var n=typeof vr=="function"?vr(s):[],o;if(xi){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in s)ve(s,h)&&(e&&String(Number(h))===h&&h<s.length||xi&&o["$"+h]instanceof Symbol||(dh.call(/[^\w$]/,h)?i.push(t(h,s)+": "+t(s[h],s)):i.push(h+": "+t(s[h],s))));if(typeof vr=="function")for(var l=0;l<n.length;l++)ph.call(s,n[l])&&i.push("["+t(n[l])+"]: "+t(s[n[l]],s));return i}var eo=Ye,Ai=au,ku=xu,Gu=eo("%TypeError%"),rs=eo("%WeakMap%",!0),ns=eo("%Map%",!0),Hu=Ai("WeakMap.prototype.get",!0),Wu=Ai("WeakMap.prototype.set",!0),Xu=Ai("WeakMap.prototype.has",!0),$u=Ai("Map.prototype.get",!0),zu=Ai("Map.prototype.set",!0),Vu=Ai("Map.prototype.has",!0),io=function(s,t){for(var e=s,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=s.next,s.next=i,i},ju=function(s,t){var e=io(s,t);return e&&e.value},Yu=function(s,t,e){var i=io(s,t);i?i.value=e:s.next={key:t,next:s.next,value:e}},qu=function(s,t){return!!io(s,t)},Ku=function(){var t,e,i,r={assert:function(n){if(!r.has(n))throw new Gu("Side channel does not contain "+ku(n))},get:function(n){if(rs&&n&&(typeof n=="object"||typeof n=="function")){if(t)return Hu(t,n)}else if(ns){if(e)return $u(e,n)}else if(i)return ju(i,n)},has:function(n){if(rs&&n&&(typeof n=="object"||typeof n=="function")){if(t)return Xu(t,n)}else if(ns){if(e)return Vu(e,n)}else if(i)return qu(i,n);return!1},set:function(n,o){rs&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new rs),Wu(t,n,o)):ns?(e||(e=new ns),zu(e,n,o)):(i||(i={key:{},next:null}),Yu(i,n,o))}};return r},Zu=String.prototype.replace,Qu=/%20/g,br={RFC1738:"RFC1738",RFC3986:"RFC3986"},so={default:br.RFC3986,formatters:{RFC1738:function(s){return Zu.call(s,Qu,"+")},RFC3986:function(s){return String(s)}},RFC1738:br.RFC1738,RFC3986:br.RFC3986},Ju=so,wr=Object.prototype.hasOwnProperty,Ue=Array.isArray,Vt=function(){for(var s=[],t=0;t<256;++t)s.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return s}(),td=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Ue(i)){for(var r=[],n=0;n<i.length;++n)typeof i[n]<"u"&&r.push(i[n]);e.obj[e.prop]=r}}},_h=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},r=0;r<t.length;++r)typeof t[r]<"u"&&(i[r]=t[r]);return i},ed=function s(t,e,i){if(!e)return t;if(typeof e!="object"){if(Ue(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!wr.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var r=t;return Ue(t)&&!Ue(e)&&(r=_h(t,i)),Ue(t)&&Ue(e)?(e.forEach(function(n,o){if(wr.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=s(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return wr.call(n,o)?n[o]=s(n[o],a,i):n[o]=a,n},r)},id=function(t,e){return Object.keys(e).reduce(function(i,r){return i[r]=e[r],i},t)},sd=function(s,t,e){var i=s.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},rd=function(t,e,i,r,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===Ju.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+Vt[l];continue}if(l<2048){a=a+(Vt[192|l>>6]+Vt[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Vt[224|l>>12]+Vt[128|l>>6&63]+Vt[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=Vt[240|l>>18]+Vt[128|l>>12&63]+Vt[128|l>>6&63]+Vt[128|l&63]}return a},nd=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],r=0;r<e.length;++r)for(var n=e[r],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],c=o[l];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:o,prop:l}),i.push(c))}return td(e),t},od=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},ad=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},hd=function(t,e){return[].concat(t,e)},ld=function(t,e){if(Ue(t)){for(var i=[],r=0;r<t.length;r+=1)i.push(e(t[r]));return i}return e(t)},vh={arrayToObject:_h,assign:id,combine:hd,compact:nd,decode:sd,encode:rd,isBuffer:ad,isRegExp:od,maybeMap:ld,merge:ed},xh=Ku,Is=vh,Wi=so,cd=Object.prototype.hasOwnProperty,Vo={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},ae=Array.isArray,ud=Array.prototype.push,bh=function(s,t){ud.apply(s,ae(t)?t:[t])},dd=Date.prototype.toISOString,jo=Wi.default,Et={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Is.encode,encodeValuesOnly:!1,format:jo,formatter:Wi.formatters[jo],indices:!1,serializeDate:function(t){return dd.call(t)},skipNulls:!1,strictNullHandling:!1},pd=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Ar={},fd=function s(t,e,i,r,n,o,a,h,l,c,u,d,p,f,m,g){for(var _=t,x=g,y=0,v=!1;(x=x.get(Ar))!==void 0&&!v;){var A=x.get(t);if(y+=1,typeof A<"u"){if(A===y)throw new RangeError("Cyclic object value");v=!0}typeof x.get(Ar)>"u"&&(y=0)}if(typeof h=="function"?_=h(e,_):_ instanceof Date?_=u(_):i==="comma"&&ae(_)&&(_=Is.maybeMap(_,function(V){return V instanceof Date?u(V):V})),_===null){if(n)return a&&!f?a(e,Et.encoder,m,"key",d):e;_=""}if(pd(_)||Is.isBuffer(_)){if(a){var B=f?e:a(e,Et.encoder,m,"key",d);return[p(B)+"="+p(a(_,Et.encoder,m,"value",d))]}return[p(e)+"="+p(String(_))]}var T=[];if(typeof _>"u")return T;var E;if(i==="comma"&&ae(_))f&&a&&(_=Is.maybeMap(_,a)),E=[{value:_.length>0?_.join(",")||null:void 0}];else if(ae(h))E=h;else{var D=Object.keys(_);E=l?D.sort(l):D}for(var k=r&&ae(_)&&_.length===1?e+"[]":e,q=0;q<E.length;++q){var M=E[q],b=typeof M=="object"&&typeof M.value<"u"?M.value:_[M];if(!(o&&b===null)){var C=ae(_)?typeof i=="function"?i(k,M):k:k+(c?"."+M:"["+M+"]");g.set(t,y);var H=xh();H.set(Ar,g),bh(T,s(b,C,i,r,n,o,i==="comma"&&f&&ae(_)?null:a,h,l,c,u,d,p,f,m,H))}}return T},md=function(t){if(!t)return Et;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||Et.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Wi.default;if(typeof t.format<"u"){if(!cd.call(Wi.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var r=Wi.formatters[i],n=Et.filter;return(typeof t.filter=="function"||ae(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Et.addQueryPrefix,allowDots:typeof t.allowDots>"u"?Et.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Et.charsetSentinel,delimiter:typeof t.delimiter>"u"?Et.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Et.encode,encoder:typeof t.encoder=="function"?t.encoder:Et.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Et.encodeValuesOnly,filter:n,format:i,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Et.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Et.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Et.strictNullHandling}},gd=function(s,t){var e=s,i=md(t),r,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):ae(i.filter)&&(n=i.filter,r=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Vo?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=Vo[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;r||(r=Object.keys(e)),i.sort&&r.sort(i.sort);for(var c=xh(),u=0;u<r.length;++u){var d=r[u];i.skipNulls&&e[d]===null||bh(o,fd(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var p=o.join(i.delimiter),f=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),p.length>0?f+p:""},bi=vh,hn=Object.prototype.hasOwnProperty,yd=Array.isArray,yt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:bi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},_d=function(s){return s.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},wh=function(s,t){return s&&typeof s=="string"&&t.comma&&s.indexOf(",")>-1?s.split(","):s},vd="utf8=%26%2310003%3B",xd="utf8=%E2%9C%93",bd=function(t,e){var i={__proto__:null},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=r.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===xd?l="utf-8":o[h]===vd&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var c=o[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,p,f;d===-1?(p=e.decoder(c,yt.decoder,l,"key"),f=e.strictNullHandling?null:""):(p=e.decoder(c.slice(0,d),yt.decoder,l,"key"),f=bi.maybeMap(wh(c.slice(d+1),e),function(m){return e.decoder(m,yt.decoder,l,"value")})),f&&e.interpretNumericEntities&&l==="iso-8859-1"&&(f=_d(f)),c.indexOf("[]=")>-1&&(f=yd(f)?[f]:f),hn.call(i,p)?i[p]=bi.combine(i[p],f):i[p]=f}return i},wd=function(s,t,e,i){for(var r=i?t:wh(t,e),n=s.length-1;n>=0;--n){var o,a=s[n];if(a==="[]"&&e.parseArrays)o=[].concat(r);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:r}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=r):h!=="__proto__"&&(o[h]=r)}r=o}return r},Ad=function(t,e,i,r){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,c=[];if(l){if(!i.plainObjects&&hn.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(n))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&hn.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),wd(c,e,i,r)}},Ed=function(t){if(!t)return yt;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?yt.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?yt.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:yt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:yt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:yt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:yt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:yt.comma,decoder:typeof t.decoder=="function"?t.decoder:yt.decoder,delimiter:typeof t.delimiter=="string"||bi.isRegExp(t.delimiter)?t.delimiter:yt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:yt.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:yt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:yt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:yt.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:yt.strictNullHandling}},Td=function(s,t){var e=Ed(t);if(s===""||s===null||typeof s>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof s=="string"?bd(s,e):s,r=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Ad(a,i[a],e,typeof s=="string");r=bi.merge(r,h,e)}return e.allowSparse===!0?r:bi.compact(r)},Sd=gd,Cd=Td,Id=so,Pd={formats:Id,parse:Cd,stringify:Sd},Rd=bc;function de(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Md=/^([a-z0-9.+-]+:)/i,Bd=/:[0-9]*$/,Dd=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Fd=["<",">",'"',"`"," ","\r",`
|
|
5
|
-
`," "],Od=["{","}","|","\\","^","`"].concat(Fd),ln=["'"].concat(Od),Yo=["%","/","?",";","#"].concat(ln),qo=["/","?","#"],Ld=255,Ko=/^[+a-z0-9A-Z_-]{0,63}$/,Nd=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ud={javascript:!0,"javascript:":!0},cn={javascript:!0,"javascript:":!0},pi={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},un=Pd;function kd(s,t,e){if(s&&typeof s=="object"&&s instanceof de)return s;var i=new de;return i.parse(s,t,e),i}de.prototype.parse=function(s,t,e){if(typeof s!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof s);var i=s.indexOf("?"),r=i!==-1&&i<s.indexOf("#")?"?":"#",n=s.split(r),o=/\\/g;n[0]=n[0].replace(o,"/"),s=n.join(r);var a=s;if(a=a.trim(),!e&&s.split("#").length===1){var h=Dd.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=un.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Md.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&cn[l])&&(a=a.substr(2),this.slashes=!0)}if(!cn[l]&&(u||l&&!pi[l])){for(var d=-1,p=0;p<qo.length;p++){var f=a.indexOf(qo[p]);f!==-1&&(d===-1||f<d)&&(d=f)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var p=0;p<Yo.length;p++){var f=a.indexOf(Yo[p]);f!==-1&&(d===-1||f<d)&&(d=f)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var x=this.hostname.split(/\./),p=0,y=x.length;p<y;p++){var v=x[p];if(v&&!v.match(Ko)){for(var A="",B=0,T=v.length;B<T;B++)v.charCodeAt(B)>127?A+="x":A+=v[B];if(!A.match(Ko)){var E=x.slice(0,p),D=x.slice(p+1),k=v.match(Nd);k&&(E.push(k[1]),D.unshift(k[2])),D.length&&(a="/"+D.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>Ld?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=Rd.toASCII(this.hostname));var q=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+q,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!Ud[c])for(var p=0,y=ln.length;p<y;p++){var b=ln[p];if(a.indexOf(b)!==-1){var C=encodeURIComponent(b);C===b&&(C=escape(b)),a=a.split(b).join(C)}}var H=a.indexOf("#");H!==-1&&(this.hash=a.substr(H),a=a.slice(0,H));var V=a.indexOf("?");if(V!==-1?(this.search=a.substr(V),this.query=a.substr(V+1),t&&(this.query=un.parse(this.query)),a=a.slice(0,V)):t&&(this.search="",this.query={}),a&&(this.pathname=a),pi[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var q=this.pathname||"",W=this.search||"";this.path=q+W}return this.href=this.format(),this};de.prototype.format=function(){var s=this.auth||"";s&&(s=encodeURIComponent(s),s=s.replace(/%3A/i,":"),s+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",r=!1,n="";this.host?r=s+this.host:this.hostname&&(r=s+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=un.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||pi[t])&&r!==!1?(r="//"+(r||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):r||(r=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+r+e+o+i};de.prototype.resolve=function(s){return this.resolveObject(kd(s,!1,!0)).format()};de.prototype.resolveObject=function(s){if(typeof s=="string"){var t=new de;t.parse(s,!1,!0),s=t}for(var e=new de,i=Object.keys(this),r=0;r<i.length;r++){var n=i[r];e[n]=this[n]}if(e.hash=s.hash,s.href==="")return e.href=e.format(),e;if(s.slashes&&!s.protocol){for(var o=Object.keys(s),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(e[h]=s[h])}return pi[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(s.protocol&&s.protocol!==e.protocol){if(!pi[s.protocol]){for(var l=Object.keys(s),c=0;c<l.length;c++){var u=l[c];e[u]=s[u]}return e.href=e.format(),e}if(e.protocol=s.protocol,!s.host&&!cn[s.protocol]){for(var y=(s.pathname||"").split("/");y.length&&!(s.host=y.shift()););s.host||(s.host=""),s.hostname||(s.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=s.pathname;if(e.search=s.search,e.query=s.query,e.host=s.host||"",e.auth=s.auth,e.hostname=s.hostname||s.host,e.port=s.port,e.pathname||e.search){var d=e.pathname||"",p=e.search||"";e.path=d+p}return e.slashes=e.slashes||s.slashes,e.href=e.format(),e}var f=e.pathname&&e.pathname.charAt(0)==="/",m=s.host||s.pathname&&s.pathname.charAt(0)==="/",g=m||f||e.host&&s.pathname,_=g,x=e.pathname&&e.pathname.split("/")||[],y=s.pathname&&s.pathname.split("/")||[],v=e.protocol&&!pi[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",s.protocol&&(s.hostname=null,s.port=null,s.host&&(y[0]===""?y[0]=s.host:y.unshift(s.host)),s.host=null),g=g&&(y[0]===""||x[0]==="")),m)e.host=s.host||s.host===""?s.host:e.host,e.hostname=s.hostname||s.hostname===""?s.hostname:e.hostname,e.search=s.search,e.query=s.query,x=y;else if(y.length)x||(x=[]),x.pop(),x=x.concat(y),e.search=s.search,e.query=s.query;else if(s.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var A=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;A&&(e.auth=A.shift(),e.hostname=A.shift(),e.host=e.hostname)}return e.search=s.search,e.query=s.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var B=x.slice(-1)[0],T=(e.host||s.host||x.length>1)&&(B==="."||B==="..")||B==="",E=0,D=x.length;D>=0;D--)B=x[D],B==="."?x.splice(D,1):B===".."?(x.splice(D,1),E++):E&&(x.splice(D,1),E--);if(!g&&!_)for(;E--;E)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),T&&x.join("/").substr(-1)!=="/"&&x.push("");var k=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=k?"":x.length?x.shift():"",e.host=e.hostname;var A=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;A&&(e.auth=A.shift(),e.hostname=A.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!k&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=s.auth||e.auth,e.slashes=e.slashes||s.slashes,e.href=e.format(),e};de.prototype.parseHost=function(){var s=this.host,t=Bd.exec(s);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),s=s.substr(0,s.length-t.length)),s&&(this.hostname=s)};const Zo={};function K(s,t,e=3){if(Zo[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
-
Deprecated since v${s}`):(i=i.split(`
|
|
7
|
-
`).splice(e).join(`
|
|
8
|
-
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
9
|
-
Deprecated since v${s}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
10
|
-
Deprecated since v${s}`),console.warn(i))),Zo[t]=!0}function Lt(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Ci(s){return s.split("?")[0].split("#")[0]}function Gd(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hd(s,t,e){return s.replace(new RegExp(Gd(t),"g"),e)}function Wd(s,t){let e="",i=0,r=-1,n=0,o=-1;for(let a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${s.slice(r+1,a)}`:e=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const ft={toPosix(s){return Hd(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Lt(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(Lt(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Ci(this.toPosix(t??O.ADAPTER.getBaseUrl())),r=Ci(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?ft.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Lt(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=Wd(s,!1),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return Lt(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const i=s[e];if(Lt(i),i.length>0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(Lt(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),o=s;s=s.slice(n.length);for(let a=s.length-1;a>=1;--a)if(t=s.charCodeAt(a),t===47){if(!r){i=a;break}}else r=!1;return i===-1?e?"/":this.isUrl(o)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){Lt(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){Lt(s),t&&Lt(t),s=Ci(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let o=t.length-1,a=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){Lt(s),s=Ci(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!r){e=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){Lt(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=Ci(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,o=0,a=-1,h=!0,l=s.length-1,c=0;for(;l>=r;--l){if(e=s.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=s.slice(1,a):t.base=t.name=s.slice(o,a)):(o===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,a)):(t.name=s.slice(o,n),t.base=s.slice(o,a)),t.ext=s.slice(n,a)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let Er;async function Xd(){return Er??(Er=(async()=>{var n;const s=document.createElement("canvas").getContext("webgl");if(!s)return Ct.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return Ct.UNPACK;const e=s.createTexture();s.bindTexture(s.TEXTURE_2D,e);const i=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,i),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return s.readPixels(0,0,1,1,s.RGBA,s.UNSIGNED_BYTE,r),s.deleteFramebuffer(i),s.deleteTexture(e),(n=s.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?Ct.PMA:Ct.UNPACK})()),Er}let Tr;function $d(){return typeof Tr>"u"&&(Tr=function(){var t;const s={stencil:!0,failIfMajorPerformanceCaveat:O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!O.ADAPTER.getWebGLRenderingContext())return!1;const e=O.ADAPTER.createCanvas();let i=e.getContext("webgl",s)||e.getContext("experimental-webgl",s);const r=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}}()),Tr}var zd={grad:.9,turn:360,rad:360/(2*Math.PI)},oe=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},vt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},Dt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Ah=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Qo=function(s){return{r:Dt(s.r,0,255),g:Dt(s.g,0,255),b:Dt(s.b,0,255),a:Dt(s.a)}},Sr=function(s){return{r:vt(s.r),g:vt(s.g),b:vt(s.b),a:vt(s.a,3)}},Vd=/^#([0-9a-f]{3,8})$/i,os=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Eh=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},Th=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:r}},Jo=function(s){return{h:Ah(s.h),s:Dt(s.s,0,100),l:Dt(s.l,0,100),a:Dt(s.a)}},ta=function(s){return{h:vt(s.h),s:vt(s.s),l:vt(s.l),a:vt(s.a,3)}},ea=function(s){return Th((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Xi=function(s){return{h:(t=Eh(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},jd=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yd=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,qd=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Kd=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dn={string:[[function(s){var t=Vd.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?vt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?vt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=qd.exec(s)||Kd.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Qo({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:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(s){var t=jd.exec(s)||Yd.exec(s);if(!t)return null;var e,i,r=Jo({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(zd[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ea(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return oe(t)&&oe(e)&&oe(i)?Qo({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!oe(t)||!oe(e)||!oe(i))return null;var o=Jo({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return ea(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!oe(t)||!oe(e)||!oe(i))return null;var o=function(a){return{h:Ah(a.h),s:Dt(a.s,0,100),v:Dt(a.v,0,100),a:Dt(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Th(o)},"hsv"]]},ia=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},Zd=function(s){return typeof s=="string"?ia(s.trim(),dn.string):typeof s=="object"&&s!==null?ia(s,dn.object):[null,void 0]},Cr=function(s,t){var e=Xi(s);return{h:e.h,s:Dt(e.s+100*t,0,100),l:e.l,a:e.a}},Ir=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},sa=function(s,t){var e=Xi(s);return{h:e.h,s:e.s,l:Dt(e.l+100*t,0,100),a:e.a}},pn=function(){function s(t){this.parsed=Zd(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return vt(Ir(this.rgba),2)},s.prototype.isDark=function(){return Ir(this.rgba)<.5},s.prototype.isLight=function(){return Ir(this.rgba)>=.5},s.prototype.toHex=function(){return t=Sr(this.rgba),e=t.r,i=t.g,r=t.b,o=(n=t.a)<1?os(vt(255*n)):"","#"+os(e)+os(i)+os(r)+o;var t,e,i,r,n,o},s.prototype.toRgb=function(){return Sr(this.rgba)},s.prototype.toRgbString=function(){return t=Sr(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return ta(Xi(this.rgba))},s.prototype.toHslString=function(){return t=ta(Xi(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Eh(this.rgba),{h:vt(t.h),s:vt(t.s),v:vt(t.v),a:vt(t.a,3)};var t},s.prototype.invert=function(){return jt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),jt(Cr(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),jt(Cr(this.rgba,-t))},s.prototype.grayscale=function(){return jt(Cr(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),jt(sa(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),jt(sa(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?jt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):vt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=Xi(this.rgba);return typeof t=="number"?jt({h:t,s:e.s,l:e.l,a:e.a}):vt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===jt(t).toHex()},s}(),jt=function(s){return s instanceof pn?s:new pn(s)},ra=[],Qd=function(s){s.forEach(function(t){ra.indexOf(t)<0&&(t(pn,dn),ra.push(t))})};function Jd(s,t){var e={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"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,d="black";if(!n.length)for(var p in e)n[p]=new s(e[p]).toRgb();for(var f in e){var m=(a=c,h=n[f],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));m<u&&(u=m,d=f)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new s(h).toRgb():null},"name"])}Qd([Jd]);const si=class Ps{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Ps)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t??[];const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=Ps.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,i,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Ps.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=jt(t);o.isValid()&&({r:e,g:i,b:r,a:n}=o.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}};si.shared=new si,si.temp=new si,si.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let et=si;function tp(s){return K("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),et.shared.setValue(s).toHex()}function ep(s){return K("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),et.shared.setValue(s).toNumber()}function ip(){const s=[],t=[];for(let i=0;i<32;i++)s[i]=i,t[i]=i;s[$.NORMAL_NPM]=$.NORMAL,s[$.ADD_NPM]=$.ADD,s[$.SCREEN_NPM]=$.SCREEN,t[$.NORMAL]=$.NORMAL_NPM,t[$.ADD]=$.ADD_NPM,t[$.SCREEN]=$.SCREEN_NPM;const e=[];return e.push(t),e.push(s),e}const Sh=ip();function Ch(s,t){return Sh[t?1:0][s]}function sp(s,t=null){const e=s*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,r=0;i<e;i+=6,r+=4)t[i+0]=r+0,t[i+1]=r+1,t[i+2]=r+2,t[i+3]=r+0,t[i+4]=r+2,t[i+5]=r+3;return t}function Ih(s){if(s.BYTES_PER_ELEMENT===4)return s instanceof Float32Array?"Float32Array":s instanceof Uint32Array?"Uint32Array":"Int32Array";if(s.BYTES_PER_ELEMENT===2){if(s instanceof Uint16Array)return"Uint16Array"}else if(s.BYTES_PER_ELEMENT===1&&s instanceof Uint8Array)return"Uint8Array";return null}function Ws(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function na(s){return!(s&s-1)&&!!s}function oa(s){let t=(s>65535?1:0)<<4;s>>>=t;let e=(s>255?1:0)<<3;return s>>>=e,t|=e,e=(s>15?1:0)<<2,s>>>=e,t|=e,e=(s>3?1:0)<<1,s>>>=e,t|=e,t|s>>1}function fi(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r<n;++r)s[r]=s[r+e];s.length=n}function Ae(s){return s===0?0:s<0?-1:1}let rp=0;function ze(){return++rp}const fn=class{constructor(s,t,e,i){this.left=s,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};fn.EMPTY=new fn(0,0,0,0);let aa=fn;const ha={},Yt=Object.create(null),me=Object.create(null);class np{constructor(t,e,i){this._canvas=O.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||O.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function la(s,t,e){for(let i=0,r=4*e*t;i<t;++i,r+=4)if(s[r+3]!==0)return!1;return!0}function ca(s,t,e,i,r){const n=4*t;for(let o=i,a=i*n+4*e;o<=r;++o,a+=n)if(s[a+3]!==0)return!1;return!0}function op(s){const{width:t,height:e}=s,i=s.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const r=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,h=e-1;for(;o<e&&la(r,t,o);)++o;if(o===e)return aa.EMPTY;for(;la(r,t,h);)--h;for(;ca(r,t,n,o,h);)++n;for(;ca(r,t,a,o,h);)--a;return++a,++h,new aa(n,o,a,h)}function ap(s){const t=op(s),{width:e,height:i}=t;let r=null;if(!t.isEmpty()){const n=s.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:r}}function hp(s,t=globalThis.location){if(s.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function pe(s,t=1){var i;const e=(i=O.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}var R=(s=>(s.Renderer="renderer",s.Application="application",s.RendererSystem="renderer-webgl-system",s.RendererPlugin="renderer-webgl-plugin",s.CanvasRendererSystem="renderer-canvas-system",s.CanvasRendererPlugin="renderer-canvas-plugin",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s))(R||{});const mn=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},ua=(s,t)=>mn(s).priority??t,N={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(mn).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(mn).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,r=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(r[e]=r[e]||[],(o=r[e])==null||o.push(t))})}),this},handle(s,t,e){var o;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((o=n[s])==null||o.forEach(a=>t(a)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>ua(n,e)-ua(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}};class gn{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const lp=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
-
`);function cp(s){let t="";for(let e=0;e<s;++e)e>0&&(t+=`
|
|
12
|
-
else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function up(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=lp.replace(/%forloop%/gi,cp(s));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}return s}const Pr=0,Rr=1,Mr=2,Br=3,Dr=4,Fr=5;class re{constructor(){this.data=0,this.blendMode=$.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Pr)}set blend(t){!!(this.data&1<<Pr)!==t&&(this.data^=1<<Pr)}get offsets(){return!!(this.data&1<<Rr)}set offsets(t){!!(this.data&1<<Rr)!==t&&(this.data^=1<<Rr)}get culling(){return!!(this.data&1<<Mr)}set culling(t){!!(this.data&1<<Mr)!==t&&(this.data^=1<<Mr)}get depthTest(){return!!(this.data&1<<Br)}set depthTest(t){!!(this.data&1<<Br)!==t&&(this.data^=1<<Br)}get depthMask(){return!!(this.data&1<<Fr)}set depthMask(t){!!(this.data&1<<Fr)!==t&&(this.data^=1<<Fr)}get clockwiseFrontFace(){return!!(this.data&1<<Dr)}set clockwiseFrontFace(t){!!(this.data&1<<Dr)!==t&&(this.data^=1<<Dr)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==$.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new re;return t.depthTest=!1,t.blend=!0,t}}re.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const yn=[];function Ph(s,t){if(!s)return null;let e="";if(typeof s=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(s);i&&(e=i[1].toLowerCase())}for(let i=yn.length-1;i>=0;--i){const r=yn[i];if(r.test&&r.test(s,e))return new r(s,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Ht{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,r,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,i,r,n,o,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Ht.prototype,{dispatch:{value:Ht.prototype.emit},run:{value:Ht.prototype.emit}});class ji{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Ht("setRealSize"),this.onUpdate=new Ht("update"),this.onError=new Ht("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class rr extends ji{constructor(t,e){const{width:i,height:r}=e||{};if(!i||!r)throw new Error("BufferResource width or height invalid");super(i,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ct.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?r.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,r.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const dp={scaleMode:he.NEAREST,alphaMode:Ct.NPM},_n=class ri extends qi{constructor(t=null,e=null){super(),e=Object.assign({},ri.defaultOptions,e);const{alphaMode:i,mipmap:r,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:p,resourceOptions:f}=e;t&&!(t instanceof ji)&&(t=Ph(t,f),t.internal=!0),this.resolution=p||O.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=ze(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=na(this.realWidth)&&na(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete me[this.cacheId],delete Yt[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),ri.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${ze()}`}n=t._pixiId}let o=me[n];if(r&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new ri(t,e),o.cacheId=n,ri.addToCache(o,n)),o}static fromBuffer(t,e,i,r){t=t||new Float32Array(e*i*4);const n=new rr(t,{width:e,height:i,...r==null?void 0:r.resourceOptions});let o,a;return t instanceof Float32Array?(o=S.RGBA,a=G.FLOAT):t instanceof Int32Array?(o=S.RGBA_INTEGER,a=G.INT):t instanceof Uint32Array?(o=S.RGBA_INTEGER,a=G.UNSIGNED_INT):t instanceof Int16Array?(o=S.RGBA_INTEGER,a=G.SHORT):t instanceof Uint16Array?(o=S.RGBA_INTEGER,a=G.UNSIGNED_SHORT):t instanceof Int8Array?(o=S.RGBA,a=G.BYTE):(o=S.RGBA,a=G.UNSIGNED_BYTE),n.internal=!0,new ri(n,Object.assign({},dp,{type:a,format:o},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),me[e]&&me[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),me[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=me[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete me[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete me[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};_n.defaultOptions={mipmap:se.POW2,anisotropicLevel:0,scaleMode:he.LINEAR,wrapMode:Te.CLAMP,alphaMode:Ct.UNPACK,target:ui.TEXTURE_2D,format:S.RGBA,type:G.UNSIGNED_BYTE},_n._globalBatch=0;let j=_n;class vn{constructor(){this.texArray=null,this.blend=0,this.type=te.TRIANGLES,this.start=0,this.size=0,this.data=null}}let pp=0;class ht{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=pp++,this.disposeRunner=new Ht("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?ee.ELEMENT_ARRAY_BUFFER:ee.ARRAY_BUFFER}get index(){return this.type===ee.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new ht(t)}}class Xs{constructor(t,e=0,i=!1,r=G.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,r,n){return new Xs(t,e,i,r,n)}}const fp={Float32Array,Uint32Array,Int32Array,Uint8Array};function mp(s,t){let e=0,i=0;const r={};for(let h=0;h<s.length;h++)i+=t[h],e+=s[h].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let h=0;h<s.length;h++){const l=t[h],c=s[h],u=Ih(c);r[u]||(r[u]=new fp[u](n)),o=r[u];for(let d=0;d<c.length;d++){const p=(d/l|0)*i+a,f=d%l;o[p+f]=c[d]}a+=l}return new Float32Array(n)}const da={5126:4,5123:2,5121:1};let gp=0;const yp={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Se{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=gp++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Ht("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,r=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof ht||(e instanceof Array&&(e=new Float32Array(e)),e=new ht(e));const l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,i,r,n);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new Xs(c,i,r,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof ht||(t instanceof Array&&(t=new Uint16Array(t)),t=new ht(t)),t.type=ee.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new ht;let r;for(r in this.attributes){const n=this.attributes[r],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*da[n.type]/4),n.buffer=0}for(i.data=mp(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new Se;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new ht(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Xs(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=ee.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Se,i=[],r=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)r[h]=r[h]||0,r[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new yp[Ih(o.buffers[a].data)](r[a]),e.buffers[a]=new ht(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=ee.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===c&&(h+=d.size*da[d.type]/4)}for(let u=0;u<t.length;u++){const d=t[u].indexBuffer.data;for(let p=0;p<d.length;p++)e.indexBuffer.data[p+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}}class Rh extends Se{constructor(t=!1){super(),this._buffer=new ht(null,t,!1),this._indexBuffer=new ht(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,G.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,G.FLOAT).addAttribute("aColor",this._buffer,4,!0,G.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,G.FLOAT).addIndex(this._indexBuffer)}}const $s=Math.PI*2,_p=180/Math.PI,vp=Math.PI/180;var wt=(s=>(s[s.POLY=0]="POLY",s[s.RECT=1]="RECT",s[s.CIRC=2]="CIRC",s[s.ELIP=3]="ELIP",s[s.RREC=4]="RREC",s))(wt||{});class X{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new X(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}X.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const as=[new X,new X,new X,new X];class z{constructor(t=0,e=0,i=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=wt.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new z(0,0,0,0)}clone(){return new z(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return!1;const D=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>D}const i=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=i||o<=n)return!1;const a=as[0].set(t.left,t.top),h=as[1].set(t.left,t.bottom),l=as[2].set(t.right,t.top),c=as[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=r||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const d=u*(h.y-a.y),p=u*(a.x-h.x),f=d*i+p*n,m=d*r+p*n,g=d*i+p*o,_=d*r+p*o;if(Math.max(f,m,g,_)<=d*a.x+p*a.y||Math.min(f,m,g,_)>=d*c.x+p*c.y)return!1;const x=u*(a.y-l.y),y=u*(l.x-a.x),v=x*i+y*n,A=x*r+y*n,B=x*i+y*o,T=x*r+y*o;return!(Math.max(v,A,B,T)<=x*a.x+y*a.y||Math.min(v,A,B,T)>=x*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}}z.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class nr{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=wt.CIRC}clone(){return new nr(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}getBounds(){return new z(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}nr.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class or{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r,this.type=wt.ELIP}clone(){return new or(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,i+r<=1}getBounds(){return new z(this.x-this.width,this.y-this.height,this.width,this.height)}}or.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class We{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;r<n;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.type=wt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new We(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let n=0,o=r-1;n<r;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}}We.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((s,t)=>`${s}, ${t}`,"")}]`};class ar{constructor(t=0,e=0,i=0,r=0,n=20){this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=wt.RREC}clone(){return new ar(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(r*r+n*n<=o||(r=t-(this.x+this.width-i),r*r+n*n<=o)||(n=e-(this.y+this.height-i),r*r+n*n<=o)||(r=t-(this.x+i),r*r+n*n<=o))return!0}return!1}}ar.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class it{constructor(t=1,e=0,i=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new X;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new X;const i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,r,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,r=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-r,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs($s-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,o=t*r-e*i;return this.a=r/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-r*n)/o,this.ty=-(t*this.ty-e*n)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new it;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new it}static get TEMP_MATRIX(){return new it}}it.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Be=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],De=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Fe=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Oe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xn=[],Mh=[],hs=Math.sign;function xp(){for(let s=0;s<16;s++){const t=[];xn.push(t);for(let e=0;e<16;e++){const i=hs(Be[s]*Be[e]+Fe[s]*De[e]),r=hs(De[s]*Be[e]+Oe[s]*De[e]),n=hs(Be[s]*Fe[e]+Fe[s]*Oe[e]),o=hs(De[s]*Fe[e]+Oe[s]*Oe[e]);for(let a=0;a<16;a++)if(Be[a]===i&&De[a]===r&&Fe[a]===n&&Oe[a]===o){t.push(a);break}}}for(let s=0;s<16;s++){const t=new it;t.set(Be[s],De[s],Fe[s],Oe[s],0,0),Mh.push(t)}}xp();const rt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:s=>Be[s],uY:s=>De[s],vX:s=>Fe[s],vY:s=>Oe[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>xn[s][t],sub:(s,t)=>xn[s][rt.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?rt.S:rt.N:Math.abs(t)*2<=Math.abs(s)?s>0?rt.E:rt.W:t>0?s>0?rt.SE:rt.SW:s>0?rt.NE:rt.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=Mh[rt.inv(t)];r.tx=e,r.ty=i,s.append(r)}};class ce{constructor(t,e,i=0,r=0){this._x=i,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ce(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}ce.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const bn=class{constructor(){this.worldTransform=new it,this.localTransform=new it,this.position=new ce(this.onChange,this,0,0),this.scale=new ce(this.onChange,this,1,1),this.pivot=new ce(this.onChange,this,0,0),this.skew=new ce(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const s=this.localTransform;this._localID!==this._currentLocalID&&(s.a=this._cx*this.scale.x,s.b=this._sx*this.scale.x,s.c=this._cy*this.scale.y,s.d=this._sy*this.scale.y,s.tx=this.position.x-(this.pivot.x*s.a+this.pivot.y*s.c),s.ty=this.position.y-(this.pivot.x*s.b+this.pivot.y*s.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(s){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==s._worldID){const e=s.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=s._worldID,this._worldID++}}setFromMatrix(s){s.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(s){this._rotation!==s&&(this._rotation=s,this.updateSkew())}};bn.IDENTITY=new bn;let ro=bn;ro.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var bp=`varying vec2 vTextureCoord;
|
|
13
|
-
|
|
14
|
-
uniform sampler2D uSampler;
|
|
15
|
-
|
|
16
|
-
void main(void){
|
|
17
|
-
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
18
|
-
}`,wp=`attribute vec2 aVertexPosition;
|
|
19
|
-
attribute vec2 aTextureCoord;
|
|
20
|
-
|
|
21
|
-
uniform mat3 projectionMatrix;
|
|
22
|
-
|
|
23
|
-
varying vec2 vTextureCoord;
|
|
24
|
-
|
|
25
|
-
void main(void){
|
|
26
|
-
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
27
|
-
vTextureCoord = aTextureCoord;
|
|
28
|
-
}
|
|
29
|
-
`;function pa(s,t,e){const i=s.createShader(t);return s.shaderSource(i,e),s.compileShader(i),i}function Or(s){const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Bh(s,t){switch(s){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Or(2*t);case"bvec3":return Or(3*t);case"bvec4":return Or(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const mi=[{test:s=>s.type==="float"&&s.size===1&&!s.isArray,code:s=>`
|
|
30
|
-
if(uv["${s}"] !== ud["${s}"].value)
|
|
31
|
-
{
|
|
32
|
-
ud["${s}"].value = uv["${s}"]
|
|
33
|
-
gl.uniform1f(ud["${s}"].location, uv["${s}"])
|
|
34
|
-
}
|
|
35
|
-
`},{test:(s,t)=>(s.type==="sampler2D"||s.type==="samplerCube"||s.type==="sampler2DArray")&&s.size===1&&!s.isArray&&(t==null||t.castToBaseTexture!==void 0),code:s=>`t = syncData.textureCount++;
|
|
36
|
-
|
|
37
|
-
renderer.texture.bind(uv["${s}"], t);
|
|
38
|
-
|
|
39
|
-
if(ud["${s}"].value !== t)
|
|
40
|
-
{
|
|
41
|
-
ud["${s}"].value = t;
|
|
42
|
-
gl.uniform1i(ud["${s}"].location, t);
|
|
43
|
-
; // eslint-disable-line max-len
|
|
44
|
-
}`},{test:(s,t)=>s.type==="mat3"&&s.size===1&&!s.isArray&&t.a!==void 0,code:s=>`
|
|
45
|
-
gl.uniformMatrix3fv(ud["${s}"].location, false, uv["${s}"].toArray(true));
|
|
46
|
-
`,codeUbo:s=>`
|
|
47
|
-
var ${s}_matrix = uv.${s}.toArray(true);
|
|
48
|
-
|
|
49
|
-
data[offset] = ${s}_matrix[0];
|
|
50
|
-
data[offset+1] = ${s}_matrix[1];
|
|
51
|
-
data[offset+2] = ${s}_matrix[2];
|
|
52
|
-
|
|
53
|
-
data[offset + 4] = ${s}_matrix[3];
|
|
54
|
-
data[offset + 5] = ${s}_matrix[4];
|
|
55
|
-
data[offset + 6] = ${s}_matrix[5];
|
|
56
|
-
|
|
57
|
-
data[offset + 8] = ${s}_matrix[6];
|
|
58
|
-
data[offset + 9] = ${s}_matrix[7];
|
|
59
|
-
data[offset + 10] = ${s}_matrix[8];
|
|
60
|
-
`},{test:(s,t)=>s.type==="vec2"&&s.size===1&&!s.isArray&&t.x!==void 0,code:s=>`
|
|
61
|
-
cv = ud["${s}"].value;
|
|
62
|
-
v = uv["${s}"];
|
|
63
|
-
|
|
64
|
-
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
65
|
-
{
|
|
66
|
-
cv[0] = v.x;
|
|
67
|
-
cv[1] = v.y;
|
|
68
|
-
gl.uniform2f(ud["${s}"].location, v.x, v.y);
|
|
69
|
-
}`,codeUbo:s=>`
|
|
70
|
-
v = uv.${s};
|
|
71
|
-
|
|
72
|
-
data[offset] = v.x;
|
|
73
|
-
data[offset+1] = v.y;
|
|
74
|
-
`},{test:s=>s.type==="vec2"&&s.size===1&&!s.isArray,code:s=>`
|
|
75
|
-
cv = ud["${s}"].value;
|
|
76
|
-
v = uv["${s}"];
|
|
77
|
-
|
|
78
|
-
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
79
|
-
{
|
|
80
|
-
cv[0] = v[0];
|
|
81
|
-
cv[1] = v[1];
|
|
82
|
-
gl.uniform2f(ud["${s}"].location, v[0], v[1]);
|
|
83
|
-
}
|
|
84
|
-
`},{test:(s,t)=>s.type==="vec4"&&s.size===1&&!s.isArray&&t.width!==void 0,code:s=>`
|
|
85
|
-
cv = ud["${s}"].value;
|
|
86
|
-
v = uv["${s}"];
|
|
87
|
-
|
|
88
|
-
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
89
|
-
{
|
|
90
|
-
cv[0] = v.x;
|
|
91
|
-
cv[1] = v.y;
|
|
92
|
-
cv[2] = v.width;
|
|
93
|
-
cv[3] = v.height;
|
|
94
|
-
gl.uniform4f(ud["${s}"].location, v.x, v.y, v.width, v.height)
|
|
95
|
-
}`,codeUbo:s=>`
|
|
96
|
-
v = uv.${s};
|
|
97
|
-
|
|
98
|
-
data[offset] = v.x;
|
|
99
|
-
data[offset+1] = v.y;
|
|
100
|
-
data[offset+2] = v.width;
|
|
101
|
-
data[offset+3] = v.height;
|
|
102
|
-
`},{test:(s,t)=>s.type==="vec4"&&s.size===1&&!s.isArray&&t.red!==void 0,code:s=>`
|
|
103
|
-
cv = ud["${s}"].value;
|
|
104
|
-
v = uv["${s}"];
|
|
105
|
-
|
|
106
|
-
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
|
107
|
-
{
|
|
108
|
-
cv[0] = v.red;
|
|
109
|
-
cv[1] = v.green;
|
|
110
|
-
cv[2] = v.blue;
|
|
111
|
-
cv[3] = v.alpha;
|
|
112
|
-
gl.uniform4f(ud["${s}"].location, v.red, v.green, v.blue, v.alpha)
|
|
113
|
-
}`,codeUbo:s=>`
|
|
114
|
-
v = uv.${s};
|
|
115
|
-
|
|
116
|
-
data[offset] = v.red;
|
|
117
|
-
data[offset+1] = v.green;
|
|
118
|
-
data[offset+2] = v.blue;
|
|
119
|
-
data[offset+3] = v.alpha;
|
|
120
|
-
`},{test:(s,t)=>s.type==="vec3"&&s.size===1&&!s.isArray&&t.red!==void 0,code:s=>`
|
|
121
|
-
cv = ud["${s}"].value;
|
|
122
|
-
v = uv["${s}"];
|
|
123
|
-
|
|
124
|
-
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
|
125
|
-
{
|
|
126
|
-
cv[0] = v.red;
|
|
127
|
-
cv[1] = v.green;
|
|
128
|
-
cv[2] = v.blue;
|
|
129
|
-
|
|
130
|
-
gl.uniform3f(ud["${s}"].location, v.red, v.green, v.blue)
|
|
131
|
-
}`,codeUbo:s=>`
|
|
132
|
-
v = uv.${s};
|
|
133
|
-
|
|
134
|
-
data[offset] = v.red;
|
|
135
|
-
data[offset+1] = v.green;
|
|
136
|
-
data[offset+2] = v.blue;
|
|
137
|
-
`},{test:s=>s.type==="vec4"&&s.size===1&&!s.isArray,code:s=>`
|
|
138
|
-
cv = ud["${s}"].value;
|
|
139
|
-
v = uv["${s}"];
|
|
140
|
-
|
|
141
|
-
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
142
|
-
{
|
|
143
|
-
cv[0] = v[0];
|
|
144
|
-
cv[1] = v[1];
|
|
145
|
-
cv[2] = v[2];
|
|
146
|
-
cv[3] = v[3];
|
|
147
|
-
|
|
148
|
-
gl.uniform4f(ud["${s}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
-
}`}],Ap={float:`
|
|
150
|
-
if (cv !== v)
|
|
151
|
-
{
|
|
152
|
-
cu.value = v;
|
|
153
|
-
gl.uniform1f(location, v);
|
|
154
|
-
}`,vec2:`
|
|
155
|
-
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
156
|
-
{
|
|
157
|
-
cv[0] = v[0];
|
|
158
|
-
cv[1] = v[1];
|
|
159
|
-
|
|
160
|
-
gl.uniform2f(location, v[0], v[1])
|
|
161
|
-
}`,vec3:`
|
|
162
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
163
|
-
{
|
|
164
|
-
cv[0] = v[0];
|
|
165
|
-
cv[1] = v[1];
|
|
166
|
-
cv[2] = v[2];
|
|
167
|
-
|
|
168
|
-
gl.uniform3f(location, v[0], v[1], v[2])
|
|
169
|
-
}`,vec4:`
|
|
170
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
171
|
-
{
|
|
172
|
-
cv[0] = v[0];
|
|
173
|
-
cv[1] = v[1];
|
|
174
|
-
cv[2] = v[2];
|
|
175
|
-
cv[3] = v[3];
|
|
176
|
-
|
|
177
|
-
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
178
|
-
}`,int:`
|
|
179
|
-
if (cv !== v)
|
|
180
|
-
{
|
|
181
|
-
cu.value = v;
|
|
182
|
-
|
|
183
|
-
gl.uniform1i(location, v);
|
|
184
|
-
}`,ivec2:`
|
|
185
|
-
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
186
|
-
{
|
|
187
|
-
cv[0] = v[0];
|
|
188
|
-
cv[1] = v[1];
|
|
189
|
-
|
|
190
|
-
gl.uniform2i(location, v[0], v[1]);
|
|
191
|
-
}`,ivec3:`
|
|
192
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
193
|
-
{
|
|
194
|
-
cv[0] = v[0];
|
|
195
|
-
cv[1] = v[1];
|
|
196
|
-
cv[2] = v[2];
|
|
197
|
-
|
|
198
|
-
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
199
|
-
}`,ivec4:`
|
|
200
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
201
|
-
{
|
|
202
|
-
cv[0] = v[0];
|
|
203
|
-
cv[1] = v[1];
|
|
204
|
-
cv[2] = v[2];
|
|
205
|
-
cv[3] = v[3];
|
|
206
|
-
|
|
207
|
-
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
208
|
-
}`,uint:`
|
|
209
|
-
if (cv !== v)
|
|
210
|
-
{
|
|
211
|
-
cu.value = v;
|
|
212
|
-
|
|
213
|
-
gl.uniform1ui(location, v);
|
|
214
|
-
}`,uvec2:`
|
|
215
|
-
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
216
|
-
{
|
|
217
|
-
cv[0] = v[0];
|
|
218
|
-
cv[1] = v[1];
|
|
219
|
-
|
|
220
|
-
gl.uniform2ui(location, v[0], v[1]);
|
|
221
|
-
}`,uvec3:`
|
|
222
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
223
|
-
{
|
|
224
|
-
cv[0] = v[0];
|
|
225
|
-
cv[1] = v[1];
|
|
226
|
-
cv[2] = v[2];
|
|
227
|
-
|
|
228
|
-
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
229
|
-
}`,uvec4:`
|
|
230
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
231
|
-
{
|
|
232
|
-
cv[0] = v[0];
|
|
233
|
-
cv[1] = v[1];
|
|
234
|
-
cv[2] = v[2];
|
|
235
|
-
cv[3] = v[3];
|
|
236
|
-
|
|
237
|
-
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
238
|
-
}`,bool:`
|
|
239
|
-
if (cv !== v)
|
|
240
|
-
{
|
|
241
|
-
cu.value = v;
|
|
242
|
-
gl.uniform1i(location, v);
|
|
243
|
-
}`,bvec2:`
|
|
244
|
-
if (cv[0] != v[0] || cv[1] != v[1])
|
|
245
|
-
{
|
|
246
|
-
cv[0] = v[0];
|
|
247
|
-
cv[1] = v[1];
|
|
248
|
-
|
|
249
|
-
gl.uniform2i(location, v[0], v[1]);
|
|
250
|
-
}`,bvec3:`
|
|
251
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
252
|
-
{
|
|
253
|
-
cv[0] = v[0];
|
|
254
|
-
cv[1] = v[1];
|
|
255
|
-
cv[2] = v[2];
|
|
256
|
-
|
|
257
|
-
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
258
|
-
}`,bvec4:`
|
|
259
|
-
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
260
|
-
{
|
|
261
|
-
cv[0] = v[0];
|
|
262
|
-
cv[1] = v[1];
|
|
263
|
-
cv[2] = v[2];
|
|
264
|
-
cv[3] = v[3];
|
|
265
|
-
|
|
266
|
-
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
267
|
-
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
|
|
268
|
-
if (cv !== v)
|
|
269
|
-
{
|
|
270
|
-
cu.value = v;
|
|
271
|
-
|
|
272
|
-
gl.uniform1i(location, v);
|
|
273
|
-
}`,samplerCube:`
|
|
274
|
-
if (cv !== v)
|
|
275
|
-
{
|
|
276
|
-
cu.value = v;
|
|
277
|
-
|
|
278
|
-
gl.uniform1i(location, v);
|
|
279
|
-
}`,sampler2DArray:`
|
|
280
|
-
if (cv !== v)
|
|
281
|
-
{
|
|
282
|
-
cu.value = v;
|
|
283
|
-
|
|
284
|
-
gl.uniform1i(location, v);
|
|
285
|
-
}`},Ep={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Tp(s,t){var i;const e=[`
|
|
286
|
-
var v = null;
|
|
287
|
-
var cv = null;
|
|
288
|
-
var cu = null;
|
|
289
|
-
var t = 0;
|
|
290
|
-
var gl = renderer.gl;
|
|
291
|
-
`];for(const r in s.uniforms){const n=t[r];if(!n){((i=s.uniforms[r])==null?void 0:i.group)===!0&&(s.uniforms[r].ubo?e.push(`
|
|
292
|
-
renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
|
|
293
|
-
`):e.push(`
|
|
294
|
-
renderer.shader.syncUniformGroup(uv.${r}, syncData);
|
|
295
|
-
`));continue}const o=s.uniforms[r];let a=!1;for(let h=0;h<mi.length;h++)if(mi[h].test(n,o)){e.push(mi[h].code(r,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?Ap:Ep)[n.type].replace("location",`ud["${r}"].location`);e.push(`
|
|
296
|
-
cu = ud["${r}"];
|
|
297
|
-
cv = cu.value;
|
|
298
|
-
v = uv["${r}"];
|
|
299
|
-
${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
300
|
-
`))}const Dh={};let ti=Dh;function Sp(){if(ti===Dh||ti!=null&&ti.isContextLost()){const s=O.ADAPTER.createCanvas();let t;O.PREFER_ENV>=je.WEBGL2&&(t=s.getContext("webgl2",{})),t||(t=s.getContext("webgl",{})||s.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),ti=t}return ti}let ls;function Cp(){if(!ls){ls=Bt.MEDIUM;const s=Sp();if(s&&s.getShaderPrecisionFormat){const t=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);t&&(ls=t.precision?Bt.HIGH:Bt.MEDIUM)}}return ls}function fa(s,t){const e=s.getShaderSource(t).split(`
|
|
301
|
-
`).map((l,c)=>`${c}: ${l}`),i=s.getShaderInfoLog(t),r=i.split(`
|
|
302
|
-
`),n={},o=r.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
|
|
303
|
-
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Ip(s,t,e,i){s.getProgramParameter(t,s.LINK_STATUS)||(s.getShaderParameter(e,s.COMPILE_STATUS)||fa(s,e),s.getShaderParameter(i,s.COMPILE_STATUS)||fa(s,i),console.error("PixiJS Error: Could not initialize shader."),s.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",s.getProgramInfoLog(t)))}const Pp={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Fh(s){return Pp[s]}let cs=null;const ma={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Oh(s,t){if(!cs){const e=Object.keys(ma);cs={};for(let i=0;i<e.length;++i){const r=e[i];cs[s[r]]=ma[r]}}return cs[t]}function ga(s,t,e){if(s.substring(0,9)!=="precision"){let i=t;return t===Bt.HIGH&&e!==Bt.HIGH&&(i=Bt.MEDIUM),`precision ${i} float;
|
|
304
|
-
${s}`}else if(e!==Bt.HIGH&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}let Ii;function Rp(){if(typeof Ii=="boolean")return Ii;try{Ii=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ii=!1}return Ii}let Mp=0;const us={},wn=class ni{constructor(t,e,i="pixi-shader",r={}){this.extra={},this.id=Mp++,this.vertexSrc=t||ni.defaultVertexSrc,this.fragmentSrc=e||ni.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=r,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),us[i]?(us[i]++,i+=`-${us[i]}`):us[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
305
|
-
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
306
|
-
${this.fragmentSrc}`,this.vertexSrc=ga(this.vertexSrc,ni.defaultVertexPrecision,Bt.HIGH),this.fragmentSrc=ga(this.fragmentSrc,ni.defaultFragmentPrecision,Cp())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return wp}static get defaultFragmentSrc(){return bp}static from(t,e,i){const r=t+e;let n=ha[r];return n||(ha[r]=n=new ni(t,e,i)),n}};wn.defaultVertexPrecision=Bt.HIGH,wn.defaultFragmentPrecision=le.apple.device?Bt.HIGH:Bt.MEDIUM;let ue=wn,Bp=0;class Wt{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Bp++,this.static=!!e,this.ubo=!!i,t instanceof ht?(this.buffer=t,this.buffer.type=ee.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new ht(new Float32Array(1)),this.buffer.type=ee.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new Wt(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new Wt(t,e,i)}static uboFrom(t,e){return new Wt(t,e??!0,!0)}}class ie{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Wt?this.uniformGroup=e:this.uniformGroup=new Wt(e):this.uniformGroup=new Wt({}),this.disposeRunner=new Ht("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const r=e.uniforms[i];if(r.group===!0&&this.checkUniformExists(t,r))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){const r=ue.from(t,e);return new ie(r,i)}}class Dp{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const i=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n;this.defaultGroupCache[t]=Wt.from({uSamplers:i},!0);let r=this.fragTemplate;r=r.replace(/%count%/gi,`${t}`),r=r.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new ue(this.vertexSrc,r)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new it,default:this.defaultGroupCache[t]};return new ie(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
307
|
-
`,e+=`
|
|
308
|
-
`;for(let i=0;i<t;i++)i>0&&(e+=`
|
|
309
|
-
else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
310
|
-
{`,e+=`
|
|
311
|
-
color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
|
|
312
|
-
}`;return e+=`
|
|
313
|
-
`,e+=`
|
|
314
|
-
`,e}}class An{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function Fp(){return!le.apple.device}function Op(s){let t=!0;const e=O.ADAPTER.getNavigator();if(le.tablet||le.phone){if(le.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(le.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?s:4}class hr{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var Lp=`varying vec2 vTextureCoord;
|
|
315
|
-
varying vec4 vColor;
|
|
316
|
-
varying float vTextureId;
|
|
317
|
-
uniform sampler2D uSamplers[%count%];
|
|
318
|
-
|
|
319
|
-
void main(void){
|
|
320
|
-
vec4 color;
|
|
321
|
-
%forloop%
|
|
322
|
-
gl_FragColor = color * vColor;
|
|
323
|
-
}
|
|
324
|
-
`,Np=`precision highp float;
|
|
325
|
-
attribute vec2 aVertexPosition;
|
|
326
|
-
attribute vec2 aTextureCoord;
|
|
327
|
-
attribute vec4 aColor;
|
|
328
|
-
attribute float aTextureId;
|
|
329
|
-
|
|
330
|
-
uniform mat3 projectionMatrix;
|
|
331
|
-
uniform mat3 translationMatrix;
|
|
332
|
-
uniform vec4 tint;
|
|
333
|
-
|
|
334
|
-
varying vec2 vTextureCoord;
|
|
335
|
-
varying vec4 vColor;
|
|
336
|
-
varying float vTextureId;
|
|
337
|
-
|
|
338
|
-
void main(void){
|
|
339
|
-
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
340
|
-
|
|
341
|
-
vTextureCoord = aTextureCoord;
|
|
342
|
-
vTextureId = aTextureId;
|
|
343
|
-
vColor = aColor * tint;
|
|
344
|
-
}
|
|
345
|
-
`;const Bi=class Ut extends hr{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Rh,this.vertexSize=6,this.state=re.for2d(),this.size=Ut.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??Op(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Fp(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return K("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return Np}static get defaultFragmentTemplate(){return Lp}setShaderGenerator({vertex:t=Ut.defaultVertexSrc,fragment:e=Ut.defaultFragmentTemplate}={}){this.shaderGenerator=new Dp(t,e)}contextChange(){const t=this.renderer.gl;O.PREFER_ENV===je.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Ut.defaultMaxTextures),this.maxTextures=up(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=Ut,i=this.size/4,r=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new vn);for(;e.length<r;)e.push(new An);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,i=Ut._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++j._globalBatch,h=0,l=i[0],c=0;r.copyBoundTextures(n,e);for(let u=0;u<this._bufferSize;++u){const d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(r.boundArray(l,n,a,e),this.buildDrawCalls(l,c,u),c=u,l=i[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,a,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<n.length;u++)n[u]=null;j._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:r,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=Ut._drawCallPool;let l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let p=e;p<i;++p){const f=r[p],m=f._texture.baseTexture,g=Sh[m.alphaMode?1:0][f.blendMode];r[p]=null,e<p&&d.blend!==g&&(d.size=u-d.start,e=p,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(f,n,o,c,u),c+=f.vertexData.length/2*a,u+=f.indices.length,d.blend=g}e<i&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;Ut.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,r=Ut._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:c,blend:u}=r[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Ut.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=Ws(Math.ceil(t/8)),i=oa(e),r=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[r];return n||(this._aBuffers[r]=n=new gn(r*this.vertexSize*4)),n}getIndexBuffer(t){const e=Ws(Math.ceil(t/12)),i=oa(e),r=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(r)),n}packInterleavedGeometry(t,e,i,r,n){const{uint32View:o,float32View:a}=e,h=r/this.vertexSize,l=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),f=et.shared.setValue(t._tintRGB).toPremultiplied(p,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[r++]=u[m],a[r++]=u[m+1],a[r++]=l[m],a[r++]=l[m+1],o[r++]=f,a[r++]=d;for(let m=0;m<c.length;m++)i[n++]=h+c[m]}};Bi.defaultBatchSize=4096,Bi.extension={name:"batch",type:R.RendererPlugin},Bi._drawCallPool=[],Bi._textureArrayPool=[];let Le=Bi;N.add(Le);var Up=`varying vec2 vTextureCoord;
|
|
346
|
-
|
|
347
|
-
uniform sampler2D uSampler;
|
|
348
|
-
|
|
349
|
-
void main(void){
|
|
350
|
-
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
351
|
-
}
|
|
352
|
-
`,kp=`attribute vec2 aVertexPosition;
|
|
353
|
-
|
|
354
|
-
uniform mat3 projectionMatrix;
|
|
355
|
-
|
|
356
|
-
varying vec2 vTextureCoord;
|
|
357
|
-
|
|
358
|
-
uniform vec4 inputSize;
|
|
359
|
-
uniform vec4 outputFrame;
|
|
360
|
-
|
|
361
|
-
vec4 filterVertexPosition( void )
|
|
362
|
-
{
|
|
363
|
-
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
364
|
-
|
|
365
|
-
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
vec2 filterTextureCoord( void )
|
|
369
|
-
{
|
|
370
|
-
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
void main(void)
|
|
374
|
-
{
|
|
375
|
-
gl_Position = filterVertexPosition();
|
|
376
|
-
vTextureCoord = filterTextureCoord();
|
|
377
|
-
}
|
|
378
|
-
`;const En=class Di extends ie{constructor(t,e,i){const r=ue.from(t||Di.defaultVertexSrc,e||Di.defaultFragmentSrc);super(r,i),this.padding=0,this.resolution=Di.defaultResolution,this.multisample=Di.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new re}apply(t,e,i,r,n){t.applyFilter(this,e,i,r)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return kp}static get defaultFragmentSrc(){return Up}};En.defaultResolution=1,En.defaultMultisample=ut.NONE;let St=En;class zs{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new et(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:r}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=r}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}zs.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},zs.extension={type:[R.RendererSystem,R.CanvasRendererSystem],name:"background"};N.add(zs);class Lh{constructor(t){this.renderer=t,this.emptyRenderer=new hr(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:i}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,i,r){const{elements:n,ids:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const c=n[l],u=c._batchLocation;if(u>=0&&u<r&&e[u]===c){o[l]=u;continue}for(;h<r;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}}Lh.extension={type:R.RendererSystem,name:"batch"};N.add(Lh);let ya=0;class Vs{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=ya++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=ya++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(O.PREFER_ENV>=je.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Vs.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Vs.extension={type:R.RendererSystem,name:"context"};N.add(Vs);class Tn{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Ht("disposeFramebuffer"),this.multisample=ut.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new j(null,{scaleMode:he.NEAREST,resolution:1,mipmap:se.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new j(null,{scaleMode:he.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:se.OFF,format:S.DEPTH_COMPONENT,type:G.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const r=this.colorTextures[i],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Nh extends j{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],r=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:r,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=ut.NONE),super(null,t),this.mipmap=se.OFF,this.valid=!0,this._clear=new et([0,0,0,0]),this.framebuffer=new Tn(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class fe extends ji{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,r=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=hp(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,r){const n=t.gl,o=e.realWidth,a=e.realHeight;if(r=r||this.source,typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ct.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,r):(i.width=o,i.height=a,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class Uh extends fe{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;fe.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??O.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ct.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class no{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const r=e.width,n=e.height;if(i){const o=t.width/2/r,a=t.height/2/n,h=t.x/r+o,l=t.y/n+a;i=rt.add(i,rt.NW),this.x0=h+o*rt.uX(i),this.y0=l+a*rt.uY(i),i=rt.add(i,2),this.x1=h+o*rt.uX(i),this.y1=l+a*rt.uY(i),i=rt.add(i,2),this.x2=h+o*rt.uX(i),this.y2=l+a*rt.uY(i),i=rt.add(i,2),this.x3=h+o*rt.uX(i),this.y3=l+a*rt.uY(i)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}no.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const _a=new no;function ds(s){s.destroy=function(){},s.on=function(){},s.once=function(){},s.emit=function(){}}class L extends qi{constructor(t,e,i,r,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new z(0,0,1,1)),t instanceof L&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=_a,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new X(o.x,o.y):new X(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&Yt[e.url]&&L.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,L.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var r;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new L(this.baseTexture,!this.noFrame&&t,e,(r=this.trim)==null?void 0:r.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===_a&&(this._uvs=new no),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof j){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${ze()}`,j.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${ze()}`}n=t._pixiId}let o=Yt[n];if(r&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof j)?(e.resolution||(e.resolution=pe(t)),o=new L(new j(t,e)),o.baseTexture.cacheId=n,j.addToCache(o.baseTexture,n),L.addToCache(o,n)):!o&&t instanceof j&&(o=new L(t),L.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=L.from(t,Object.assign({resourceOptions:i},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,i,r){return new L(j.fromBuffer(t,e,i,r))}static fromLoader(t,e,i,r){const n=new j(t,Object.assign({scaleMode:j.defaultOptions.scaleMode,resolution:pe(e)},r)),{resource:o}=n;o instanceof Uh&&(o.url=e);const a=new L(n);return i||(i=e),j.addToCache(a.baseTexture,i),L.addToCache(a,i),i!==e&&(j.addToCache(a.baseTexture,e),L.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Yt[e]&&Yt[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Yt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Yt[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Yt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Yt[t.textureCacheIds[e]]===t&&delete Yt[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:r,height:n}=t,o=e+r>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return L._EMPTY||(L._EMPTY=new L(new j),ds(L._EMPTY),ds(L._EMPTY.baseTexture)),L._EMPTY}static get WHITE(){if(!L._WHITE){const t=O.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),L._WHITE=new L(j.from(t)),ds(L._WHITE),ds(L._WHITE.baseTexture)}return L._WHITE}}class qe extends L{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,o=Math.round(e*r)/r;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new qe(new Nh(t))}}class kh{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=ut.NONE){const r=new Nh(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new qe(r)}getOptimalTexture(t,e,i=1,r=ut.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Ws(t),e=Ws(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,r)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||ut.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}kh.SCREEN_KEY=-1;class Gp extends Se{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Gh extends Se{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new ht(this.vertices),this.uvBuffer=new ht(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class Hp{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ut.NONE,this.sourceFrame=new z,this.destinationFrame=new z,this.bindingSourceFrame=new z,this.bindingDestinationFrame=new z,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const ps=[new X,new X,new X,new X],Lr=new it;class Hh{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new kh,this.statePool=[],this.quad=new Gp,this.quadUv=new Gh,this.tempRect=new z,this.activeState={},this.globalUniforms=new Wt({outputFrame:new z,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const i=this.renderer,r=this.defaultFilterStack,n=this.statePool.pop()||new Hp,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,p=e[0].legacy??!0;for(let g=1;g<e.length;g++){const _=e[g];l=Math.min(l,_.resolution||a),c=Math.min(c,_.multisample??h),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,d=d&&_.autoFit,p=p||(_.legacy??!0)}r.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),r.push(n),n.resolution=l,n.multisample=c,n.legacy=p,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(u);const f=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Lr.copyFrom(i.projection.transform).invert(),f),d?(n.sourceFrame.fit(f),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(f)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,c),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const n=r.inputSize,o=r.inputPixel,a=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const l=r.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,Qt.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Qt.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Qt.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Qt.CLEAR){const{renderTexture:i,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===Qt.CLEAR||e===Qt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(te.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(te.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:r}=this.activeState,{orig:n}=e._texture,o=t.set(r.width,0,0,r.height,i.x,i.y),a=e.worldTransform.copyTo(it.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,r=ut.NONE){return this.texturePool.getOptimalTexture(t,e,i,r)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||ut.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=ps[0],r=ps[1],n=ps[2],o=ps[3];i.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,r.x,n.x,o.x),h=Math.min(i.y,r.y,n.y,o.y),l=Math.max(i.x,r.x,n.x,o.x),c=Math.max(i.y,r.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,i,r,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?Lr.copyFrom(n):Lr.identity(),n.translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Hh.extension={type:R.RendererSystem,name:"filter"};N.add(Hh);class Wp{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ut.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Xp=new z;class Wh{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Tn(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new z,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;O.PREFER_ENV===je.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),(n.width!==i||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=r,this.gl.viewport(t,e,i,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,r,n=Kr.COLOR|Kr.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,r),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new Wp(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=r[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:i}=this,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer():r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const l=n[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&r.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,r.stencil)}else r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=ut.NONE;if(t<=1||e===null)return i;for(let r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return i===1&&(i=ut.NONE),i}blit(t,e,i){const{current:r,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!r)return;const h=r.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const c=r.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Tn(r.width,r.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||(e=Xp,e.width=r.width,e.height=r.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,r=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,r):n.renderbufferStorage(n.RENDERBUFFER,h,i,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new z}destroy(){this.renderer=null}}Wh.extension={type:R.RendererSystem,name:"framebuffer"};N.add(Wh);const Nr={5126:4,5123:2,5121:1};class Xh{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;O.PREFER_ENV===je.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=r=>i.bindVertexArrayOES(r),t.deleteVertexArray=r=>i.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(r,n)=>i.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,o,a,h)=>i.drawElementsInstancedANGLE(r,n,o,a,h),t.drawArraysInstanced=(r,n,o,a)=>i.drawArraysInstancedANGLE(r,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const o=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const r=t.buffers[i];e.update(r)}}checkCompatibility(t,e){const i=t.attributes,r=e.attributeData;for(const n in r)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,r=e.attributeData,n=["g",t.id];for(const o in i)r[o]&&n.push(o,r[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const r=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let c=l[h];if(c)return l[a.id]=c,c;const u=t.buffers,d=t.attributes,p={},f={};for(const m in u)p[m]=0,f[m]=0;for(const m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),p[d[m].buffer]+=d[m].size*Nr[d[m].type];for(const m in d){const g=d[m],_=g.size;g.stride===void 0&&(p[g.buffer]===_*Nr[g.type]?g.stride=0:g.stride=p[g.buffer]),g.start===void 0&&(g.start=f[g.buffer],f[g.buffer]+=_*Nr[g.type])}c=r.createVertexArray(),r.bindVertexArray(c);for(let m=0;m<u.length;m++){const g=u[m];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,r.bindVertexArray(null),o.unbind(ee.ARRAY_BUFFER),c}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),r.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const c=a[l],u=o[c.buffer],d=u._glBuffers[r];if(e.attributeData[l]){h!==d&&(n.bind(u),h=d);const p=e.attributeData[l].location;if(i.enableVertexAttribArray(p),i.vertexAttribPointer(p,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(p,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,r){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,r||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),r||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Xh.extension={type:R.RendererSystem,name:"geometry"};N.add(Xh);const va=new it;class $h{constructor(t,e){this._texture=t,this.mapCoord=new it,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],o=t[r+1];e[r]=n*i.a+o*i.c+i.tx,e[r+1]=n*i.b+o*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const r=e.orig,n=e.trim;n&&(va.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(va));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var $p=`varying vec2 vMaskCoord;
|
|
379
|
-
varying vec2 vTextureCoord;
|
|
380
|
-
|
|
381
|
-
uniform sampler2D uSampler;
|
|
382
|
-
uniform sampler2D mask;
|
|
383
|
-
uniform float alpha;
|
|
384
|
-
uniform float npmAlpha;
|
|
385
|
-
uniform vec4 maskClamp;
|
|
386
|
-
|
|
387
|
-
void main(void)
|
|
388
|
-
{
|
|
389
|
-
float clip = step(3.5,
|
|
390
|
-
step(maskClamp.x, vMaskCoord.x) +
|
|
391
|
-
step(maskClamp.y, vMaskCoord.y) +
|
|
392
|
-
step(vMaskCoord.x, maskClamp.z) +
|
|
393
|
-
step(vMaskCoord.y, maskClamp.w));
|
|
394
|
-
|
|
395
|
-
vec4 original = texture2D(uSampler, vTextureCoord);
|
|
396
|
-
vec4 masky = texture2D(mask, vMaskCoord);
|
|
397
|
-
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
398
|
-
|
|
399
|
-
original *= (alphaMul * masky.r * alpha * clip);
|
|
400
|
-
|
|
401
|
-
gl_FragColor = original;
|
|
402
|
-
}
|
|
403
|
-
`,zp=`attribute vec2 aVertexPosition;
|
|
404
|
-
attribute vec2 aTextureCoord;
|
|
405
|
-
|
|
406
|
-
uniform mat3 projectionMatrix;
|
|
407
|
-
uniform mat3 otherMatrix;
|
|
408
|
-
|
|
409
|
-
varying vec2 vMaskCoord;
|
|
410
|
-
varying vec2 vTextureCoord;
|
|
411
|
-
|
|
412
|
-
void main(void)
|
|
413
|
-
{
|
|
414
|
-
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
415
|
-
|
|
416
|
-
vTextureCoord = aTextureCoord;
|
|
417
|
-
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
418
|
-
}
|
|
419
|
-
`;class Vp extends St{constructor(t,e,i){let r=null;typeof t!="string"&&e===void 0&&i===void 0&&(r=t,t=void 0,e=void 0,i=void 0),super(t||zp,e||$p,i),this.maskSprite=r,this.maskMatrix=new it}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,r){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new $h(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,r))}}class jp{constructor(t=null){this.type=pt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=St.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=pt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class zh{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new jp;n.pooled=!0,n.maskObject=e,i=n}const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(r),i._colorMask=r?r._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==pt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case pt.SCISSOR:this.renderer.scissor.push(i);break;case pt.STENCIL:this.renderer.stencil.push(i);break;case pt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case pt.COLOR:this.pushColorMask(i);break}i.type===pt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case pt.SCISSOR:this.renderer.scissor.pop(e);break;case pt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case pt.SPRITE:this.popSpriteMask(e);break;case pt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===pt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=pt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=pt.SCISSOR:t.type=pt.STENCIL:t.type=pt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new Vp])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,r),i.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}zh.extension={type:R.RendererSystem,name:"mask"};N.add(zh);class Vh{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==i&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const xa=new it,ba=[],jh=class Rs extends Vh{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:r}=this,n=r.renderTexture,o=i.getBounds(!0,ba.pop()??new z);this.roundFrameToPixels(o,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:r,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Rs.isMatrixRotated(e.worldTransform)||Rs.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,r,n){Rs.isMatrixRotated(n)||(n=n?xa.copyFrom(n):xa.identity(),n.translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&ba.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};jh.extension={type:R.RendererSystem,name:"scissor"};let Yp=jh;N.add(Yp);class Yh extends Vh{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;r!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(i._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Yh.extension={type:R.RendererSystem,name:"stencil"};N.add(Yh);class qh{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return K("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return K("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return K("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}qh.extension={type:[R.RendererSystem,R.CanvasRendererSystem],name:"_plugin"};N.add(qh);class Kh{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new it,this.transform=null}update(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,r){const n=this.projectionMatrix,o=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Kh.extension={type:R.RendererSystem,name:"projection"};N.add(Kh);const qp=new ro,wa=new z;class Zh{constructor(t){this.renderer=t,this._tempMatrix=new it}generateTexture(t,e){const{region:i,...r}=e||{},n=(i==null?void 0:i.copyTo(wa))||t.getLocalBounds(wa,!0),o=r.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),r.width=n.width,r.height=n.height,r.resolution=o,r.multisample??(r.multisample=this.renderer.multisample);const a=qe.create(r);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=qp,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Zh.extension={type:[R.RendererSystem,R.CanvasRendererSystem],name:"textureGenerator"};N.add(Zh);const Re=new z,Pi=new z;class Qh{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new z,this.destinationFrame=new z,this.viewportFrame=new z}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const r=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(Re.width=t.frame.width,Re.height=t.frame.height,e=Re),i||(Pi.x=t.frame.x,Pi.y=t.frame.y,Pi.width=e.width,Pi.height=e.height,i=Pi),o=n.framebuffer):(a=r.resolution,e||(Re.width=r._view.screen.width,Re.height=r._view.screen.height,e=Re),i||(i=Re,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=et.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Qh.extension={type:R.RendererSystem,name:"renderTexture"};N.add(Qh);class Kp{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Zp(s,t){const e={},i=t.getProgramParameter(s,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const n=t.getActiveAttrib(s,r);if(n.name.startsWith("gl_"))continue;const o=Oh(t,n.type),a={type:o,name:n.name,size:Fh(o),location:t.getAttribLocation(s,n.name)};e[n.name]=a}return e}function Qp(s,t){const e={},i=t.getProgramParameter(s,t.ACTIVE_UNIFORMS);for(let r=0;r<i;r++){const n=t.getActiveUniform(s,r),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=Oh(t,n.type);e[o]={name:o,index:r,type:h,size:n.size,isArray:a,value:Bh(h,n.size)}}return e}function Jp(s,t){var a;const e=pa(s,s.VERTEX_SHADER,t.vertexSrc),i=pa(s,s.FRAGMENT_SHADER,t.fragmentSrc),r=s.createProgram();s.attachShader(r,e),s.attachShader(r,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof s.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):s.transformFeedbackVaryings(r,n.names,n.bufferMode==="separate"?s.SEPARATE_ATTRIBS:s.INTERLEAVED_ATTRIBS)),s.linkProgram(r),s.getProgramParameter(r,s.LINK_STATUS)||Ip(s,r,e,i),t.attributeData=Zp(r,s),t.uniformData=Qp(r,s),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,c)=>l>c?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,s.bindAttribLocation(r,l,h[l]);s.linkProgram(r)}s.deleteShader(e),s.deleteShader(i);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:s.getUniformLocation(r,h),value:Bh(l.type,l.size)}}return new Kp(r,o)}function tf(s,t,e,i,r){e.buffer.update(r)}const ef={float:`
|
|
420
|
-
data[offset] = v;
|
|
421
|
-
`,vec2:`
|
|
422
|
-
data[offset] = v[0];
|
|
423
|
-
data[offset+1] = v[1];
|
|
424
|
-
`,vec3:`
|
|
425
|
-
data[offset] = v[0];
|
|
426
|
-
data[offset+1] = v[1];
|
|
427
|
-
data[offset+2] = v[2];
|
|
428
|
-
|
|
429
|
-
`,vec4:`
|
|
430
|
-
data[offset] = v[0];
|
|
431
|
-
data[offset+1] = v[1];
|
|
432
|
-
data[offset+2] = v[2];
|
|
433
|
-
data[offset+3] = v[3];
|
|
434
|
-
`,mat2:`
|
|
435
|
-
data[offset] = v[0];
|
|
436
|
-
data[offset+1] = v[1];
|
|
437
|
-
|
|
438
|
-
data[offset+4] = v[2];
|
|
439
|
-
data[offset+5] = v[3];
|
|
440
|
-
`,mat3:`
|
|
441
|
-
data[offset] = v[0];
|
|
442
|
-
data[offset+1] = v[1];
|
|
443
|
-
data[offset+2] = v[2];
|
|
444
|
-
|
|
445
|
-
data[offset + 4] = v[3];
|
|
446
|
-
data[offset + 5] = v[4];
|
|
447
|
-
data[offset + 6] = v[5];
|
|
448
|
-
|
|
449
|
-
data[offset + 8] = v[6];
|
|
450
|
-
data[offset + 9] = v[7];
|
|
451
|
-
data[offset + 10] = v[8];
|
|
452
|
-
`,mat4:`
|
|
453
|
-
for(var i = 0; i < 16; i++)
|
|
454
|
-
{
|
|
455
|
-
data[offset + i] = v[i];
|
|
456
|
-
}
|
|
457
|
-
`},Jh={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function sf(s){const t=s.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,r=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=Jh[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,i%e!==0&&i<16){const a=i%e%16;i+=a,r+=a}i+e>16?(r=Math.ceil(r/16)*16,o.offset=r,r+=e,i=e):(o.offset=r,i+=e,r+=e)}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}function rf(s,t){const e=[];for(const i in s)t[i]&&e.push(t[i]);return e.sort((i,r)=>i.index-r.index),e}function nf(s,t){if(!s.autoManage)return{size:0,syncFunc:tf};const e=rf(s.uniforms,t),{uboElements:i,size:r}=sf(e),n=[`
|
|
458
|
-
var v = null;
|
|
459
|
-
var v2 = null;
|
|
460
|
-
var cv = null;
|
|
461
|
-
var t = 0;
|
|
462
|
-
var gl = renderer.gl
|
|
463
|
-
var index = 0;
|
|
464
|
-
var data = buffer.data;
|
|
465
|
-
`];for(let o=0;o<i.length;o++){const a=i[o],h=s.uniforms[a.data.name],l=a.data.name;let c=!1;for(let u=0;u<mi.length;u++){const d=mi[u];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,mi[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){const u=Fh(a.data.type),d=Math.max(Jh[a.data.type]/16,1),p=u/d,f=(4-p%4)%4;n.push(`
|
|
466
|
-
cv = ud.${l}.value;
|
|
467
|
-
v = uv.${l};
|
|
468
|
-
offset = ${a.offset/4};
|
|
469
|
-
|
|
470
|
-
t = 0;
|
|
471
|
-
|
|
472
|
-
for(var i=0; i < ${a.data.size*d}; i++)
|
|
473
|
-
{
|
|
474
|
-
for(var j = 0; j < ${p}; j++)
|
|
475
|
-
{
|
|
476
|
-
data[offset++] = v[t++];
|
|
477
|
-
}
|
|
478
|
-
offset += ${f};
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
`)}else{const u=ef[a.data.type];n.push(`
|
|
482
|
-
cv = ud.${l}.value;
|
|
483
|
-
v = uv.${l};
|
|
484
|
-
offset = ${a.offset/4};
|
|
485
|
-
${u};
|
|
486
|
-
`)}}return n.push(`
|
|
487
|
-
renderer.buffer.update(buffer);
|
|
488
|
-
`),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
489
|
-
`))}}let of=0;const fs={textureCount:0,uboCount:0};class tl{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=of++}systemCheck(){if(!Rp())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(fs.textureCount=0,fs.uboCount=0,this.syncUniformGroup(t.uniformGroup,fs)),r}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Tp(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,fs,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=nf(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const r=t.uniforms,n=[`${i}-`];for(const o in r)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,r=Jp(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}tl.extension={type:R.RendererSystem,name:"shader"};N.add(tl);class js{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.0 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}js.defaultOptions={hello:!1},js.extension={type:[R.RendererSystem,R.CanvasRendererSystem],name:"startup"};N.add(js);function af(s,t=[]){return t[$.NORMAL]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.ADD]=[s.ONE,s.ONE],t[$.MULTIPLY]=[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.SCREEN]=[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.OVERLAY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.DARKEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.LIGHTEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.COLOR_DODGE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.COLOR_BURN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.HARD_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.SOFT_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.DIFFERENCE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.EXCLUSION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.HUE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.SATURATION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.COLOR]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.LUMINOSITY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.NONE]=[0,0],t[$.NORMAL_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.ADD_NPM]=[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],t[$.SCREEN_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[$.SRC_IN]=[s.DST_ALPHA,s.ZERO],t[$.SRC_OUT]=[s.ONE_MINUS_DST_ALPHA,s.ZERO],t[$.SRC_ATOP]=[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],t[$.DST_OVER]=[s.ONE_MINUS_DST_ALPHA,s.ONE],t[$.DST_IN]=[s.ZERO,s.SRC_ALPHA],t[$.DST_OUT]=[s.ZERO,s.ONE_MINUS_SRC_ALPHA],t[$.DST_ATOP]=[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],t[$.XOR]=[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],t[$.SUBTRACT]=[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD],t}const hf=0,lf=1,cf=2,uf=3,df=4,pf=5,el=class Sn{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=$.NONE,this._blendEq=!1,this.map=[],this.map[hf]=this.setBlend,this.map[lf]=this.setOffset,this.map[cf]=this.setCullFace,this.map[uf]=this.setDepthTest,this.map[df]=this.setFrontFace,this.map[pf]=this.setDepthMask,this.checks=[],this.defaultState=new re,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=af(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Sn.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Sn.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};el.extension={type:R.RendererSystem,name:"state"};let ff=el;N.add(ff);class mf extends qi{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(r=>t.systems[r]),i=[...e,...Object.keys(t.systems).filter(r=>!e.includes(r))];for(const r of i)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Ht(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=i.find(o=>this._systemsHash[o]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Fi=class Ms{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Ms.defaultMaxIdle,this.checkCountMax=Ms.defaultCheckCountMax,this.mode=Ms.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Yn.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let r=0;r<e.length;r++){const n=e[r];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,i=!0)}if(i){let r=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[r++]=e[n]);e.length=r}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};Fi.defaultMode=Yn.AUTO,Fi.defaultMaxIdle=60*60,Fi.defaultCheckCountMax=60*10,Fi.extension={type:R.RendererSystem,name:"textureGC"};let Ne=Fi;N.add(Ne);class Ur{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=G.UNSIGNED_BYTE,this.internalFormat=S.RGBA,this.samplerType=0}}function gf(s){let t;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?t={[s.RGB]:F.FLOAT,[s.RGBA]:F.FLOAT,[s.ALPHA]:F.FLOAT,[s.LUMINANCE]:F.FLOAT,[s.LUMINANCE_ALPHA]:F.FLOAT,[s.R8]:F.FLOAT,[s.R8_SNORM]:F.FLOAT,[s.RG8]:F.FLOAT,[s.RG8_SNORM]:F.FLOAT,[s.RGB8]:F.FLOAT,[s.RGB8_SNORM]:F.FLOAT,[s.RGB565]:F.FLOAT,[s.RGBA4]:F.FLOAT,[s.RGB5_A1]:F.FLOAT,[s.RGBA8]:F.FLOAT,[s.RGBA8_SNORM]:F.FLOAT,[s.RGB10_A2]:F.FLOAT,[s.RGB10_A2UI]:F.FLOAT,[s.SRGB8]:F.FLOAT,[s.SRGB8_ALPHA8]:F.FLOAT,[s.R16F]:F.FLOAT,[s.RG16F]:F.FLOAT,[s.RGB16F]:F.FLOAT,[s.RGBA16F]:F.FLOAT,[s.R32F]:F.FLOAT,[s.RG32F]:F.FLOAT,[s.RGB32F]:F.FLOAT,[s.RGBA32F]:F.FLOAT,[s.R11F_G11F_B10F]:F.FLOAT,[s.RGB9_E5]:F.FLOAT,[s.R8I]:F.INT,[s.R8UI]:F.UINT,[s.R16I]:F.INT,[s.R16UI]:F.UINT,[s.R32I]:F.INT,[s.R32UI]:F.UINT,[s.RG8I]:F.INT,[s.RG8UI]:F.UINT,[s.RG16I]:F.INT,[s.RG16UI]:F.UINT,[s.RG32I]:F.INT,[s.RG32UI]:F.UINT,[s.RGB8I]:F.INT,[s.RGB8UI]:F.UINT,[s.RGB16I]:F.INT,[s.RGB16UI]:F.UINT,[s.RGB32I]:F.INT,[s.RGB32UI]:F.UINT,[s.RGBA8I]:F.INT,[s.RGBA8UI]:F.UINT,[s.RGBA16I]:F.INT,[s.RGBA16UI]:F.UINT,[s.RGBA32I]:F.INT,[s.RGBA32UI]:F.UINT,[s.DEPTH_COMPONENT16]:F.FLOAT,[s.DEPTH_COMPONENT24]:F.FLOAT,[s.DEPTH_COMPONENT32F]:F.FLOAT,[s.DEPTH_STENCIL]:F.FLOAT,[s.DEPTH24_STENCIL8]:F.FLOAT,[s.DEPTH32F_STENCIL8]:F.FLOAT}:t={[s.RGB]:F.FLOAT,[s.RGBA]:F.FLOAT,[s.ALPHA]:F.FLOAT,[s.LUMINANCE]:F.FLOAT,[s.LUMINANCE_ALPHA]:F.FLOAT,[s.DEPTH_STENCIL]:F.FLOAT},t}function yf(s){let t;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?t={[G.UNSIGNED_BYTE]:{[S.RGBA]:s.RGBA8,[S.RGB]:s.RGB8,[S.RG]:s.RG8,[S.RED]:s.R8,[S.RGBA_INTEGER]:s.RGBA8UI,[S.RGB_INTEGER]:s.RGB8UI,[S.RG_INTEGER]:s.RG8UI,[S.RED_INTEGER]:s.R8UI,[S.ALPHA]:s.ALPHA,[S.LUMINANCE]:s.LUMINANCE,[S.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[G.BYTE]:{[S.RGBA]:s.RGBA8_SNORM,[S.RGB]:s.RGB8_SNORM,[S.RG]:s.RG8_SNORM,[S.RED]:s.R8_SNORM,[S.RGBA_INTEGER]:s.RGBA8I,[S.RGB_INTEGER]:s.RGB8I,[S.RG_INTEGER]:s.RG8I,[S.RED_INTEGER]:s.R8I},[G.UNSIGNED_SHORT]:{[S.RGBA_INTEGER]:s.RGBA16UI,[S.RGB_INTEGER]:s.RGB16UI,[S.RG_INTEGER]:s.RG16UI,[S.RED_INTEGER]:s.R16UI,[S.DEPTH_COMPONENT]:s.DEPTH_COMPONENT16},[G.SHORT]:{[S.RGBA_INTEGER]:s.RGBA16I,[S.RGB_INTEGER]:s.RGB16I,[S.RG_INTEGER]:s.RG16I,[S.RED_INTEGER]:s.R16I},[G.UNSIGNED_INT]:{[S.RGBA_INTEGER]:s.RGBA32UI,[S.RGB_INTEGER]:s.RGB32UI,[S.RG_INTEGER]:s.RG32UI,[S.RED_INTEGER]:s.R32UI,[S.DEPTH_COMPONENT]:s.DEPTH_COMPONENT24},[G.INT]:{[S.RGBA_INTEGER]:s.RGBA32I,[S.RGB_INTEGER]:s.RGB32I,[S.RG_INTEGER]:s.RG32I,[S.RED_INTEGER]:s.R32I},[G.FLOAT]:{[S.RGBA]:s.RGBA32F,[S.RGB]:s.RGB32F,[S.RG]:s.RG32F,[S.RED]:s.R32F,[S.DEPTH_COMPONENT]:s.DEPTH_COMPONENT32F},[G.HALF_FLOAT]:{[S.RGBA]:s.RGBA16F,[S.RGB]:s.RGB16F,[S.RG]:s.RG16F,[S.RED]:s.R16F},[G.UNSIGNED_SHORT_5_6_5]:{[S.RGB]:s.RGB565},[G.UNSIGNED_SHORT_4_4_4_4]:{[S.RGBA]:s.RGBA4},[G.UNSIGNED_SHORT_5_5_5_1]:{[S.RGBA]:s.RGB5_A1},[G.UNSIGNED_INT_2_10_10_10_REV]:{[S.RGBA]:s.RGB10_A2,[S.RGBA_INTEGER]:s.RGB10_A2UI},[G.UNSIGNED_INT_10F_11F_11F_REV]:{[S.RGB]:s.R11F_G11F_B10F},[G.UNSIGNED_INT_5_9_9_9_REV]:{[S.RGB]:s.RGB9_E5},[G.UNSIGNED_INT_24_8]:{[S.DEPTH_STENCIL]:s.DEPTH24_STENCIL8},[G.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[S.DEPTH_STENCIL]:s.DEPTH32F_STENCIL8}}:t={[G.UNSIGNED_BYTE]:{[S.RGBA]:s.RGBA,[S.RGB]:s.RGB,[S.ALPHA]:s.ALPHA,[S.LUMINANCE]:s.LUMINANCE,[S.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[G.UNSIGNED_SHORT_5_6_5]:{[S.RGB]:s.RGB},[G.UNSIGNED_SHORT_4_4_4_4]:{[S.RGBA]:s.RGBA},[G.UNSIGNED_SHORT_5_5_5_1]:{[S.RGBA]:s.RGBA}},t}class il{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new j,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=yf(t),this.samplerTypes=gf(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};const i=new Ur(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ur(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let r=0;r<this.boundTextures.length;r++)this.bind(null,r)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[r].samplerType!==F.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Ur(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??F.FLOAT,this.webGLVersion===2&&t.type===G.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var r;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(r=t.resource)==null?void 0:r.upload(i,t,e))e.samplerType!==F.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&fi(this.managedTextures,r,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===se.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Te.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==se.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===he.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===he.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===he.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===he.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}il.extension={type:R.RendererSystem,name:"texture"};N.add(il);class sl{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,r=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:r}=this;e&&r.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}sl.extension={type:R.RendererSystem,name:"transformFeedback"};N.add(sl);class Ys{constructor(t){this.renderer=t}init(t){this.screen=new z(0,0,t.width,t.height),this.element=t.view||O.ADAPTER.createCanvas(),this.resolution=t.resolution||O.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Ys.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Ys.extension={type:[R.RendererSystem,R.CanvasRendererSystem],name:"_view"};N.add(Ys);O.PREFER_ENV=je.WEBGL2;O.STRICT_TEXTURE_CACHE=!1;O.RENDER_OPTIONS={...Vs.defaultOptions,...zs.defaultOptions,...Ys.defaultOptions,...js.defaultOptions};Object.defineProperties(O,{WRAP_MODE:{get(){return j.defaultOptions.wrapMode},set(s){K("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),j.defaultOptions.wrapMode=s}},SCALE_MODE:{get(){return j.defaultOptions.scaleMode},set(s){K("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),j.defaultOptions.scaleMode=s}},MIPMAP_TEXTURES:{get(){return j.defaultOptions.mipmap},set(s){K("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),j.defaultOptions.mipmap=s}},ANISOTROPIC_LEVEL:{get(){return j.defaultOptions.anisotropicLevel},set(s){K("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),j.defaultOptions.anisotropicLevel=s}},FILTER_RESOLUTION:{get(){return K("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),St.defaultResolution},set(s){St.defaultResolution=s}},FILTER_MULTISAMPLE:{get(){return K("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),St.defaultMultisample},set(s){St.defaultMultisample=s}},SPRITE_MAX_TEXTURES:{get(){return Le.defaultMaxTextures},set(s){K("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Le.defaultMaxTextures=s}},SPRITE_BATCH_SIZE:{get(){return Le.defaultBatchSize},set(s){K("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Le.defaultBatchSize=s}},CAN_UPLOAD_SAME_BUFFER:{get(){return Le.canUploadSameBuffer},set(s){K("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Le.canUploadSameBuffer=s}},GC_MODE:{get(){return Ne.defaultMode},set(s){K("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Ne.defaultMode=s}},GC_MAX_IDLE:{get(){return Ne.defaultMaxIdle},set(s){K("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Ne.defaultMaxIdle=s}},GC_MAX_CHECK_COUNT:{get(){return Ne.defaultCheckCountMax},set(s){K("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Ne.defaultCheckCountMax=s}},PRECISION_VERTEX:{get(){return ue.defaultVertexPrecision},set(s){K("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),ue.defaultVertexPrecision=s}},PRECISION_FRAGMENT:{get(){return ue.defaultFragmentPrecision},set(s){K("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),ue.defaultFragmentPrecision=s}}});var Ve=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(Ve||{});class kr{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const rl=class Rt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new kr(null,null,1/0),this.deltaMS=1/Rt.targetFPMS,this.elapsedMS=1/Rt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Ve.NORMAL){return this._addListener(new kr(t,e,i))}addOnce(t,e,i=Ve.NORMAL){return this._addListener(new kr(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Rt.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Rt.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Rt._shared){const t=Rt._shared=new Rt;t.autoStart=!0,t._protected=!0}return Rt._shared}static get system(){if(!Rt._system){const t=Rt._system=new Rt;t.autoStart=!0,t._protected=!0}return Rt._system}};rl.targetFPMS=.06;let It=rl;Object.defineProperties(O,{TARGET_FPMS:{get(){return It.targetFPMS},set(s){K("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),It.targetFPMS=s}}});class nl{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ve.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?It.shared:new It,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}nl.extension=R.Application;N.add(nl);const ol=[];N.handleByList(R.Renderer,ol);function _f(s){for(const t of ol)if(t.test(s))return new t(s);throw new Error("Unable to auto-detect a suitable renderer.")}var vf=`attribute vec2 aVertexPosition;
|
|
490
|
-
attribute vec2 aTextureCoord;
|
|
491
|
-
|
|
492
|
-
uniform mat3 projectionMatrix;
|
|
493
|
-
|
|
494
|
-
varying vec2 vTextureCoord;
|
|
495
|
-
|
|
496
|
-
void main(void)
|
|
497
|
-
{
|
|
498
|
-
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
499
|
-
vTextureCoord = aTextureCoord;
|
|
500
|
-
}`,xf=`attribute vec2 aVertexPosition;
|
|
501
|
-
|
|
502
|
-
uniform mat3 projectionMatrix;
|
|
503
|
-
|
|
504
|
-
varying vec2 vTextureCoord;
|
|
505
|
-
|
|
506
|
-
uniform vec4 inputSize;
|
|
507
|
-
uniform vec4 outputFrame;
|
|
508
|
-
|
|
509
|
-
vec4 filterVertexPosition( void )
|
|
510
|
-
{
|
|
511
|
-
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
512
|
-
|
|
513
|
-
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
vec2 filterTextureCoord( void )
|
|
517
|
-
{
|
|
518
|
-
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
void main(void)
|
|
522
|
-
{
|
|
523
|
-
gl_Position = filterVertexPosition();
|
|
524
|
-
vTextureCoord = filterTextureCoord();
|
|
525
|
-
}
|
|
526
|
-
`;const bf=vf,al=xf;class hl{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=ut.HIGH?this.multisample=ut.HIGH:e>=ut.MEDIUM?this.multisample=ut.MEDIUM:e>=ut.LOW?this.multisample=ut.LOW:this.multisample=ut.NONE}destroy(){}}hl.extension={type:R.RendererSystem,name:"_multisample"};N.add(hl);class wf{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class ll{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:r,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new wf(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}ll.extension={type:R.RendererSystem,name:"buffer"};N.add(ll);class cl{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let r,n,o,a;if(e&&(r=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(r||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(e.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}cl.extension={type:R.RendererSystem,name:"objectRenderer"};N.add(cl);const Bs=class Cn extends mf{constructor(t){super(),this.type=th.WEBGL,t=Object.assign({},O.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Wt({projectionMatrix:new it},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Cn.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(K("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Cn.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:$d()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return K("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return K("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return K("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return K("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){K("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return K("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){K("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return K("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Bs.extension={type:R.Renderer,priority:1},Bs.__plugins={},Bs.__systems={};let oo=Bs;N.handleByMap(R.RendererPlugin,oo.__plugins);N.handleByMap(R.RendererSystem,oo.__systems);N.add(oo);class ul extends ji{constructor(t,e){const{width:i,height:r}=e||{};super(i,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new j;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof ji?this.addResourceAt(t[i],i):this.addResourceAt(Ph(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Af extends ul{constructor(t,e){const{width:i,height:r}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ui.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:r,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,e.format,i.type,null);for(let h=0;h<r;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class Ef extends fe{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const dl=class Oi extends ul{constructor(t,e){const{width:i,height:r,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Oi.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:r});for(let a=0;a<Oi.SIDES;a++)this.items[a].target=ui.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=ui.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ui.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const r=this.itemDirtyIds;for(let n=0;n<Oi.SIDES;n++){const o=this.items[n];(r[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),r[n]=o.dirtyId):r[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),r[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Oi.SIDES}};dl.SIDES=6;let Tf=dl;class ci extends fe{constructor(t,e){e=e||{};let i,r,n;typeof t=="string"?(i=ci.EMPTY,r=t,n=!0):(i=t,r=null,n=!1),super(i),this.url=r,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await O.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ct.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ci._EMPTY=ci._EMPTY??O.ADAPTER.createCanvas(0,0),ci._EMPTY}}const In=class Ds extends fe{constructor(t,e){e=e||{},super(O.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Ds.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;fe.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),r=Math.round(r),n=Math.round(n);const o=this.source;o.width=r,o.height=n,o._pixiId=`canvas_${ze()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Ds.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Ds.SVG_XML.test(t)}};In.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,In.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Pn=In;class Sf extends fe{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Rn=class Mn extends fe{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];fe.crossOrigin(i,r,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||Mn.MIME_TYPES[c]||`video/${c}`}o.src=a,h&&(o.type=h),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=It.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(It.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(It.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(It.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Mn.TYPES.includes(e)}};Rn.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Rn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let pl=Rn;yn.push(ci,Uh,Ef,pl,Sf,Pn,rr,Tf,Af);class qs{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?z.EMPTY:(t=t||new z(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:r,c:n,d:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,c=r*e.x+o*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,r=o>r?o:r,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)}addFrameMatrix(t,e,i,r,n){const o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,p=this.minY,f=this.maxX,m=this.maxY,g=o*e+h*i+c,_=a*e+l*i+u;d=g<d?g:d,p=_<p?_:p,f=g>f?g:f,m=_>m?_:m,g=o*r+h*i+c,_=a*r+l*i+u,d=g<d?g:d,p=_<p?_:p,f=g>f?g:f,m=_>m?_:m,g=o*e+h*n+c,_=a*e+l*n+u,d=g<d?g:d,p=_<p?_:p,f=g>f?g:f,m=_>m?_:m,g=o*r+h*n+c,_=a*r+l*n+u,d=g<d?g:d,p=_<p?_:p,f=g>f?g:f,m=_>m?_:m,this.minX=d,this.minY=p,this.maxX=f,this.maxY=m}addVertexData(t,e,i){let r=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=e;h<i;h+=2){const l=t[h],c=t[h+1];r=l<r?l:r,n=c<n?c:n,o=l>o?l:o,a=c>a?c:a}this.minX=r,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)}addVerticesMatrix(t,e,i,r,n=0,o=n){const a=t.a,h=t.b,l=t.c,c=t.d,u=t.tx,d=t.ty;let p=this.minX,f=this.minY,m=this.maxX,g=this.maxY;for(let _=i;_<r;_+=2){const x=e[_],y=e[_+1],v=a*x+l*y+u,A=c*y+h*x+d;p=Math.min(p,v-n),m=Math.max(m,v+n),f=Math.min(f,A-o),g=Math.max(g,A+o)}this.minX=p,this.minY=f,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&r<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&r<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,r,n,o){t-=n,e-=o,i+=n,r+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class ot extends qi{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ro,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new qs,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const r=e[i];Object.defineProperty(ot.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new z),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new z),t=this._localBoundsRect),this._localBounds||(this._localBounds=new qs);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,r=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Cf),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*_p}set angle(t){this.transform.rotation=t*vp}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class Cf extends ot{constructor(){super(...arguments),this.sortDirty=null}}ot.prototype.displayObjectUpdateTransform=ot.prototype.updateTransform;const If=new it;function Pf(s,t){return s.zIndex===t.zIndex?s._lastSortedIndex-t._lastSortedIndex:s.zIndex-t.zIndex}const fl=class Bn extends ot{constructor(){super(),this.children=[],this.sortableChildren=Bn.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);fi(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,fi(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,fi(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,r=e,n=r-i;let o;if(n>0&&n<=r){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const r=this.children[e];r._lastSortedIndex=e,!t&&r.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Pf),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let r=0,n=this.children.length;r<n;++r){const o=this.children[r];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,r;this.cullArea?(i=this.cullArea,r=this.worldTransform):this._render!==Bn.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=If.copyFrom(r),r.prepend(n)):r=n),i&&e.intersects(i,r))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,r=this.children.length;i<r;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const r=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==pt.NONE));if(r&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}r&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let r=0;r<i.length;++r)i[r].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};fl.defaultSortableChildren=!1;let Ft=fl;Ft.prototype.containerUpdateTransform=Ft.prototype.updateTransform;Object.defineProperties(O,{SORTABLE_CHILDREN:{get(){return Ft.defaultSortableChildren},set(s){K("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Ft.defaultSortableChildren=s}}});const Ri=new X,Rf=new Uint16Array([0,1,2,0,2,3]);class Ke extends Ft{constructor(t){super(),this._anchor=new ce(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new et(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=$.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||L.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Rf,this.pluginName="batch",this.isSprite=!0,this._roundPixels=O.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Ae(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Ae(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let p=0,f=0,m=0,g=0;if(c?(f=c.x-d._x*u.width,p=f+c.width,g=c.y-d._y*u.height,m=g+c.height):(f=-d._x*u.width,p=f+u.width,g=-d._y*u.height,m=g+u.height),l[0]=i*f+n*g+a,l[1]=o*g+r*f+h,l[2]=i*p+n*g+a,l[3]=o*g+r*p+h,l[4]=i*p+n*m+a,l[5]=o*m+r*p+h,l[6]=i*f+n*m+a,l[7]=o*m+r*f+h,this._roundPixels){const _=O.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*_)/_}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty,d=-r._x*i.width,p=d+i.width,f=-r._y*i.height,m=f+i.height;if(e[0]=o*d+h*f+c,e[1]=l*f+a*d+u,e[2]=o*p+h*f+c,e[3]=l*f+a*p+u,e[4]=o*p+h*m+c,e[5]=l*m+a*p+u,e[6]=o*d+h*m+c,e[7]=l*m+a*d+u,this._roundPixels){const g=O.RESOLUTION;for(let _=0;_<e.length;++_)e[_]=Math.round(e[_]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new qs),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new z),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Ri);const e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return Ri.x>=r&&Ri.x<r+e&&(n=-i*this.anchor.y,Ri.y>=n&&Ri.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof L?t:L.from(t,e);return new Ke(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=Ae(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=Ae(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||L.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const ml=new it;ot.prototype._cacheAsBitmap=!1;ot.prototype._cacheData=null;ot.prototype._cacheAsBitmapResolution=null;ot.prototype._cacheAsBitmapMultisample=null;class Mf{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(ot.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(s){s!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(s){s!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(s){if(this._cacheAsBitmap===s)return;this._cacheAsBitmap=s;let t;s?(this._cacheData||(this._cacheData=new Mf),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}});ot.prototype._renderCached=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(s),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(s))};ot.prototype._initCachedDisplayObject=function(s){var d,p;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,s.batch.flush();const e=this.getLocalBounds(new z,!0);if((p=this.filters)!=null&&p.length){const f=this.filters[0].padding;e.pad(f)}const i=this.cacheAsBitmapResolution||s.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const r=s.renderTexture.current,n=s.renderTexture.sourceFrame.clone(),o=s.renderTexture.destinationFrame.clone(),a=s.projection.transform,h=qe.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??s.multisample}),l=`cacheAsBitmap_${ze()}`;this._cacheData.textureCacheId=l,j.addToCache(h.baseTexture,l),L.addToCache(h,l);const c=this.transform.localTransform.copyTo(ml).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,s.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),s.framebuffer.blit(),s.projection.transform=a,s.renderTexture.bind(r,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const u=new Ke(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)};ot.prototype._renderCachedCanvas=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(s),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(s))};ot.prototype._initCachedDisplayObjectCanvas=function(s){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new z,!0),e=this.alpha;this.alpha=1;const i=s.canvasContext.activeContext,r=s._projTransform,n=this.cacheAsBitmapResolution||s.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=qe.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${ze()}`;this._cacheData.textureCacheId=a,j.addToCache(o.baseTexture,a),L.addToCache(o,a);const h=ml;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,s.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),s.canvasContext.activeContext=i,s._projTransform=r,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new Ke(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=s._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)};ot.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};ot.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};ot.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,j.removeFromCache(this._cacheData.textureCacheId),L.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};ot.prototype._cacheAsBitmapDestroy=function(s){this.cacheAsBitmap=!1,this.destroy(s)};ot.prototype.name=null;Ft.prototype.getChildByName=function(s,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===s)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const r=this.children[e];if(!r.getChildByName)continue;const n=r.getChildByName(s,!0);if(n)return n}return null};ot.prototype.getGlobalPosition=function(s=new X,t=!1){return this.parent?this.parent.toGlobal(this.position,s,t):(s.x=this.position.x,s.y=this.position.y),s};var Bf=`varying vec2 vTextureCoord;
|
|
527
|
-
|
|
528
|
-
uniform sampler2D uSampler;
|
|
529
|
-
uniform float uAlpha;
|
|
530
|
-
|
|
531
|
-
void main(void)
|
|
532
|
-
{
|
|
533
|
-
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
534
|
-
}
|
|
535
|
-
`;class Df extends St{constructor(t=1){super(bf,Bf,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Ff={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Of=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
536
|
-
`);function Lf(s){const t=Ff[s],e=t.length;let i=Of,r="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<s;a++){let h=n.replace("%index%",a.toString());o=a,a>=e&&(o=s-a-1),h=h.replace("%value%",t[o].toString()),r+=h,r+=`
|
|
537
|
-
`}return i=i.replace("%blur%",r),i=i.replace("%size%",s.toString()),i}const Nf=`
|
|
538
|
-
attribute vec2 aVertexPosition;
|
|
539
|
-
|
|
540
|
-
uniform mat3 projectionMatrix;
|
|
541
|
-
|
|
542
|
-
uniform float strength;
|
|
543
|
-
|
|
544
|
-
varying vec2 vBlurTexCoords[%size%];
|
|
545
|
-
|
|
546
|
-
uniform vec4 inputSize;
|
|
547
|
-
uniform vec4 outputFrame;
|
|
548
|
-
|
|
549
|
-
vec4 filterVertexPosition( void )
|
|
550
|
-
{
|
|
551
|
-
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
552
|
-
|
|
553
|
-
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
vec2 filterTextureCoord( void )
|
|
557
|
-
{
|
|
558
|
-
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
void main(void)
|
|
562
|
-
{
|
|
563
|
-
gl_Position = filterVertexPosition();
|
|
564
|
-
|
|
565
|
-
vec2 textureCoord = filterTextureCoord();
|
|
566
|
-
%blur%
|
|
567
|
-
}`;function Uf(s,t){const e=Math.ceil(s/2);let i=Nf,r="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<s;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),r+=a,r+=`
|
|
568
|
-
`}return i=i.replace("%blur%",r),i=i.replace("%size%",s.toString()),i}class Dn extends St{constructor(t,e=8,i=4,r=St.defaultResolution,n=5){const o=Uf(n,t),a=Lf(n);super(o,a),this.horizontal=t,this.resolution=r,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,r){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,e,i,r);else{const n=t.getFilterTexture(),o=t.renderer;let a=e,h=n;this.state.blend=!1,t.applyFilter(this,a,h,Qt.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(a,Qt.BLIT),this.uniforms.uSampler=h;const c=h;h=a,a=c,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,h,i,r),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class kf extends St{constructor(t=8,e=4,i=St.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Dn(!0,t,e,i,r),this.blurYFilter=new Dn(!1,t,e,i,r),this.resolution=i,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,r){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=t.getFilterTexture();this.blurXFilter.apply(t,e,a,Qt.CLEAR),this.blurYFilter.apply(t,a,i,r),t.returnFilterTexture(a)}else o?this.blurYFilter.apply(t,e,i,r):this.blurXFilter.apply(t,e,i,r)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var Gf=`varying vec2 vTextureCoord;
|
|
569
|
-
uniform sampler2D uSampler;
|
|
570
|
-
uniform float m[20];
|
|
571
|
-
uniform float uAlpha;
|
|
572
|
-
|
|
573
|
-
void main(void)
|
|
574
|
-
{
|
|
575
|
-
vec4 c = texture2D(uSampler, vTextureCoord);
|
|
576
|
-
|
|
577
|
-
if (uAlpha == 0.0) {
|
|
578
|
-
gl_FragColor = c;
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
583
|
-
if (c.a > 0.0) {
|
|
584
|
-
c.rgb /= c.a;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
vec4 result;
|
|
588
|
-
|
|
589
|
-
result.r = (m[0] * c.r);
|
|
590
|
-
result.r += (m[1] * c.g);
|
|
591
|
-
result.r += (m[2] * c.b);
|
|
592
|
-
result.r += (m[3] * c.a);
|
|
593
|
-
result.r += m[4];
|
|
594
|
-
|
|
595
|
-
result.g = (m[5] * c.r);
|
|
596
|
-
result.g += (m[6] * c.g);
|
|
597
|
-
result.g += (m[7] * c.b);
|
|
598
|
-
result.g += (m[8] * c.a);
|
|
599
|
-
result.g += m[9];
|
|
600
|
-
|
|
601
|
-
result.b = (m[10] * c.r);
|
|
602
|
-
result.b += (m[11] * c.g);
|
|
603
|
-
result.b += (m[12] * c.b);
|
|
604
|
-
result.b += (m[13] * c.a);
|
|
605
|
-
result.b += m[14];
|
|
606
|
-
|
|
607
|
-
result.a = (m[15] * c.r);
|
|
608
|
-
result.a += (m[16] * c.g);
|
|
609
|
-
result.a += (m[17] * c.b);
|
|
610
|
-
result.a += (m[18] * c.a);
|
|
611
|
-
result.a += m[19];
|
|
612
|
-
|
|
613
|
-
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
|
614
|
-
|
|
615
|
-
// Premultiply alpha again.
|
|
616
|
-
rgb *= result.a;
|
|
617
|
-
|
|
618
|
-
gl_FragColor = vec4(rgb, result.a);
|
|
619
|
-
}
|
|
620
|
-
`;class Fn extends St{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(al,Gf,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,r,n]=et.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,r,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),r=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),h=i+(1-i)*o,l=o*(1-i)-a*r,c=o*(1-i)+a*r,u=o*(1-i)+a*r,d=i+o*(1-i),p=o*(1-i)-a*r,f=o*(1-i)-a*r,m=o*(1-i)+a*r,g=i+o*(1-i),_=[h,l,c,0,0,u,d,p,0,0,f,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const i=(t||0)+1,r=-.5*(i-1),n=[i,0,0,0,r,0,i,0,0,r,0,0,i,0,r,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,r=(i-1)*-.5,n=[i,r,r,0,0,r,i,r,0,0,r,r,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,r,n){t=t||.2,e=e||.15,i=i||16770432,r=r||3375104;const o=et.shared,[a,h,l]=o.setValue(i).toArray(),[c,u,d]=o.setValue(r).toArray(),p=[.3,.59,.11,0,0,a,h,l,t,0,c,u,d,e,0,a-c,h-u,l-d,0,0];this._loadMatrix(p,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}Fn.prototype.grayscale=Fn.prototype.greyscale;var Hf=`varying vec2 vFilterCoord;
|
|
621
|
-
varying vec2 vTextureCoord;
|
|
622
|
-
|
|
623
|
-
uniform vec2 scale;
|
|
624
|
-
uniform mat2 rotation;
|
|
625
|
-
uniform sampler2D uSampler;
|
|
626
|
-
uniform sampler2D mapSampler;
|
|
627
|
-
|
|
628
|
-
uniform highp vec4 inputSize;
|
|
629
|
-
uniform vec4 inputClamp;
|
|
630
|
-
|
|
631
|
-
void main(void)
|
|
632
|
-
{
|
|
633
|
-
vec4 map = texture2D(mapSampler, vFilterCoord);
|
|
634
|
-
|
|
635
|
-
map -= 0.5;
|
|
636
|
-
map.xy = scale * inputSize.zw * (rotation * map.xy);
|
|
637
|
-
|
|
638
|
-
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
639
|
-
}
|
|
640
|
-
`,Wf=`attribute vec2 aVertexPosition;
|
|
641
|
-
|
|
642
|
-
uniform mat3 projectionMatrix;
|
|
643
|
-
uniform mat3 filterMatrix;
|
|
644
|
-
|
|
645
|
-
varying vec2 vTextureCoord;
|
|
646
|
-
varying vec2 vFilterCoord;
|
|
647
|
-
|
|
648
|
-
uniform vec4 inputSize;
|
|
649
|
-
uniform vec4 outputFrame;
|
|
650
|
-
|
|
651
|
-
vec4 filterVertexPosition( void )
|
|
652
|
-
{
|
|
653
|
-
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
654
|
-
|
|
655
|
-
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
vec2 filterTextureCoord( void )
|
|
659
|
-
{
|
|
660
|
-
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
void main(void)
|
|
664
|
-
{
|
|
665
|
-
gl_Position = filterVertexPosition();
|
|
666
|
-
vTextureCoord = filterTextureCoord();
|
|
667
|
-
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
668
|
-
}
|
|
669
|
-
`;class Xf extends St{constructor(t,e){const i=new it;t.renderable=!1,super(Wf,Hf,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,e==null&&(e=20),this.scale=new X(e,e)}apply(t,e,i,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),t.applyFilter(this,e,i,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var $f=`varying vec2 v_rgbNW;
|
|
670
|
-
varying vec2 v_rgbNE;
|
|
671
|
-
varying vec2 v_rgbSW;
|
|
672
|
-
varying vec2 v_rgbSE;
|
|
673
|
-
varying vec2 v_rgbM;
|
|
674
|
-
|
|
675
|
-
varying vec2 vFragCoord;
|
|
676
|
-
uniform sampler2D uSampler;
|
|
677
|
-
uniform highp vec4 inputSize;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
Basic FXAA implementation based on the code on geeks3d.com with the
|
|
682
|
-
modification that the texture2DLod stuff was removed since it's
|
|
683
|
-
unsupported by WebGL.
|
|
684
|
-
|
|
685
|
-
--
|
|
686
|
-
|
|
687
|
-
From:
|
|
688
|
-
https://github.com/mitsuhiko/webgl-meincraft
|
|
689
|
-
|
|
690
|
-
Copyright (c) 2011 by Armin Ronacher.
|
|
691
|
-
|
|
692
|
-
Some rights reserved.
|
|
693
|
-
|
|
694
|
-
Redistribution and use in source and binary forms, with or without
|
|
695
|
-
modification, are permitted provided that the following conditions are
|
|
696
|
-
met:
|
|
697
|
-
|
|
698
|
-
* Redistributions of source code must retain the above copyright
|
|
699
|
-
notice, this list of conditions and the following disclaimer.
|
|
700
|
-
|
|
701
|
-
* Redistributions in binary form must reproduce the above
|
|
702
|
-
copyright notice, this list of conditions and the following
|
|
703
|
-
disclaimer in the documentation and/or other materials provided
|
|
704
|
-
with the distribution.
|
|
705
|
-
|
|
706
|
-
* The names of the contributors may not be used to endorse or
|
|
707
|
-
promote products derived from this software without specific
|
|
708
|
-
prior written permission.
|
|
709
|
-
|
|
710
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
711
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
712
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
713
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
714
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
715
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
716
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
717
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
718
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
719
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
720
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
721
|
-
*/
|
|
722
|
-
|
|
723
|
-
#ifndef FXAA_REDUCE_MIN
|
|
724
|
-
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
|
725
|
-
#endif
|
|
726
|
-
#ifndef FXAA_REDUCE_MUL
|
|
727
|
-
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
|
728
|
-
#endif
|
|
729
|
-
#ifndef FXAA_SPAN_MAX
|
|
730
|
-
#define FXAA_SPAN_MAX 8.0
|
|
731
|
-
#endif
|
|
732
|
-
|
|
733
|
-
//optimized version for mobile, where dependent
|
|
734
|
-
//texture reads can be a bottleneck
|
|
735
|
-
vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
|
|
736
|
-
vec2 v_rgbNW, vec2 v_rgbNE,
|
|
737
|
-
vec2 v_rgbSW, vec2 v_rgbSE,
|
|
738
|
-
vec2 v_rgbM) {
|
|
739
|
-
vec4 color;
|
|
740
|
-
vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
|
|
741
|
-
vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
|
|
742
|
-
vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
|
|
743
|
-
vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
|
|
744
|
-
vec4 texColor = texture2D(tex, v_rgbM);
|
|
745
|
-
vec3 rgbM = texColor.xyz;
|
|
746
|
-
vec3 luma = vec3(0.299, 0.587, 0.114);
|
|
747
|
-
float lumaNW = dot(rgbNW, luma);
|
|
748
|
-
float lumaNE = dot(rgbNE, luma);
|
|
749
|
-
float lumaSW = dot(rgbSW, luma);
|
|
750
|
-
float lumaSE = dot(rgbSE, luma);
|
|
751
|
-
float lumaM = dot(rgbM, luma);
|
|
752
|
-
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
|
753
|
-
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
|
754
|
-
|
|
755
|
-
mediump vec2 dir;
|
|
756
|
-
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
|
757
|
-
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
|
758
|
-
|
|
759
|
-
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
|
760
|
-
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
|
761
|
-
|
|
762
|
-
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
|
763
|
-
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
|
764
|
-
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
|
765
|
-
dir * rcpDirMin)) * inverseVP;
|
|
766
|
-
|
|
767
|
-
vec3 rgbA = 0.5 * (
|
|
768
|
-
texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
|
769
|
-
texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
|
770
|
-
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
|
771
|
-
texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
|
772
|
-
texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
|
773
|
-
|
|
774
|
-
float lumaB = dot(rgbB, luma);
|
|
775
|
-
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
|
776
|
-
color = vec4(rgbA, texColor.a);
|
|
777
|
-
else
|
|
778
|
-
color = vec4(rgbB, texColor.a);
|
|
779
|
-
return color;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
void main() {
|
|
783
|
-
|
|
784
|
-
vec4 color;
|
|
785
|
-
|
|
786
|
-
color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
787
|
-
|
|
788
|
-
gl_FragColor = color;
|
|
789
|
-
}
|
|
790
|
-
`,zf=`
|
|
791
|
-
attribute vec2 aVertexPosition;
|
|
792
|
-
|
|
793
|
-
uniform mat3 projectionMatrix;
|
|
794
|
-
|
|
795
|
-
varying vec2 v_rgbNW;
|
|
796
|
-
varying vec2 v_rgbNE;
|
|
797
|
-
varying vec2 v_rgbSW;
|
|
798
|
-
varying vec2 v_rgbSE;
|
|
799
|
-
varying vec2 v_rgbM;
|
|
800
|
-
|
|
801
|
-
varying vec2 vFragCoord;
|
|
802
|
-
|
|
803
|
-
uniform vec4 inputSize;
|
|
804
|
-
uniform vec4 outputFrame;
|
|
805
|
-
|
|
806
|
-
vec4 filterVertexPosition( void )
|
|
807
|
-
{
|
|
808
|
-
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
809
|
-
|
|
810
|
-
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
void texcoords(vec2 fragCoord, vec2 inverseVP,
|
|
814
|
-
out vec2 v_rgbNW, out vec2 v_rgbNE,
|
|
815
|
-
out vec2 v_rgbSW, out vec2 v_rgbSE,
|
|
816
|
-
out vec2 v_rgbM) {
|
|
817
|
-
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
|
|
818
|
-
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
|
|
819
|
-
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
|
|
820
|
-
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
|
|
821
|
-
v_rgbM = vec2(fragCoord * inverseVP);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
void main(void) {
|
|
825
|
-
|
|
826
|
-
gl_Position = filterVertexPosition();
|
|
827
|
-
|
|
828
|
-
vFragCoord = aVertexPosition * outputFrame.zw;
|
|
829
|
-
|
|
830
|
-
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
831
|
-
}
|
|
832
|
-
`;class Vf extends St{constructor(){super(zf,$f)}}var jf=`precision highp float;
|
|
833
|
-
|
|
834
|
-
varying vec2 vTextureCoord;
|
|
835
|
-
varying vec4 vColor;
|
|
836
|
-
|
|
837
|
-
uniform float uNoise;
|
|
838
|
-
uniform float uSeed;
|
|
839
|
-
uniform sampler2D uSampler;
|
|
840
|
-
|
|
841
|
-
float rand(vec2 co)
|
|
842
|
-
{
|
|
843
|
-
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
void main()
|
|
847
|
-
{
|
|
848
|
-
vec4 color = texture2D(uSampler, vTextureCoord);
|
|
849
|
-
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
|
850
|
-
float diff = (randomValue - 0.5) * uNoise;
|
|
851
|
-
|
|
852
|
-
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
853
|
-
if (color.a > 0.0) {
|
|
854
|
-
color.rgb /= color.a;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
color.r += diff;
|
|
858
|
-
color.g += diff;
|
|
859
|
-
color.b += diff;
|
|
860
|
-
|
|
861
|
-
// Premultiply alpha again.
|
|
862
|
-
color.rgb *= color.a;
|
|
863
|
-
|
|
864
|
-
gl_FragColor = color;
|
|
865
|
-
}
|
|
866
|
-
`;class Yf extends St{constructor(t=.5,e=Math.random()){super(al,jf,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Aa={AlphaFilter:Df,BlurFilter:kf,BlurFilterPass:Dn,ColorMatrixFilter:Fn,DisplacementFilter:Xf,FXAAFilter:Vf,NoiseFilter:Yf};Object.entries(Aa).forEach(([s,t])=>{Object.defineProperty(Aa,s,{get(){return K("7.1.0",`filters.${s} has moved to ${s}`),t}})});class qf{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(It.system.add(this.tickerUpdate,this,Ve.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(It.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const be=new qf;class Zi{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Zi.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new X,this.page=new X,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,r,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Ks extends Zi{constructor(){super(...arguments),this.client=new X,this.movement=new X,this.offset=new X,this.global=new X,this.screen=new X}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,o,a,h,l,c,u,d,p,f,m){throw new Error("Method not implemented.")}}class kt extends Ks{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class gi extends Ks{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}gi.DOM_DELTA_PIXEL=0,gi.DOM_DELTA_LINE=1,gi.DOM_DELTA_PAGE=2;const Kf=2048,Zf=new X,Gr=new X;class Qf{constructor(t){this.dispatch=new qi,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,r)=>i.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,r=e.length;i<r;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){be.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[i](this.rootTarget,this.rootTarget.eventMode,Zf.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)r.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<Kf&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,r,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(be.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let u=c.length-1;u>=0;u--){const d=c[u],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,r,n,o||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;const f=t.isInteractive();(p.length>0||f)&&(f&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(t,i)&&r(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,r,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(be.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,r,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();return(u.length>0||d)&&u.push(t),u}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&r(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Gr),!t.hitArea.contains(Gr.x,Gr.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((i=r.containsPoint)!=null&&i.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((h=r.overTargets)==null?void 0:h.length)>0&&n!==e.target){const c=t.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(t,c,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const p=this.clonePointerEvent(e,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==n&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),i&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(u)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",r);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof gi)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const r=this.allocateEvent(kt);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(gi);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(kt);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof kt&&e instanceof kt&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Ks&&e instanceof Ks&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}const Jf=1,tm={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},On=class Ln{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Qf(null),be.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new kt(null),this.rootWheelEvent=new gi(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Ln.defaultEventFeatures},{set:(e,i,r)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[i]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Ln._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,r=e.length;i<r;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,be.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,o=r.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,r[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,be.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;be.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;be.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-r.left)*(this.domElement.width/r.width)*n,t.y=(i-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,r=t.changedTouches.length;i<r;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=Jf),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=tm[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};On.extension={name:"events",type:[R.RendererSystem,R.CanvasRendererSystem]},On.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Nn=On;N.add(Nn);function Ea(s){return s==="dynamic"||s==="static"}const em={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Ea(Nn.defaultEventMode)},set interactive(s){K("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=s,this.eventMode=s?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Nn.defaultEventMode},set eventMode(s){this._internalInteractive=Ea(s),this._internalEventMode=s},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(s,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;s=i?`${s}capture`:s;const a=typeof t=="function"?t:t.handleEvent,h=this;r&&r.addEventListener("abort",()=>{h.off(s,a,o)}),n?h.once(s,a,o):h.on(s,a,o)},removeEventListener(s,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;s=i?`${s}capture`:s,t=typeof t=="function"?t:t.handleEvent,this.off(s,t,r)},dispatchEvent(s){if(!(s instanceof Zi))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return s.defaultPrevented=!1,s.path=null,s.target=this,s.manager.dispatchEvent(s),!s.defaultPrevented}};ot.mixin(em);const im={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};ot.mixin(im);const sm=9,ms=100,rm=0,nm=0,Ta=2,Sa=1,om=-1e3,am=-1e3,hm=2;class gl{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(le.tablet||le.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${ms}px`,e.style.height=`${ms}px`,e.style.position="absolute",e.style.top=`${rm}px`,e.style.left=`${nm}px`,e.style.zIndex=Ta.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Sa}px`,t.style.height=`${Sa}px`,t.style.position="absolute",t.style.top=`${om}px`,t.style.left=`${am}px`,t.style.zIndex=hm.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(le.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=r/o*h,c=n/a*h;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const p=this.children[d];if(p.renderId!==this.renderId)p._accessibleActive=!1,fi(this.children,d,1),this.div.removeChild(p._accessibleDiv),this.pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{u=p._accessibleDiv;let f=p.hitArea;const m=p.worldTransform;p.hitArea?(u.style.left=`${(m.tx+f.x*m.a)*l}px`,u.style.top=`${(m.ty+f.y*m.d)*c}px`,u.style.width=`${f.width*m.a*l}px`,u.style.height=`${f.height*m.d*c}px`):(f=p.getBounds(),this.capHitArea(f),u.style.left=`${f.x*l}px`,u.style.top=`${f.y*c}px`,u.style.width=`${f.width*l}px`,u.style.height=`${f.height*c}px`,u.title!==p.accessibleTitle&&p.accessibleTitle!==null&&(u.title=p.accessibleTitle),u.getAttribute("aria-label")!==p.accessibleHint&&p.accessibleHint!==null&&u.setAttribute("aria-label",p.accessibleHint)),(p.accessibleTitle!==u.title||p.tabIndex!==u.tabIndex)&&(u.title=p.accessibleTitle,u.tabIndex=p.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${ms}px`,e.style.height=`${ms}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Ta.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:i}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new Zi(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>r.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===sm&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}gl.extension={name:"accessibility",type:[R.RendererPlugin,R.CanvasRendererPlugin]};N.add(gl);const yl=class Un{constructor(t){this.stage=new Ft,t=Object.assign({forceCanvas:!1},t),this.renderer=_f(t),Un._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=Un._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};yl._plugins=[];let _l=yl;N.handleByList(R.Application,_l._plugins);class vl{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}vl.extension=R.Application;N.add(vl);const Ca={loader:R.LoadParser,resolver:R.ResolveParser,cache:R.CacheParser,detection:R.DetectionParser};N.handle(R.Asset,s=>{const t=s.ref;Object.entries(Ca).filter(([e])=>!!t[e]).forEach(([e,i])=>N.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(Ca).filter(e=>!!t[e]).forEach(e=>N.remove(t[e]))});class lm{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function Ei(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function Pe(s,t){const e=s.split("?")[0],i=ft.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const Gt=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s),kn=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s};function xl(s,t,e,i,r){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?xl(s.replace(i[e],a),t,e+1,i,r):r.push(s.replace(i[e],a))}}function cm(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const r=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),xl(s,r,0,e,i)}else i.push(s);return i}const Zs=s=>!Array.isArray(s);class um{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=Gt(t);let r;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){r=h.getCacheableAssets(i,e);break}}r||(r={},i.forEach(a=>{r[a]=e}));const n=Object.keys(r),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,r[a])}),e instanceof L){const a=e;i.forEach(h=>{a.baseTexture!==L.EMPTY.baseTexture&&j.addToCache(a.baseTexture,h),L.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const ke=new um;class dm{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,i.parser=l)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const r={},n=Zs(t),o=Gt(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=ft.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),r[l.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete r[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
867
|
-
${u}`)}});return await Promise.all(h),n?r[o[0].src]:r}async unload(t){const e=Gt(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const r=ft.toAbsolute(i.src),n=this.promiseCache[r];if(n){const h=await n.promise;delete this.promiseCache[r],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,h,i,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var Xt=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Xt||{});const pm=".json",fm="application/json",mm={extension:{type:R.LoadParser,priority:Xt.Low},name:"loadJson",test(s){return Ei(s,fm)||Pe(s,pm)},async load(s){return await(await O.ADAPTER.fetch(s)).json()}};N.add(mm);const gm=".txt",ym="text/plain",_m={name:"loadTxt",extension:{type:R.LoadParser,priority:Xt.Low},test(s){return Ei(s,ym)||Pe(s,gm)},async load(s){return await(await O.ADAPTER.fetch(s)).text()}};N.add(_m);const vm=["normal","bold","100","200","300","400","500","600","700","800","900"],xm=[".ttf",".otf",".woff",".woff2"],bm=["font/ttf","font/otf","font/woff","font/woff2"],wm=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Am(s){const t=ft.extname(s),e=ft.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(wm)){i=!1;break}let r=e.join(" ");return i||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const Em=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Tm(s){return Em.test(s)?s:encodeURI(s)}const Sm={extension:{type:R.LoadParser,priority:Xt.Low},name:"loadWebFont",test(s){return Ei(s,bm)||Pe(s,xm)},async load(s,t){var i,r,n;const e=O.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Am(s),h=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(c=>vm.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${Tm(s)})`,{...l,weight:u});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(s){(Array.isArray(s)?s:[s]).forEach(t=>O.ADAPTER.getFontFaceSet().delete(t))}};N.add(Sm);const Cm=`(function() {
|
|
868
|
-
"use strict";
|
|
869
|
-
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
870
|
-
async function checkImageBitmap() {
|
|
871
|
-
try {
|
|
872
|
-
if (typeof createImageBitmap != "function")
|
|
873
|
-
return !1;
|
|
874
|
-
const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
|
|
875
|
-
return imageBitmap.width === 1 && imageBitmap.height === 1;
|
|
876
|
-
} catch {
|
|
877
|
-
return !1;
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
checkImageBitmap().then((result) => {
|
|
881
|
-
self.postMessage(result);
|
|
882
|
-
});
|
|
883
|
-
})();
|
|
884
|
-
`;let yi=null,Gn=class extends Worker{constructor(){yi||(yi=URL.createObjectURL(new Blob([Cm],{type:"application/javascript"}))),super(yi)}};Gn.revokeObjectURL=function(){yi&&(URL.revokeObjectURL(yi),yi=null)};const Im=`(function() {
|
|
885
|
-
"use strict";
|
|
886
|
-
async function loadImageBitmap(url) {
|
|
887
|
-
const response = await fetch(url);
|
|
888
|
-
if (!response.ok)
|
|
889
|
-
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
|
|
890
|
-
const imageBlob = await response.blob();
|
|
891
|
-
return await createImageBitmap(imageBlob);
|
|
892
|
-
}
|
|
893
|
-
self.onmessage = async (event) => {
|
|
894
|
-
try {
|
|
895
|
-
const imageBitmap = await loadImageBitmap(event.data.data[0]);
|
|
896
|
-
self.postMessage({
|
|
897
|
-
data: imageBitmap,
|
|
898
|
-
uuid: event.data.uuid,
|
|
899
|
-
id: event.data.id
|
|
900
|
-
}, [imageBitmap]);
|
|
901
|
-
} catch (e) {
|
|
902
|
-
self.postMessage({
|
|
903
|
-
error: e,
|
|
904
|
-
uuid: event.data.uuid,
|
|
905
|
-
id: event.data.id
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
})();
|
|
910
|
-
`;let _i=null;class bl extends Worker{constructor(){_i||(_i=URL.createObjectURL(new Blob([Im],{type:"application/javascript"}))),super(_i)}}bl.revokeObjectURL=function(){_i&&(URL.revokeObjectURL(_i),_i=null)};let Ia=0,Hr;class Pm{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const e=new Gn;e.addEventListener("message",i=>{e.terminate(),Gn.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Hr===void 0&&(Hr=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Hr&&(this._createdWorkers++,t=new bl,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[Ia]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ia++,id:i})}}const Pa=new Pm;function Qi(s,t,e){s.resource.internal=!0;const i=new L(s),r=()=>{delete t.promiseCache[e],ke.has(e)&&ke.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),i.once("destroyed",()=>{s.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),i}const Rm=[".jpeg",".jpg",".png",".webp",".avif"],Mm=["image/jpeg","image/png","image/webp","image/avif"];async function Bm(s){const t=await O.ADAPTER.fetch(s);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const lr={name:"loadTextures",extension:{type:R.LoadParser,priority:Xt.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return Ei(s,Mm)||Pe(s,Rm)},async load(s,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let r;i?this.config.preferWorkers&&await Pa.isImageBitmapSupported()?r=await Pa.loadImageBitmap(s):r=await Bm(s):r=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=s,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const n={...t.data};n.resolution??(n.resolution=pe(s)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new j(r,n);return o.resource.src=s,Qi(o,e,s)},unload(s){s.destroy(!0)}};N.add(lr);const Dm=".svg",Fm="image/svg+xml",Om={extension:{type:R.LoadParser,priority:Xt.High},name:"loadSVG",test(s){return Ei(s,Fm)||Pe(s,Dm)},async testParse(s){return Pn.test(s)},async parse(s,t,e){var n;const i=new Pn(s,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const r=new j(i,{resolution:pe(s),...t==null?void 0:t.data});return r.resource.src=t.src,Qi(r,e,t.src)},async load(s,t){return(await O.ADAPTER.fetch(s)).text()},unload:lr.unload};N.add(Om);const Lm=[".mp4",".m4v",".webm",".ogv"],Nm=["video/mp4","video/webm","video/ogg"],Um={name:"loadVideo",extension:{type:R.LoadParser,priority:Xt.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(s){return Ei(s,Nm)||Pe(s,Lm)},async load(s,t,e){var o;let i;const r=await(await O.ADAPTER.fetch(s)).blob(),n=URL.createObjectURL(r);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions,autoLoad:!0},h=new pl(n,a);await h.load();const l=new j(h,{alphaMode:await Xd(),resolution:pe(s),...t==null?void 0:t.data});l.resource.src=s,i=Qi(l,e,s),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(s){s.destroy(!0)}};N.add(Um);class km{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:r,srcs:n}=t;return Gt(e||i||r||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(r=>{const n=r.src??r.srcs,o=r.alias??r.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(t,o);i.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(t,l));i.push(...h),a=[...o,...h]}this.add({...r,alias:a,src:n})}):Object.keys(e).forEach(r=>{const n=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:n,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:n,src:e[r]});else{const o=e[r],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,r,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(K("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
|
911
|
-
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:r,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},Gt(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:p}=h;const f=Gt(l||c).map(_=>typeof _=="string"?cm(_):Array.isArray(_)?_:[_]),m=this.getAlias(h);Array.isArray(m)?m.forEach(a):a(m);const g=[];f.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const A=this._parsers[v];if(A.test(x)){y=A.parse(x);break}}}else u=x.data??u,d=x.format??d,p=x.loadParser??p,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:u,format:d,loadParser:p}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Zs(t);t=Gt(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(r,h)]=l}i[r]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=Zs(t);t=Gt(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const c=n.filter(u=>u[h]?u[h]===l:!1);c.length&&(n=c)})}),this._resolverHash[r]=n[0]??o}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=ft.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??ft.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Gm{constructor(){this._detections=[],this._initialized=!1,this.resolver=new km,this.loader=new dm,this.cache=ke,this._backgroundLoader=new lm(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,r,n){this.resolver.add(t,e,i,r,n)}async load(t,e){this._initialized||await this.init();const i=Zs(t),r=Gt(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(r),o=await this._mapLoadToResolve(n,e);return i?o[r[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},o=Object.keys(r);let a=0,h=0;const l=()=>{e==null||e(++a/h)},c=o.map(u=>{const d=r[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[u]=p})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return ke.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=ke.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const l=n[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[r[h]]=l,ke.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=Gt(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Gt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{ke.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}get preferWorkers(){return lr.config.preferWorkers}set preferWorkers(t){K("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const gs=new Gm;N.handleByList(R.LoadParser,gs.loader.parsers).handleByList(R.ResolveParser,gs.resolver.parsers).handleByList(R.CacheParser,gs.cache.parsers).handleByList(R.DetectionParser,gs.detections);const Hm={extension:R.CacheParser,test:s=>Array.isArray(s)&&s.every(t=>t instanceof L),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};N.add(Hm);async function wl(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const Wm={extension:{type:R.DetectionParser,priority:1},test:async()=>wl("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")};N.add(Wm);const Xm={extension:{type:R.DetectionParser,priority:0},test:async()=>wl("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")};N.add(Xm);const Ra=["png","jpg","jpeg"],$m={extension:{type:R.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Ra],remove:async s=>s.filter(t=>!Ra.includes(t))};N.add($m);const zm="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ao(s){return zm?!1:document.createElement("video").canPlayType(s)!==""}const Vm={extension:{type:R.DetectionParser,priority:0},test:async()=>ao("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")};N.add(Vm);const jm={extension:{type:R.DetectionParser,priority:0},test:async()=>ao("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")};N.add(jm);const Ym={extension:{type:R.DetectionParser,priority:0},test:async()=>ao("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")};N.add(Ym);const qm={extension:R.ResolveParser,test:lr.test,parse:s=>{var t;return{resolution:parseFloat(((t=O.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:ft.extname(s).slice(1),src:s}}};N.add(qm);var bt=(s=>(s[s.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",s[s.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",s[s.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",s[s.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",s[s.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",s[s.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",s[s.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",s[s.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",s[s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",s[s.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",s[s.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",s[s.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",s[s.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",s[s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",s[s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",s[s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",s))(bt||{});const Qs={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let qt,oi;function Ma(){oi={s3tc:qt.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:qt.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:qt.getExtension("WEBGL_compressed_texture_etc"),etc1:qt.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:qt.getExtension("WEBGL_compressed_texture_pvrtc")||qt.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:qt.getExtension("WEBGL_compressed_texture_atc"),astc:qt.getExtension("WEBGL_compressed_texture_astc"),bptc:qt.getExtension("EXT_texture_compression_bptc")}}const Km={extension:{type:R.DetectionParser,priority:2},test:async()=>{const s=O.ADAPTER.createCanvas().getContext("webgl");return s?(qt=s,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async s=>{oi||Ma();const t=[];for(const e in oi)oi[e]&&t.push(e);return[...t,...s]},remove:async s=>(oi||Ma(),s.filter(t=>!(t in oi)))};N.add(Km);class Zm extends rr{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,r;typeof t=="string"?(i=t,r=new Uint8Array):(i=null,r=t),super(r,e),this.origin=i,this.buffer=r?new gn(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new gn(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Xe extends Zm{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Xe._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Xe._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:c}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,a,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=Xe._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,i,r,n,o,a){const h=new Array(i);let l=t.byteOffset,c=o,u=a,d=c+r-1&~(r-1),p=u+n-1&~(n-1),f=d*p*Qs[e];for(let m=0;m<i;m++)h[m]={levelID:m,levelWidth:i>1?c:d,levelHeight:i>1?u:p,levelBuffer:new Uint8Array(t.buffer,l,f)},l+=f,c=c>>1||1,u=u>>1||1,d=c+r-1&~(r-1),p=u+n-1&~(n-1),f=d*p*Qs[e];return h}}const Wr=4,ys=124,Qm=32,Ba=20,Jm=542327876,_s={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},tg={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},vs={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},eg=1,ig=2,sg=4,rg=64,ng=512,og=131072,ag=827611204,hg=861165636,lg=894720068,cg=808540228,ug=4,dg={[ag]:bt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[hg]:bt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[lg]:bt.COMPRESSED_RGBA_S3TC_DXT5_EXT},pg={70:bt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:bt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:bt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:bt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:bt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:bt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:bt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:bt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:bt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:bt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:bt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:bt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:bt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function fg(s){const t=new Uint32Array(s);if(t[0]!==Jm)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(s,0,ys/Uint32Array.BYTES_PER_ELEMENT),i=e[_s.HEIGHT],r=e[_s.WIDTH],n=e[_s.MIPMAP_COUNT],o=new Uint32Array(s,_s.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Qm/Uint32Array.BYTES_PER_ELEMENT),a=o[eg];if(a&sg){const h=o[tg.FOURCC];if(h!==cg){const x=dg[h],y=Wr+ys,v=new Uint8Array(s,y);return[new Xe(v,{format:x,width:r,height:i,levels:n})]}const l=Wr+ys,c=new Uint32Array(t.buffer,l,Ba/Uint32Array.BYTES_PER_ELEMENT),u=c[vs.DXGI_FORMAT],d=c[vs.RESOURCE_DIMENSION],p=c[vs.MISC_FLAG],f=c[vs.ARRAY_SIZE],m=pg[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(p===ug)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,_=Wr+ys+Ba;if(f===1)g.push(new Uint8Array(s,_));else{const x=Qs[m];let y=0,v=r,A=i;for(let T=0;T<n;T++){const E=Math.max(1,v+3&-4),D=Math.max(1,A+3&-4),k=E*D*x;y+=k,v=v>>>1,A=A>>>1}let B=_;for(let T=0;T<f;T++)g.push(new Uint8Array(s,B,y)),B+=y}return g.map(x=>new Xe(x,{format:m,width:r,height:i,levels:n}))}throw a&rg?new Error("DDSParser does not support uncompressed texture data."):a&ng?new Error("DDSParser does not supported YUV uncompressed texture data."):a&og?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&ig?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Da=[171,75,84,88,32,49,49,187,13,10,26,10],mg=67305985,Nt={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},Hn=64,Fa={[G.UNSIGNED_BYTE]:1,[G.UNSIGNED_SHORT]:2,[G.INT]:4,[G.UNSIGNED_INT]:4,[G.FLOAT]:4,[G.HALF_FLOAT]:8},gg={[S.RGBA]:4,[S.RGB]:3,[S.RG]:2,[S.RED]:1,[S.LUMINANCE]:1,[S.LUMINANCE_ALPHA]:2,[S.ALPHA]:1},yg={[G.UNSIGNED_SHORT_4_4_4_4]:2,[G.UNSIGNED_SHORT_5_5_5_1]:2,[G.UNSIGNED_SHORT_5_6_5]:2};function _g(s,t,e=!1){const i=new DataView(t);if(!vg(s,i))return null;const r=i.getUint32(Nt.ENDIANNESS,!0)===mg,n=i.getUint32(Nt.GL_TYPE,r),o=i.getUint32(Nt.GL_FORMAT,r),a=i.getUint32(Nt.GL_INTERNAL_FORMAT,r),h=i.getUint32(Nt.PIXEL_WIDTH,r),l=i.getUint32(Nt.PIXEL_HEIGHT,r)||1,c=i.getUint32(Nt.PIXEL_DEPTH,r)||1,u=i.getUint32(Nt.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=i.getUint32(Nt.NUMBER_OF_FACES,r),p=i.getUint32(Nt.NUMBER_OF_MIPMAP_LEVELS,r),f=i.getUint32(Nt.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,_=h+3&-4,x=l+3&-4,y=new Array(u);let v=h*l;n===0&&(v=_*x);let A;if(n!==0?Fa[n]?A=Fa[n]*gg[o]:A=yg[n]:A=Qs[a],A===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const B=e?bg(i,f,r):null;let T=v*A,E=h,D=l,k=_,q=x,M=Hn+f;for(let b=0;b<p;b++){const C=i.getUint32(M,r);let H=M+4;for(let V=0;V<u;V++){let W=y[V];W||(W=y[V]=new Array(p)),W[b]={levelID:b,levelWidth:p>1||n!==0?E:k,levelHeight:p>1||n!==0?D:q,levelBuffer:new Uint8Array(t,H,T)},H+=T}M+=C+4,M=M%4!==0?M+4-M%4:M,E=E>>1||1,D=D>>1||1,k=E+m-1&~(m-1),q=D+g-1&~(g-1),T=k*q*A}return n!==0?{uncompressed:y.map(b=>{let C=b[0].levelBuffer,H=!1;return n===G.FLOAT?C=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):n===G.UNSIGNED_INT?(H=!0,C=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):n===G.INT&&(H=!0,C=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new rr(C,{width:b[0].levelWidth,height:b[0].levelHeight}),type:n,format:H?xg(o):o}}),kvData:B}:{compressed:y.map(b=>new Xe(null,{format:a,width:h,height:l,levels:p,levelBuffers:b})),kvData:B}}function vg(s,t){for(let e=0;e<Da.length;e++)if(t.getUint8(e)!==Da[e])return console.error(`${s} is not a valid *.ktx file!`),!1;return!0}function xg(s){switch(s){case S.RGBA:return S.RGBA_INTEGER;case S.RGB:return S.RGB_INTEGER;case S.RG:return S.RG_INTEGER;case S.RED:return S.RED_INTEGER;default:return s}}function bg(s,t,e){const i=new Map;let r=0;for(;r<t;){const n=s.getUint32(Hn+r,e),o=Hn+r+4,a=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&s.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(s.buffer,o,h)),c=new DataView(s.buffer,o+h+1,n-h-1);i.set(l,c),r+=4+n+a}return i}const wg={extension:{type:R.LoadParser,priority:Xt.High},name:"loadDDS",test(s){return Pe(s,".dds")},async load(s,t,e){const i=await(await O.ADAPTER.fetch(s)).arrayBuffer(),r=fg(i).map(n=>{const o=new j(n,{mipmap:se.OFF,alphaMode:Ct.NO_PREMULTIPLIED_ALPHA,resolution:pe(s),...t.data});return Qi(o,e,s)});return r.length===1?r[0]:r},unload(s){Array.isArray(s)?s.forEach(t=>t.destroy(!0)):s.destroy(!0)}};N.add(wg);const Ag={extension:{type:R.LoadParser,priority:Xt.High},name:"loadKTX",test(s){return Pe(s,".ktx")},async load(s,t,e){const i=await(await O.ADAPTER.fetch(s)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:o}=_g(s,i),a=r??n,h={mipmap:se.OFF,alphaMode:Ct.NO_PREMULTIPLIED_ALPHA,resolution:pe(s),...t.data},l=a.map(c=>{a===n&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new j(u,h);return d.ktxKeyValueData=o,Qi(d,e,s)});return l.length===1?l[0]:l},unload(s){Array.isArray(s)?s.forEach(t=>t.destroy(!0)):s.destroy(!0)}};N.add(Ag);const Eg={extension:R.ResolveParser,test:s=>{const t=ft.extname(s).slice(1);return["basis","ktx","dds"].includes(t)},parse:s=>{var e,i;const t=ft.extname(s).slice(1);if(t==="ktx"){const r=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx",".bptc.ktx"];if(r.some(n=>s.endsWith(n)))return{resolution:parseFloat(((e=O.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:r.find(n=>s.endsWith(n)),src:s}}return{resolution:parseFloat(((i=O.RETINA_PREFIX.exec(s))==null?void 0:i[1])??"1"),format:t,src:s}}};N.add(Eg);const xs=new z,Tg=4,Al=class Li{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,r){const n=new Image;return n.src=await this.base64(t,e,i,r),n}async base64(t,e,i,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:r,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&Li._flipY(i,r,n),a&&Li._unpremultiplyAlpha(i);const h=new np(r,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:r,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&Li._flipY(i,r,n),a&&Li._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let r,n=!1,o=!1,a,h=!1;t&&(t instanceof qe?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(xs.width=e.width,xs.height=e.height,e=xs)));const l=i.gl;if(a){if(r=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===S.RGBA,!h){i.renderTexture.bind(a);const p=a.framebuffer.glFramebuffers[i.CONTEXT_UID];p.blitFramebuffer&&i.framebuffer.bind(p.blitFramebuffer)}}else r=i.resolution,e||(e=xs,e.width=i.width/r,e.height=i.height/r),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*r),1),u=Math.max(Math.round(e.height*r),1),d=new Uint8Array(Tg*c*u);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),c,u,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const r=e<<2,n=i>>1,o=new Uint8Array(r);for(let a=0;a<n;a++){const h=a*r,l=(i-a-1)*r;o.set(t.subarray(h,h+r)),t.copyWithin(h,l,l+r),t.set(o,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const r=t[i+3];if(r!==0){const n=255.001/r;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};Al.extension={name:"extract",type:R.RendererSystem};let Sg=Al;N.add(Sg);const Js={build(s){const t=s.points;let e,i,r,n,o,a;if(s.type===wt.CIRC){const f=s.shape;e=f.x,i=f.y,o=a=f.radius,r=n=0}else if(s.type===wt.ELIP){const f=s.shape;e=f.x,i=f.y,o=f.width,a=f.height,r=n=0}else{const f=s.shape,m=f.width/2,g=f.height/2;e=f.x+m,i=f.y+g,o=a=Math.max(0,Math.min(f.radius,Math.min(m,g))),r=m-o,n=g-a}if(!(o>=0&&a>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n;return}let c=0,u=h*4+(r?2:0)+2,d=u,p=l;{const f=r+o,m=n,g=e+f,_=e-f,x=i+m;if(t[c++]=g,t[c++]=x,t[--u]=x,t[--u]=_,n){const y=i-m;t[d++]=_,t[d++]=y,t[--p]=y,t[--p]=g}}for(let f=1;f<h;f++){const m=Math.PI/2*(f/h),g=r+Math.cos(m)*o,_=n+Math.sin(m)*a,x=e+g,y=e-g,v=i+_,A=i-_;t[c++]=x,t[c++]=v,t[--u]=v,t[--u]=y,t[d++]=y,t[d++]=A,t[--p]=A,t[--p]=x}{const f=r,m=n+a,g=e+f,_=e-f,x=i+m,y=i-m;t[c++]=g,t[c++]=x,t[--p]=y,t[--p]=g,r&&(t[c++]=_,t[c++]=x,t[--p]=y,t[--p]=_)}},triangulate(s,t){const e=s.points,i=t.points,r=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,h;if(s.type!==wt.RREC){const c=s.shape;a=c.x,h=c.y}else{const c=s.shape;a=c.x+c.width/2,h=c.y+c.height/2}const l=s.matrix;i.push(s.matrix?l.a*a+l.c*h+l.tx:a,s.matrix?l.b*a+l.d*h+l.ty:h),n++,i.push(e[0],e[1]);for(let c=2;c<e.length;c+=2)i.push(e[c],e[c+1]),r.push(n++,o,n);r.push(o+1,o,n)}};function Oa(s,t=!1){const e=s.length;if(e<6)return;let i=0;for(let r=0,n=s[e-2],o=s[e-1];r<e;r+=2){const a=s[r],h=s[r+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[s[o],s[h]]=[s[h],s[o]],[s[a],s[l]]=[s[l],s[a]]}}}const El={build(s){s.points=s.shape.points.slice()},triangulate(s,t){let e=s.points;const i=s.holes,r=t.points,n=t.indices;if(e.length>=6){Oa(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];Oa(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=xc(e,o,2);if(!a)return;const h=r.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)r.push(e[l])}}},Cg={build(s){const t=s.shape,e=t.x,i=t.y,r=t.width,n=t.height,o=s.points;o.length=0,r>=0&&n>=0&&o.push(e,i,e+r,i,e+r,i+n,e,i+n)},triangulate(s,t){const e=s.points,i=t.points;if(e.length===0)return;const r=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},Ig={build(s){Js.build(s)},triangulate(s,t){Js.triangulate(s,t)}};var Mt=(s=>(s.MITER="miter",s.BEVEL="bevel",s.ROUND="round",s))(Mt||{}),Ee=(s=>(s.BUTT="butt",s.ROUND="round",s.SQUARE="square",s))(Ee||{});const wi={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,t=20){if(!this.adaptive||!s||isNaN(s))return t;let e=Math.ceil(s/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class La{static curveTo(t,e,i,r,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,c=r-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const p=h*h+l*l,f=c*c+u*u,m=h*c+l*u,g=n*Math.sqrt(p)/d,_=n*Math.sqrt(f)/d,x=g*m/p,y=_*m/f,v=g*u+_*l,A=g*c+_*h,B=l*(_+x),T=h*(_+x),E=u*(g+y),D=c*(g+y),k=Math.atan2(T-A,B-v),q=Math.atan2(D-A,E-v);return{cx:v+t,cy:A+e,radius:n,startAngle:k,endAngle:q,anticlockwise:l*c>u*h}}static arc(t,e,i,r,n,o,a,h,l){const c=a-o,u=wi._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/$s)*40),d=c/(u*2),p=d*2,f=Math.cos(d),m=Math.sin(d),g=u-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+o+p*y,A=Math.cos(v),B=-Math.sin(v);l.push((f*A+m*B)*n+i,(f*-B+m*A)*n+r)}}}class Pg{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class ho{static curveLength(t,e,i,r,n,o,a,h){let l=0,c=0,u=0,d=0,p=0,f=0,m=0,g=0,_=0,x=0,y=0,v=t,A=e;for(let B=1;B<=10;++B)c=B/10,u=c*c,d=u*c,p=1-c,f=p*p,m=f*p,g=m*t+3*f*c*i+3*p*u*n+d*a,_=m*e+3*f*c*r+3*p*u*o+d*h,x=v-g,y=A-_,v=g,A=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,i,r,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const c=wi._segmentsCount(ho.curveLength(h,l,t,e,i,r,n,o));let u=0,d=0,p=0,f=0,m=0;a.push(h,l);for(let g=1,_=0;g<=c;++g)_=g/c,u=1-_,d=u*u,p=d*u,f=_*_,m=f*_,a.push(p*h+3*d*_*t+3*u*f*i+m*n,p*l+3*d*_*e+3*u*f*r+m*o)}}function Na(s,t,e,i,r,n,o,a){const h=s-e*r,l=t-i*r,c=s+e*n,u=t+i*n;let d,p;o?(d=i,p=-e):(d=-i,p=e);const f=h+d,m=l+p,g=c+d,_=u+p;return a.push(f,m,g,_),2}function Me(s,t,e,i,r,n,o,a){const h=e-s,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(r-s,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const p=u-c,f=Math.abs(p),m=Math.sqrt(h*h+l*l),g=(15*f*Math.sqrt(m)/Math.PI>>0)+1,_=p/g;if(d+=_,a){o.push(s,t,e,i);for(let x=1,y=d;x<g;x++,y+=_)o.push(s,t,s+Math.sin(y)*m,t+Math.cos(y)*m);o.push(s,t,r,n)}else{o.push(e,i,s,t);for(let x=1,y=d;x<g;x++,y+=_)o.push(s+Math.sin(y)*m,t+Math.cos(y)*m,s,t);o.push(r,n,s,t)}return g*2}function Rg(s,t){const e=s.shape;let i=s.points||e.points.slice();const r=t.closePointEps;if(i.length===0)return;const n=s.lineStyle,o=new X(i[0],i[1]),a=new X(i[i.length-2],i[i.length-1]),h=e.type!==wt.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<r&&Math.abs(o.y-a.y)<r;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const W=(o.x+a.x)*.5,Y=(a.y+o.y)*.5;i.unshift(W,Y),i.push(W,Y)}const c=t.points,u=i.length/2;let d=i.length;const p=c.length/2,f=n.width/2,m=f*f,g=n.miterLimit*n.miterLimit;let _=i[0],x=i[1],y=i[2],v=i[3],A=0,B=0,T=-(x-v),E=_-y,D=0,k=0,q=Math.sqrt(T*T+E*E);T/=q,E/=q,T*=f,E*=f;const M=n.alignment,b=(1-M)*2,C=M*2;h||(n.cap===Ee.ROUND?d+=Me(_-T*(b-C)*.5,x-E*(b-C)*.5,_-T*b,x-E*b,_+T*C,x+E*C,c,!0)+2:n.cap===Ee.SQUARE&&(d+=Na(_,x,T,E,b,C,!0,c))),c.push(_-T*b,x-E*b,_+T*C,x+E*C);for(let W=1;W<u-1;++W){_=i[(W-1)*2],x=i[(W-1)*2+1],y=i[W*2],v=i[W*2+1],A=i[(W+1)*2],B=i[(W+1)*2+1],T=-(x-v),E=_-y,q=Math.sqrt(T*T+E*E),T/=q,E/=q,T*=f,E*=f,D=-(v-B),k=y-A,q=Math.sqrt(D*D+k*k),D/=q,k/=q,D*=f,k*=f;const Y=y-_,at=x-v,P=y-A,I=B-v,Q=Y*P+at*I,J=at*P-I*Y,tt=J<0;if(Math.abs(J)<.001*Math.abs(Q)){c.push(y-T*b,v-E*b,y+T*C,v+E*C),Q>=0&&(n.join===Mt.ROUND?d+=Me(y,v,y-T*b,v-E*b,y-D*b,v-k*b,c,!1)+4:d+=2,c.push(y-D*C,v-k*C,y+D*b,v+k*b));continue}const mt=(-T+_)*(-E+v)-(-T+y)*(-E+x),lt=(-D+A)*(-k+v)-(-D+y)*(-k+B),gt=(Y*lt-P*mt)/J,At=(I*mt-at*lt)/J,Pt=(gt-y)*(gt-y)+(At-v)*(At-v),xt=y+(gt-y)*b,st=v+(At-v)*b,ct=y-(gt-y)*C,dt=v-(At-v)*C,$t=Math.min(Y*Y+at*at,P*P+I*I),zt=tt?b:C,Ti=$t+zt*zt*m,zl=Pt<=Ti;let Ji=n.join;if(Ji===Mt.MITER&&Pt/m>g&&(Ji=Mt.BEVEL),zl)switch(Ji){case Mt.MITER:{c.push(xt,st,ct,dt);break}case Mt.BEVEL:{tt?c.push(xt,st,y+T*C,v+E*C,xt,st,y+D*C,v+k*C):c.push(y-T*b,v-E*b,ct,dt,y-D*b,v-k*b,ct,dt),d+=2;break}case Mt.ROUND:{tt?(c.push(xt,st,y+T*C,v+E*C),d+=Me(y,v,y+T*C,v+E*C,y+D*C,v+k*C,c,!0)+4,c.push(xt,st,y+D*C,v+k*C)):(c.push(y-T*b,v-E*b,ct,dt),d+=Me(y,v,y-T*b,v-E*b,y-D*b,v-k*b,c,!1)+4,c.push(y-D*b,v-k*b,ct,dt));break}}else{switch(c.push(y-T*b,v-E*b,y+T*C,v+E*C),Ji){case Mt.MITER:{tt?c.push(ct,dt,ct,dt):c.push(xt,st,xt,st),d+=2;break}case Mt.ROUND:{tt?d+=Me(y,v,y+T*C,v+E*C,y+D*C,v+k*C,c,!0)+2:d+=Me(y,v,y-T*b,v-E*b,y-D*b,v-k*b,c,!1)+2;break}}c.push(y-D*b,v-k*b,y+D*C,v+k*C),d+=2}}_=i[(u-2)*2],x=i[(u-2)*2+1],y=i[(u-1)*2],v=i[(u-1)*2+1],T=-(x-v),E=_-y,q=Math.sqrt(T*T+E*E),T/=q,E/=q,T*=f,E*=f,c.push(y-T*b,v-E*b,y+T*C,v+E*C),h||(n.cap===Ee.ROUND?d+=Me(y-T*(b-C)*.5,v-E*(b-C)*.5,y-T*b,v-E*b,y+T*C,v+E*C,c,!1)+2:n.cap===Ee.SQUARE&&(d+=Na(y,v,T,E,b,C,!1,c)));const H=t.indices,V=wi.epsilon*wi.epsilon;for(let W=p;W<d+p-2;++W)_=c[W*2],x=c[W*2+1],y=c[(W+1)*2],v=c[(W+1)*2+1],A=c[(W+2)*2],B=c[(W+2)*2+1],!(Math.abs(_*(v-B)+y*(B-x)+A*(x-v))<V)&&H.push(W,W+1,W+2)}function Mg(s,t){let e=0;const i=s.shape,r=s.points||i.points,n=i.type!==wt.POLY||i.closeStroke;if(r.length===0)return;const o=t.points,a=t.indices,h=r.length/2,l=o.length/2;let c=l;for(o.push(r[0],r[1]),e=1;e<h;e++)o.push(r[e*2],r[e*2+1]),a.push(c,c+1),c++;n&&a.push(c,l)}function Ua(s,t){s.lineStyle.native?Mg(s,t):Rg(s,t)}class lo{static curveLength(t,e,i,r,n,o){const a=t-2*i+n,h=e-2*r+o,l=2*i-2*t,c=2*r-2*e,u=4*(a*a+h*h),d=4*(a*l+h*c),p=l*l+c*c,f=2*Math.sqrt(u+d+p),m=Math.sqrt(u),g=2*u*m,_=2*Math.sqrt(p),x=d/m;return(g*f+m*d*(f-_)+(4*p*u-d*d)*Math.log((2*m+x+f)/(x+_)))/(4*g)}static curveTo(t,e,i,r,n){const o=n[n.length-2],a=n[n.length-1],h=wi._segmentsCount(lo.curveLength(o,a,t,e,i,r));let l=0,c=0;for(let u=1;u<=h;++u){const d=u/h;l=o+(t-o)*d,c=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,c+(e+(r-e)*d-c)*d)}}}const Xr={[wt.POLY]:El,[wt.CIRC]:Js,[wt.ELIP]:Js,[wt.RECT]:Cg,[wt.RREC]:Ig},ka=[],bs=[];class tr{constructor(t,e=null,i=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new tr(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const ei=new X,Tl=class Sl extends Rh{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new qs,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),bs.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),ka.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,r=null){const n=new tr(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new tr(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const r=e[i];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,ei):ei.copyFrom(t),r.shape.contains(ei.x,ei.y))){let n=!1;if(r.holes){for(let o=0;o<r.holes.length;o++)if(r.holes[o].shape.contains(ei.x,ei.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,r=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],r=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],c=l.fillStyle,u=l.lineStyle;Xr[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const p=d===0?c:u;if(!p.visible)continue;const f=p.texture.baseTexture,m=this.indices.length,g=this.points.length/2;f.wrapMode=Te.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(i&&!this._compareStyles(r,p)&&(i.end(m,g),i=null),i||(i=ka.pop()||new Pg,i.begin(p,m,g),this.batches.push(i),r=p),this.addUvs(this.points,t,p.texture,g,_,p.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const r=t[e];for(let n=0;n<r.size;n++){const o=r.start+n;this.indicesUint16[o]=this.indicesUint16[o]-r.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Sl.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++j._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),bs.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let r=bs.pop();r||(r=new vn,r.texArray=new An),r.texArray.count=0,r.start=0,r.size=0,r.type=te.TRIANGLES;let n=0,o=null,a=0,h=!1,l=te.TRIANGLES,c=0;this.drawCalls.push(r);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],p=8,f=d.style,m=f.texture.baseTexture;h!==!!f.native&&(h=!!f.native,l=h?te.LINES:te.TRIANGLES,o=null,n=p,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===p&&(t++,n=0,r.size>0&&(r=bs.pop(),r||(r=new vn,r.texArray=new An),this.drawCalls.push(r)),r.start=c,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Te.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,c+=d.size,a=m._batchLocation,this.addColors(e,f.color,f.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}j._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?El.triangulate(t,this):Xr[t.type].triangulate(t,this)}processLine(t){Ua(t,this);for(let e=0;e<t.holes.length;e++)Ua(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Xr[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const r=t[i*2],n=t[i*2+1];t[i*2]=e.a*r+e.c*n+e.tx,t[i*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,i,r,n=0){const o=et.shared.setValue(e).toLittleEndianNumber(),a=et.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+r);for(let h=0;h<r;h++)t[n+h]=a}addTextureIds(t,e,i,r=0){t.length=Math.max(t.length,r+i);for(let n=0;n<i;n++)t[r+n]=e}addUvs(t,e,i,r,n,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let u=t[(r+a)*2],d=t[(r+a)*2+1];if(o){const p=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=p}a++,e.push(u/l.width,d/l.height)}const c=i.baseTexture;(l.width<c.width||l.height<c.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,r){const n=e.baseTexture,o=1e-6,a=i+r*2,h=e.frame,l=h.width/n.width,c=h.height/n.height;let u=h.x/h.width,d=h.y/h.height,p=Math.floor(t[i]+o),f=Math.floor(t[i+1]+o);for(let m=i+2;m<a;m+=2)p=Math.min(p,Math.floor(t[m]+o)),f=Math.min(f,Math.floor(t[m+1]+o));u-=p,d-=f;for(let m=i;m<a;m+=2)t[m]=(t[m]+u)*l,t[m+1]=(t[m+1]+d)*c}};Tl.BATCHABLE_SIZE=100;let Bg=Tl;class cr{constructor(){this.color=16777215,this.alpha=1,this.texture=L.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new cr;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=L.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class co extends cr{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Ee.BUTT,this.join=Mt.MITER,this.miterLimit=10}clone(){const t=new co;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=Ee.BUTT,this.join=Mt.MITER,this.miterLimit=10}}const $r={},Wn=class Fs extends Ft{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new cr,this._lineStyle=new co,this._matrix=null,this._holeMode=!1,this.state=re.for2d(),this._geometry=t||new Bg,this._geometry.refCount++,this._transformID=-1,this._tintColor=new et(16777215),this.blendMode=$.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Fs(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:L.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Ee.BUTT,join:Mt.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new We,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new We,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),lo.curveTo(t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,o){return this._initCurve(),ho.curveTo(t,e,i,r,n,o,this.currentPath.points),this}arcTo(t,e,i,r,n){this._initCurve(t,e);const o=this.currentPath.points,a=La.curveTo(t,e,i,r,n,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:d,anticlockwise:p}=a;this.arc(h,l,c,u,d,p)}return this}arc(t,e,i,r,n,o=!1){if(r===n)return this;if(!o&&n<=r?n+=$s:o&&r<=n&&(r+=$s),n-r===0)return this;const a=t+Math.cos(r)*i,h=e+Math.sin(r)*i,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-a),d=Math.abs(c[c.length-1]-h);u<l&&d<l||c.push(a,h)}else this.moveTo(a,h),c=this.currentPath.points;return La.arc(a,h,t,e,i,r,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:L.WHITE,color:t,alpha:e})}normalizeColor(t){const e=et.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:L.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,r){return this.drawShape(new z(t,e,i,r))}drawRoundedRect(t,e,i,r,n){return this.drawShape(new ar(t,e,i,r,n))}drawCircle(t,e,i){return this.drawShape(new nr(t,e,i))}drawEllipse(t,e,i,r){return this.drawShape(new or(t,e,i,r))}drawPolygon(...t){let e,i=!0;const r=t[0];r.points?(i=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new We(e);return n.closeStroke=i,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===wt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let r=0;r<i;r++){const n=t.batches[r],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),c={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:et.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=c}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,r=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,et.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:r,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(r,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!$r[i]){const{maxTextures:r}=t.plugins[i],n=new Int32Array(r);for(let h=0;h<r;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new it,default:Wt.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;$r[i]=new ie(a,o)}e=$r[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Fs._TEMP_POINT),this._geometry.containsPoint(Fs._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=et.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,c=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const p=l[d],f=l[d+1];c[u++]=i*p+n*f+a,c[u++]=o*f+r*p+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Wn.curves=wi,Wn._TEMP_POINT=new X;let Cl=Wn;class Dg{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const zr=new X,Ga=new We,Il=class Pl extends Ft{constructor(t,e,i,r=te.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||re.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=O.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===te.TRIANGLES&&e.length<Pl.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const r=this.transform.worldTransform,n=r.a,o=r.b,a=r.c,h=r.d,l=r.tx,c=r.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const p=e[d*2],f=e[d*2+1];u[d*2]=n*p+a*f+l,u[d*2+1]=o*p+h*f+c}if(this._roundPixels){const d=O.RESOLUTION;for(let p=0;p<u.length;++p)u[p]=Math.round(u[p]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Dg(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,zr);const e=this.geometry.getBuffer("aVertexPosition").data,i=Ga.points,r=this.geometry.getIndex().data,n=r.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=r[a]*2,l=r[a+1]*2,c=r[a+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[l],i[3]=e[l+1],i[4]=e[c],i[5]=e[c+1],Ga.contains(zr.x,zr.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Il.BATCHABLE_SIZE=100;let Ha=Il;class Fg extends Se{constructor(t,e,i){super();const r=new ht(t),n=new ht(e,!0),o=new ht(i,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,G.FLOAT).addAttribute("aTextureCoord",n,2,!1,G.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var Og=`varying vec2 vTextureCoord;
|
|
912
|
-
uniform vec4 uColor;
|
|
913
|
-
|
|
914
|
-
uniform sampler2D uSampler;
|
|
915
|
-
|
|
916
|
-
void main(void)
|
|
917
|
-
{
|
|
918
|
-
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
919
|
-
}
|
|
920
|
-
`,Lg=`attribute vec2 aVertexPosition;
|
|
921
|
-
attribute vec2 aTextureCoord;
|
|
922
|
-
|
|
923
|
-
uniform mat3 projectionMatrix;
|
|
924
|
-
uniform mat3 translationMatrix;
|
|
925
|
-
uniform mat3 uTextureMatrix;
|
|
926
|
-
|
|
927
|
-
varying vec2 vTextureCoord;
|
|
928
|
-
|
|
929
|
-
void main(void)
|
|
930
|
-
{
|
|
931
|
-
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
932
|
-
|
|
933
|
-
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
934
|
-
}
|
|
935
|
-
`;class Wa extends ie{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:it.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(i,e.uniforms),super(e.program||ue.from(Lg,Og),i),this._colorDirty=!1,this.uvMatrix=new $h(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new et(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;et.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class Xa{constructor(t,e,i){this.geometry=new Se,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let n=t[r];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||G.FLOAT,offset:n.offset},e[r]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new ht(sp(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=e,e+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new ht(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=r,r+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new ht(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===G.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===G.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(t,e,i){for(let r=0;r<this.dynamicProperties.length;r++){const n=this.dynamicProperties[r];n.uploadFunction(t,e,i,n.type===G.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let r=0;r<this.staticProperties.length;r++){const n=this.staticProperties[r];n.uploadFunction(t,e,i,n.type===G.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var Ng=`varying vec2 vTextureCoord;
|
|
936
|
-
varying vec4 vColor;
|
|
937
|
-
|
|
938
|
-
uniform sampler2D uSampler;
|
|
939
|
-
|
|
940
|
-
void main(void){
|
|
941
|
-
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
942
|
-
gl_FragColor = color;
|
|
943
|
-
}`,Ug=`attribute vec2 aVertexPosition;
|
|
944
|
-
attribute vec2 aTextureCoord;
|
|
945
|
-
attribute vec4 aColor;
|
|
946
|
-
|
|
947
|
-
attribute vec2 aPositionCoord;
|
|
948
|
-
attribute float aRotation;
|
|
949
|
-
|
|
950
|
-
uniform mat3 translationMatrix;
|
|
951
|
-
uniform vec4 uColor;
|
|
952
|
-
|
|
953
|
-
varying vec2 vTextureCoord;
|
|
954
|
-
varying vec4 vColor;
|
|
955
|
-
|
|
956
|
-
void main(void){
|
|
957
|
-
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
|
|
958
|
-
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
|
|
959
|
-
|
|
960
|
-
vec2 v = vec2(x, y);
|
|
961
|
-
v = v + aPositionCoord;
|
|
962
|
-
|
|
963
|
-
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
964
|
-
|
|
965
|
-
vTextureCoord = aTextureCoord;
|
|
966
|
-
vColor = aColor * uColor;
|
|
967
|
-
}
|
|
968
|
-
`;class Rl extends hr{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new it,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:G.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=ie.from(Ug,Ng,{}),this.state=re.for2d()}render(t){const e=t.children,i=t._maxSize,r=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=Ch(t.blendMode,l),n.state.set(this.state);const c=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=et.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let p=0,f=0;p<o;p+=r,f+=1){let m=o-p;m>r&&(m=r),f>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[f];g.uploadDynamic(e,p,m);const _=t._bufferUpdateIDs[f]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,p,m)),n.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,m*6,c.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,r=t._batchSize,n=t._properties;for(let o=0;o<i;o+=r)e.push(new Xa(this.properties,n,r));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Xa(this.properties,i,e)}uploadVertices(t,e,i,r,n,o){let a=0,h=0,l=0,c=0;for(let u=0;u<i;++u){const d=t[e+u],p=d._texture,f=d.scale.x,m=d.scale.y,g=p.trim,_=p.orig;g?(h=g.x-d.anchor.x*_.width,a=h+g.width,c=g.y-d.anchor.y*_.height,l=c+g.height):(a=_.width*(1-d.anchor.x),h=_.width*-d.anchor.x,l=_.height*(1-d.anchor.y),c=_.height*-d.anchor.y),r[o]=h*f,r[o+1]=c*m,r[o+n]=a*f,r[o+n+1]=c*m,r[o+n*2]=a*f,r[o+n*2+1]=l*m,r[o+n*3]=h*f,r[o+n*3+1]=l*m,o+=n*4}}uploadPosition(t,e,i,r,n,o){for(let a=0;a<i;a++){const h=t[e+a].position;r[o]=h.x,r[o+1]=h.y,r[o+n]=h.x,r[o+n+1]=h.y,r[o+n*2]=h.x,r[o+n*2+1]=h.y,r[o+n*3]=h.x,r[o+n*3+1]=h.y,o+=n*4}}uploadRotation(t,e,i,r,n,o){for(let a=0;a<i;a++){const h=t[e+a].rotation;r[o]=h,r[o+n]=h,r[o+n*2]=h,r[o+n*3]=h,o+=n*4}}uploadUvs(t,e,i,r,n,o){for(let a=0;a<i;++a){const h=t[e+a]._texture._uvs;h?(r[o]=h.x0,r[o+1]=h.y0,r[o+n]=h.x1,r[o+n+1]=h.y1,r[o+n*2]=h.x2,r[o+n*2+1]=h.y2,r[o+n*3]=h.x3,r[o+n*3+1]=h.y3,o+=n*4):(r[o]=0,r[o+1]=0,r[o+n]=0,r[o+n+1]=0,r[o+n*2]=0,r[o+n*2+1]=0,r[o+n*3]=0,r[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,r,n,o){for(let a=0;a<i;++a){const h=t[e+a],l=et.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);r[o]=l,r[o+n]=l,r[o+n*2]=l,r[o+n*3]=l,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Rl.extension={name:"particle",type:R.RendererPlugin};N.add(Rl);var ur=(s=>(s[s.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",s[s.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",s))(ur||{});const ws={willReadFrequently:!0},Kt=class U{static get experimentalLetterSpacingSupported(){let t=U._experimentalLetterSpacingSupported;if(t!==void 0){const e=O.ADAPTER.getCanvasRenderingContext2D().prototype;t=U._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,r,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,r=U._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=U.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=r.getContext("2d",ws);a.font=n;const h=(i?U.wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let f=0;f<h.length;f++){const m=U._measureText(h[f],e.letterSpacing,a);l[f]=m,c=Math.max(c,m)}let u=c+e.strokeThickness;e.dropShadow&&(u+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let p=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(p+=e.dropShadowDistance),new U(t,e,u,p,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let r=!1;U.experimentalLetterSpacingSupported&&(U.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,r=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(r?n-=e:n+=(U.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=U._canvas){const r=i.getContext("2d",ws);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=U.collapseSpaces(c),d=U.collapseNewlines(c);let p=!u;const f=e.wordWrapWidth+l,m=U.tokenize(t);for(let g=0;g<m.length;g++){let _=m[g];if(U.isNewline(_)){if(!d){a+=U.addLine(o),p=!u,o="",n=0;continue}_=" "}if(u){const y=U.isBreakingSpace(_),v=U.isBreakingSpace(o[o.length-1]);if(y&&v)continue}const x=U.getFromCache(_,l,h,r);if(x>f)if(o!==""&&(a+=U.addLine(o),o="",n=0),U.canBreakWords(_,e.breakWords)){const y=U.wordWrapSplit(_);for(let v=0;v<y.length;v++){let A=y[v],B=A,T=1;for(;y[v+T];){const D=y[v+T];if(!U.canBreakChars(B,D,_,v,e.breakWords))A+=D;else break;B=D,T++}v+=T-1;const E=U.getFromCache(A,l,h,r);E+n>f&&(a+=U.addLine(o),p=!1,o="",n=0),o+=A,n+=E}}else{o.length>0&&(a+=U.addLine(o),o="",n=0);const y=g===m.length-1;a+=U.addLine(_,!y),p=!1,o="",n=0}else x+n>f&&(p=!1,a+=U.addLine(o),o="",n=0),(o.length>0||!U.isBreakingSpace(_)||p)&&(o+=_,n+=x)}return a+=U.addLine(o,!1),a}static addLine(t,e=!0){return t=U.trimRight(t),t=e?`${t}
|
|
969
|
-
`:t,t}static getFromCache(t,e,i,r){let n=i[t];return typeof n!="number"&&(n=U._measureText(t,e,r)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!U.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:U._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:U._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let r=0;r<t.length;r++){const n=t[r],o=t[r+1];if(U.isBreakingSpace(n,o)||U.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,n){return!0}static wordWrapSplit(t){return U.graphemeSegmenter(t)}static measureFont(t){if(U._fonts[t])return U._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=U._canvas,r=U._context;r.font=t;const n=U.METRICS_STRING+U.BASELINE_SYMBOL,o=Math.ceil(r.measureText(n).width);let a=Math.ceil(r.measureText(U.BASELINE_SYMBOL).width);const h=Math.ceil(U.HEIGHT_MULTIPLIER*a);if(a=a*U.BASELINE_MULTIPLIER|0,o===0||h===0)return U._fonts[t]=e,e;i.width=o,i.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,a);const l=r.getImageData(0,0,o,h).data,c=l.length,u=o*4;let d=0,p=0,f=!1;for(d=0;d<a;++d){for(let m=0;m<u;m+=4)if(l[p+m]!==255){f=!0;break}if(!f)p+=u;else break}for(e.ascent=a-d,p=c-u,f=!1,d=h;d>a;--d){for(let m=0;m<u;m+=4)if(l[p+m]!==255){f=!0;break}if(!f)p-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,U._fonts[t]=e,e}static clearMetrics(t=""){t?delete U._fonts[t]:U._fonts={}}static get _canvas(){var t;if(!U.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",ws))!=null&&t.measureText)return U.__canvas=i,i;e=O.ADAPTER.createCanvas()}catch{e=O.ADAPTER.createCanvas()}e.width=e.height=10,U.__canvas=e}return U.__canvas}static get _context(){return U.__context||(U.__context=U._canvas.getContext("2d",ws)),U.__context}};Kt.METRICS_STRING="|ÉqÅ",Kt.BASELINE_SYMBOL="M",Kt.BASELINE_MULTIPLIER=1.4,Kt.HEIGHT_MULTIPLIER=2,Kt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>[...s.segment(t)].map(e=>e.segment)}return s=>[...s]})(),Kt.experimentalLetterSpacing=!1,Kt._fonts={},Kt._newlines=[10,13],Kt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let xe=Kt;const kg=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Ml=class Ni{constructor(t){this.styleID=0,this.reset(),jr(this,t,t)}clone(){const t={};return jr(t,this,Ni.defaultStyle),new Ni(t)}reset(){jr(this,Ni.defaultStyle,Ni.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Vr(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=Vr(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){Gg(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Vr(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!kg.includes(r)&&(r=`"${r}"`),e[i]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Ml.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ur.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ce=Ml;function Vr(s){const t=et.shared,e=i=>{const r=t.setValue(i);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(s)?s.map(e):e(s)}function Gg(s,t){if(!Array.isArray(s)||!Array.isArray(t)||s.length!==t.length)return!1;for(let e=0;e<s.length;++e)if(s[e]!==t[e])return!1;return!0}function jr(s,t,e){for(const i in e)Array.isArray(t[i])?s[i]=t[i].slice():s[i]=t[i]}const Hg={texture:!0,children:!1,baseTexture:!0},Bl=class Xn extends Ke{constructor(t,e,i){let r=!1;i||(i=O.ADAPTER.createCanvas(),r=!0),i.width=3,i.height=3;const n=L.from(i);n.orig=new z,n.trim=new z,super(n),this._ownCanvas=r,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Xn.defaultResolution??O.RESOLUTION,this._autoResolution=Xn.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return xe.experimentalLetterSpacing}static set experimentalLetterSpacing(t){K("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),xe.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const i=this.context,r=xe.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,o=r.height,a=r.lines,h=r.lineHeight,l=r.lineWidths,c=r.maxLineWidth,u=r.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,p;const f=e.dropShadow?2:1;for(let m=0;m<f;++m){const g=e.dropShadow&&m===0,_=g?Math.ceil(Math.max(1,o)+e.padding*2):0,x=_*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,A=e.dropShadowBlur*this._resolution,B=e.dropShadowDistance*this._resolution;i.shadowColor=et.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=A,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*B,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*B+x}else i.fillStyle=this._generateFillStyle(e,a,r),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let y=(h-u.fontSize)/2;h-u.fontSize<0&&(y=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,p=e.strokeThickness/2+v*h+u.ascent+y,e.align==="right"?d+=c-l[v]:e.align==="center"&&(d+=(c-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-_,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-_)}this.updateTexture()}drawLetterSpacing(t,e,i,r=!1){const n=this._style.letterSpacing;let o=!1;if(xe.experimentalLetterSpacingSupported&&(xe.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=xe.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];r?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let p="";for(let f=u+1;f<h.length;++f)p+=h[f];c=this.context.measureText(p).width,a+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=ap(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,r=i.trim?0:i.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-r,e.trim.y=-r,e.orig.width=e._frame.width-r*2,e.orig.height=e._frame.height-r*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const r=t.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,c=r.slice(),u=t.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let p=1;p<d;++p)u.push(p/d)}if(c.unshift(r[0]),u.unshift(0),c.push(r[r.length-1]),u.push(1),t.fillGradientType===ur.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let p=0;p<e.length;p++){const f=i.lineHeight*(p-1)+d,m=i.lineHeight*p;let g=m;p>0&&f>m&&(g=(m+f)/2);const _=m+d,x=i.lineHeight*(p+1);let y=_;p+1<e.length&&x<_&&(y=(_+x)/2);const v=(y-g)/l;for(let A=0;A<c.length;A++){let B=0;typeof u[A]=="number"?B=u[A]:B=A/c.length;let T=Math.min(1,Math.max(0,g/l+B*v));T=Number(T.toFixed(5)),n.addColorStop(T,c[A])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=c.length+1;let p=1;for(let f=0;f<c.length;f++){let m;typeof u[f]=="number"?m=u[f]:m=p/d,n.addColorStop(m,c[f]),p++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Hg,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=Ae(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=Ae(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof Ce?this._style=t:this._style=new Ce(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Bl.defaultAutoResolution=!0;let Dl=Bl;class Wg{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function Xg(s,t){var i;let e=!1;if((i=s==null?void 0:s._textures)!=null&&i.length){for(let r=0;r<s._textures.length;r++)if(s._textures[r]instanceof L){const n=s._textures[r].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function $g(s,t){if(s.baseTexture instanceof j){const e=s.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function zg(s,t){if(s._texture&&s._texture instanceof L){const e=s._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Vg(s,t){return t instanceof Dl?(t.updateText(!0),!0):!1}function jg(s,t){if(t instanceof Ce){const e=t.toFontString();return xe.measureFont(e),!0}return!1}function Yg(s,t){if(s instanceof Dl){t.includes(s.style)||t.push(s.style),t.includes(s)||t.push(s);const e=s._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function qg(s,t){return s instanceof Ce?(t.includes(s)||t.push(s),!0):!1}const Fl=class Ol{constructor(t){this.limiter=new Wg(Ol.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(Yg),this.registerFindHook(qg),this.registerFindHook(Xg),this.registerFindHook($g),this.registerFindHook(zg),this.registerUploadHook(Vg),this.registerUploadHook(jg)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,It.system.addOnce(this.tick,this,Ve.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)It.system.addOnce(this.tick,this,Ve.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Ft)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&It.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};Fl.uploadsPerFrame=4;let $n=Fl;Object.defineProperties(O,{UPLOADS_PER_FRAME:{get(){return $n.uploadsPerFrame},set(s){K("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),$n.uploadsPerFrame=s}}});function Ll(s,t){return t instanceof j?(t._glTextures[s.CONTEXT_UID]||s.texture.bind(t),!0):!1}function Kg(s,t){if(!(t instanceof Cl))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let r=0;r<i.length;r++){const{texture:n}=i[r].style;n&&Ll(s,n.baseTexture)}return e.batchable||s.geometry.bind(e,t._resolveDirectShader(s)),!0}function Zg(s,t){return s instanceof Cl?(t.push(s),!0):!1}class Nl extends $n{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(Zg),this.registerUploadHook(Ll),this.registerUploadHook(Kg)}}Nl.extension={name:"prepare",type:R.RendererSystem};N.add(Nl);var Qg=`#version 300 es
|
|
970
|
-
#define SHADER_NAME Tiling-Sprite-100
|
|
971
|
-
|
|
972
|
-
precision lowp float;
|
|
973
|
-
|
|
974
|
-
in vec2 vTextureCoord;
|
|
975
|
-
|
|
976
|
-
out vec4 fragmentColor;
|
|
977
|
-
|
|
978
|
-
uniform sampler2D uSampler;
|
|
979
|
-
uniform vec4 uColor;
|
|
980
|
-
uniform mat3 uMapCoord;
|
|
981
|
-
uniform vec4 uClampFrame;
|
|
982
|
-
uniform vec2 uClampOffset;
|
|
983
|
-
|
|
984
|
-
void main(void)
|
|
985
|
-
{
|
|
986
|
-
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
987
|
-
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
988
|
-
vec2 unclamped = coord;
|
|
989
|
-
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
990
|
-
|
|
991
|
-
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
|
|
992
|
-
|
|
993
|
-
fragmentColor = texSample * uColor;
|
|
994
|
-
}
|
|
995
|
-
`,Jg=`#version 300 es
|
|
996
|
-
#define SHADER_NAME Tiling-Sprite-300
|
|
997
|
-
|
|
998
|
-
precision lowp float;
|
|
999
|
-
|
|
1000
|
-
in vec2 aVertexPosition;
|
|
1001
|
-
in vec2 aTextureCoord;
|
|
1002
|
-
|
|
1003
|
-
uniform mat3 projectionMatrix;
|
|
1004
|
-
uniform mat3 translationMatrix;
|
|
1005
|
-
uniform mat3 uTransform;
|
|
1006
|
-
|
|
1007
|
-
out vec2 vTextureCoord;
|
|
1008
|
-
|
|
1009
|
-
void main(void)
|
|
1010
|
-
{
|
|
1011
|
-
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1012
|
-
|
|
1013
|
-
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1014
|
-
}
|
|
1015
|
-
`,ty=`#version 100
|
|
1016
|
-
#ifdef GL_EXT_shader_texture_lod
|
|
1017
|
-
#extension GL_EXT_shader_texture_lod : enable
|
|
1018
|
-
#endif
|
|
1019
|
-
#define SHADER_NAME Tiling-Sprite-100
|
|
1020
|
-
|
|
1021
|
-
precision lowp float;
|
|
1022
|
-
|
|
1023
|
-
varying vec2 vTextureCoord;
|
|
1024
|
-
|
|
1025
|
-
uniform sampler2D uSampler;
|
|
1026
|
-
uniform vec4 uColor;
|
|
1027
|
-
uniform mat3 uMapCoord;
|
|
1028
|
-
uniform vec4 uClampFrame;
|
|
1029
|
-
uniform vec2 uClampOffset;
|
|
1030
|
-
|
|
1031
|
-
void main(void)
|
|
1032
|
-
{
|
|
1033
|
-
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
1034
|
-
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
1035
|
-
vec2 unclamped = coord;
|
|
1036
|
-
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
1037
|
-
|
|
1038
|
-
#ifdef GL_EXT_shader_texture_lod
|
|
1039
|
-
vec4 texSample = unclamped == coord
|
|
1040
|
-
? texture2D(uSampler, coord)
|
|
1041
|
-
: texture2DLodEXT(uSampler, coord, 0);
|
|
1042
|
-
#else
|
|
1043
|
-
vec4 texSample = texture2D(uSampler, coord);
|
|
1044
|
-
#endif
|
|
1045
|
-
|
|
1046
|
-
gl_FragColor = texSample * uColor;
|
|
1047
|
-
}
|
|
1048
|
-
`,$a=`#version 100
|
|
1049
|
-
#define SHADER_NAME Tiling-Sprite-100
|
|
1050
|
-
|
|
1051
|
-
precision lowp float;
|
|
1052
|
-
|
|
1053
|
-
attribute vec2 aVertexPosition;
|
|
1054
|
-
attribute vec2 aTextureCoord;
|
|
1055
|
-
|
|
1056
|
-
uniform mat3 projectionMatrix;
|
|
1057
|
-
uniform mat3 translationMatrix;
|
|
1058
|
-
uniform mat3 uTransform;
|
|
1059
|
-
|
|
1060
|
-
varying vec2 vTextureCoord;
|
|
1061
|
-
|
|
1062
|
-
void main(void)
|
|
1063
|
-
{
|
|
1064
|
-
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1065
|
-
|
|
1066
|
-
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1067
|
-
}
|
|
1068
|
-
`,ey=`#version 100
|
|
1069
|
-
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
1070
|
-
|
|
1071
|
-
precision lowp float;
|
|
1072
|
-
|
|
1073
|
-
varying vec2 vTextureCoord;
|
|
1074
|
-
|
|
1075
|
-
uniform sampler2D uSampler;
|
|
1076
|
-
uniform vec4 uColor;
|
|
1077
|
-
|
|
1078
|
-
void main(void)
|
|
1079
|
-
{
|
|
1080
|
-
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
1081
|
-
gl_FragColor = texSample * uColor;
|
|
1082
|
-
}
|
|
1083
|
-
`;const As=new it;class Ul extends hr{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Gh,this.state=re.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=ie.from($a,ey,e),this.shader=t.context.webGLVersion>1?ie.from(Jg,Qg,e):ie.from($a,ty,e)}render(t){const e=this.renderer,i=this.quad;let r=i.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;r=i.uvs,r[0]=r[6]=-n,r[1]=r[3]=-o,r[2]=r[4]=1-n,r[5]=r[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,c=t.tileTransform.localTransform,u=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Te.CLAMP:h.wrapMode===Te.CLAMP&&(h.wrapMode=Te.REPEAT));const p=d?this.simpleShader:this.shader,f=a.width,m=a.height,g=t._width,_=t._height;As.set(c.a*f/g,c.b*f/_,c.c*m/g,c.d*m/_,c.tx/g,c.ty/_),As.invert(),d?As.prepend(u.mapCoord):(p.uniforms.uMapCoord=u.mapCoord.toArray(!0),p.uniforms.uClampFrame=u.uClampFrame,p.uniforms.uClampOffset=u.uClampOffset),p.uniforms.uTransform=As.toArray(!0),p.uniforms.uColor=et.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(p.uniforms.uColor),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=a,e.shader.bind(p),e.geometry.bind(i),this.state.blendMode=Ch(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ul.extension={name:"tilingSprite",type:R.RendererPlugin};N.add(Ul);const kl=class Ui{constructor(t,e,i){this.linkedSheets=[],(t instanceof j||t instanceof L)&&(t={texture:t,data:e,resolutionFilename:i});const{texture:r,data:n,resolutionFilename:o=null,cachePrefix:a=""}=t;this.cachePrefix=a,this._texture=r instanceof L?r:null,this.baseTexture=r instanceof j?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(o||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let i=pe(t,null);return i===null&&(i=typeof e=="number"?e:parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Ui.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Ui.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new z(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new z(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new z(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[r]=new L(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),L.addToCache(this.textures[r],this.cachePrefix+r.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ui.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ui.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};kl.BATCH_SIZE=1e3;let za=kl;const iy=["jpg","png","jpeg","avif","webp"];function Gl(s,t,e){const i={};if(s.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=ft.dirname(s[0]);t.linkedSheets.forEach((n,o)=>{Object.assign(i,Gl([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0))})}return i}const sy={extension:R.Asset,cache:{test:s=>s instanceof za,getCacheableAssets:(s,t)=>Gl(s,t,!1)},resolver:{test:s=>{const t=s.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&iy.includes(i)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=O.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:R.LoadParser,priority:Xt.Normal},async testParse(s,t){return ft.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var c,u;const{texture:i,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let o=ft.dirname(t.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(i&&i.baseTexture)a=i;else{const d=kn(o+(r??s.meta.image),t.src);a=(await e.load([d]))[d]}const h=new za({texture:a.baseTexture,data:s,resolutionFilename:t.src,cachePrefix:n});await h.parse();const l=(c=s==null?void 0:s.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(l)){const d=[];for(const f of l){if(typeof f!="string")continue;let m=o+f;(u=t.data)!=null&&u.ignoreMultiPack||(m=kn(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const p=await Promise.all(d);h.linkedSheets=p,p.forEach(f=>{f.linkedSheets=[h].concat(h.linkedSheets.filter(m=>m!==f))})}return h},unload(s){s.destroy(!0)}}};N.add(sy);class er{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Os{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const c=a[l].split("="),u=c[0],d=c[1].replace(/"/gm,""),p=parseFloat(d),f=isNaN(p)?d:p;h[u]=f}i[o].push(h)}const r=new er;return i.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class zn{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new er,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)e.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<r.length;l++)e.common.push({lineHeight:parseInt(r[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<o.length;l++){const c=o[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class Vn{static test(t){return typeof t=="string"&&t.includes("<font>")?zn.test(O.ADAPTER.parseXML(t)):!1}static parse(t){return zn.parse(O.ADAPTER.parseXML(t))}}const Yr=[Os,zn,Vn];function ry(s){for(let t=0;t<Yr.length;t++)if(Yr[t].test(s))return Yr[t];return null}function ny(s,t,e,i,r,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,c=s.width/i-h-l*2,u=s.height/i-h-l*2,d=o.slice(),p=e.fillGradientStops.slice();if(!p.length){const f=d.length+1;for(let m=1;m<f;++m)p.push(m/f)}if(d.unshift(o[0]),p.unshift(0),d.push(o[o.length-1]),p.push(1),e.fillGradientType===ur.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,l,c/2,u+l);let f=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<r.length;g++){const _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof p[x]=="number"?y=p[x]:y=x/d.length;const v=_/u+y*m;let A=Math.max(f,v);A=Math.min(A,1),a.addColorStop(A,d[x]),f=A}}}else{a=t.createLinearGradient(l,u/2,c+l,u/2);const f=d.length+1;let m=1;for(let g=0;g<d.length;g++){let _;typeof p[g]=="number"?_=p[g]:_=m/f,a.addColorStop(_,d[g]),m++}}return a}function oy(s,t,e,i,r,n,o){const a=e.text,h=e.fontProperties;t.translate(i,r),t.scale(n,n);const l=o.strokeThickness/2,c=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=ny(s,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*n,p=o.dropShadowDistance*n;t.shadowColor=et.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,c+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,c+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ls(s){return s.codePointAt?s.codePointAt(0):s.charCodeAt(0)}function Hl(s){return Array.from?Array.from(s):s.split("")}function ay(s){typeof s=="string"&&(s=[s]);const t=[];for(let e=0,i=s.length;e<i;e++){const r=s[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),o=r[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Hl(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const ye=class Zt{constructor(t,e,i){var c;const[r]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=pe(o.file),l={};this._ownsTextures=i,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=l;for(let u=0;u<t.page.length;u++){const{id:d,file:p}=t.page[u];l[d]=e instanceof Array?e[u]:e[p],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Ct.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=se.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:p}=t.char[u];let{x:f,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[u];f/=h,m/=h,g/=h,_/=h,x/=h,y/=h,v/=h;const A=new z(f+l[p].frame.x/h,m+l[p].frame.y/h,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new L(l[p].baseTexture,A),page:p}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:p,amount:f}=t.kerning[u];d/=h,p/=h,f/=h,this.chars[p]&&(this.chars[p].kerning[d]=f)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.fieldType)==null?void 0:c.toLowerCase())??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,i){let r;if(t instanceof er)r=t;else{const o=ry(t);if(!o)throw new Error("Unrecognized data format for font.");r=o.parse(t)}e instanceof L&&(e=[e]);const n=new Zt(r,e,i);return Zt.available[n.font]=n,n}static uninstall(t){const e=Zt.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Zt.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Zt.defaultOptions,i),c=ay(r),u=e instanceof Ce?e:new Ce(e),d=a,p=new er;p.info[0]={face:u.fontFamily,size:u.fontSize},p.common[0]={lineHeight:u.fontSize};let f=0,m=0,g,_,x,y=0;const v=[];for(let B=0;B<c.length;B++){g||(g=O.ADAPTER.createCanvas(),g.width=a,g.height=h,_=g.getContext("2d"),x=new j(g,{resolution:o,...l}),v.push(new L(x)),p.page.push({id:v.length-1,file:""}));const T=c[B],E=xe.measureText(T,u,!1,g),D=E.width,k=Math.ceil(E.height),q=Math.ceil((u.fontStyle==="italic"?2:1)*D);if(m>=h-k*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--B,g=null,_=null,x=null,m=0,f=0,y=0;continue}if(y=Math.max(k+E.fontProperties.descent,y),q*o+f>=d){if(f===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--B,m+=y*o,m=Math.ceil(m),f=0,y=0;continue}oy(g,_,E,f,m,o,u);const M=Ls(E.text);p.char.push({id:M,page:v.length-1,x:f/o,y:m/o,width:q,height:k,xoffset:0,yoffset:0,xadvance:D-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),f+=(q+2*n)*o,f=Math.ceil(f)}if(!(i!=null&&i.skipKerning))for(let B=0,T=c.length;B<T;B++){const E=c[B];for(let D=0;D<T;D++){const k=c[D],q=_.measureText(E).width,M=_.measureText(k).width,b=_.measureText(E+k).width-(q+M);b&&p.kerning.push({first:Ls(E),second:Ls(k),amount:b})}}const A=new Zt(p,v,!0);return Zt.available[t]!==void 0&&Zt.uninstall(t),Zt.available[t]=A,A}};ye.ALPHA=[["a","z"],["A","Z"]," "],ye.NUMERIC=[["0","9"]],ye.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],ye.ASCII=[[" ","~"]],ye.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:ye.ALPHANUMERIC},ye.available={};let _e=ye;var hy=`// Pixi texture info\r
|
|
1084
|
-
varying vec2 vTextureCoord;\r
|
|
1085
|
-
uniform sampler2D uSampler;\r
|
|
1086
|
-
\r
|
|
1087
|
-
// Tint\r
|
|
1088
|
-
uniform vec4 uColor;\r
|
|
1089
|
-
\r
|
|
1090
|
-
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
|
1091
|
-
uniform float uFWidth;\r
|
|
1092
|
-
\r
|
|
1093
|
-
void main(void) {\r
|
|
1094
|
-
\r
|
|
1095
|
-
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
|
1096
|
-
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
|
1097
|
-
\r
|
|
1098
|
-
// MSDF\r
|
|
1099
|
-
float median = texColor.r + texColor.g + texColor.b -\r
|
|
1100
|
-
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
|
1101
|
-
max(texColor.r, max(texColor.g, texColor.b));\r
|
|
1102
|
-
// SDF\r
|
|
1103
|
-
median = min(median, texColor.a);\r
|
|
1104
|
-
\r
|
|
1105
|
-
float screenPxDistance = uFWidth * (median - 0.5);\r
|
|
1106
|
-
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
|
1107
|
-
if (median < 0.01) {\r
|
|
1108
|
-
alpha = 0.0;\r
|
|
1109
|
-
} else if (median > 0.99) {\r
|
|
1110
|
-
alpha = 1.0;\r
|
|
1111
|
-
}\r
|
|
1112
|
-
\r
|
|
1113
|
-
// Gamma correction for coverage-like alpha\r
|
|
1114
|
-
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
|
|
1115
|
-
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
|
|
1116
|
-
float coverage = pow(uColor.a * alpha, gamma); \r
|
|
1117
|
-
\r
|
|
1118
|
-
// NPM Textures, NPM outputs\r
|
|
1119
|
-
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
1120
|
-
}\r
|
|
1121
|
-
`,ly=`// Mesh material default fragment\r
|
|
1122
|
-
attribute vec2 aVertexPosition;\r
|
|
1123
|
-
attribute vec2 aTextureCoord;\r
|
|
1124
|
-
\r
|
|
1125
|
-
uniform mat3 projectionMatrix;\r
|
|
1126
|
-
uniform mat3 translationMatrix;\r
|
|
1127
|
-
uniform mat3 uTextureMatrix;\r
|
|
1128
|
-
\r
|
|
1129
|
-
varying vec2 vTextureCoord;\r
|
|
1130
|
-
\r
|
|
1131
|
-
void main(void)\r
|
|
1132
|
-
{\r
|
|
1133
|
-
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
|
1134
|
-
\r
|
|
1135
|
-
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
1136
|
-
}\r
|
|
1137
|
-
`;const Va=[],ja=[],Ya=[],cy=class Wl extends Ft{constructor(t,e={}){super();const{align:i,tint:r,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},Wl.styleDefaults,e);if(!_e.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new et(r),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new ce(()=>{this.dirty=!0},this,0,0),this._roundPixels=O.ROUND_PIXELS,this.dirty=!0,this._resolution=O.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var q;const t=_e.available[this._fontName],e=this.fontSize,i=e/t.size,r=new X,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1138
|
-
`)||" ",l=Hl(h),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?Va:ja;let d=null,p=0,f=0,m=0,g=-1,_=0,x=0,y=0,v=0;for(let M=0;M<l.length;M++){const b=l[M],C=Ls(b);if(/(?:\s)/.test(b)&&(g=M,_=p,v++),b==="\r"||b===`
|
|
1139
|
-
`){o.push(p),a.push(-1),f=Math.max(f,p),++m,++x,r.x=0,r.y+=t.lineHeight,d=null,v=0;continue}const H=t.chars[C];if(!H)continue;d&&H.kerning[d]&&(r.x+=H.kerning[d]);const V=Ya.pop()||{texture:L.EMPTY,line:0,charCode:0,prevSpaces:0,position:new X};V.texture=H.texture,V.line=m,V.charCode=C,V.position.x=Math.round(r.x+H.xOffset+this._letterSpacing/2),V.position.y=Math.round(r.y+H.yOffset),V.prevSpaces=v,n.push(V),p=V.position.x+Math.max(H.xAdvance-H.xOffset,H.texture.orig.width),r.x+=H.xAdvance+this._letterSpacing,y=Math.max(y,H.yOffset+H.texture.height),d=C,g!==-1&&c>0&&r.x>c&&(++x,fi(n,1+g-x,1+M-g),M=g,g=-1,o.push(_),a.push(n.length>0?n[n.length-1].prevSpaces:0),f=Math.max(f,_),m++,r.x=0,r.y+=t.lineHeight,d=null,v=0)}const A=l[l.length-1];A!=="\r"&&A!==`
|
|
1140
|
-
`&&(/(?:\s)/.test(A)&&(p=_),o.push(p),f=Math.max(f,p),a.push(-1));const B=[];for(let M=0;M<=m;M++){let b=0;this._align==="right"?b=f-o[M]:this._align==="center"?b=(f-o[M])/2:this._align==="justify"&&(b=a[M]<0?0:(f-o[M])/a[M]),B.push(b)}const T=n.length,E={},D=[],k=this._activePagesMeshData;u.push(...k);for(let M=0;M<T;M++){const b=n[M].texture,C=b.baseTexture.uid;if(!E[C]){let H=u.pop();if(!H){const W=new Fg;let Y,at;t.distanceFieldType==="none"?(Y=new Wa(L.EMPTY),at=$.NORMAL):(Y=new Wa(L.EMPTY,{program:ue.from(ly,hy),uniforms:{uFWidth:0}}),at=$.NORMAL_NPM);const P=new Ha(W,Y);P.blendMode=at,H={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:P,vertices:null,uvs:null,indices:null}}H.index=0,H.indexCount=0,H.vertexCount=0,H.uvsCount=0,H.total=0;const{_textureCache:V}=this;V[C]=V[C]||new L(b.baseTexture),H.mesh.texture=V[C],H.mesh.tint=this._tintColor.value,D.push(H),E[C]=H}E[C].total++}for(let M=0;M<k.length;M++)D.includes(k[M])||this.removeChild(k[M].mesh);for(let M=0;M<D.length;M++)D[M].mesh.parent!==this&&this.addChild(D[M].mesh);this._activePagesMeshData=D;for(const M in E){const b=E[M],C=b.total;if(!(((q=b.indices)==null?void 0:q.length)>6*C)||b.vertices.length<Ha.BATCHABLE_SIZE*2)b.vertices=new Float32Array(4*2*C),b.uvs=new Float32Array(4*2*C),b.indices=new Uint16Array(6*C);else{const H=b.total,V=b.vertices;for(let W=H*4*2;W<V.length;W++)V[W]=0}b.mesh.size=6*C}for(let M=0;M<T;M++){const b=n[M];let C=b.position.x+B[b.line]*(this._align==="justify"?b.prevSpaces:1);this._roundPixels&&(C=Math.round(C));const H=C*i,V=b.position.y*i,W=b.texture,Y=E[W.baseTexture.uid],at=W.frame,P=W._uvs,I=Y.index++;Y.indices[I*6+0]=0+I*4,Y.indices[I*6+1]=1+I*4,Y.indices[I*6+2]=2+I*4,Y.indices[I*6+3]=0+I*4,Y.indices[I*6+4]=2+I*4,Y.indices[I*6+5]=3+I*4,Y.vertices[I*8+0]=H,Y.vertices[I*8+1]=V,Y.vertices[I*8+2]=H+at.width*i,Y.vertices[I*8+3]=V,Y.vertices[I*8+4]=H+at.width*i,Y.vertices[I*8+5]=V+at.height*i,Y.vertices[I*8+6]=H,Y.vertices[I*8+7]=V+at.height*i,Y.uvs[I*8+0]=P.x0,Y.uvs[I*8+1]=P.y0,Y.uvs[I*8+2]=P.x1,Y.uvs[I*8+3]=P.y1,Y.uvs[I*8+4]=P.x2,Y.uvs[I*8+5]=P.y2,Y.uvs[I*8+6]=P.x3,Y.uvs[I*8+7]=P.y3}this._textWidth=f*i,this._textHeight=(r.y+t.lineHeight)*i;for(const M in E){const b=E[M];if(this.anchor.x!==0||this.anchor.y!==0){let W=0;const Y=this._textWidth*this.anchor.x,at=this._textHeight*this.anchor.y;for(let P=0;P<b.total;P++)b.vertices[W++]-=Y,b.vertices[W++]-=at,b.vertices[W++]-=Y,b.vertices[W++]-=at,b.vertices[W++]-=Y,b.vertices[W++]-=at,b.vertices[W++]-=Y,b.vertices[W++]-=at}this._maxLineHeight=y*i;const C=b.mesh.geometry.getBuffer("aVertexPosition"),H=b.mesh.geometry.getBuffer("aTextureCoord"),V=b.mesh.geometry.getIndex();C.data=b.vertices,H.data=b.uvs,V.data=b.indices,C.update(),H.update(),V.update()}for(let M=0;M<n.length;M++)Ya.push(n[M]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:r}=_e.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=this.fontSize/r,p=t._view.resolution;for(const f of this._activePagesMeshData)f.mesh.shader.uniforms.uFWidth=u*e*d*p}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=_e.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!_e.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??_e.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,i=_e.available[this._fontName].distanceFieldType==="none"?Va:ja;i.push(...this._activePagesMeshData);for(const r of this._activePagesMeshData)this.removeChild(r.mesh);this._activePagesMeshData=[],i.filter(r=>e[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=L.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};cy.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const uy=[".xml",".fnt"],dy={extension:{type:R.LoadParser,priority:Xt.Normal},name:"loadBitmapFont",test(s){return uy.includes(ft.extname(s).toLowerCase())},async testParse(s){return Os.test(s)||Vn.test(s)},async parse(s,t,e){const i=Os.test(s)?Os.parse(s):Vn.parse(s),{src:r}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=ft.join(ft.dirname(r),c);u=kn(u,r),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return _e.install(i,h,!0)},async load(s,t){return(await O.ADAPTER.fetch(s)).text()},unload(s){s.destroy()}};N.add(dy);const jn=class ai extends Ce{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new ai(Object.keys(ai.defaultOptions).reduce((e,i)=>({...e,[i]:t[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete ai.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=ai;if(i[t]){const r=i[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return O.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,o)=>{const a=URL.createObjectURL(r),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(r)})).then(async([r,n])=>{const o=Object.assign({family:ft.basename(t,ft.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
|
|
1141
|
-
@font-face {
|
|
1142
|
-
font-family: "${e.family}";
|
|
1143
|
-
src: url('${e.dataSrc}');
|
|
1144
|
-
font-weight: ${e.weight};
|
|
1145
|
-
font-style: ${e.style};
|
|
1146
|
-
font-display: ${e.display};
|
|
1147
|
-
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=ep(t)),typeof t=="number"?tp(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,ai.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=O.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};jn.availableFonts={},jn.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let qr=jn;const Es=class hi extends Ke{constructor(t="",e={}){super(L.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,r=L.from(i,{scaleMode:O.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new z,r.trim=new z,this.texture=r;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=hi.defaultMaxWidth,this.maxHeight=hi.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=hi.defaultAutoResolution,this._resolution=hi.defaultResolution??O.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;const{text:e,style:i,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(r)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(r)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=r.width=Math.ceil(Math.max(1,n)),i.height=r.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{r.onload=async()=>{if(a<this._updateID){h();return}await e.onBeforeDraw(),i.src=r.src,r.onload=null,r.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:r}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=i.width/r,e.trim.height=e._frame.height=i.height/r,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,r),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var i,r,n,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},hi.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=e,(r=this._svgRoot)==null||r.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=Ae(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=Ae(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof qr?(this.ownsStyle=!1,this._style=t):t instanceof Ce?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=qr.from(t)):(this.ownsStyle=!0,this._style=new qr(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};Es.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Es.defaultMaxWidth=2024,Es.defaultMaxHeight=2024,Es.defaultAutoResolution=!0;var py=Object.defineProperty,fy=(s,t,e)=>t in s?py(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,w=(s,t,e)=>(fy(s,typeof t!="symbol"?t+"":t,e),e);class Ot{constructor(t){w(this,"parent"),w(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var my=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Xl={exports:{}};(function(s,t){(function(){var e,i;i=function(r){return s.exports=r},e={linear:function(r,n,o,a){return o*r/a+n},easeInQuad:function(r,n,o,a){return o*(r/=a)*r+n},easeOutQuad:function(r,n,o,a){return-o*(r/=a)*(r-2)+n},easeInOutQuad:function(r,n,o,a){return(r/=a/2)<1?o/2*r*r+n:-o/2*(--r*(r-2)-1)+n},easeInCubic:function(r,n,o,a){return o*(r/=a)*r*r+n},easeOutCubic:function(r,n,o,a){return o*((r=r/a-1)*r*r+1)+n},easeInOutCubic:function(r,n,o,a){return(r/=a/2)<1?o/2*r*r*r+n:o/2*((r-=2)*r*r+2)+n},easeInQuart:function(r,n,o,a){return o*(r/=a)*r*r*r+n},easeOutQuart:function(r,n,o,a){return-o*((r=r/a-1)*r*r*r-1)+n},easeInOutQuart:function(r,n,o,a){return(r/=a/2)<1?o/2*r*r*r*r+n:-o/2*((r-=2)*r*r*r-2)+n},easeInQuint:function(r,n,o,a){return o*(r/=a)*r*r*r*r+n},easeOutQuint:function(r,n,o,a){return o*((r=r/a-1)*r*r*r*r+1)+n},easeInOutQuint:function(r,n,o,a){return(r/=a/2)<1?o/2*r*r*r*r*r+n:o/2*((r-=2)*r*r*r*r+2)+n},easeInSine:function(r,n,o,a){return-o*Math.cos(r/a*(Math.PI/2))+o+n},easeOutSine:function(r,n,o,a){return o*Math.sin(r/a*(Math.PI/2))+n},easeInOutSine:function(r,n,o,a){return-o/2*(Math.cos(Math.PI*r/a)-1)+n},easeInExpo:function(r,n,o,a){return r===0?n:o*Math.pow(2,10*(r/a-1))+n},easeOutExpo:function(r,n,o,a){return r===a?n+o:o*(-Math.pow(2,-10*r/a)+1)+n},easeInOutExpo:function(r,n,o,a){return(r/=a/2)<1?o/2*Math.pow(2,10*(r-1))+n:o/2*(-Math.pow(2,-10*--r)+2)+n},easeInCirc:function(r,n,o,a){return-o*(Math.sqrt(1-(r/=a)*r)-1)+n},easeOutCirc:function(r,n,o,a){return o*Math.sqrt(1-(r=r/a-1)*r)+n},easeInOutCirc:function(r,n,o,a){return(r/=a/2)<1?-o/2*(Math.sqrt(1-r*r)-1)+n:o/2*(Math.sqrt(1-(r-=2)*r)+1)+n},easeInElastic:function(r,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,r===0||(r/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(r-=1))*Math.sin((r*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(r,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,r===0||(r/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*r)*Math.sin((r*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(r,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,r===0||(r/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),r<1?-.5*(h*Math.pow(2,10*(r-=1))*Math.sin((r*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(r-=1))*Math.sin((r*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(r,n,o,a,h){return h===void 0&&(h=1.70158),o*(r/=a)*r*((h+1)*r-h)+n},easeOutBack:function(r,n,o,a,h){return h===void 0&&(h=1.70158),o*((r=r/a-1)*r*((h+1)*r+h)+1)+n},easeInOutBack:function(r,n,o,a,h){return h===void 0&&(h=1.70158),(r/=a/2)<1?o/2*(r*r*(((h*=1.525)+1)*r-h))+n:o/2*((r-=2)*r*(((h*=1.525)+1)*r+h)+2)+n},easeInBounce:function(r,n,o,a){var h;return h=e.easeOutBounce(a-r,0,o,a),o-h+n},easeOutBounce:function(r,n,o,a){return(r/=a)<1/2.75?o*(7.5625*r*r)+n:r<2/2.75?o*(7.5625*(r-=1.5/2.75)*r+.75)+n:r<2.5/2.75?o*(7.5625*(r-=2.25/2.75)*r+.9375)+n:o*(7.5625*(r-=2.625/2.75)*r+.984375)+n},easeInOutBounce:function(r,n,o,a){var h;return r<a/2?(h=e.easeInBounce(r*2,0,o,a),h*.5+n):(h=e.easeOutBounce(r*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(my)})(Xl);const qa=Xl.exports;function dr(s,t){if(s){if(typeof s=="function")return s;if(typeof s=="string")return qa[s]}else return qa[t]}const gy={removeOnInterrupt:!1,ease:"linear",time:1e3};class yy extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"startX"),w(this,"startY"),w(this,"deltaX"),w(this,"deltaY"),w(this,"keepCenter"),w(this,"startWidth",null),w(this,"startHeight",null),w(this,"deltaWidth",null),w(this,"deltaHeight",null),w(this,"width",null),w(this,"height",null),w(this,"time",0),this.options=Object.assign({},gy,e),this.options.ease=dr(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new X(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,r=this.parent.height;this.complete(),(i!==this.parent.width||r!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const r=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(r+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const r=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(r+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const r=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new X(this.parent.x,this.parent.y);this.parent.moveCenter(r+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const _y={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class vy extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"left"),w(this,"top"),w(this,"right"),w(this,"bottom"),w(this,"underflowX"),w(this,"underflowY"),w(this,"ease"),w(this,"toX"),w(this,"toY"),this.options=Object.assign({},_y,e),this.ease=dr(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,r=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>r,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new X(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new X(r*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new X(0,0),bottomRight:new X(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,r=this.parent.plugins.get("decelerate",!0);r&&(r.x||r.y)&&(r.x&&r.percentChangeX===((t=r.options)==null?void 0:t.friction)||r.y&&r.percentChangeY===((e=r.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(r.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(r.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(r=r||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!r.x||!r.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!r.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!r.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const xy={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class by extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"last"),w(this,"noUnderflow"),w(this,"underflowX"),w(this,"underflowY"),this.options=Object.assign({},xy,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new X(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const wy={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class Ay extends Ot{constructor(t,e={}){super(t),w(this,"options"),this.options=Object.assign({},wy,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,r=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&r<t.y&&(r=t.y),e.y!==null&&r>e.y&&(r=e.y),(i!==this.parent.scale.x||r!==this.parent.scale.y)&&(this.parent.scale.set(i,r),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const Ey={friction:.98,bounce:.8,minSpeed:.01},ge=16;class Ty extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"x"),w(this,"y"),w(this,"percentChangeX"),w(this,"percentChangeY"),w(this,"saved"),w(this,"timeSinceRelease"),this.options=Object.assign({},Ey,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,r=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*ge/o*(Math.pow(n,r/ge)-Math.pow(n,i/ge)),this.x*=Math.pow(this.percentChangeX,t/ge)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*ge/o*(Math.pow(n,r/ge)-Math.pow(n,i/ge)),this.y*=Math.pow(this.percentChangeY,t/ge)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const Sy={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class Cy extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"moved"),w(this,"reverse"),w(this,"xDirection"),w(this,"yDirection"),w(this,"keyIsPressed"),w(this,"mouse"),w(this,"underflowX"),w(this,"underflowY"),w(this,"last"),w(this,"current"),w(this,"windowEventHandlers",[]),this.options=Object.assign({},Sy,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=r=>{t.includes(r.code)&&(this.keyIsPressed=!0)},i=r=>{t.includes(r.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,r=this.parent.input.count();if(r===1||r>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new X(this.last.x,this.last.y),world:this.parent.toWorld(new X(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new X(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,r=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?r.reverse():r;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const Iy={speed:0,acceleration:null,radius:null};class Py extends Ot{constructor(t,e,i={}){super(t),w(this,"options"),w(this,"target"),w(this,"velocity"),this.target=e,this.options=Object.assign({},Iy,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,r=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,r=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=r-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(r-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,p=Math.abs(u)>Math.abs(o)?r:e.y+u;this.parent.moveCenter(d,p),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(r-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?r:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,r),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const Ry={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class My extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"reverse"),w(this,"radiusSquared"),w(this,"left"),w(this,"top"),w(this,"right"),w(this,"bottom"),w(this,"horizontal"),w(this,"vertical"),this.options=Object.assign({},Ry,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const r=this.parent.toScreen(this.parent.center);if(Math.pow(r.x-e,2)+Math.pow(r.y-i,2)>=this.radiusSquared){const n=Math.atan2(r.y-i,r.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const By={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class Dy extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"active",!1),w(this,"pinching",!1),w(this,"moved",!1),w(this,"lastCenter"),this.options=Object.assign({},By,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,r=this.parent.input.touches;if(r.length>=2){const n=r[0],o=r[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new X(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const p=this.parent.toGlobal(h);this.parent.x+=(l.x-p.x)*this.options.factor,this.parent.y+=(l.y-p.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const Fy={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class Oy extends Ot{constructor(t,e,i,r={}){super(t),w(this,"options"),w(this,"ease"),w(this,"x"),w(this,"y"),w(this,"percent"),w(this,"snapping"),w(this,"deltaX"),w(this,"deltaY"),w(this,"startX"),w(this,"startY"),this.options=Object.assign({},Fy,r),this.ease=dr(r.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,r,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,r=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);r=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(r,n):this.parent.moveCenter(r,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const Ly={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class Ny extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"ease"),w(this,"xScale"),w(this,"yScale"),w(this,"xIndependent"),w(this,"yIndependent"),w(this,"snapping"),this.options=Object.assign({},Ly,e),this.ease=dr(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,r=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:r-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const r=this.parent.plugins.get("clamp-zoom",!0);r&&r.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const Uy={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class ky extends Ot{constructor(t,e={}){super(t),w(this,"options"),w(this,"smoothing"),w(this,"smoothingCenter"),w(this,"smoothingCount"),w(this,"keyIsPressed"),this.options=Object.assign({},Uy,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const r=this.parent.plugins.get("clamp-zoom",!0);if(r&&r.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,r=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=r),this.isAxisY()&&(this.parent.scale.y*=r),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,r=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*r-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*r-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=r),this.isAxisY()&&(this.parent.scale.y*=r),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class Gy{constructor(t){w(this,"viewport"),w(this,"clickedAvailable"),w(this,"isMouseDown"),w(this,"last"),w(this,"wheelFunction"),w(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new z(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,r=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(r))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new X;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const Mi=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Hy{constructor(t){w(this,"plugins"),w(this,"list"),w(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Mi.length){const r=this.plugins[t];r&&r.destroy(),this.plugins[t]=e;const n=Mi.indexOf(t);n!==-1&&Mi.splice(n,1),Mi.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of Mi)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const Wy={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:It.shared,allowPreserveDragOutside:!1};class Xy extends Ft{constructor(t){super(),w(this,"moving"),w(this,"screenWidth"),w(this,"screenHeight"),w(this,"threshold"),w(this,"input"),w(this,"plugins"),w(this,"zooming"),w(this,"lastViewport"),w(this,"options"),w(this,"_dirty"),w(this,"_forceHitArea"),w(this,"_hitAreaDefault"),w(this,"_pause"),w(this,"tickerFunction"),w(this,"_worldWidth"),w(this,"_worldHeight"),w(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...Wy,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new Gy(this),this.plugins=new Hy(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new z(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,r){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof r<"u"&&(this._worldHeight=r),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new z(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new X(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new X(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new X(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const r=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==r||this.y!==n)&&(this.position.set(r,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new X(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,r=this.screenHeight/e;return Math.min(i,r)}findCover(t,e){const i=this.screenWidth/t,r=this.screenHeight/e;return Math.max(i,r)}fitWidth(t=this.worldWidth,e,i=!0,r){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!r&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,r){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!r&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let r;t&&(r=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&r&&this.moveCenter(r),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const r=this.plugins.get("clamp-zoom",!0);return r&&r.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new Ny(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new X(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new z(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new Cy(this,t)),this}clamp(t){return this.plugins.add("clamp",new by(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new Ty(this,t)),this}bounce(t){return this.plugins.add("bounce",new vy(this,t)),this}pinch(t){return this.plugins.add("pinch",new Dy(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new Oy(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new Py(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new ky(this,t)),this}animate(t){return this.plugins.add("animate",new yy(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new Ay(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new My(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,r,n){n&&(i>this.worldScreenWidth||r>this.worldScreenHeight)&&(this.fit(!0,i,r),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+r>this.bottom&&(this.bottom=e+r,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}const $y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAIrSURBVHic7dWhEcQwAAPBJEW4//bsJvzwg446YLcCkRvdc8598RljjNMTeHlOD4AvEwgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUC499779Aj+1lqnJ/DiQSAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIPwAhCgMRcz+Nz0AAAAASUVORK5CYII=";var zy=Object.defineProperty,Vy=Object.getOwnPropertyDescriptor,$l=(s,t,e,i)=>{for(var r=i>1?void 0:i?Vy(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&zy(t,e,r),r};let Yi=class extends Vl{constructor(){super(),this.app=new _l({backgroundAlpha:0,autoDensity:!0,resolution:2}),this.viewport=new Xy({events:this.app.renderer.events,worldWidth:250,worldHeight:250}),this.texture=new Jl(this.app.view),this._sprite=new Ke,this.resize=this.app.resize.bind(this.app),this.app.stage.addChild(this.viewport);const s=async()=>{const{left:t,right:e,top:i,bottom:r,worldWidth:n,worldHeight:o}=this.viewport;if(new z(t,i,e-t,r-i),!this.app.view.toDataURL)return;const a=this.app.view.toDataURL("image/png",.75);this.dispatchEvent(new CustomEvent("image-change",{detail:{image:a},bubbles:!0,composed:!0}))};this.viewport.drag({}).pinch().wheel().decelerate({friction:0,bounce:1}).on("zoomed-end",s).on("moved-end",s),this.app.view.addEventListener("wheel",function(t){t.preventDefault()},{passive:!1})}firstUpdated(s){var t;super.firstUpdated(s),this.container&&((t=this.container)==null||t.append(this.app.view),this.app.resizeTo=this.container,this.viewport.addChild(this._sprite))}async add(s){this._sprite.texture=await L.fromURL(s),this._sprite.anchor.set(.5,.5),this._sprite.position.set(this.viewport.center.x/2,this.viewport.center.y/2)}disconnectedCallback(){super.disconnectedCallback(),this.viewport.destroy({children:!0,texture:!0,baseTexture:!0}),this.viewport.off("zoomed"),this.viewport.off("moved"),this.viewport.off("moved-end"),this.app.destroy(!0)}render(){return jl`
|
|
1148
|
-
<div class="cropper-container"></div>
|
|
1149
|
-
`}};Yi.styles=Yl`
|
|
1150
|
-
:host {
|
|
1151
|
-
width: 100%;
|
|
1152
|
-
height: 100%;
|
|
1153
|
-
}
|
|
1154
|
-
.cropper-container {
|
|
1155
|
-
width: 100%;
|
|
1156
|
-
height: 100%;
|
|
1157
|
-
|
|
1158
|
-
canvas {
|
|
1159
|
-
width: 100%;
|
|
1160
|
-
height: 100%;
|
|
1161
|
-
background: url("${ql($y)}") center repeat;
|
|
1162
|
-
background-size: 25px;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
device-viewer {
|
|
1166
|
-
position: absolute;
|
|
1167
|
-
left: 500px;
|
|
1168
|
-
top: 0px;
|
|
1169
|
-
height: 1000px;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
`;$l([Kl(".cropper-container")],Yi.prototype,"container",2);Yi=$l([Zl("image-cropper")],Yi);const Qy={title:"Shop/ImageCropper",tags:["autodocs"],render:()=>new Yi,argTypes:{}},Ts={args:{}};var Ka,Za,Qa;Ts.parameters={...Ts.parameters,docs:{...(Ka=Ts.parameters)==null?void 0:Ka.docs,source:{originalSource:`{
|
|
1173
|
-
args: {}
|
|
1174
|
-
}`,...(Qa=(Za=Ts.parameters)==null?void 0:Za.docs)==null?void 0:Qa.source}}};const Jy=["Primary"];export{Ts as Primary,Jy as __namedExportsOrder,Qy as default};
|